FastAsyncWorldedit/src/com/boydti/fawe/util/SafeExtentWrapper.java
Jesse Boyd 1169b42fab Code cleanup, fixes, optimizations, tweaks and new features
Code cleanup:
- Slight restructure
- FaweAPI class with some useful functions
- Abstracting some components for future port different versions /
platform

Fixes:
- Fixed lighting issues
- Fixed some async exceptions
- Fixed undo/redo having unexpected behavior
- Fixed support for third party extents

Improvements on the relighting algorithm.
- It's slightly slower but results in more reliable lighting

Queue optimizations:
- Decreased overhead, faster block placement and relighting
- Now supports async biome changes

Block logging:
- Now supports block logging (with BlocksHub)

Schematic streaming:
- Completely bypass the clipboard and "//stream <file>" giant schematics
into the world

Region selection:
- Use "//worldeditregion" to select your current region restriction

Manual relighting:
- Use "//fixlighting" to fix the lighting in your current selection
2015-11-18 18:49:57 +11:00

37 lines
1.2 KiB
Java

package com.boydti.fawe.util;
import com.boydti.fawe.config.BBC;
import com.boydti.fawe.object.FawePlayer;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.Extent;
public class SafeExtentWrapper extends AbstractDelegateExtent {
private final FawePlayer<?> player;
public SafeExtentWrapper(final FawePlayer<?> player, final Extent extent) {
super(extent);
this.player = player;
}
@Override
public boolean setBlock(final Vector location, final BaseBlock block) throws WorldEditException {
if (super.setBlock(location, block)) {
if (MemUtil.isMemoryLimited()) {
if (player != null) {
BBC.WORLDEDIT_OOM.send(player);
if (Perm.hasPermission(player, "worldedit.fast")) {
BBC.WORLDEDIT_OOM_ADMIN.send(player);
}
}
WEManager.IMP.cancelEdit(this);
return false;
}
return true;
}
return false;
}
}