mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 17:57:38 +00:00
Fixed console commands not working due to null Worlds.
This commit is contained in:
parent
b941e21d4d
commit
d85c0096a9
@ -104,14 +104,14 @@ public class EditSession implements Extent {
|
|||||||
protected final World world;
|
protected final World world;
|
||||||
private final ChangeSet changeSet = new BlockOptimizedHistory();
|
private final ChangeSet changeSet = new BlockOptimizedHistory();
|
||||||
|
|
||||||
private final FastModeExtent fastModeExtent;
|
private @Nullable FastModeExtent fastModeExtent;
|
||||||
private final ChunkLoadingExtent chunkLoadingExtent;
|
private @Nullable ChunkLoadingExtent chunkLoadingExtent;
|
||||||
private final LastAccessExtentCache cacheExtent;
|
private @Nullable LastAccessExtentCache cacheExtent;
|
||||||
private final BlockQuirkExtent quirkExtent;
|
private @Nullable BlockQuirkExtent quirkExtent;
|
||||||
private final DataValidatorExtent validator;
|
private @Nullable DataValidatorExtent validator;
|
||||||
private final BlockBagExtent blockBagExtent;
|
private final BlockBagExtent blockBagExtent;
|
||||||
private final MultiStageReorder reorderExtent;
|
private final MultiStageReorder reorderExtent;
|
||||||
private final ChangeSetExtent changeSetExtent;
|
private @Nullable ChangeSetExtent changeSetExtent;
|
||||||
private final MaskingExtent maskingExtent;
|
private final MaskingExtent maskingExtent;
|
||||||
private final BlockChangeLimiter changeLimiter;
|
private final BlockChangeLimiter changeLimiter;
|
||||||
|
|
||||||
@ -150,12 +150,12 @@ public class EditSession implements Extent {
|
|||||||
*/
|
*/
|
||||||
EditSession(EventBus eventBus, World world, int maxBlocks, @Nullable BlockBag blockBag, EditSessionEvent event) {
|
EditSession(EventBus eventBus, World world, int maxBlocks, @Nullable BlockBag blockBag, EditSessionEvent event) {
|
||||||
checkNotNull(eventBus);
|
checkNotNull(eventBus);
|
||||||
checkNotNull(world);
|
|
||||||
checkArgument(maxBlocks >= -1, "maxBlocks >= -1 required");
|
checkArgument(maxBlocks >= -1, "maxBlocks >= -1 required");
|
||||||
checkNotNull(event);
|
checkNotNull(event);
|
||||||
|
|
||||||
this.world = world;
|
this.world = world;
|
||||||
|
|
||||||
|
if (world != null) {
|
||||||
Extent extent;
|
Extent extent;
|
||||||
|
|
||||||
// This extents are ALWAYS used
|
// This extents are ALWAYS used
|
||||||
@ -180,6 +180,16 @@ public class EditSession implements Extent {
|
|||||||
this.bypassReorderHistory = blockBagExtent;
|
this.bypassReorderHistory = blockBagExtent;
|
||||||
this.bypassHistory = reorderExtent;
|
this.bypassHistory = reorderExtent;
|
||||||
this.bypassNone = extent;
|
this.bypassNone = extent;
|
||||||
|
} else {
|
||||||
|
Extent extent = new NullExtent();
|
||||||
|
extent = blockBagExtent = new BlockBagExtent(extent, blockBag);
|
||||||
|
extent = reorderExtent = new MultiStageReorder(extent, false);
|
||||||
|
extent = maskingExtent = new MaskingExtent(extent, Masks.alwaysTrue());
|
||||||
|
extent = changeLimiter = new BlockChangeLimiter(extent, maxBlocks);
|
||||||
|
this.bypassReorderHistory = extent;
|
||||||
|
this.bypassHistory = extent;
|
||||||
|
this.bypassNone = extent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Extent wrapExtent(Extent extent, EventBus eventBus, EditSessionEvent event, Stage stage) {
|
private Extent wrapExtent(Extent extent, EventBus eventBus, EditSessionEvent event, Stage stage) {
|
||||||
@ -285,8 +295,10 @@ public class EditSession implements Extent {
|
|||||||
* @param enabled true to enable
|
* @param enabled true to enable
|
||||||
*/
|
*/
|
||||||
public void setFastMode(boolean enabled) {
|
public void setFastMode(boolean enabled) {
|
||||||
|
if (fastModeExtent != null) {
|
||||||
fastModeExtent.setEnabled(enabled);
|
fastModeExtent.setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return fast mode status.
|
* Return fast mode status.
|
||||||
@ -296,7 +308,7 @@ public class EditSession implements Extent {
|
|||||||
* @return true if enabled
|
* @return true if enabled
|
||||||
*/
|
*/
|
||||||
public boolean hasFastMode() {
|
public boolean hasFastMode() {
|
||||||
return fastModeExtent.isEnabled();
|
return fastModeExtent != null ? fastModeExtent.isEnabled() : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user