2011-04-08 15:51:07 +02:00
|
|
|
package org.mcteam.factions.commands;
|
2011-03-22 15:45:41 +01:00
|
|
|
|
2011-03-23 17:39:56 +01:00
|
|
|
import org.bukkit.command.CommandSender;
|
2011-04-08 15:51:07 +02:00
|
|
|
import org.mcteam.factions.Board;
|
|
|
|
import org.mcteam.factions.FLocation;
|
2011-03-22 15:45:41 +01:00
|
|
|
|
|
|
|
|
|
|
|
public class FCommandMap extends FBaseCommand {
|
|
|
|
|
|
|
|
public FCommandMap() {
|
2011-03-22 18:48:09 +01:00
|
|
|
aliases.add("map");
|
|
|
|
|
2011-03-22 15:45:41 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2011-06-21 07:38:31 +02:00
|
|
|
@Override
|
2011-03-22 15:45:41 +01:00
|
|
|
public void perform() {
|
|
|
|
if (parameters.size() > 0) {
|
|
|
|
String mapAutoUpdating = parameters.get(0);
|
2011-03-22 18:48:09 +01:00
|
|
|
if (parseBool(mapAutoUpdating)) {
|
2011-03-22 15:45:41 +01:00
|
|
|
// 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()));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|