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

50 lines
1.0 KiB
Java
Raw Normal View History

2011-07-18 22:06:02 +02:00
package com.massivecraft.factions.commands;
2011-03-23 17:39:56 +01:00
import org.bukkit.command.CommandSender;
2011-07-18 22:06:02 +02:00
import com.massivecraft.factions.Board;
import com.massivecraft.factions.FLocation;
public class FCommandMap extends FBaseCommand {
public FCommandMap() {
aliases.add("map");
optionalParameters.add("on|off");
helpDescription = "Show territory map, set optional auto update";
}
2011-03-23 17:39:56 +01:00
@Override
public boolean hasPermission(CommandSender sender) {
return true;
}
@Override
public void perform() {
if (parameters.size() > 0) {
String mapAutoUpdating = parameters.get(0);
if (parseBool(mapAutoUpdating)) {
// Turn on
me.setMapAutoUpdating(true);
sendMessage("Map auto update ENABLED.");
// And show the map once
showMap();
} else {
// Turn off
me.setMapAutoUpdating(false);
sendMessage("Map auto update DISABLED.");
}
} else {
showMap();
}
}
public void showMap() {
sendMessage(Board.getMap(me.getFaction(), new FLocation(me), me.getPlayer().getLocation().getYaw()));
}
}