@@ -206,7 +206,7 @@ public class CmdFly extends FCommand {
|
||||
if (entities.get(i) instanceof Player) {
|
||||
Player eplayer = (Player) entities.get(i);
|
||||
FPlayer efplayer = FPlayers.getInstance().getByPlayer(eplayer);
|
||||
if (efplayer.getRelationTo(fme) == Relation.ENEMY) {
|
||||
if (efplayer.getRelationTo(fme) == Relation.ENEMY && !efplayer.isStealthEnabled()) {
|
||||
fme.msg(TL.COMMAND_FLY_CHECK_ENEMY);
|
||||
return;
|
||||
}
|
||||
@@ -214,6 +214,7 @@ public class CmdFly extends FCommand {
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (args.size() == 0) {
|
||||
toggleFlight(!fme.isFlying(), me);
|
||||
} else if (args.size() == 1) {
|
||||
|
||||
43
src/main/java/com/massivecraft/factions/cmd/CmdStealth.java
Normal file
43
src/main/java/com/massivecraft/factions/cmd/CmdStealth.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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
|
||||
fme.setStealth(!fme.isStealthEnabled());
|
||||
//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");
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_STEALTH_DESCRIPTION;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -51,6 +51,7 @@ public class FCmdRoot extends FCommand {
|
||||
public CmdSethome cmdSethome = new CmdSethome();
|
||||
public CmdShow cmdShow = new CmdShow();
|
||||
public CmdStatus cmdStatus = new CmdStatus();
|
||||
public CmdStealth cmdStealth = new CmdStealth();
|
||||
public CmdStuck cmdStuck = new CmdStuck();
|
||||
public CmdTag cmdTag = new CmdTag();
|
||||
public CmdTitle cmdTitle = new CmdTitle();
|
||||
@@ -166,6 +167,7 @@ public class FCmdRoot extends FCommand {
|
||||
this.addSubCommand(this.cmdSethome);
|
||||
this.addSubCommand(this.cmdShow);
|
||||
this.addSubCommand(this.cmdStatus);
|
||||
this.addSubCommand(this.cmdStealth);
|
||||
this.addSubCommand(this.cmdStuck);
|
||||
this.addSubCommand(this.cmdTag);
|
||||
this.addSubCommand(this.cmdTitle);
|
||||
|
||||
Reference in New Issue
Block a user