2010-12-04 14:24:32 +01:00
|
|
|
import java.util.logging.Logger;
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
public class map extends Plugin {
|
|
|
|
|
|
|
|
protected static final Logger log = Logger.getLogger("Minecraft");
|
|
|
|
|
|
|
|
private WebServer server = null;
|
|
|
|
private MapManager mgr = null;
|
|
|
|
private MapListener listener = null;
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void enable() {
|
|
|
|
log.info("Map INIT");
|
|
|
|
|
|
|
|
mgr = new MapManager();
|
|
|
|
mgr.startManager();
|
|
|
|
|
|
|
|
try {
|
2010-12-05 22:00:52 +01:00
|
|
|
server = new WebServer(mgr.serverport, mgr);
|
2010-12-04 14:24:32 +01:00
|
|
|
} catch(IOException e) {
|
|
|
|
log.info("position failed to start WebServer (IOException)");
|
|
|
|
}
|
|
|
|
|
|
|
|
listener = new MapListener(mgr);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void disable() {
|
|
|
|
log.info("Map UNINIT");
|
|
|
|
|
|
|
|
mgr.stopManager();
|
|
|
|
|
|
|
|
if(server != null) {
|
|
|
|
server.shutdown();
|
|
|
|
server = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void initialize() {
|
|
|
|
etc.getLoader().addListener(PluginLoader.Hook.COMMAND, listener, this, PluginListener.Priority.MEDIUM);
|
|
|
|
etc.getLoader().addListener(PluginLoader.Hook.BLOCK_CREATED, listener, this, PluginListener.Priority.MEDIUM);
|
|
|
|
etc.getLoader().addListener(PluginLoader.Hook.BLOCK_DESTROYED, listener, this, PluginListener.Priority.MEDIUM);
|
|
|
|
|
|
|
|
etc.getInstance().addCommand("/map_wait", " [wait] - set wait between tile renders (ms)");
|
|
|
|
etc.getInstance().addCommand("/map_stat", " - query number of tiles in render queue");
|
|
|
|
etc.getInstance().addCommand("/map_regen", " - regenerate entire map");
|
|
|
|
etc.getInstance().addCommand("/map_debug", " - send map debugging messages");
|
|
|
|
etc.getInstance().addCommand("/map_nodebug", " - disable map debugging messages");
|
2010-12-05 22:00:52 +01:00
|
|
|
etc.getInstance().addCommand("/addmarker", " [name] - adds a named marker to the map");
|
|
|
|
etc.getInstance().addCommand("/removemarker", " [name] - removes a named marker to the map");
|
|
|
|
etc.getInstance().addCommand("/listmarkers", " - list all named markers");
|
|
|
|
etc.getInstance().addCommand("/tpmarker", " [name] - teleport to a named marker");
|
2010-12-04 14:24:32 +01:00
|
|
|
}
|
|
|
|
}
|