Renamed hey0's plugin to SMWorldEdit. Made WorldEdit somewhat a singleton to hold the ServerInterface instance.

This commit is contained in:
sk89q
2010-10-14 11:59:45 -07:00
parent 5f1a014bfb
commit 92dc88562c
5 changed files with 73 additions and 26 deletions

View File

@@ -33,6 +33,15 @@ import com.sk89q.worldedit.*;
* @author sk89q
*/
public class WorldEdit {
/**
* WorldEdit instance.
*/
private static WorldEdit instance;
/**
* Server interface.
*/
private ServerInterface server;
/**
* List of default allowed blocks.
*/
@@ -65,10 +74,41 @@ public class WorldEdit {
*/
private int defaultChangeLimit = -1;
/**
* Set up an instance.
*
* @param server
* @return
*/
public static WorldEdit setup(ServerInterface server) {
WorldEdit worldEdit = new WorldEdit();
worldEdit.server = server;
instance = worldEdit;
return worldEdit;
}
/**
* Get WorldEdit instance.
*
* @return
*/
public static WorldEdit getInstance() {
return instance;
}
/**
* Get server interface.
*
* @return
*/
public static ServerInterface getServer() {
return instance.server;
}
/**
* Construct an instance of the plugin.
*/
public WorldEdit() {
private WorldEdit() {
commands.put("/editpos1", "Set editing position #1");
commands.put("/editpos2", "Set editing position #2");
commands.put("/toggleplace", "Toggle placing at pos #1");