Skip to content
This repository has been archived by the owner on Jul 7, 2023. It is now read-only.

Commit

Permalink
Improved recent Stealth feature to use local variables (performance e…
Browse files Browse the repository at this point in the history
…nchancing)
  • Loading branch information
Svenja Reissaus committed Aug 2, 2018
1 parent 6a3b4db commit 1ac9c12
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/main/java/com/massivecraft/factions/cmd/CmdStealth.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,15 @@ public CmdStealth() {
}

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;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/massivecraft/factions/zcore/util/TL.java
Original file line number Diff line number Diff line change
Expand Up @@ -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("<a>Teleport cancelled because you were damaged"),
Expand Down

0 comments on commit 1ac9c12

Please sign in to comment.