Introduced Brigadier Command System. More Formatting Coming in next commit.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
@@ -8,31 +7,23 @@ public class CmdStealth extends FCommand {
|
||||
public CmdStealth() {
|
||||
this.aliases.add("ninja");
|
||||
this.aliases.add("stealth");
|
||||
this.permission = Permission.STEALTH.node;
|
||||
|
||||
this.disableOnLock = true;
|
||||
|
||||
this.senderMustBePlayer = true;
|
||||
this.senderMustBeMember = false;
|
||||
this.senderMustBeModerator = false;
|
||||
this.senderMustBeColeader = false;
|
||||
this.senderMustBeAdmin = false;
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.STEALTH)
|
||||
.playerOnly()
|
||||
.build();
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
|
||||
|
||||
Faction faction = fme.getFaction();
|
||||
if (faction != null && !faction.getId().equalsIgnoreCase("0") && !faction.getId().equalsIgnoreCase("none") && !faction.getId().equalsIgnoreCase("safezone") && !faction.getId().equalsIgnoreCase("warzone")) {
|
||||
fme.setStealth(!fme.isStealthEnabled());
|
||||
fme.msg(fme.isStealthEnabled() ? TL.COMMAND_STEALTH_ENABLE : TL.COMMAND_STEALTH_DISABLE);
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
if (context.faction != null && !context.faction.getId().equalsIgnoreCase("0") && !context.faction.getId().equalsIgnoreCase("none") && !context.faction.getId().equalsIgnoreCase("safezone") && !context.faction.getId().equalsIgnoreCase("warzone")) {
|
||||
context.fPlayer.setStealth(!context.fPlayer.isStealthEnabled());
|
||||
context.msg(context.fPlayer.isStealthEnabled() ? TL.COMMAND_STEALTH_ENABLE : TL.COMMAND_STEALTH_DISABLE);
|
||||
} else {
|
||||
fme.msg(TL.COMMAND_STEALTH_MUSTBEMEMBER);
|
||||
context.msg(TL.COMMAND_STEALTH_MUSTBEMEMBER);
|
||||
}
|
||||
}
|
||||
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_STEALTH_DESCRIPTION;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user