Add filter-players logic
This commit is contained in:
@@ -19,10 +19,7 @@ public final class AdvancedKill extends JavaPlugin {
|
|||||||
saveDefaultConfig();
|
saveDefaultConfig();
|
||||||
|
|
||||||
getCommand("akill").setExecutor(this);
|
getCommand("akill").setExecutor(this);
|
||||||
|
|
||||||
if (getConfig().getBoolean("filter-player")) {
|
|
||||||
getCommand("afilter").setExecutor(new AdvancedKillFilter(this));
|
getCommand("afilter").setExecutor(new AdvancedKillFilter(this));
|
||||||
}
|
|
||||||
|
|
||||||
getLogger().info("AdvancedKill was loaded!");
|
getLogger().info("AdvancedKill was loaded!");
|
||||||
}
|
}
|
||||||
@@ -62,6 +59,7 @@ public final class AdvancedKill extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Check filter
|
//Check filter
|
||||||
|
if (getConfig().getBoolean("filter-player")) {
|
||||||
List<String> filter = getConfig().getStringList("bypass-players");
|
List<String> filter = getConfig().getStringList("bypass-players");
|
||||||
|
|
||||||
String uuid = target.getUniqueId().toString();
|
String uuid = target.getUniqueId().toString();
|
||||||
@@ -70,6 +68,9 @@ public final class AdvancedKill extends JavaPlugin {
|
|||||||
sender.sendMessage("§cYou can not kill this player!");
|
sender.sendMessage("§cYou can not kill this player!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Run Commands
|
//Run Commands
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
|
|||||||
@@ -21,6 +21,20 @@ public class AdvancedKillFilter implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(plugin.getConfig().getBoolean("filter-player"))) {
|
||||||
|
sender.sendMessage("§cThe filter is not aktive.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> players = plugin.getConfig().getStringList("bypass-players");
|
||||||
|
|
||||||
|
if (!(args.length == 1)) {
|
||||||
|
sender.sendMessage("No Player defined");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
String msg = "";
|
||||||
|
|
||||||
Player target = Bukkit.getPlayer(args[0]);
|
Player target = Bukkit.getPlayer(args[0]);
|
||||||
|
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
@@ -30,10 +44,6 @@ public class AdvancedKillFilter implements CommandExecutor {
|
|||||||
|
|
||||||
String uuid = target.getUniqueId().toString();
|
String uuid = target.getUniqueId().toString();
|
||||||
|
|
||||||
List<String> players = plugin.getConfig().getStringList("bypass-players");
|
|
||||||
|
|
||||||
String msg = "";
|
|
||||||
|
|
||||||
if (players.contains(uuid)) {
|
if (players.contains(uuid)) {
|
||||||
players.remove(uuid);
|
players.remove(uuid);
|
||||||
msg = "§aPlayer was removed successfully!";
|
msg = "§aPlayer was removed successfully!";
|
||||||
|
|||||||
Reference in New Issue
Block a user