mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-05 20:36:42 +00:00
Implement EditSessionFactory
This commit is contained in:
@ -112,6 +112,11 @@ public class WorldEdit {
|
||||
*/
|
||||
public static final Logger logger = Logger.getLogger("Minecraft.WorldEdit");
|
||||
|
||||
/**
|
||||
* Holds the current instance of this class, for static access
|
||||
*/
|
||||
private static WorldEdit instance;
|
||||
|
||||
/**
|
||||
* Holds WorldEdit's version.
|
||||
*/
|
||||
@ -131,6 +136,11 @@ public class WorldEdit {
|
||||
* List of commands.
|
||||
*/
|
||||
private final CommandsManager<LocalPlayer> commands;
|
||||
|
||||
/**
|
||||
* Holds the factory responsible for the creation of edit sessions
|
||||
*/
|
||||
private EditSessionFactory editSessionFactory = new EditSessionFactory();
|
||||
|
||||
/**
|
||||
* Stores a list of WorldEdit sessions, keyed by players' names. Sessions
|
||||
@ -155,6 +165,7 @@ public class WorldEdit {
|
||||
* @param config
|
||||
*/
|
||||
public WorldEdit(ServerInterface server, final LocalConfiguration config) {
|
||||
instance = this;
|
||||
this.server = server;
|
||||
this.config = config;
|
||||
|
||||
@ -253,6 +264,15 @@ public class WorldEdit {
|
||||
server.onCommandRegistration(commands.registerAndReturn(clazz), commands);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current instance of this class
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static WorldEdit getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the LocalSession for a player name if it exists
|
||||
*
|
||||
@ -1529,6 +1549,28 @@ public class WorldEdit {
|
||||
return server;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the edit session factory
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public EditSessionFactory getEditSessionFactory() {
|
||||
return this.editSessionFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the edit session factory
|
||||
*
|
||||
* @param factory
|
||||
*/
|
||||
public void setEditSessionFactory(EditSessionFactory factory) {
|
||||
if (factory == null) {
|
||||
throw new IllegalArgumentException("New EditSessionFactory may not be null");
|
||||
}
|
||||
logger.info("Accepted EditSessionFactory of type " + factory.getClass().getName() + " from " + factory.getClass().getPackage().getName());
|
||||
this.editSessionFactory = factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the version.
|
||||
*
|
||||
|
Reference in New Issue
Block a user