From da3324584251484b35dd291975886a7513eb8345 Mon Sep 17 00:00:00 2001 From: Wyatt Childers Date: Wed, 18 May 2016 18:30:22 -0400 Subject: [PATCH] Perform some restructuring --- .../com/sk89q/worldedit/sponge/SpongeAdapter.java | 1 + .../worldedit/sponge/SpongeBiomeRegistry.java | 1 + .../com/sk89q/worldedit/sponge/SpongeEntity.java | 1 + .../sk89q/worldedit/sponge/SpongePlatform.java | 3 +++ .../com/sk89q/worldedit/sponge/SpongePlayer.java | 1 + .../com/sk89q/worldedit/sponge/SpongeWorld.java | 8 +++----- .../sk89q/worldedit/sponge/SpongeWorldEdit.java | 3 +++ .../sponge/{ => config}/SpongeConfiguration.java | 3 ++- .../worldedit/sponge/{ => nms}/IDHelper.java | 5 +++-- .../worldedit/sponge/{ => nms}/NBTConverter.java | 3 ++- .../worldedit/sponge/{ => nms}/NMSHelper.java | 5 +++-- .../sponge/{ => nms}/SpongeNMSWorld.java | 15 +++------------ .../sponge/{ => nms}/TileEntityBaseBlock.java | 3 ++- .../sponge/{ => nms}/TileEntityUtils.java | 3 ++- 14 files changed, 30 insertions(+), 25 deletions(-) rename worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/{ => config}/SpongeConfiguration.java (93%) rename worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/{ => nms}/IDHelper.java (95%) rename worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/{ => nms}/NBTConverter.java (99%) rename worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/{ => nms}/NMSHelper.java (95%) rename worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/{ => nms}/SpongeNMSWorld.java (94%) rename worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/{ => nms}/TileEntityBaseBlock.java (96%) rename worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/{ => nms}/TileEntityUtils.java (98%) diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeAdapter.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeAdapter.java index ab4bceedb..51723964f 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeAdapter.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeAdapter.java @@ -21,6 +21,7 @@ package com.sk89q.worldedit.sponge; import com.flowpowered.math.vector.Vector3d; import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.sponge.nms.SpongeNMSWorld; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.World; diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeBiomeRegistry.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeBiomeRegistry.java index d65c59f2b..837463139 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeBiomeRegistry.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeBiomeRegistry.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit.sponge; +import com.sk89q.worldedit.sponge.nms.IDHelper; import com.sk89q.worldedit.world.biome.BaseBiome; import com.sk89q.worldedit.world.biome.BiomeData; import com.sk89q.worldedit.world.registry.BiomeRegistry; diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeEntity.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeEntity.java index 5c93aeafe..b078f7fa2 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeEntity.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeEntity.java @@ -24,6 +24,7 @@ import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.metadata.EntityType; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.sponge.nms.NMSHelper; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.NullWorld; import org.spongepowered.api.world.World; diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlatform.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlatform.java index 4b006660e..b2db5060a 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlatform.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlatform.java @@ -24,6 +24,9 @@ import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.event.platform.CommandEvent; import com.sk89q.worldedit.event.platform.CommandSuggestionEvent; import com.sk89q.worldedit.extension.platform.*; +import com.sk89q.worldedit.sponge.config.SpongeConfiguration; +import com.sk89q.worldedit.sponge.nms.IDHelper; +import com.sk89q.worldedit.sponge.nms.SpongeNMSWorld; import com.sk89q.worldedit.util.command.CommandMapping; import com.sk89q.worldedit.util.command.Dispatcher; import com.sk89q.worldedit.world.World; diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java index 30b1ea0c1..64a553b68 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java @@ -29,6 +29,7 @@ import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.internal.LocalWorldAdapter; import com.sk89q.worldedit.internal.cui.CUIEvent; import com.sk89q.worldedit.session.SessionKey; +import com.sk89q.worldedit.sponge.nms.IDHelper; import com.sk89q.worldedit.util.Location; import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.item.inventory.ItemStack; diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java index 33914c626..34a3efa54 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java @@ -30,6 +30,7 @@ import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.regions.Region; +import com.sk89q.worldedit.sponge.nms.IDHelper; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.AbstractWorld; import com.sk89q.worldedit.world.biome.BaseBiome; @@ -54,7 +55,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.Random; -import java.util.logging.Logger; import static com.google.common.base.Preconditions.checkNotNull; @@ -64,8 +64,6 @@ import static com.google.common.base.Preconditions.checkNotNull; public abstract class SpongeWorld extends AbstractWorld { protected static final Random random = new Random(); - protected static final int UPDATE = 1, NOTIFY = 2, NOTIFY_CLIENT = 4; - protected static final Logger logger = Logger.getLogger(SpongeWorld.class.getCanonicalName()); private final WeakReference worldRef; @@ -74,9 +72,9 @@ public abstract class SpongeWorld extends AbstractWorld { * * @param world the world */ - SpongeWorld(World world) { + protected SpongeWorld(World world) { checkNotNull(world); - this.worldRef = new WeakReference(world); + this.worldRef = new WeakReference<>(world); } /** diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java index 1e198fa90..320c92b67 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java @@ -28,6 +28,9 @@ import com.sk89q.worldedit.event.platform.PlatformReadyEvent; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.internal.LocalWorldAdapter; +import com.sk89q.worldedit.sponge.config.SpongeConfiguration; +import com.sk89q.worldedit.sponge.nms.NMSHelper; +import com.sk89q.worldedit.sponge.nms.SpongeNMSWorld; import org.spongepowered.api.Sponge; import org.spongepowered.api.block.BlockSnapshot; import org.spongepowered.api.block.BlockType; diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeConfiguration.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/config/SpongeConfiguration.java similarity index 93% rename from worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeConfiguration.java rename to worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/config/SpongeConfiguration.java index ee8470d77..947e0750f 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeConfiguration.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/config/SpongeConfiguration.java @@ -17,8 +17,9 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.sponge; +package com.sk89q.worldedit.sponge.config; +import com.sk89q.worldedit.sponge.SpongeWorldEdit; import com.sk89q.worldedit.util.PropertiesConfiguration; import java.io.File; diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/IDHelper.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/IDHelper.java similarity index 95% rename from worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/IDHelper.java rename to worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/IDHelper.java index be717fa3d..52aa06c0c 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/IDHelper.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/IDHelper.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.sponge; +package com.sk89q.worldedit.sponge.nms; import net.minecraft.block.Block; import net.minecraft.item.Item; @@ -26,7 +26,8 @@ import org.spongepowered.api.block.BlockType; import org.spongepowered.api.item.ItemType; import org.spongepowered.api.world.biome.BiomeType; -final class IDHelper { +@Deprecated +public final class IDHelper { private IDHelper() { } diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/NBTConverter.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/NBTConverter.java similarity index 99% rename from worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/NBTConverter.java rename to worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/NBTConverter.java index a026a51cf..48e8b5da0 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/NBTConverter.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/NBTConverter.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.sponge; +package com.sk89q.worldedit.sponge.nms; import com.sk89q.jnbt.*; import net.minecraft.nbt.*; @@ -28,6 +28,7 @@ import java.util.Map.Entry; /** * Converts between JNBT and Minecraft NBT classes. */ +@Deprecated final class NBTConverter { private NBTConverter() { diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/NMSHelper.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/NMSHelper.java similarity index 95% rename from worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/NMSHelper.java rename to worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/NMSHelper.java index da8abf3e5..4917c1f68 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/NMSHelper.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/NMSHelper.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.sponge; +package com.sk89q.worldedit.sponge.nms; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.entity.BaseEntity; @@ -28,7 +28,8 @@ import org.spongepowered.api.item.inventory.ItemStack; import java.util.Map; -final class NMSHelper { +@Deprecated +public final class NMSHelper { private NMSHelper() { } diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeNMSWorld.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/SpongeNMSWorld.java similarity index 94% rename from worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeNMSWorld.java rename to worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/SpongeNMSWorld.java index ecdfc8677..4e1c38d23 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeNMSWorld.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/SpongeNMSWorld.java @@ -17,17 +17,16 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.sponge; +package com.sk89q.worldedit.sponge.nms; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.LazyBlock; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.internal.Constants; -import com.sk89q.worldedit.regions.Region; +import com.sk89q.worldedit.sponge.SpongeWorld; import com.sk89q.worldedit.util.TreeGenerator; import net.minecraft.block.*; import net.minecraft.block.state.IBlockState; @@ -37,11 +36,6 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagInt; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; -import net.minecraft.util.LongHashMap; -import net.minecraft.world.ChunkCoordIntPair; -import net.minecraft.world.chunk.Chunk; -import net.minecraft.world.chunk.IChunkProvider; -import net.minecraft.world.gen.ChunkProviderServer; import net.minecraft.world.gen.feature.*; import org.spongepowered.api.block.BlockState; import org.spongepowered.api.entity.Entity; @@ -49,13 +43,10 @@ import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; import javax.annotation.Nullable; -import java.lang.reflect.Field; -import java.util.List; -import java.util.Set; -import java.util.logging.Level; import static com.google.common.base.Preconditions.checkNotNull; +@Deprecated public class SpongeNMSWorld extends SpongeWorld { private static final IBlockState JUNGLE_LOG = Blocks.log.getDefaultState().withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.JUNGLE); diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/TileEntityBaseBlock.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/TileEntityBaseBlock.java similarity index 96% rename from worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/TileEntityBaseBlock.java rename to worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/TileEntityBaseBlock.java index 9004474b5..524d680de 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/TileEntityBaseBlock.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/TileEntityBaseBlock.java @@ -17,13 +17,14 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.sponge; +package com.sk89q.worldedit.sponge.nms; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.TileEntityBlock; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +@Deprecated public class TileEntityBaseBlock extends BaseBlock implements TileEntityBlock { public TileEntityBaseBlock(int type, int data, TileEntity tile) { diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/TileEntityUtils.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/TileEntityUtils.java similarity index 98% rename from worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/TileEntityUtils.java rename to worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/TileEntityUtils.java index 3c9f3d587..357cf53ad 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/TileEntityUtils.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/TileEntityUtils.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.sponge; +package com.sk89q.worldedit.sponge.nms; import com.sk89q.worldedit.Vector; import net.minecraft.nbt.NBTTagCompound; @@ -34,6 +34,7 @@ import static com.google.common.base.Preconditions.checkNotNull; /** * Utility methods for setting tile entities in the world. */ +@Deprecated final class TileEntityUtils { private TileEntityUtils() {