mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-12-01 07:03:52 +01:00
Avoid duplicate wrapping
This commit is contained in:
parent
6c14c13ceb
commit
37f2ef9765
@ -37,7 +37,14 @@ public class WorldWrapper extends AbstractWorld {
|
|||||||
|
|
||||||
private final AbstractWorld parent;
|
private final AbstractWorld parent;
|
||||||
|
|
||||||
public WorldWrapper(AbstractWorld parent) {
|
public static WorldWrapper wrap(AbstractWorld world) {
|
||||||
|
if (world instanceof WorldWrapper) {
|
||||||
|
return (WorldWrapper) world;
|
||||||
|
}
|
||||||
|
return new WorldWrapper(world);
|
||||||
|
}
|
||||||
|
|
||||||
|
private WorldWrapper(AbstractWorld parent) {
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ public class EditSession implements Extent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Wrap the world
|
// Wrap the world
|
||||||
this.world = (world instanceof WorldWrapper) ? world : (world = new WorldWrapper((AbstractWorld) world));
|
this.world = (world = WorldWrapper.wrap((AbstractWorld) world));
|
||||||
|
|
||||||
// Delegate some methods to an implementation specific class
|
// Delegate some methods to an implementation specific class
|
||||||
this.wrapper = Fawe.imp().getEditSessionWrapper(this);
|
this.wrapper = Fawe.imp().getEditSessionWrapper(this);
|
||||||
|
Loading…
Reference in New Issue
Block a user