Allow just one edit instance per resource
This commit is contained in:
parent
4767d61198
commit
3fc5102020
|
@ -58,6 +58,11 @@ public class EditCommand extends BRCommand {
|
|||
}
|
||||
|
||||
DResourceWorld resource = worlds.getResourceByName(mapName);
|
||||
if (resource == null) {
|
||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NO_SUCH_MAP.getMessage(mapName));
|
||||
return;
|
||||
}
|
||||
|
||||
DEditWorld editWorld = resource.instantiateAsEditWorld();
|
||||
DGroup dGroup = DGroup.getByPlayer(player);
|
||||
DGlobalPlayer dPlayer = plugin.getDPlayers().getByPlayer(player);
|
||||
|
|
|
@ -236,14 +236,20 @@ public class DResourceWorld {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return an instance of this world
|
||||
* @return an old or a new instance of this world.
|
||||
*/
|
||||
public DEditWorld instantiateAsEditWorld() {
|
||||
for (DEditWorld instance : worlds.getEditWorlds()) {
|
||||
if (instance.getName().equals(getName())) {
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
return (DEditWorld) instantiate(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return an instance of this world
|
||||
* @return a new instance of this world
|
||||
*/
|
||||
public DGameWorld instantiateAsGameWorld() {
|
||||
return (DGameWorld) instantiate(true);
|
||||
|
|
Loading…
Reference in New Issue