Add f fly
This commit is contained in:
@@ -54,6 +54,7 @@ public class CmdFactions extends FactionsCommand
|
||||
public CmdFactionsRelationOld cmdFactionsRelationOldEnemy = new CmdFactionsRelationOld("enemy");
|
||||
public CmdFactionsPerm cmdFactionsPerm = new CmdFactionsPerm();
|
||||
public CmdFactionsFlag cmdFactionsFlag = new CmdFactionsFlag();
|
||||
public CmdFactionsFly cmdFactionsFly = new CmdFactionsFly();
|
||||
public CmdFactionsUnstuck cmdFactionsUnstuck = new CmdFactionsUnstuck();
|
||||
public CmdFactionsOverride cmdFactionsOverride = new CmdFactionsOverride();
|
||||
public CmdFactionsDisband cmdFactionsDisband = new CmdFactionsDisband();
|
||||
|
||||
63
src/com/massivecraft/factions/cmd/CmdFactionsFly.java
Normal file
63
src/com/massivecraft/factions/cmd/CmdFactionsFly.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.engine.EngineFly;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.MassiveCommandToggle;
|
||||
import com.massivecraft.massivecore.engine.EngineMassiveCorePlayerUpdate;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
import com.massivecraft.massivecore.util.IdUtil;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CmdFactionsFly extends MassiveCommandToggle
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static CmdFactionsFly i = new CmdFactionsFly();
|
||||
public static CmdFactionsFly get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdFactionsFly()
|
||||
{
|
||||
super();
|
||||
this.setAliases("fly");
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return "faction flying";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getValue() throws MassiveException
|
||||
{
|
||||
return MPlayer.get(sender).isFlying();
|
||||
}
|
||||
|
||||
public void setValue(boolean value) throws MassiveException
|
||||
{
|
||||
MPlayer mplayer = MPlayer.get(sender);
|
||||
Player player = IdUtil.getPlayer(sender);
|
||||
if (player == null) throw new MassiveException().addMsg("<b>Could not find player.");
|
||||
|
||||
PS ps = PS.valueOf(player);
|
||||
if (value && !EngineFly.canFlyInTerritory(mplayer, ps))
|
||||
{
|
||||
throw new MassiveException().addMsg("<b>You can't fly where you are.");
|
||||
}
|
||||
|
||||
mplayer.setFlying(value);
|
||||
EngineMassiveCorePlayerUpdate.update(player, false);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user