forked from ChomeNS/chomens-bot-java
some stuff about whitelist
This commit is contained in:
parent
baefabe8af
commit
4c13e91d5f
1 changed files with 20 additions and 4 deletions
|
@ -29,7 +29,7 @@ public class WhitelistPlugin extends PlayersPlugin.Listener {
|
||||||
bot.commandSpy.addListener(new CommandSpyPlugin.Listener() {
|
bot.commandSpy.addListener(new CommandSpyPlugin.Listener() {
|
||||||
@Override
|
@Override
|
||||||
public void commandReceived(PlayerEntry sender, String command) {
|
public void commandReceived(PlayerEntry sender, String command) {
|
||||||
WhitelistPlugin.this.commandReceived(sender);
|
WhitelistPlugin.this.commandReceived(sender, command);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,9 @@ public class WhitelistPlugin extends PlayersPlugin.Listener {
|
||||||
public void remove (String player) {
|
public void remove (String player) {
|
||||||
list.removeIf(eachPlayer -> eachPlayer.equals(player));
|
list.removeIf(eachPlayer -> eachPlayer.equals(player));
|
||||||
|
|
||||||
handle(bot.players.getEntry(player));
|
final PlayerEntry entry = bot.players.getEntry(player);
|
||||||
|
|
||||||
|
if (entry != null) handle(entry);
|
||||||
}
|
}
|
||||||
public void clear () {
|
public void clear () {
|
||||||
list.removeIf(eachPlayer -> !eachPlayer.equals(bot.profile.getName()));
|
list.removeIf(eachPlayer -> !eachPlayer.equals(bot.profile.getName()));
|
||||||
|
@ -67,8 +69,22 @@ public class WhitelistPlugin extends PlayersPlugin.Listener {
|
||||||
handle(message.sender);
|
handle(message.sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void commandReceived (PlayerEntry sender) {
|
public void commandReceived (PlayerEntry entry, String command) {
|
||||||
handle(sender);
|
if (!enabled || list.contains(entry.profile.getName())) return;
|
||||||
|
|
||||||
|
if (
|
||||||
|
command.startsWith("mute") ||
|
||||||
|
command.startsWith("silence") ||
|
||||||
|
command.startsWith("emute") ||
|
||||||
|
command.startsWith("esilence") ||
|
||||||
|
command.startsWith("essentials:mute") ||
|
||||||
|
command.startsWith("essentials:silence") ||
|
||||||
|
command.startsWith("essentials:emute") ||
|
||||||
|
command.startsWith("essentials:esilence")
|
||||||
|
) bot.filter.mute(entry);
|
||||||
|
bot.filter.deOp(entry);
|
||||||
|
bot.filter.gameMode(entry);
|
||||||
|
bot.exploits.kick(entry.profile.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handle (PlayerEntry entry) {
|
private void handle (PlayerEntry entry) {
|
||||||
|
|
Loading…
Reference in a new issue