BotSpam Module
This commit is contained in:
parent
901dad2f8a
commit
cf618abd4e
@ -20,6 +20,7 @@
|
||||
<element id="module-output" name="Mineplex.Database" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/jooq-3.5.2.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/commons-dbcp2-2.0.1.jar" path-in-jar="/" />
|
||||
<element id="module-output" name="Mineplex.PlayerCache" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
@ -4,6 +4,7 @@
|
||||
<option name="DEFAULT_COMPILER" value="Javac" />
|
||||
<excludeFromCompile>
|
||||
<directory url="file://$PROJECT_DIR$/Nautilus.Game.PvP" includeSubdirectories="true" />
|
||||
<directory url="file://$PROJECT_DIR$/Mineplex.ServerMonitor" includeSubdirectories="true" />
|
||||
<directory url="file://$PROJECT_DIR$/Mineplex.Game.Clans" includeSubdirectories="true" />
|
||||
</excludeFromCompile>
|
||||
<resourceExtensions />
|
||||
|
@ -20,5 +20,6 @@
|
||||
<orderEntry type="library" name="commons-dbcp2" level="project" />
|
||||
<orderEntry type="module" module-name="Classpath.Dummy" />
|
||||
<orderEntry type="library" name="NoCheatPlus" level="project" />
|
||||
<orderEntry type="module" module-name="Mineplex.PlayerCache" />
|
||||
</component>
|
||||
</module>
|
@ -22,7 +22,7 @@ public class TablistFix extends MiniPlugin
|
||||
// This is sort of experimental!
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onJoin(PlayerJoinEvent event)
|
||||
{
|
||||
{/*
|
||||
final Player player = event.getPlayer();
|
||||
runSyncLater(new Runnable()
|
||||
{
|
||||
@ -49,5 +49,6 @@ public class TablistFix extends MiniPlugin
|
||||
}
|
||||
}
|
||||
}, 20L);
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,162 @@
|
||||
package mineplex.core.botspam;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.message.PrivateMessageEvent;
|
||||
import mineplex.core.punish.Category;
|
||||
import mineplex.core.punish.Punish;
|
||||
import mineplex.core.botspam.command.BotSpamCommand;
|
||||
import mineplex.core.botspam.repository.BotSpamRepository;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class BotSpamManager extends MiniPlugin
|
||||
{
|
||||
private Punish _punish;
|
||||
private CoreClientManager _clientManager;
|
||||
private BotSpamRepository _repository;
|
||||
private volatile ArrayList<SpamText> _spam = new ArrayList<SpamText>();
|
||||
|
||||
public BotSpamManager(JavaPlugin plugin, CoreClientManager clientManager, Punish punish)
|
||||
{
|
||||
super("SpamBot Manager", plugin);
|
||||
|
||||
_punish = punish;
|
||||
_clientManager = clientManager;
|
||||
_repository = new BotSpamRepository(plugin);
|
||||
_spam = _repository.getSpamText();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPrivateMessage(PrivateMessageEvent event)
|
||||
{
|
||||
Player recipient = event.getRecipient();
|
||||
// Ignore messages sent to staff members
|
||||
if (_clientManager.hasRank(recipient, Rank.HELPER))
|
||||
return;
|
||||
|
||||
for (SpamText spamText : _spam)
|
||||
{
|
||||
if (spamText.isEnabled() && spamText.isSpam(event.getMessage()))
|
||||
{
|
||||
punishBot(event.getSender(), spamText);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void punishBot(Player player, final SpamText botText)
|
||||
{
|
||||
_punish.AddPunishment(player.getName(), Category.Other, "Bot Spam #" + botText.getId(), "Chiss", 1, true, -1, true);
|
||||
|
||||
// Update bot text count
|
||||
runAsync(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
_repository.addPunishment(botText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void addSpamText(final String text, final Runnable callback)
|
||||
{
|
||||
runAsync(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
_repository.addSpamText(text);
|
||||
_spam = _repository.getSpamText();
|
||||
|
||||
if (callback != null)
|
||||
runSync(callback);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void enableSpamText(final SpamText spamText, final Runnable callback)
|
||||
{
|
||||
runAsync(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
_repository.enableSpamText(spamText);
|
||||
|
||||
runSync(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
spamText.setEnabled(true);
|
||||
|
||||
if (callback != null)
|
||||
callback.run();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void disableSpamText(final SpamText spamText, final Runnable callback)
|
||||
{
|
||||
runAsync(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
_repository.disableSpamText(spamText);
|
||||
|
||||
runSync(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
spamText.setEnabled(false);
|
||||
|
||||
if (callback != null)
|
||||
callback.run();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public List<SpamText> getSpamTexts()
|
||||
{
|
||||
return _spam;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateText(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.MIN_01)
|
||||
{
|
||||
runAsync(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
_spam = _repository.getSpamText();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCommands()
|
||||
{
|
||||
addCommand(new BotSpamCommand(this));
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package mineplex.core.botspam;
|
||||
|
||||
public class SpamText
|
||||
{
|
||||
private int _id;
|
||||
private String _text;
|
||||
private int _punishments;
|
||||
private boolean _enabled;
|
||||
|
||||
public SpamText(int id, String text, int punishments, boolean enabled)
|
||||
{
|
||||
_id = id;
|
||||
_text = text;
|
||||
_punishments = punishments;
|
||||
_enabled = enabled;
|
||||
}
|
||||
|
||||
public boolean isSpam(String message)
|
||||
{
|
||||
return message.toLowerCase().contains(_text.toLowerCase());
|
||||
}
|
||||
|
||||
public int getId()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
public String getText()
|
||||
{
|
||||
return _text;
|
||||
}
|
||||
|
||||
public int getPunishments()
|
||||
{
|
||||
return _punishments;
|
||||
}
|
||||
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return _enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled)
|
||||
{
|
||||
_enabled = enabled;
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package mineplex.core.botspam.command;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.botspam.SpamText;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.botspam.BotSpamManager;
|
||||
|
||||
public class BotSpamAddCommand extends CommandBase<BotSpamManager>
|
||||
{
|
||||
public BotSpamAddCommand(BotSpamManager plugin)
|
||||
{
|
||||
super(plugin, Rank.DEVELOPER, "add");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(final Player caller, String[] args)
|
||||
{
|
||||
if (args != null && args.length >= 1)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < args.length; i++)
|
||||
{
|
||||
if (i > 0) sb.append(" ");
|
||||
|
||||
sb.append(args[i]);
|
||||
}
|
||||
|
||||
final String text = sb.toString();
|
||||
|
||||
if (text.length() < 8)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("BotSpam", "Spam text must be at least 8 characters"));
|
||||
return;
|
||||
}
|
||||
|
||||
for (SpamText spamText : Plugin.getSpamTexts())
|
||||
{
|
||||
if (text.equalsIgnoreCase(spamText.getText()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("BotSpam", "That Spam Text already exists. Type " + F.elem("/botspam list") + " to view"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Plugin.addSpamText(text, new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (caller.isOnline())
|
||||
UtilPlayer.message(caller, F.main("BotSpam", "Added Spam Text: " + F.elem(text)));
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("BotSpam", "/botspam add <text>"));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package mineplex.core.botspam.command;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.MultiCommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.botspam.BotSpamManager;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
|
||||
public class BotSpamCommand extends MultiCommandBase<BotSpamManager>
|
||||
{
|
||||
public BotSpamCommand(BotSpamManager plugin)
|
||||
{
|
||||
super(plugin, Rank.DEVELOPER, "botban", "botspam");
|
||||
|
||||
AddCommand(new BotSpamAddCommand(Plugin));
|
||||
AddCommand(new BotSpamEnableCommand(Plugin));
|
||||
AddCommand(new BotSpamDisableCommand(Plugin));
|
||||
AddCommand(new BotSpamListCommand(Plugin));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void Help(Player caller, String[] args)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("BotSpam", "/botspam list"));
|
||||
UtilPlayer.message(caller, F.main("BotSpam", "/botspam add <text>"));
|
||||
UtilPlayer.message(caller, F.main("BotSpam", "/botspam enable <text id>"));
|
||||
UtilPlayer.message(caller, F.main("BotSpam", "/botspam disable <text id>"));
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package mineplex.core.botspam.command;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.botspam.SpamText;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.botspam.BotSpamManager;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
|
||||
public class BotSpamDisableCommand extends CommandBase<BotSpamManager>
|
||||
{
|
||||
public BotSpamDisableCommand(BotSpamManager plugin)
|
||||
{
|
||||
super(plugin, Rank.DEVELOPER, "disable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(final Player caller, String[] args)
|
||||
{
|
||||
if (args != null && args.length == 1)
|
||||
{
|
||||
final int spamId;
|
||||
|
||||
try
|
||||
{
|
||||
spamId = Integer.parseInt(args[0]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("BotSpam", "/botspam disable <text id>"));
|
||||
return;
|
||||
}
|
||||
|
||||
SpamText text = null;
|
||||
for (SpamText spamText : Plugin.getSpamTexts())
|
||||
{
|
||||
if (spamText.getId() == spamId)
|
||||
text = spamText;
|
||||
}
|
||||
|
||||
if (text == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("BotSpam", "Could not find a spam text with the id " + F.elem("" + spamId)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!text.isEnabled())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("BotSpam", "That spam text is already disabled"));
|
||||
return;
|
||||
}
|
||||
|
||||
final SpamText finalText = text;
|
||||
Plugin.disableSpamText(text, new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("BotSpam", "Disabled Spam Text " + F.elem(finalText.getText())));
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("BotSpam", "/botspam disable <text id>"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package mineplex.core.botspam.command;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.botspam.SpamText;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.botspam.BotSpamManager;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
|
||||
public class BotSpamEnableCommand extends CommandBase<BotSpamManager>
|
||||
{
|
||||
public BotSpamEnableCommand(BotSpamManager plugin)
|
||||
{
|
||||
super(plugin, Rank.DEVELOPER, "enable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(final Player caller, String[] args)
|
||||
{
|
||||
if (args != null && args.length == 1)
|
||||
{
|
||||
final int spamId;
|
||||
|
||||
try
|
||||
{
|
||||
spamId = Integer.parseInt(args[0]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("BotSpam", "/botspam enable <text id>"));
|
||||
return;
|
||||
}
|
||||
|
||||
SpamText text = null;
|
||||
for (SpamText spamText : Plugin.getSpamTexts())
|
||||
{
|
||||
if (spamText.getId() == spamId)
|
||||
text = spamText;
|
||||
}
|
||||
|
||||
if (text == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("BotSpam", "Could not find a spam text with the id " + F.elem("" + spamId)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (text.isEnabled())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("BotSpam", "That spam text is already enabled"));
|
||||
return;
|
||||
}
|
||||
|
||||
final SpamText finalText = text;
|
||||
Plugin.enableSpamText(text, new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("BotSpam", "Enabled Spam Text " + F.elem(finalText.getText())));
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("BotSpam", "/botspam enable <text id>"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package mineplex.core.botspam.command;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.botspam.SpamText;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.botspam.BotSpamManager;
|
||||
import mineplex.core.common.jsonchat.ClickEvent;
|
||||
import mineplex.core.common.jsonchat.HoverEvent;
|
||||
import mineplex.core.common.jsonchat.JsonMessage;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
|
||||
public class BotSpamListCommand extends CommandBase<BotSpamManager>
|
||||
{
|
||||
public BotSpamListCommand(BotSpamManager plugin)
|
||||
{
|
||||
super(plugin, Rank.DEVELOPER, "list");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("BotSpam", "Listing Spam Texts. Hover for more details"));
|
||||
UtilPlayer.message(caller, ""); // Blank Line!
|
||||
|
||||
for (SpamText spamText : Plugin.getSpamTexts())
|
||||
{
|
||||
String modifyMessage = spamText.isEnabled() ? C.cRed + "Click To Disable" : C.cGreen + "Click To Enable";
|
||||
String hoverMessage = C.cYellow + "Spam Id: " + C.cWhite + spamText.getId() + "\\n" + C.cYellow + "Ban Count: " + C.cWhite + spamText.getPunishments() + "\\n" + C.cYellow + "Enabled: " + C.cWhite + spamText.isEnabled() + "\\n\\n" + modifyMessage;
|
||||
|
||||
JsonMessage message = new JsonMessage((spamText.isEnabled() ? "" : C.cRed) + spamText.getText());
|
||||
message.hover(HoverEvent.SHOW_TEXT, hoverMessage);
|
||||
message.click(ClickEvent.RUN_COMMAND, "/botspam " + (spamText.isEnabled() ? "disable" : "enable") + " " + spamText.getId());
|
||||
message.send(JsonMessage.MessageType.SYSTEM_MESSAGE, caller);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
package mineplex.core.botspam.repository;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.database.DBPool;
|
||||
import mineplex.core.database.RepositoryBase;
|
||||
import mineplex.core.botspam.SpamText;
|
||||
import mineplex.core.database.ResultSetCallable;
|
||||
import mineplex.core.database.column.ColumnInt;
|
||||
import mineplex.core.database.column.ColumnVarChar;
|
||||
|
||||
public class BotSpamRepository extends RepositoryBase
|
||||
{
|
||||
private static final String GET_SPAM_TEXT = "SELECT * FROM botSpam";
|
||||
private static final String ADD_SPAM_TEXT = "INSERT INTO botSpam (text) VALUES (?)";
|
||||
private static final String DELETE_SPAM_TEXT = "DELETE FROM botSpam WHERE id = ?";
|
||||
private static final String ENABLE_SPAM_TEXT = "UPDATE botSpam SET enabled = 1 WHERE id = ?";
|
||||
private static final String DISABLE_SPAM_TEXT = "UPDATE botSpam SET enabled = 0 WHERE id = ?";
|
||||
private static final String ADD_PUNISHMENT = "UPDATE botSpam SET punishments = punishments + 1 WHERE id = ?";
|
||||
|
||||
public BotSpamRepository(JavaPlugin plugin)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
}
|
||||
|
||||
public ArrayList<SpamText> getSpamText()
|
||||
{
|
||||
final ArrayList<SpamText> list = new ArrayList<SpamText>();
|
||||
|
||||
executeQuery(GET_SPAM_TEXT, new ResultSetCallable()
|
||||
{
|
||||
@Override
|
||||
public void processResultSet(ResultSet resultSet) throws SQLException
|
||||
{
|
||||
while (resultSet.next())
|
||||
{
|
||||
int id = resultSet.getInt(1);
|
||||
String text = resultSet.getString(2);
|
||||
int punishments = resultSet.getInt(3);
|
||||
boolean enabled = resultSet.getBoolean(4);
|
||||
|
||||
list.add(new SpamText(id, text, punishments, enabled));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public void addPunishment(SpamText text)
|
||||
{
|
||||
executeUpdate(ADD_PUNISHMENT, new ColumnInt("id", text.getId()));
|
||||
}
|
||||
|
||||
public void disableSpamText(SpamText text)
|
||||
{
|
||||
executeUpdate(DISABLE_SPAM_TEXT, new ColumnInt("id", text.getId()));
|
||||
}
|
||||
|
||||
public void enableSpamText(SpamText text)
|
||||
{
|
||||
executeUpdate(ENABLE_SPAM_TEXT, new ColumnInt("id", text.getId()));
|
||||
}
|
||||
|
||||
public void addSpamText(String spamText)
|
||||
{
|
||||
executeInsert(ADD_SPAM_TEXT, null, new ColumnVarChar("text", 200, spamText));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initialize()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -115,12 +115,18 @@ public class Punish extends MiniPlugin
|
||||
}
|
||||
|
||||
public void AddPunishment(final String playerName, final Category category, final String reason, final Player caller, final int severity, boolean ban, long duration)
|
||||
{
|
||||
AddPunishment(playerName, category, reason, caller == null ? null : caller.getName(), severity, ban, duration, false);
|
||||
}
|
||||
|
||||
public void AddPunishment(final String playerName, final Category category, final String reason, final String callerName, final int severity, boolean ban, long duration, final boolean silent)
|
||||
{
|
||||
if (!_punishClients.containsKey(playerName.toLowerCase()))
|
||||
{
|
||||
_punishClients.put(playerName.toLowerCase(), new PunishClient());
|
||||
}
|
||||
|
||||
final Player caller = (callerName == null ? null : UtilPlayer.searchExact(callerName));
|
||||
final PunishmentSentence sentence = !ban ? PunishmentSentence.Mute : PunishmentSentence.Ban;
|
||||
|
||||
final long finalDuration = duration;
|
||||
@ -160,8 +166,7 @@ public class Punish extends MiniPlugin
|
||||
{
|
||||
String kickReason = C.cRed + C.Bold + "You were banned for " + durationString + " by " + (caller == null ? "Mineplex Anti-Cheat" : caller.getName()) +
|
||||
"\n" + C.cWhite + reason +
|
||||
"\n" + C.cDGreen + "Unfairly banned? Appeal at " + C.cGreen + "www.mineplex.com/appeals"
|
||||
;
|
||||
"\n" + C.cDGreen + "Unfairly banned? Appeal at " + C.cGreen + "www.mineplex.com/appeals";
|
||||
|
||||
Player target = UtilPlayer.searchOnline(null, playerName, false);
|
||||
if (target != null)
|
||||
@ -171,6 +176,7 @@ public class Punish extends MiniPlugin
|
||||
}
|
||||
});
|
||||
|
||||
if (!silent)
|
||||
informOfPunish(playerName, F.main(getName(), caller == null ? "Mineplex Anti-Cheat" : caller.getName() + " banned " + playerName + " for " + durationString + "."));
|
||||
}
|
||||
else
|
||||
@ -181,8 +187,10 @@ public class Punish extends MiniPlugin
|
||||
|
||||
//Warning
|
||||
if (finalDuration == 0)
|
||||
if (!silent)
|
||||
informOfPunish(playerName, F.main(getName(), caller == null ? "Mineplex Anti-Cheat" : caller.getName() + " issued a friendly warning to " + playerName + "."));
|
||||
else
|
||||
if (!silent)
|
||||
informOfPunish(playerName, F.main(getName(), caller == null ? "Mineplex Anti-Cheat" : caller.getName() + " muted " + playerName + " for " + durationString + "."));
|
||||
|
||||
//Inform
|
||||
@ -207,7 +215,7 @@ public class Punish extends MiniPlugin
|
||||
}
|
||||
|
||||
|
||||
}, playerName, category.toString(), sentence, reason, duration, caller == null ? "Mineplex Anti-Cheat" : caller.getName(), severity);
|
||||
}, playerName, category.toString(), sentence, reason, duration, callerName == null ? "Mineplex Anti-Cheat" : callerName, severity);
|
||||
}
|
||||
|
||||
private void informOfPunish(String punishee, String msg)
|
||||
|
@ -122,7 +122,7 @@ public class Hub extends JavaPlugin implements IRelation
|
||||
PartyManager partyManager = new PartyManager(this, portal, clientManager, preferenceManager);
|
||||
|
||||
PersonalServerManager personalServerManager = new PersonalServerManager(this, clientManager);
|
||||
HubManager hubManager = new HubManager(this, blockRestore, clientManager, donationManager, new ConditionManager(this), disguiseManager, new TaskManager(this, clientManager, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this), npcManager, personalServerManager, packetHandler);
|
||||
HubManager hubManager = new HubManager(this, blockRestore, clientManager, donationManager, new ConditionManager(this), disguiseManager, new TaskManager(this, clientManager, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this), npcManager, personalServerManager, packetHandler, punish);
|
||||
|
||||
QueueManager queueManager = new QueueManager(this, clientManager, donationManager, new EloManager(this, clientManager), partyManager);
|
||||
|
||||
|
@ -47,6 +47,7 @@ import mineplex.core.achievement.AchievementManager;
|
||||
import mineplex.core.aprilfools.AprilFoolsManager;
|
||||
import mineplex.core.benefit.BenefitManager;
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.botspam.BotSpamManager;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
@ -80,6 +81,7 @@ import mineplex.core.pet.PetManager;
|
||||
import mineplex.core.portal.Portal;
|
||||
import mineplex.core.preferences.PreferencesManager;
|
||||
import mineplex.core.projectile.ProjectileManager;
|
||||
import mineplex.core.punish.Punish;
|
||||
import mineplex.core.reward.RewardManager;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
import mineplex.core.task.TaskManager;
|
||||
@ -157,7 +159,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
//Admin
|
||||
private boolean _gadgetsEnabled = true;
|
||||
|
||||
public HubManager(JavaPlugin plugin, BlockRestore blockRestore, CoreClientManager clientManager, DonationManager donationManager, ConditionManager conditionManager, DisguiseManager disguiseManager, TaskManager taskManager, Portal portal, PartyManager partyManager, PreferencesManager preferences, PetManager petManager, PollManager pollManager, StatsManager statsManager, AchievementManager achievementManager, HologramManager hologramManager, NpcManager npcManager, PersonalServerManager personalServerManager, PacketHandler packetHandler)
|
||||
public HubManager(JavaPlugin plugin, BlockRestore blockRestore, CoreClientManager clientManager, DonationManager donationManager, ConditionManager conditionManager, DisguiseManager disguiseManager, TaskManager taskManager, Portal portal, PartyManager partyManager, PreferencesManager preferences, PetManager petManager, PollManager pollManager, StatsManager statsManager, AchievementManager achievementManager, HologramManager hologramManager, NpcManager npcManager, PersonalServerManager personalServerManager, PacketHandler packetHandler, Punish punish)
|
||||
{
|
||||
super("Hub Manager", plugin);
|
||||
|
||||
@ -211,6 +213,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
_packetHandler = packetHandler;
|
||||
|
||||
new NotificationManager(getPlugin(), clientManager);
|
||||
new BotSpamManager(plugin, clientManager, punish);
|
||||
|
||||
((CraftWorld)Bukkit.getWorlds().get(0)).getHandle().pvpMode = true;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user