2
0
Эх сурвалжийг харах

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

nossr50 6 жил өмнө
parent
commit
38bc60ba86

+ 7 - 0
Changelog.txt

@@ -1,8 +1,15 @@
 Version 2.1.82
     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)
     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
     Fixed a bug where Arrow Deflect would never trigger outside of PVP
     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;
                     }
 
-                    if (CommandUtils.inspectOffline(sender, profile, Permissions.inspectOffline(sender))) {
-                        return true;
-                    }
-
                     if (Config.getInstance().getScoreboardsEnabled() && sender instanceof Player && Config.getInstance().getInspectUseBoard()) {
                         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;
                     }
                 }
-                else if (CommandUtils.inspectOffline(sender, mcMMO.getDatabaseManager().loadPlayerProfile(playerName, false), Permissions.mcrankOffline(sender))) {
-                    return true;
-                }
 
                 display(sender, playerName);
                 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.google.common.collect.ImmutableList;
 import org.bukkit.Color;
+import org.bukkit.OfflinePlayer;
 import org.bukkit.entity.Entity;
 import org.bukkit.entity.Player;
 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() {
-        Player player = mcMMO.p.getServer().getPlayerExact(playerName);
+//        Player player = mcMMO.p.getServer().getPlayerExact(playerName);
         Integer rank;
 
         sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Heading"));
         sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Player", playerName));
 
         for (PrimarySkillType skill : PrimarySkillType.NON_CHILD_SKILLS) {
-            if (!skill.getPermissions(player)) {
-                continue;
-            }
+//            if (!skill.getPermissions(player)) {
+//                continue;
+//            }
 
             rank = skills.get(skill);
             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;
     }
 
-    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) {
         if (sender instanceof Player && !Misc.isNear(((Player) sender).getLocation(), target.getLocation(), Config.getInstance().getInspectDistance()) && !hasPermission) {
             sender.sendMessage(LocaleLoader.getString("Inspect.TooFar"));

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

@@ -716,7 +716,6 @@ permissions:
             mcmmo.bypass.hardcoremode: true
             mcmmo.commands.inspect.far: true
             mcmmo.commands.inspect.hidden: true
-            mcmmo.commands.inspect.offline: true
     mcmmo.bypass.partylimit:
         default: false
         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.inspect.far: true
             mcmmo.commands.inspect.hidden: true
-            mcmmo.commands.inspect.offline: true
             mcmmo.commands.mcability.others: true
             mcmmo.commands.mcconvert.all: true
             mcmmo.commands.mcchatspy: true
@@ -866,15 +864,12 @@ permissions:
             mcmmo.commands.inspect: true
             mcmmo.commands.inspect.far: true
             mcmmo.commands.inspect.hidden: true
-            mcmmo.commands.inspect.offline: true
     mcmmo.commands.inspect:
         description: Allows access to the inspect command
     mcmmo.commands.inspect.far:
         description: Allows access to the inspect command for far players
     mcmmo.commands.inspect.hidden:
         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:
         description: Allows access to the mcability command
     mcmmo.commands.mcability.others:
@@ -935,13 +930,10 @@ permissions:
         children:
             mcmmo.commands.mcrank.others: true
             mcmmo.commands.mcrank.others.far: true
-            mcmmo.commands.mcrank.others.offline: true
     mcmmo.commands.mcrank.others:
         description: Allows access to the mcrank command for other players
     mcmmo.commands.mcrank.others.far:
         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:
         description: Allows access to the mcrefresh command
     mcmmo.commands.mcrefresh.others: