Factions/src/com/massivecraft/factions/cmd/CmdFactionsMap.java

63 lines
1.5 KiB
Java
Raw Normal View History

2011-10-09 21:57:43 +02:00
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.BoardColl;
2013-04-09 13:15:25 +02:00
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Perm;
2013-04-16 11:27:03 +02:00
import com.massivecraft.mcore.cmd.arg.ARBoolean;
2013-04-16 10:11:59 +02:00
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer;
import com.massivecraft.mcore.ps.PS;
2013-04-10 13:12:22 +02:00
public class CmdFactionsMap extends FCommand
{
2013-04-10 13:12:22 +02:00
public CmdFactionsMap()
{
2013-04-16 10:11:59 +02:00
this.addAliases("map");
this.addOptionalArg("on/off", "once");
2013-04-16 10:11:59 +02:00
this.addRequirements(ReqHasPerm.get(Perm.MAP.node));
this.addRequirements(ReqIsPlayer.get());
2011-03-23 17:39:56 +01:00
}
@Override
public void perform()
{
2013-04-16 11:27:03 +02:00
if (!this.argIsSet(0))
{
2013-04-16 11:27:03 +02:00
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if ( ! payForCommand(ConfServer.econCostMap, "to show the map", "for showing the map")) return;
2013-04-16 11:27:03 +02:00
showMap();
return;
}
2013-04-16 11:27:03 +02:00
if (this.arg(0, ARBoolean.get(), !fme.isMapAutoUpdating()))
{
2013-04-16 11:27:03 +02:00
// Turn on
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
2013-04-09 13:15:25 +02:00
if ( ! payForCommand(ConfServer.econCostMap, "to show the map", "for showing the map")) return;
2013-04-16 11:27:03 +02:00
fme.setMapAutoUpdating(true);
msg("<i>Map auto update <green>ENABLED.");
// And show the map once
showMap();
}
2013-04-16 11:27:03 +02:00
else
{
// Turn off
fme.setMapAutoUpdating(false);
msg("<i>Map auto update <red>DISABLED.");
}
}
public void showMap()
{
sendMessage(BoardColl.get().getMap(myFaction, PS.valueOf(me), fme.getPlayer().getLocation().getYaw()));
}
}