From a4ff2c7701d6981c0e76469a2a1241d743b48e4b Mon Sep 17 00:00:00 2001 From: GJ Date: Wed, 25 Apr 2012 22:07:01 -0400 Subject: [PATCH] Added bypass nodes for offline inspecting & long-distance inspecting. Also fixed some JavaDoc typos. --- .../com/gmail/nossr50/commands/CommandHelper.java | 3 --- .../nossr50/commands/general/InspectCommand.java | 5 +++-- src/main/java/com/gmail/nossr50/mcMMO.java | 2 +- src/main/java/com/gmail/nossr50/mcPermissions.java | 11 +++++++++++ src/main/resources/config.yml | 8 ++++---- src/main/resources/plugin.yml | 10 ++++++++++ 6 files changed, 29 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/CommandHelper.java b/src/main/java/com/gmail/nossr50/commands/CommandHelper.java index 5116bfc86..afa5cb45f 100644 --- a/src/main/java/com/gmail/nossr50/commands/CommandHelper.java +++ b/src/main/java/com/gmail/nossr50/commands/CommandHelper.java @@ -46,7 +46,6 @@ public class CommandHelper { * * @param inspect The player to retrieve stats for * @param display The sender to display stats to - * @param online true if the player to retrieve stats for is online, false otherwise */ public static void printGatheringSkills(Player inspect, CommandSender display) { if (Skills.hasGatheringSkills(inspect)) { @@ -85,7 +84,6 @@ public class CommandHelper { * * @param inspect The player to retrieve stats for * @param display The sender to display stats to - * @param online true if the player to retrieve stats for is online, false otherwise */ public static void printCombatSkills(Player inspect, CommandSender display) { if (Skills.hasCombatSkills(inspect)) { @@ -124,7 +122,6 @@ public class CommandHelper { * * @param inspect The player to retrieve stats for * @param display The sender to display stats to - * @param online true if the player to retrieve stats for is online, false otherwise */ public static void printMiscSkills(Player inspect, CommandSender display) { if (Skills.hasMiscSkills(inspect)) { diff --git a/src/main/java/com/gmail/nossr50/commands/general/InspectCommand.java b/src/main/java/com/gmail/nossr50/commands/general/InspectCommand.java index 860fc6f42..d69c96941 100644 --- a/src/main/java/com/gmail/nossr50/commands/general/InspectCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/general/InspectCommand.java @@ -9,6 +9,7 @@ import org.bukkit.entity.Player; import com.gmail.nossr50.Users; import com.gmail.nossr50.m; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.mcPermissions; import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; @@ -39,7 +40,7 @@ public class InspectCommand implements CommandExecutor { if (target.isOnline()) { Player player = (Player) target; - if (sender instanceof Player && !sender.isOp() && !m.isNear(((Player) sender).getLocation(), player.getLocation(), 5.0)) { + if (sender instanceof Player && !sender.isOp() && !m.isNear(((Player) sender).getLocation(), player.getLocation(), 5.0) && !mcPermissions.getInstance().inspectDistanceBypass((Player) sender)) { sender.sendMessage(mcLocale.getString("Inspect.TooFar")); return true; } @@ -53,7 +54,7 @@ public class InspectCommand implements CommandExecutor { return true; } else { - if (sender instanceof Player && !sender.isOp()) { + if (sender instanceof Player && !sender.isOp() && !mcPermissions.getInstance().inspectOfflineBypass((Player) sender)) { sender.sendMessage(mcLocale.getString("Inspect.Offline")); return true; } diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 419c8ec9b..32160617d 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -178,7 +178,7 @@ public class mcMMO extends JavaPlugin { *
* This function is designed for API usage. * - * @param player Name of player whose profile to get + * @param playerName Name of player whose profile to get * @return the PlayerProfile object */ public PlayerProfile getPlayerProfileByName(String playerName) { diff --git a/src/main/java/com/gmail/nossr50/mcPermissions.java b/src/main/java/com/gmail/nossr50/mcPermissions.java index 5f94a6227..473d3ed3b 100644 --- a/src/main/java/com/gmail/nossr50/mcPermissions.java +++ b/src/main/java/com/gmail/nossr50/mcPermissions.java @@ -29,10 +29,21 @@ public class mcPermissions { return player.hasPermission("mcmmo.admin"); } + /* + * MCMMO.BYPASS.* + */ public boolean arcaneBypass(Player player) { return player.hasPermission("mcmmo.bypass.arcanebypass"); } + public boolean inspectDistanceBypass(Player player) { + return player.hasPermission("mcmmo.bypass.inspect.distance"); + } + + public boolean inspectOfflineBypass(Player player) { + return player.hasPermission("mcmmo.bypass.inspect.offline"); + } + /* * MCMMO.TOOLS.* */ diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index f336e3b43..c0bc38660 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -259,11 +259,11 @@ Experience: Multiplier: Animals: 1.0 Creeper: 4.0 - Skeleton: 2.0 - Spider: 3.0 + Skeleton: 3.0 + Spider: 2.0 Zombie: 2.0 Pig_Zombie: 3.0 - Enderman: 2.0 + Enderman: 4.0 Cave_Spider: 3.0 Silverfish: 3.0 Blaze: 3.0 @@ -399,4 +399,4 @@ Spout: Mining: BLUE: 0.75 GREEN: 0.3 - RED: 0.3 \ No newline at end of file + RED: 0.3 diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 397b0492b..ddd9e2fbe 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -139,8 +139,18 @@ permissions: mcmmo.tools.*: true mcmmo.admin: description: Allows access to mmoupdate and other sensitive commands + mcmmo.bypass.*: + description: Implies all bypass permissions. + children: + mcmmo.bypass.arcanebypass: true + mcmmo.bypass.inspect.distance: true + mcmmo.bypass.inspect.offline: true mcmmo.bypass.arcanebypass: description: Allows user to bypass Arcane Repair so he will never lose enchantments + mcmmo.bypass.inspect.distance: + description: Allows user to bypass Inspect's distance requirements + mcmmo.bypass.inspect.offline: + description: Allows user to bypass Inspect's offline player requirements mcmmo.tools.*: description: Implies all mcmmo.tools permissions. children: