Saber-Factions/src/com/massivecraft/factions/commands/FCommandMap.java

67 lines
1.5 KiB
Java
Raw Normal View History

2011-07-18 22:06:02 +02:00
package com.massivecraft.factions.commands;
2011-07-18 22:06:02 +02:00
import com.massivecraft.factions.Board;
import com.massivecraft.factions.Conf;
2011-07-18 22:06:02 +02:00
import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.struct.Permission;
public class FCommandMap extends FCommand
{
public FCommandMap()
{
super();
this.aliases.add("map");
//this.requiredArgs.add("");
this.optionalArgs.put("on/off", "once");
this.permission = Permission.COMMAND_MAP.node;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = 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
if ( ! payForCommand(Conf.econCostMap)) return;
fme.setMapAutoUpdating(true);
sendMessageParsed("<i>Map auto update <green>ENABLED.");
// And show the map once
showMap();
}
else
{
// Turn off
fme.setMapAutoUpdating(false);
sendMessageParsed("<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
if ( ! payForCommand(Conf.econCostMap)) return;
showMap();
}
}
public void showMap()
{
sendMessage(Board.getMap(fme.getFaction(), new FLocation(fme), fme.getPlayer().getLocation().getYaw()));
}
}