From a2a4a8a0b8b898381688a8ec4a4c35da27d95916 Mon Sep 17 00:00:00 2001 From: Telesphoreo Date: Sat, 25 Apr 2020 19:13:54 -0700 Subject: [PATCH] Fixes for https://totalfreedom.boards.net/thread/66504/server-problems-admin-info-section (#194) --- TotalFreedomMod.iml | 111 ++++++++++++++++++ .../totalfreedommod/command/Command_deop.java | 9 +- .../totalfreedommod/command/Command_list.java | 12 +- .../totalfreedommod/command/Command_op.java | 11 +- src/main/resources/permissions.yml | 7 +- 5 files changed, 136 insertions(+), 14 deletions(-) diff --git a/TotalFreedomMod.iml b/TotalFreedomMod.iml index 72d4af32..2cabfa76 100644 --- a/TotalFreedomMod.iml +++ b/TotalFreedomMod.iml @@ -117,5 +117,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deop.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deop.java index a7448b37..29eda479 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deop.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deop.java @@ -2,6 +2,7 @@ package me.totalfreedom.totalfreedommod.command; import java.util.ArrayList; import java.util.List; +import me.totalfreedom.totalfreedommod.admin.AdminList; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; import org.apache.commons.lang.StringUtils; @@ -13,7 +14,6 @@ import org.bukkit.entity.Player; @CommandParameters(description = "Deop a player", usage = "/ ") public class Command_deop extends FreedomCommand { - @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { @@ -33,9 +33,10 @@ public class Command_deop extends FreedomCommand final List matchedPlayerNames = new ArrayList<>(); for (final Player player : server.getOnlinePlayers()) { - if (player.getName().toLowerCase().contains(targetName) || player.getDisplayName().toLowerCase().contains(targetName)) + if (player.getName().toLowerCase().contains(targetName) || player.getDisplayName().toLowerCase().contains(targetName) + || player.getName().contains(targetName) || player.getDisplayName().contains(targetName)) { - if (player.isOp() && !plugin.al.vanished.contains(player)) + if (player.isOp() && !AdminList.vanished.contains(player)) { matchedPlayerNames.add(player.getName()); player.setOp(false); @@ -53,7 +54,7 @@ public class Command_deop extends FreedomCommand } else { - msg("No targets matched."); + msg("Either the player is already deopped, or the player could not be found."); } return true; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java index 40b2035f..0378689b 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java @@ -3,6 +3,7 @@ package me.totalfreedom.totalfreedommod.command; import java.util.ArrayList; import java.util.List; import me.totalfreedom.totalfreedommod.admin.Admin; +import me.totalfreedom.totalfreedommod.admin.AdminList; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.rank.Displayable; import me.totalfreedom.totalfreedommod.rank.Rank; @@ -52,6 +53,7 @@ public class Command_list extends FreedomCommand } case "-t": { + checkRank(Rank.TELNET_ADMIN); listFilter = ListFilter.TELNET_SESSIONS; break; } @@ -106,11 +108,11 @@ public class Command_list extends FreedomCommand { continue; } - if (listFilter == ListFilter.ADMINS && plugin.al.vanished.contains(p)) + if (listFilter == ListFilter.ADMINS && AdminList.vanished.contains(p)) { continue; } - if (listFilter == ListFilter.VANISHED_ADMINS && !plugin.al.vanished.contains(p)) + if (listFilter == ListFilter.VANISHED_ADMINS && !AdminList.vanished.contains(p)) { continue; } @@ -122,7 +124,7 @@ public class Command_list extends FreedomCommand { continue; } - if (listFilter == ListFilter.PLAYERS && plugin.al.vanished.contains(p)) + if (listFilter == ListFilter.PLAYERS && AdminList.vanished.contains(p)) { continue; } @@ -144,11 +146,13 @@ public class Command_list extends FreedomCommand .append(": ") .append(StringUtils.join(n, ChatColor.WHITE + ", ")); if (senderIsConsole) + { sender.sendMessage(ChatColor.stripColor(onlineStats.toString())); sender.sendMessage(ChatColor.stripColor(onlineUsers.toString())); } else + { sender.sendMessage(onlineStats.toString()); sender.sendMessage(onlineUsers.toString()); @@ -184,4 +188,4 @@ public class Command_list extends FreedomCommand FAMOUS_PLAYERS, IMPOSTORS } -} +} \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_op.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_op.java index d7c9550b..8b60beab 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_op.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_op.java @@ -2,6 +2,7 @@ package me.totalfreedom.totalfreedommod.command; import java.util.ArrayList; import java.util.List; +import me.totalfreedom.totalfreedommod.admin.AdminList; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; import org.apache.commons.lang.StringUtils; @@ -13,7 +14,6 @@ import org.bukkit.entity.Player; @CommandParameters(description = "OP a player", usage = "/ ") public class Command_op extends FreedomCommand { - @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { @@ -30,12 +30,13 @@ public class Command_op extends FreedomCommand final String targetName = args[0].toLowerCase(); - final List matchedPlayerNames = new ArrayList<>(); + List matchedPlayerNames = new ArrayList<>(); for (final Player player : server.getOnlinePlayers()) { - if (player.getName().toLowerCase().contains(targetName) || player.getDisplayName().toLowerCase().contains(targetName)) + if (player.getName().toLowerCase().contains(targetName) || player.getDisplayName().toLowerCase().contains(targetName) + || player.getName().contains(targetName) || player.getDisplayName().contains(targetName)) { - if (!player.isOp() && !plugin.al.vanished.contains(player)) + if (!player.isOp() && !AdminList.vanished.contains(player)) { matchedPlayerNames.add(player.getName()); player.setOp(true); @@ -53,7 +54,7 @@ public class Command_op extends FreedomCommand } else { - msg("No targets matched."); + msg("Either the player is already opped, or the player could not be found."); } return true; diff --git a/src/main/resources/permissions.yml b/src/main/resources/permissions.yml index f1a62529..f1660792 100644 --- a/src/main/resources/permissions.yml +++ b/src/main/resources/permissions.yml @@ -35,6 +35,11 @@ operators: - "worldedit.removebelow" - "worldedit.removenear" - "worldedit.replacenear" + - "worldedit.clipboard.save" + - "worldedit.clipboard.load" + - "worldedit.schematic.save" + - "worldedit.schematic.load" + - "worldedit.schematic.formats" # CoreProtect - "coreprotect.inspect" @@ -50,7 +55,7 @@ operators: - "coreprotect.co" # WorldGuard - - "worldgyardregion.list.own" + - "worldguard.region.list.own" - "worldguard.region.addmember.own.*" - "worldguard.region.removemember.own.*" - "worldguard.region.info.*"