Improved recent Stealth feature to use local variables (performance enchancing)

This commit is contained in:
Svenja Reissaus 2018-08-02 11:32:53 -03:00
parent 6a3b4db565
commit 1ac9c123d0
2 changed files with 5 additions and 9 deletions

View File

@ -21,20 +21,15 @@ public class CmdStealth extends FCommand {
} }
public void perform() { public void perform() {
//Grabs Faction if (myFaction != null && !myFaction.isWilderness() && !myFaction.isSafeZone() && !myFaction.isWarZone() && myFaction.isNormal()) {
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
fme.setStealth(!fme.isStealthEnabled()); fme.setStealth(!fme.isStealthEnabled());
//Sends Enable/Disable Message // Sends Enable/Disable Message
fme.msg(fme.isStealthEnabled() ? TL.COMMAND_STEALTH_ENABLE : TL.COMMAND_STEALTH_DISABLE); fme.msg(fme.isStealthEnabled() ? TL.COMMAND_STEALTH_ENABLE : TL.COMMAND_STEALTH_DISABLE);
} else { } else {
//Send "Needed Faction" Message fme.msg(TL.COMMAND_STEALTH_MUSTBEMEMBER);
fme.sendMessage(ChatColor.RED + "You must be in a faction to use this command");
} }
} }
@Override @Override
public TL getUsageTranslation() { public TL getUsageTranslation() {
return TL.COMMAND_STEALTH_DESCRIPTION; return TL.COMMAND_STEALTH_DESCRIPTION;

View File

@ -636,6 +636,7 @@ public enum TL {
COMMAND_STEALTH_DESCRIPTION("Enable and Disable Stealth Mode"), COMMAND_STEALTH_DESCRIPTION("Enable and Disable Stealth Mode"),
COMMAND_STEALTH_ENABLE( "&2Stealth &8» &7You will no longer disable nearby players fly."), 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_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_TIMEFORMAT("m 'minutes', s 'seconds.'"),
COMMAND_STUCK_CANCELLED("<a>Teleport cancelled because you were damaged"), COMMAND_STUCK_CANCELLED("<a>Teleport cancelled because you were damaged"),