From 0cad7f229ba9cd4323786ce905a0dc7265b2ece3 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Wed, 15 Jan 2020 20:38:46 -0500 Subject: [PATCH] API improvements --- .../boydti/fawe/bukkit/adapter/NMSAdapter.java | 2 +- .../bukkit/adapter/BukkitImplAdapter.java | 2 +- .../bukkit/adapter/IBukkitAdapter.java | 2 +- .../adapter/IDelegateBukkitImplAdapter.java | 4 ++-- .../bukkit/adapter/SimpleBukkitAdapter.java | 2 +- .../adapter/impl/FAWE_Spigot_v1_13_R2.java | 7 +++---- .../adapter/impl/FAWE_Spigot_v1_14_R4.java | 4 ++-- .../adapter/impl/FAWE_Spigot_v1_15_R1.java | 6 +++--- .../src/main/java/com/boydti/fawe/FaweAPI.java | 5 +++-- .../main/java/com/boydti/fawe/beta/Flood.java | 2 +- .../beta/implementation/queue/QueueHandler.java | 17 ++++++++--------- .../object/clipboard/ReadOnlyClipboard.java | 4 ++-- .../plotquared/FaweLocalBlockQueue.java | 6 +++--- .../boydti/fawe/util/EditSessionBuilder.java | 3 ++- .../main/java/com/sk89q/jnbt/ByteArrayTag.java | 4 ---- .../src/main/java/com/sk89q/jnbt/ByteTag.java | 4 ---- .../main/java/com/sk89q/jnbt/CompoundTag.java | 4 ---- .../src/main/java/com/sk89q/jnbt/DoubleTag.java | 6 +----- .../src/main/java/com/sk89q/jnbt/EndTag.java | 4 ---- .../src/main/java/com/sk89q/jnbt/FloatTag.java | 4 ---- .../main/java/com/sk89q/jnbt/IntArrayTag.java | 6 ------ .../src/main/java/com/sk89q/jnbt/IntTag.java | 4 ---- .../src/main/java/com/sk89q/jnbt/ListTag.java | 4 ---- .../main/java/com/sk89q/jnbt/LongArrayTag.java | 6 ------ .../src/main/java/com/sk89q/jnbt/LongTag.java | 6 +----- .../java/com/sk89q/jnbt/NBTOutputStream.java | 6 +++--- .../src/main/java/com/sk89q/jnbt/ShortTag.java | 4 ---- .../src/main/java/com/sk89q/jnbt/StringTag.java | 4 ---- .../src/main/java/com/sk89q/jnbt/Tag.java | 2 -- 29 files changed, 38 insertions(+), 96 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/NMSAdapter.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/NMSAdapter.java index c5c100042..c6d1102b4 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/NMSAdapter.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/NMSAdapter.java @@ -3,7 +3,7 @@ package com.boydti.fawe.bukkit.adapter; import com.sk89q.worldedit.world.block.BlockID; import java.util.function.Function; -public class NMSAdapter { +public class NMSAdapter { public static int createPalette(int[] blockToPalette, int[] paletteToBlock, int[] blocksCopy, int[] num_palette_buffer, char[] set) { int air = 0; int num_palette = 0; diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java index 1d655a6f6..8b4c0d35e 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java @@ -102,7 +102,7 @@ public interface BukkitImplAdapter extends IBukkitAdapter { * @param notifyAndLight notify and light if set * @return true if a block was likely changed */ - boolean setBlock(Location location, BlockStateHolder state, boolean notifyAndLight); + > boolean setBlock(Location location, B state, boolean notifyAndLight); /** * Notifies the simulation that the block at the given location has diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/IBukkitAdapter.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/IBukkitAdapter.java index 63a47abe9..bdb6b8048 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/IBukkitAdapter.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/IBukkitAdapter.java @@ -231,7 +231,7 @@ public interface IBukkitAdapter { * @param block The WorldEdit BlockStateHolder * @return The Bukkit BlockData */ - default BlockData adapt(BlockStateHolder block) { + default > BlockData adapt(B block) { return Bukkit.createBlockData(block.getAsString()); } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/IDelegateBukkitImplAdapter.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/IDelegateBukkitImplAdapter.java index b965046c6..6656c032f 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/IDelegateBukkitImplAdapter.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/IDelegateBukkitImplAdapter.java @@ -65,7 +65,7 @@ public interface IDelegateBukkitImplAdapter extends BukkitImplAdapter { return getParent().getBlock(location); } - default boolean setBlock(Location location, BlockStateHolder state, boolean notifyAndLight) { + default > boolean setBlock(Location location, B state, boolean notifyAndLight) { return getParent().setBlock(location, state, notifyAndLight); } @@ -227,7 +227,7 @@ public interface IDelegateBukkitImplAdapter extends BukkitImplAdapter { } @Override - default BlockData adapt(BlockStateHolder block) { + default > BlockData adapt(B block) { return getParent().adapt(block); } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/SimpleBukkitAdapter.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/SimpleBukkitAdapter.java index 55bca525c..f51ffea35 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/SimpleBukkitAdapter.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/SimpleBukkitAdapter.java @@ -26,7 +26,7 @@ public class SimpleBukkitAdapter extends CachedBukkitAdapter { * @return The Bukkit BlockData */ @Override - public BlockData adapt(BlockStateHolder block) { + public > BlockData adapt(B block) { try { checkNotNull(block); int typeId = block.getInternalBlockTypeId(); diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/FAWE_Spigot_v1_13_R2.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/FAWE_Spigot_v1_13_R2.java index 72a061991..28d7d9627 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/FAWE_Spigot_v1_13_R2.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/FAWE_Spigot_v1_13_R2.java @@ -162,7 +162,6 @@ public final class FAWE_Spigot_v1_13_R2 extends CachedBukkitAdapter implements I return IRegistry.BLOCK.get(new MinecraftKey(blockType.getNamespace(), blockType.getResource())); } - @SuppressWarnings("deprecation") @Override public BaseBlock getBlock(Location location) { checkNotNull(location); @@ -188,7 +187,7 @@ public final class FAWE_Spigot_v1_13_R2 extends CachedBukkitAdapter implements I } @Override - public boolean setBlock(Location location, BlockStateHolder state, boolean notifyAndLight) { + public > boolean setBlock(Location location, B state, boolean notifyAndLight) { return this.setBlock(location.getChunk(), location.getBlockX(), location.getBlockY(), location.getBlockZ(), state, notifyAndLight); } @@ -314,7 +313,7 @@ public final class FAWE_Spigot_v1_13_R2 extends CachedBukkitAdapter implements I } @Override - public BlockData adapt(BlockStateHolder state) { + public > BlockData adapt(B state) { try { BlockMaterial_1_13 material = (BlockMaterial_1_13) state.getMaterial(); return material.getCraftBlockData(); @@ -397,7 +396,7 @@ public final class FAWE_Spigot_v1_13_R2 extends CachedBukkitAdapter implements I public boolean regenerate(org.bukkit.World world, Region region, @Nullable Long seed, @Nullable BiomeType biome, EditSession editSession) { WorldServer originalWorld = ((CraftWorld) world).getHandle(); ChunkProviderServer provider = originalWorld.getChunkProvider(); - if (!(provider instanceof ChunkProviderServer)) { + if (provider == null) { return false; } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/FAWE_Spigot_v1_14_R4.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/FAWE_Spigot_v1_14_R4.java index b689395bb..0c1055d68 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/FAWE_Spigot_v1_14_R4.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/FAWE_Spigot_v1_14_R4.java @@ -190,7 +190,7 @@ public final class FAWE_Spigot_v1_14_R4 extends CachedBukkitAdapter implements I } @Override - public boolean setBlock(Location location, BlockStateHolder state, boolean notifyAndLight) { + public > boolean setBlock(Location location, B state, boolean notifyAndLight) { return this.setBlock(location.getChunk(), location.getBlockX(), location.getBlockY(), location.getBlockZ(), state, notifyAndLight); } @@ -316,7 +316,7 @@ public final class FAWE_Spigot_v1_14_R4 extends CachedBukkitAdapter implements I } @Override - public BlockData adapt(BlockStateHolder state) { + public > BlockData adapt(B state) { BlockMaterial_1_14 material = (BlockMaterial_1_14) state.getMaterial(); return material.getCraftBlockData(); } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/FAWE_Spigot_v1_15_R1.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/FAWE_Spigot_v1_15_R1.java index 1d5ef9242..beeec07ce 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/FAWE_Spigot_v1_15_R1.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/FAWE_Spigot_v1_15_R1.java @@ -186,11 +186,11 @@ public final class FAWE_Spigot_v1_15_R1 extends CachedBukkitAdapter implements I } @Override - public boolean setBlock(Location location, BlockStateHolder state, boolean notifyAndLight) { + public > boolean setBlock(Location location, B state, boolean notifyAndLight) { return this.setBlock(location.getChunk(), location.getBlockX(), location.getBlockY(), location.getBlockZ(), state, notifyAndLight); } - public boolean setBlock(org.bukkit.Chunk chunk, int x, int y, int z, BlockStateHolder state, boolean update) { + public > boolean setBlock(org.bukkit.Chunk chunk, int x, int y, int z, B state, boolean update) { CraftChunk craftChunk = (CraftChunk) chunk; Chunk nmsChunk = craftChunk.getHandle(); World nmsWorld = nmsChunk.getWorld(); @@ -312,7 +312,7 @@ public final class FAWE_Spigot_v1_15_R1 extends CachedBukkitAdapter implements I } @Override - public BlockData adapt(BlockStateHolder state) { + public > BlockData adapt(B state) { BlockMaterial_1_15 material = (BlockMaterial_1_15) state.getMaterial(); return material.getCraftBlockData(); } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/FaweAPI.java b/worldedit-core/src/main/java/com/boydti/fawe/FaweAPI.java index 315b30597..dfcff725f 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/FaweAPI.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/FaweAPI.java @@ -1,5 +1,6 @@ package com.boydti.fawe; +import com.boydti.fawe.beta.IQueueChunk; import com.boydti.fawe.beta.IQueueExtent; import com.boydti.fawe.config.Settings; import com.boydti.fawe.object.RegionWrapper; @@ -155,8 +156,8 @@ public class FaweAPI { * @param autoQueue If it should start dispatching before you enqueue it. * @return the queue extent */ - public static IQueueExtent createQueue(World world, boolean autoQueue) { - IQueueExtent queue = Fawe.get().getQueueHandler().getQueue(world); + public static IQueueExtent createQueue(World world, boolean autoQueue) { + IQueueExtent queue = Fawe.get().getQueueHandler().getQueue(world); if (!autoQueue) { queue.disableQueue(); } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/beta/Flood.java b/worldedit-core/src/main/java/com/boydti/fawe/beta/Flood.java index 9143a86a2..3369ca207 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/beta/Flood.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/beta/Flood.java @@ -38,7 +38,7 @@ public class Flood { public synchronized void run(World world) { QueueHandler queueHandler = Fawe.get().getQueueHandler(); - IQueueExtent fq = queueHandler.getQueue(world); + IQueueExtent fq = queueHandler.getQueue(world); while (!chunkQueues.isEmpty()) { long firstKey = chunkQueues.firstLongKey(); int x = MathMan.unpairIntX(firstKey); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/queue/QueueHandler.java b/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/queue/QueueHandler.java index 43940c9d5..343d4b484 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/queue/QueueHandler.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/queue/QueueHandler.java @@ -3,7 +3,6 @@ package com.boydti.fawe.beta.implementation.queue; import com.boydti.fawe.Fawe; import com.boydti.fawe.FaweCache; import com.boydti.fawe.beta.IBatchProcessor; -import com.boydti.fawe.beta.IChunk; import com.boydti.fawe.beta.IChunkGet; import com.boydti.fawe.beta.IChunkSet; import com.boydti.fawe.beta.IQueueChunk; @@ -46,7 +45,7 @@ public abstract class QueueHandler implements Trimable, Runnable { private ConcurrentLinkedQueue syncWhenFree = new ConcurrentLinkedQueue<>(); private Map>> chunkGetCache = new HashMap<>(); - private CleanableThreadLocal queuePool = new CleanableThreadLocal<>(QueueHandler.this::create); + private CleanableThreadLocal> queuePool = new CleanableThreadLocal<>(QueueHandler.this::create); /** * Used to calculate elapsed time in milliseconds and ensure block placement doesn't lag the * server @@ -263,16 +262,16 @@ public abstract class QueueHandler implements Trimable, Runnable { } } - public IQueueExtent create() { + public IQueueExtent create() { return new SingleThreadQueueExtent(); } - public void uncache() { + public void unCache() { queuePool.set(null); } - private IQueueExtent pool() { - IQueueExtent queue = queuePool.get(); + private IQueueExtent pool() { + IQueueExtent queue = queuePool.get(); if (queue == null) { queuePool.set(queue = queuePool.init()); } @@ -283,12 +282,12 @@ public abstract class QueueHandler implements Trimable, Runnable { public abstract void endSet(boolean parallel); - public IQueueExtent getQueue(World world) { + public IQueueExtent getQueue(World world) { return getQueue(world, null); } - public IQueueExtent getQueue(World world, IBatchProcessor processor) { - final IQueueExtent queue = pool(); + public IQueueExtent getQueue(World world, IBatchProcessor processor) { + final IQueueExtent queue = pool(); IChunkCache cacheGet = getOrCreateWorldCache(world); IChunkCache set = null; // TODO cache? queue.init(world, cacheGet, set); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/ReadOnlyClipboard.java b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/ReadOnlyClipboard.java index ac5f62274..1fe4f1ef9 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/ReadOnlyClipboard.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/ReadOnlyClipboard.java @@ -37,12 +37,12 @@ public abstract class ReadOnlyClipboard extends SimpleClipboard { } public static ReadOnlyClipboard of(Extent extent, final Region region) { - Fawe.get().getQueueHandler().uncache(); + Fawe.get().getQueueHandler().unCache(); return of(() -> extent, region); } public static ReadOnlyClipboard of(Extent extent, final Region region, boolean copyEntities, boolean copyBiomes) { - Fawe.get().getQueueHandler().uncache(); + Fawe.get().getQueueHandler().unCache(); return of(() -> extent, region, copyEntities, copyBiomes); } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/regions/general/integrations/plotquared/FaweLocalBlockQueue.java b/worldedit-core/src/main/java/com/boydti/fawe/regions/general/integrations/plotquared/FaweLocalBlockQueue.java index 5993eb9c5..ed10b172d 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/regions/general/integrations/plotquared/FaweLocalBlockQueue.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/regions/general/integrations/plotquared/FaweLocalBlockQueue.java @@ -3,6 +3,7 @@ package com.boydti.fawe.regions.general.integrations.plotquared; import com.boydti.fawe.Fawe; import com.boydti.fawe.FaweAPI; import com.boydti.fawe.FaweCache; +import com.boydti.fawe.beta.IQueueChunk; import com.boydti.fawe.beta.IQueueExtent; import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; import com.sk89q.jnbt.CompoundTag; @@ -13,12 +14,11 @@ import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.registry.LegacyMapper; // TODO FIXME public class FaweLocalBlockQueue extends LocalBlockQueue { - public final IQueueExtent IMP; + public final IQueueExtent IMP; private final World world; private BlockVector3 mutable = new MutableBlockVector3(); @@ -26,7 +26,7 @@ public class FaweLocalBlockQueue extends LocalBlockQueue { super(worldName); this.world = FaweAPI.getWorld(worldName); IMP = Fawe.get().getQueueHandler().getQueue(world); - Fawe.get().getQueueHandler().uncache(); + Fawe.get().getQueueHandler().unCache(); } @Override diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/EditSessionBuilder.java b/worldedit-core/src/main/java/com/boydti/fawe/util/EditSessionBuilder.java index c2ba56de5..cc29e7479 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/util/EditSessionBuilder.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/util/EditSessionBuilder.java @@ -6,6 +6,7 @@ import com.boydti.fawe.Fawe; import com.boydti.fawe.FaweAPI; import com.boydti.fawe.FaweCache; import com.boydti.fawe.beta.IBatchProcessor; +import com.boydti.fawe.beta.IQueueChunk; import com.boydti.fawe.beta.IQueueExtent; import com.boydti.fawe.beta.implementation.processors.LimitProcessor; import com.boydti.fawe.beta.implementation.queue.ParallelQueueExtent; @@ -323,7 +324,7 @@ public class EditSessionBuilder { this.limit = limit.copy(); if (extent == null) { - IQueueExtent queue = null; + IQueueExtent queue = null; World unwrapped = WorldWrapper.unwrap(world); boolean placeChunks = this.fastmode || this.limit.FAST_PLACEMENT; diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/ByteArrayTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/ByteArrayTag.java index 98fe8256f..38298c5a0 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/ByteArrayTag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/ByteArrayTag.java @@ -25,10 +25,6 @@ import java.util.Locale; * The {@code TAG_Byte_Array} tag. */ public final class ByteArrayTag extends Tag { - @Override - public String getTypeName() { - return "TAG_Byte_Array"; - } @Override public int getTypeCode() { diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/ByteTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/ByteTag.java index e25d97f7e..b90b1acfb 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/ByteTag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/ByteTag.java @@ -27,10 +27,6 @@ public final class ByteTag extends NumberTag { public int getTypeCode() { return NBTConstants.TYPE_BYTE; } - @Override - public String getTypeName() { - return "TAG_Byte"; - } private final byte value; diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/CompoundTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/CompoundTag.java index fa65f39c7..faa23c1df 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/CompoundTag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/CompoundTag.java @@ -32,10 +32,6 @@ import java.util.UUID; * The {@code TAG_Compound} tag. */ public class CompoundTag extends Tag { - @Override - public String getTypeName() { - return "TAG_Compound"; - } @Override public int getTypeCode() { diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/DoubleTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/DoubleTag.java index 5b0b67e00..ca27de1e7 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/DoubleTag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/DoubleTag.java @@ -21,17 +21,13 @@ package com.sk89q.jnbt; /** * The {@code TAG_Double} tag. - * + * */ public final class DoubleTag extends NumberTag { @Override public int getTypeCode() { return NBTConstants.TYPE_DOUBLE; } - @Override - public String getTypeName() { - return "TAG_Double"; - } private final double value; diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/EndTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/EndTag.java index 7731a0858..00e9d9da8 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/EndTag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/EndTag.java @@ -23,10 +23,6 @@ package com.sk89q.jnbt; * The {@code TAG_End} tag. */ public final class EndTag extends Tag { - @Override - public String getTypeName() { - return "TAG_End"; - } @Override public int getTypeCode() { diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/FloatTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/FloatTag.java index 17c400274..eaf76c620 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/FloatTag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/FloatTag.java @@ -27,10 +27,6 @@ public final class FloatTag extends NumberTag { public int getTypeCode() { return NBTConstants.TYPE_FLOAT; } - @Override - public String getTypeName() { - return "TAG_Float"; - } private final float value; diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/IntArrayTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/IntArrayTag.java index eb1f045d9..b4fa50a20 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/IntArrayTag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/IntArrayTag.java @@ -23,16 +23,10 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.util.Locale; -import java.util.Locale; - /** * The {@code TAG_Int_Array} tag. */ public final class IntArrayTag extends Tag { - @Override - public String getTypeName() { - return "TAG_Int_Array"; - } @Override public int getTypeCode() { diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/IntTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/IntTag.java index b3eb4e5c8..e1da41b01 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/IntTag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/IntTag.java @@ -27,10 +27,6 @@ public final class IntTag extends NumberTag { public int getTypeCode() { return NBTConstants.TYPE_INT; } - @Override - public String getTypeName() { - return "TAG_Int"; - } private final int value; diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/ListTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/ListTag.java index 8ad7590be..205492f8c 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/ListTag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/ListTag.java @@ -31,10 +31,6 @@ import javax.annotation.Nullable; * The {@code TAG_List} tag. */ public class ListTag extends Tag { - @Override - public String getTypeName() { - return "TAG_List"; - } @Override public int getTypeCode() { diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/LongArrayTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/LongArrayTag.java index f368f70d8..f5139cfc4 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/LongArrayTag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/LongArrayTag.java @@ -23,16 +23,10 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.util.Locale; -import java.util.Locale; - /** * The {@code TAG_Long_Array} tag. */ public class LongArrayTag extends Tag { - @Override - public String getTypeName() { - return "TAG_Long_Array"; - } @Override public int getTypeCode() { diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/LongTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/LongTag.java index 9608ef540..c3fe1cb04 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/LongTag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/LongTag.java @@ -21,17 +21,13 @@ package com.sk89q.jnbt; /** * The {@code TAG_Long} tag. - * + * */ public final class LongTag extends NumberTag { @Override public int getTypeCode() { return NBTConstants.TYPE_LONG; } - @Override - public String getTypeName() { - return "TAG_Long"; - } private final long value; diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/NBTOutputStream.java b/worldedit-core/src/main/java/com/sk89q/jnbt/NBTOutputStream.java index 15c9f2a04..99b0acdf0 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/NBTOutputStream.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/NBTOutputStream.java @@ -90,7 +90,7 @@ public final class NBTOutputStream extends OutputStream implements Closeable, Da checkNotNull(name); checkNotNull(tag); - int type = tag.getTypeCode(); + int type = NBTUtils.getTypeCode(tag.getClass()); writeNamedTagName(name, type); if (type == NBTConstants.TYPE_END) { @@ -189,7 +189,7 @@ public final class NBTOutputStream extends OutputStream implements Closeable, Da } public void writeTag(Tag tag) throws IOException { - int type = tag.getTypeCode(); + int type = NBTUtils.getTypeCode(tag.getClass()); os.writeByte(type); writeTagPayload(tag); } @@ -207,7 +207,7 @@ public final class NBTOutputStream extends OutputStream implements Closeable, Da * if an I/O error occurs. */ public void writeTagPayload(Tag tag) throws IOException { - int type = tag.getTypeCode(); + int type = NBTUtils.getTypeCode(tag.getClass()); switch (type) { case NBTConstants.TYPE_END: writeEndTagPayload((EndTag) tag); diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/ShortTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/ShortTag.java index 8b6474efc..3464254bf 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/ShortTag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/ShortTag.java @@ -27,10 +27,6 @@ public final class ShortTag extends NumberTag { public int getTypeCode() { return NBTConstants.TYPE_SHORT; } - @Override - public String getTypeName() { - return "TAG_Short"; - } private final short value; diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/StringTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/StringTag.java index b78be1699..057ac8c64 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/StringTag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/StringTag.java @@ -25,10 +25,6 @@ import static com.google.common.base.Preconditions.checkNotNull; * The {@code TAG_String} tag. */ public final class StringTag extends Tag { - @Override - public String getTypeName() { - return "TAG_String"; - } @Override public int getTypeCode() { diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/Tag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/Tag.java index 02881d9d7..adfc5147a 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/Tag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/Tag.java @@ -37,6 +37,4 @@ public abstract class Tag { public abstract int getTypeCode(); - public abstract String getTypeName(); - }