瀏覽代碼

Inspecting offline players no longer requires permissions + fixing
errors when using mcrank on an offline player

nossr50 6 年之前
父節點
當前提交
38bc60ba86

+ 7 - 0
Changelog.txt

@@ -1,8 +1,15 @@
 Version 2.1.82
 Version 2.1.82
     Added proper error handling when loading parties file
     Added proper error handling when loading parties file
+    Fixed an error that could occur when using mcrank on an offline player
+    You can now use mcrank on offline players by default
+    You can now use inspect on offline players by default
+    Removed the offline inspect/mcrank permissions
     Updated Chinese locale (thanks to the user named 89009332 from github)
     Updated Chinese locale (thanks to the user named 89009332 from github)
     Added some redundancy checks when loading profiles (NPC checks to be specific)
     Added some redundancy checks when loading profiles (NPC checks to be specific)
 
 
+    NOTES:
+    There were reasons to prevent inspecting offline players in the past, I don't see any reason for them anymore so I've removed the restriction.
+
 Version 2.1.81
 Version 2.1.81
     Fixed a bug where Arrow Deflect would never trigger outside of PVP
     Fixed a bug where Arrow Deflect would never trigger outside of PVP
     Fixed a bug where failing to salvage enchantments incorrectly colored the text
     Fixed a bug where failing to salvage enchantments incorrectly colored the text

+ 0 - 4
src/main/java/com/gmail/nossr50/commands/player/InspectCommand.java

@@ -36,10 +36,6 @@ public class InspectCommand implements TabExecutor {
                         return true;
                         return true;
                     }
                     }
 
 
-                    if (CommandUtils.inspectOffline(sender, profile, Permissions.inspectOffline(sender))) {
-                        return true;
-                    }
-
                     if (Config.getInstance().getScoreboardsEnabled() && sender instanceof Player && Config.getInstance().getInspectUseBoard()) {
                     if (Config.getInstance().getScoreboardsEnabled() && sender instanceof Player && Config.getInstance().getInspectUseBoard()) {
                         ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, profile);
                         ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, profile);
 
 

+ 0 - 3
src/main/java/com/gmail/nossr50/commands/player/McrankCommand.java

@@ -62,9 +62,6 @@ public class McrankCommand implements TabExecutor {
                         return true;
                         return true;
                     }
                     }
                 }
                 }
-                else if (CommandUtils.inspectOffline(sender, mcMMO.getDatabaseManager().loadPlayerProfile(playerName, false), Permissions.mcrankOffline(sender))) {
-                    return true;
-                }
 
 
                 display(sender, playerName);
                 display(sender, playerName);
                 return true;
                 return true;

+ 1 - 0
src/main/java/com/gmail/nossr50/datatypes/skills/PrimarySkillType.java

@@ -25,6 +25,7 @@ import com.gmail.nossr50.util.StringUtils;
 import com.gmail.nossr50.util.skills.RankUtils;
 import com.gmail.nossr50.util.skills.RankUtils;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableList;
 import org.bukkit.Color;
 import org.bukkit.Color;
+import org.bukkit.OfflinePlayer;
 import org.bukkit.entity.Entity;
 import org.bukkit.entity.Entity;
 import org.bukkit.entity.Player;
 import org.bukkit.entity.Player;
 import org.bukkit.entity.Tameable;
 import org.bukkit.entity.Tameable;

+ 4 - 4
src/main/java/com/gmail/nossr50/runnables/commands/McrankCommandDisplayTask.java

