From 1ac9c123d0cffe755a741a592edb2ad820778f5a Mon Sep 17 00:00:00 2001 From: Svenja Reissaus Date: Thu, 2 Aug 2018 11:32:53 -0300 Subject: [PATCH] Improved recent Stealth feature to use local variables (performance enchancing) --- .../com/massivecraft/factions/cmd/CmdStealth.java | 13 ++++--------- .../com/massivecraft/factions/zcore/util/TL.java | 1 + 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdStealth.java b/src/main/java/com/massivecraft/factions/cmd/CmdStealth.java index 1c6fc8a7..1d12faac 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdStealth.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdStealth.java @@ -21,20 +21,15 @@ public class CmdStealth extends FCommand { } public void perform() { - //Grabs Faction - Faction faction = fme.getFaction(); - - if (faction != null && !faction.getId().equalsIgnoreCase("0") && !faction.getId().equalsIgnoreCase("none") && !faction.getId().equalsIgnoreCase("safezone") && !faction.getId().equalsIgnoreCase("warzone")) { - //Grabs Boolean From FPlayer + if (myFaction != null && !myFaction.isWilderness() && !myFaction.isSafeZone() && !myFaction.isWarZone() && myFaction.isNormal()) { fme.setStealth(!fme.isStealthEnabled()); - //Sends Enable/Disable Message + // Sends Enable/Disable Message fme.msg(fme.isStealthEnabled() ? TL.COMMAND_STEALTH_ENABLE : TL.COMMAND_STEALTH_DISABLE); - } else { - //Send "Needed Faction" Message - fme.sendMessage(ChatColor.RED + "You must be in a faction to use this command"); + fme.msg(TL.COMMAND_STEALTH_MUSTBEMEMBER); } } + @Override public TL getUsageTranslation() { return TL.COMMAND_STEALTH_DESCRIPTION; diff --git a/src/main/java/com/massivecraft/factions/zcore/util/TL.java b/src/main/java/com/massivecraft/factions/zcore/util/TL.java index 2af73b40..87393034 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/TL.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/TL.java @@ -636,6 +636,7 @@ public enum TL { COMMAND_STEALTH_DESCRIPTION("Enable and Disable Stealth Mode"), COMMAND_STEALTH_ENABLE( "&2Stealth &8» &7You will no longer disable nearby players fly."), COMMAND_STEALTH_DISABLE("&2Stealth &8» &7You will now disable other nearby players fly."), + COMMAND_STEALTH_MUSTBEMEMBER("&2Stealth &8» &4You must be in a faction to use this command"), COMMAND_STUCK_TIMEFORMAT("m 'minutes', s 'seconds.'"), COMMAND_STUCK_CANCELLED("Teleport cancelled because you were damaged"),