1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 11:45:51 +00:00

Merge pull request #814 from PrzemoVi/master

WorldEdit 7.0 support, Ancient Altar fix.
This commit is contained in:
TheBusyBiscuit 2018-12-29 21:02:17 +01:00 committed by GitHub
commit c74b14140e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 15 deletions

View File

@ -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);
event.setExtent(new AbstractDelegateExtent(event.getExtent()) {
if (b.getType() == 0) {
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,7 +33,8 @@ public class WESlimefunManager {
if (BlockStorage.hasBlockInfo(l)) BlockStorage.clearBlockInfo(l);
}
}
}
return getExtent().setBlock(pos, block);
}
});
}

View File

@ -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);