@@ -41,16 +41,16 @@ public class McrankCommandDisplayTask extends BukkitRunnable {
     }
     }
 
 
     private void displayChat() {
     private void displayChat() {
-        Player player = mcMMO.p.getServer().getPlayerExact(playerName);
+//        Player player = mcMMO.p.getServer().getPlayerExact(playerName);
         Integer rank;
         Integer rank;
 
 
         sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Heading"));
         sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Heading"));
         sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Player", playerName));
         sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Player", playerName));
 
 
         for (PrimarySkillType skill : PrimarySkillType.NON_CHILD_SKILLS) {
         for (PrimarySkillType skill : PrimarySkillType.NON_CHILD_SKILLS) {
-            if (!skill.getPermissions(player)) {
-                continue;
-            }
+//            if (!skill.getPermissions(player)) {
+//                continue;
+//            }
 
 
             rank = skills.get(skill);
             rank = skills.get(skill);
             sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Skill", skill.getName(), (rank == null ? LocaleLoader.getString("Commands.mcrank.Unranked") : rank)));
             sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Skill", skill.getName(), (rank == null ? LocaleLoader.getString("Commands.mcrank.Unranked") : rank)));

+ 0 - 13
src/main/java/com/gmail/nossr50/util/commands/CommandUtils.java

@@ -33,19 +33,6 @@ public final class CommandUtils {
         return true;
         return true;
     }
     }
 
 
-    public static boolean inspectOffline(CommandSender sender, PlayerProfile profile, boolean hasPermission) {
-        if (unloadedProfile(sender, profile)) {
-            return true;
-        }
-
-        if (!hasPermission) {
-            sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
-            return true;
-        }
-
-        return false;
-    }
-
     public static boolean tooFar(CommandSender sender, Player target, boolean hasPermission) {
     public static boolean tooFar(CommandSender sender, Player target, boolean hasPermission) {
         if (sender instanceof Player && !Misc.isNear(((Player) sender).getLocation(), target.getLocation(), Config.getInstance().getInspectDistance()) && !hasPermission) {
         if (sender instanceof Player && !Misc.isNear(((Player) sender).getLocation(), target.getLocation(), Config.getInstance().getInspectDistance()) && !hasPermission) {
             sender.sendMessage(LocaleLoader.getString("Inspect.TooFar"));
             sender.sendMessage(LocaleLoader.getString("Inspect.TooFar"));

+ 0 - 8
src/main/resources/plugin.yml

@@ -716,7 +716,6 @@ permissions:
             mcmmo.bypass.hardcoremode: true
             mcmmo.bypass.hardcoremode: true
             mcmmo.commands.inspect.far: true
             mcmmo.commands.inspect.far: true
             mcmmo.commands.inspect.hidden: true
             mcmmo.commands.inspect.hidden: true
-            mcmmo.commands.inspect.offline: true
     mcmmo.bypass.partylimit:
     mcmmo.bypass.partylimit:
         default: false
         default: false
         description: Allows user to bypass party size limitations if present on the server
         description: Allows user to bypass party size limitations if present on the server
@@ -794,7 +793,6 @@ permissions:
             mcmmo.commands.hardcore.all: true
             mcmmo.commands.hardcore.all: true
             mcmmo.commands.inspect.far: true
             mcmmo.commands.inspect.far: true
             mcmmo.commands.inspect.hidden: true
             mcmmo.commands.inspect.hidden: true
-            mcmmo.commands.inspect.offline: true
             mcmmo.commands.mcability.others: true
             mcmmo.commands.mcability.others: true
             mcmmo.commands.mcconvert.all: true
             mcmmo.commands.mcconvert.all: true
             mcmmo.commands.mcchatspy: true
             mcmmo.commands.mcchatspy: true
@@ -866,15 +864,12 @@ permissions:
             mcmmo.commands.inspect: true
             mcmmo.commands.inspect: true
             mcmmo.commands.inspect.far: true
             mcmmo.commands.inspect.far: true
             mcmmo.commands.inspect.hidden: true
             mcmmo.commands.inspect.hidden: true
-            mcmmo.commands.inspect.offline: true
     mcmmo.commands.inspect:
     mcmmo.commands.inspect:
         description: Allows access to the inspect command
         description: Allows access to the inspect command
     mcmmo.commands.inspect.far:
     mcmmo.commands.inspect.far:
         description: Allows access to the inspect command for far players
         description: Allows access to the inspect command for far players
     mcmmo.commands.inspect.hidden:
     mcmmo.commands.inspect.hidden:
         description: Allows access to the inspect command for hidden players
         description: Allows access to the inspect command for hidden players
-    mcmmo.commands.inspect.offline:
-        description: Allows access to the inspect command for offline players
     mcmmo.commands.mcability:
     mcmmo.commands.mcability:
         description: Allows access to the mcability command
         description: Allows access to the mcability command
     mcmmo.commands.mcability.others:
     mcmmo.commands.mcability.others:
@@ -935,13 +930,10 @@ permissions:
         children:
         children:
             mcmmo.commands.mcrank.others: true
             mcmmo.commands.mcrank.others: true
             mcmmo.commands.mcrank.others.far: true
             mcmmo.commands.mcrank.others.far: true
-            mcmmo.commands.mcrank.others.offline: true
     mcmmo.commands.mcrank.others:
     mcmmo.commands.mcrank.others:
         description: Allows access to the mcrank command for other players
         description: Allows access to the mcrank command for other players
     mcmmo.commands.mcrank.others.far:
     mcmmo.commands.mcrank.others.far:
         description: Allows access to the mcrank command for far players
         description: Allows access to the mcrank command for far players
-    mcmmo.commands.mcrank.others.offline:
-        description: Allows access to the mcrank command for offline players
     mcmmo.commands.mcrefresh:
     mcmmo.commands.mcrefresh:
         description: Allows access to the mcrefresh command
         description: Allows access to the mcrefresh command
     mcmmo.commands.mcrefresh.others:
     mcmmo.commands.mcrefresh.others: