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

68 lines
1.5 KiB
Java
Raw Normal View History

2011-10-09 21:57:43 +02:00
package com.massivecraft.factions.cmd;
2013-04-11 07:01:30 +02:00
import com.massivecraft.factions.BoardOld;
2013-04-09 13:15:25 +02:00
import com.massivecraft.factions.ConfServer;
2011-07-18 22:06:02 +02:00
import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.Perm;
2013-04-10 13:12:22 +02:00
public class CmdFactionsMap extends FCommand
{
2013-04-10 13:12:22 +02:00
public CmdFactionsMap()
{
super();
this.aliases.add("map");
//this.requiredArgs.add("");
this.optionalArgs.put("on/off", "once");
this.permission = Perm.MAP.node;
2011-10-09 21:57:43 +02:00
this.disableOnLock = false;
senderMustBePlayer = true;
senderMustBeMember = false;
2011-10-23 17:55:53 +02:00
senderMustBeOfficer = false;
senderMustBeLeader = false;
2011-03-23 17:39:56 +01:00
}
@Override
public void perform()
{
if (this.argIsSet(0))
{
if (this.argAsBool(0, ! fme.isMapAutoUpdating()))
{
// 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;
fme.setMapAutoUpdating(true);
2011-10-10 13:40:24 +02:00
msg("<i>Map auto update <green>ENABLED.");
// And show the map once
showMap();
}
else
{
// Turn off
fme.setMapAutoUpdating(false);
2011-10-10 13:40:24 +02:00
msg("<i>Map auto update <red>DISABLED.");
}
}
else
{
// 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;
showMap();
}
}
public void showMap()
{
2013-04-11 07:01:30 +02:00
sendMessage(BoardOld.getMap(myFaction, new FLocation(fme), fme.getPlayer().getLocation().getYaw()));
}
}