mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 11:45:51 +00:00
commit
8b2f286ee4
@ -15,20 +15,18 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
|
|||||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||||
|
|
||||||
public class WESlimefunManager {
|
public class WESlimefunManager {
|
||||||
|
|
||||||
public WESlimefunManager() {
|
public WESlimefunManager() {
|
||||||
WorldEdit.getInstance().getEventBus().register(this);
|
WorldEdit.getInstance().getEventBus().register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void wrapForLogging(final EditSessionEvent event) {
|
public void wrapForLogging(final EditSessionEvent event) {
|
||||||
event.setExtent(new AbstractDelegateExtent(event.getExtent()) {
|
event.setExtent(new AbstractDelegateExtent(event.getExtent()) {
|
||||||
@SuppressWarnings({ "rawtypes", "deprecation" })
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBlock(BlockVector3 pos, BlockStateHolder block) throws WorldEditException {
|
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 pos, T block) throws WorldEditException {
|
||||||
if (block.getBlockType().getLegacyId() == 0) {
|
if (block.getBlockType().getMaterial().isAir()) {
|
||||||
World world = Bukkit.getWorld(event.getWorld().getName());
|
World world = Bukkit.getWorld(event.getWorld().getName());
|
||||||
|
|
||||||
if (world != null) {
|
if (world != null) {
|
||||||
Location l = new Location(world, pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
|
Location l = new Location(world, pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
|
||||||
if (BlockStorage.hasBlockInfo(l)) BlockStorage.clearBlockInfo(l);
|
if (BlockStorage.hasBlockInfo(l)) BlockStorage.clearBlockInfo(l);
|
||||||
@ -36,8 +34,7 @@ public class WESlimefunManager {
|
|||||||
}
|
}
|
||||||
return getExtent().setBlock(pos, block);
|
return getExtent().setBlock(pos, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user