mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
Merge pull request #814 from PrzemoVi/master
WorldEdit 7.0 support, Ancient Altar fix.
This commit is contained in:
commit
c74b14140e
@ -1,17 +1,17 @@
|
||||
package me.mrCookieSlime.Slimefun.WorldEdit;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.event.extent.EditSessionEvent;
|
||||
import com.sk89q.worldedit.extent.logging.AbstractLoggingExtent;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.util.eventbus.Subscribe;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
public class WESlimefunManager {
|
||||
|
||||
@ -21,13 +21,11 @@ public class WESlimefunManager {
|
||||
|
||||
@Subscribe
|
||||
public void wrapForLogging(final EditSessionEvent event) {
|
||||
event.setExtent(new AbstractLoggingExtent(event.getExtent()) {
|
||||
|
||||
@Override
|
||||
protected void onBlockChange(Vector pos, BaseBlock b) {
|
||||
super.onBlockChange(pos, b);
|
||||
|
||||
if (b.getType() == 0) {
|
||||
|
||||
event.setExtent(new AbstractDelegateExtent(event.getExtent()) {
|
||||
|
||||
public boolean setBlock(Vector pos, BlockStateHolder block) throws WorldEditException {
|
||||
if (block.getBlockType().getLegacyId() == 0) {
|
||||
World world = Bukkit.getWorld(event.getWorld().getName());
|
||||
|
||||
if (world != null) {
|
||||
@ -35,9 +33,10 @@ public class WESlimefunManager {
|
||||
if (BlockStorage.hasBlockInfo(l)) BlockStorage.clearBlockInfo(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
return getExtent().setBlock(pos, block);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -145,12 +145,11 @@ public class AncientAltarListener implements Listener {
|
||||
|
||||
public static ItemStack fixItemStack(ItemStack itemStack, String customName) {
|
||||
ItemStack stack = itemStack.clone();
|
||||
if (customName.equals(StringUtils.formatItemName(new CustomItem(itemStack, 1), false))) {
|
||||
if (customName.equals(StringUtils.formatItemName(new ItemStack(itemStack.getType()), false))) {
|
||||
ItemMeta im = stack.getItemMeta();
|
||||
im.setDisplayName(null);
|
||||
stack.setItemMeta(im);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ItemMeta im = stack.getItemMeta();
|
||||
im.setDisplayName(customName);
|
||||
stack.setItemMeta(im);
|
||||
|
Loading…
Reference in New Issue
Block a user