From 893c2b30884285b9aa1f01f645bc132519c2c260 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Thu, 11 Feb 2016 06:43:47 +1100 Subject: [PATCH] Remove bukkit classes from core --- .../com/intellectualcrafters/plot/commands/Cluster.java | 4 ---- .../com/intellectualcrafters/plot/commands/DebugExec.java | 3 +-- .../java/com/intellectualcrafters/plot/commands/Deny.java | 7 +------ .../com/intellectualcrafters/plot/commands/Remove.java | 7 +------ .../java/com/intellectualcrafters/plot/commands/Trust.java | 7 +------ .../com/intellectualcrafters/plot/commands/Undeny.java | 7 +------ .../java/com/intellectualcrafters/plot/util/EventUtil.java | 2 +- .../intellectualcrafters/plot/util/SchematicHandler.java | 5 +++-- src/main/java/com/plotsquared/bukkit/BukkitMain.java | 3 +++ .../plot => plotsquared/bukkit}/commands/DebugUUID.java | 5 ++++- .../com/plotsquared/bukkit/listeners/PlayerEvents.java | 1 + .../bukkit}/object/entity/AgeableStats.java | 2 +- .../bukkit}/object/entity/ArmorStandStats.java | 2 +- .../bukkit}/object/entity/EntityBaseStats.java | 3 +-- .../plotsquared/bukkit/object/entity/EntityWrapper.java | 4 ---- .../bukkit}/object/entity/HorseStats.java | 2 +- .../{ => bukkit}/object/schematic/StateWrapper.java | 2 +- .../java/com/plotsquared/bukkit/util/BukkitCommand.java | 2 +- .../plotsquared/bukkit/util/BukkitSchematicHandler.java | 7 ++++++- .../listeners => listener}/PlayerBlockEventType.java | 2 +- 20 files changed, 30 insertions(+), 47 deletions(-) rename src/main/java/com/{intellectualcrafters/plot => plotsquared/bukkit}/commands/DebugUUID.java (98%) rename src/main/java/com/{intellectualcrafters/plot => plotsquared/bukkit}/object/entity/AgeableStats.java (66%) rename src/main/java/com/{intellectualcrafters/plot => plotsquared/bukkit}/object/entity/ArmorStandStats.java (88%) rename src/main/java/com/{intellectualcrafters/plot => plotsquared/bukkit}/object/entity/EntityBaseStats.java (64%) rename src/main/java/com/{intellectualcrafters/plot => plotsquared/bukkit}/object/entity/HorseStats.java (73%) rename src/main/java/com/plotsquared/{ => bukkit}/object/schematic/StateWrapper.java (98%) rename src/main/java/com/plotsquared/{bukkit/listeners => listener}/PlayerBlockEventType.java (94%) diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java b/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java index 458d2aeda..272fdd474 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java @@ -41,10 +41,6 @@ import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.UUIDHandler; -//import com.plotsquared.bukkit.generator.AugmentedPopulator; -//import com.plotsquared.bukkit.generator.AugmentedPopulator; -//import com.plotsquared.bukkit.generator.BukkitPlotGenerator; -//import com.plotsquared.bukkit.generator.HybridGen; import com.plotsquared.general.commands.CommandDeclaration; @CommandDeclaration( diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java index 9df88ebb5..23420745e 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java @@ -71,7 +71,6 @@ import com.intellectualcrafters.plot.util.StringMan; import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.UUIDHandler; import com.intellectualcrafters.plot.util.WorldUtil; -import com.plotsquared.bukkit.util.BukkitHybridUtils; import com.plotsquared.general.commands.Command; import com.plotsquared.general.commands.CommandDeclaration; @@ -238,7 +237,7 @@ public class DebugExec extends SubCommand { return false; } if (HybridUtils.regions != null) { - result = ((BukkitHybridUtils) (HybridUtils.manager)).scheduleRoadUpdate(area, HybridUtils.regions, 0); + result = ((HybridUtils.manager)).scheduleRoadUpdate(area, HybridUtils.regions, 0); } else { result = HybridUtils.manager.scheduleRoadUpdate(area, 0); } diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Deny.java b/src/main/java/com/intellectualcrafters/plot/commands/Deny.java index 7c8d992f0..a05d1187d 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Deny.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Deny.java @@ -32,7 +32,6 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.UUIDHandler; import com.intellectualcrafters.plot.util.WorldUtil; -import com.plotsquared.bukkit.uuid.SQLUUIDHandler; import com.plotsquared.general.commands.Argument; import com.plotsquared.general.commands.CommandDeclaration; @@ -66,11 +65,7 @@ public class Deny extends SubCommand { uuid = UUIDHandler.getUUID(args[0], null); } if (uuid == null) { - if (UUIDHandler.implementation instanceof SQLUUIDHandler) { - MainUtil.sendMessage(plr, C.INVALID_PLAYER_WAIT, args[0]); - } else { - MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]); - } + MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]); return false; } if (plot.isOwner(uuid)) { diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Remove.java b/src/main/java/com/intellectualcrafters/plot/commands/Remove.java index c2b86bbd5..cc29578b2 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Remove.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Remove.java @@ -31,7 +31,6 @@ import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.UUIDHandler; -import com.plotsquared.bukkit.uuid.SQLUUIDHandler; import com.plotsquared.general.commands.Argument; import com.plotsquared.general.commands.CommandDeclaration; @@ -126,11 +125,7 @@ public class Remove extends SubCommand { break; } if (count == 0) { - if (UUIDHandler.implementation instanceof SQLUUIDHandler) { - MainUtil.sendMessage(plr, C.INVALID_PLAYER_WAIT, args[0]); - } else { - MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]); - } + MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]); return false; } else { MainUtil.sendMessage(plr, C.REMOVED_PLAYERS, count + ""); diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Trust.java b/src/main/java/com/intellectualcrafters/plot/commands/Trust.java index f3f06cd98..bde5a89ba 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Trust.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Trust.java @@ -31,7 +31,6 @@ import com.intellectualcrafters.plot.util.EventUtil; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.UUIDHandler; -import com.plotsquared.bukkit.uuid.SQLUUIDHandler; import com.plotsquared.general.commands.Argument; import com.plotsquared.general.commands.CommandDeclaration; @@ -71,11 +70,7 @@ public class Trust extends SubCommand { uuid = UUIDHandler.getUUID(args[0], null); } if (uuid == null) { - if (UUIDHandler.implementation instanceof SQLUUIDHandler) { - MainUtil.sendMessage(plr, C.INVALID_PLAYER_WAIT, args[0]); - } else { - MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]); - } + MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]); return false; } if (plot.isOwner(uuid)) { diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Undeny.java b/src/main/java/com/intellectualcrafters/plot/commands/Undeny.java index d9a744be6..1a7a4c820 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Undeny.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Undeny.java @@ -30,7 +30,6 @@ import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.UUIDHandler; -import com.plotsquared.bukkit.uuid.SQLUUIDHandler; import com.plotsquared.general.commands.Argument; import com.plotsquared.general.commands.CommandDeclaration; @@ -93,11 +92,7 @@ public class Undeny extends SubCommand { break; } if (count == 0) { - if (UUIDHandler.implementation instanceof SQLUUIDHandler) { - MainUtil.sendMessage(plr, C.INVALID_PLAYER_WAIT, args[0]); - } else { - MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]); - } + MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]); return false; } else { MainUtil.sendMessage(plr, C.REMOVED_PLAYERS, count + ""); diff --git a/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java b/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java index d989bab73..be930da5e 100644 --- a/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java +++ b/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java @@ -17,7 +17,7 @@ import com.intellectualcrafters.plot.object.PlotCluster; import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.Rating; -import com.plotsquared.bukkit.listeners.PlayerBlockEventType; +import com.plotsquared.listener.PlayerBlockEventType; public abstract class EventUtil { diff --git a/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java b/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java index cfc4e9921..4e244d3b8 100644 --- a/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java +++ b/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java @@ -51,7 +51,6 @@ import com.intellectualcrafters.plot.object.PlotBlock; import com.intellectualcrafters.plot.object.RegionWrapper; import com.intellectualcrafters.plot.object.RunnableVal; import com.intellectualcrafters.plot.object.schematic.PlotItem; -import com.plotsquared.object.schematic.StateWrapper; public abstract class SchematicHandler { public static SchematicHandler manager; @@ -439,7 +438,7 @@ public abstract class SchematicHandler { final short x = IntTag.class.cast(state.get("x")).getValue().shortValue(); final short y = IntTag.class.cast(state.get("y")).getValue().shortValue(); final short z = IntTag.class.cast(state.get("z")).getValue().shortValue(); - new StateWrapper(ct).restoreTag(x, y, z, schem); + manager.restoreTag(ct, x, y, z, schem); } catch (final Exception e) { e.printStackTrace(); } @@ -450,6 +449,8 @@ public abstract class SchematicHandler { return schem; } + public abstract void restoreTag(CompoundTag ct, short x, short y, short z, Schematic schem); + /** * Get a schematic * diff --git a/src/main/java/com/plotsquared/bukkit/BukkitMain.java b/src/main/java/com/plotsquared/bukkit/BukkitMain.java index 8798bce05..c918b184a 100644 --- a/src/main/java/com/plotsquared/bukkit/BukkitMain.java +++ b/src/main/java/com/plotsquared/bukkit/BukkitMain.java @@ -26,6 +26,7 @@ import org.bukkit.plugin.java.JavaPlugin; import com.intellectualcrafters.configuration.ConfigurationSection; import com.intellectualcrafters.plot.IPlotMain; import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.commands.MainCommand; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.ConfigurationNode; import com.intellectualcrafters.plot.config.Settings; @@ -56,6 +57,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler; import com.intellectualcrafters.plot.util.UUIDHandlerImplementation; import com.intellectualcrafters.plot.util.WorldUtil; import com.intellectualcrafters.plot.uuid.UUIDWrapper; +import com.plotsquared.bukkit.commands.DebugUUID; import com.plotsquared.bukkit.database.plotme.ClassicPlotMeConnector; import com.plotsquared.bukkit.database.plotme.LikePlotMeConverter; import com.plotsquared.bukkit.database.plotme.PlotMeConnector_017; @@ -174,6 +176,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain { plotCommand.setExecutor(bcmd); plotCommand.setAliases(Arrays.asList("p", "ps", "plotme", "plot")); plotCommand.setTabCompleter(bcmd); + MainCommand.getInstance().addCommand(new DebugUUID()); } @Override diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugUUID.java b/src/main/java/com/plotsquared/bukkit/commands/DebugUUID.java similarity index 98% rename from src/main/java/com/intellectualcrafters/plot/commands/DebugUUID.java rename to src/main/java/com/plotsquared/bukkit/commands/DebugUUID.java index d5117fa30..360e8f09f 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/DebugUUID.java +++ b/src/main/java/com/plotsquared/bukkit/commands/DebugUUID.java @@ -18,7 +18,7 @@ // / // You can contact us via: support@intellectualsites.com / //////////////////////////////////////////////////////////////////////////////////////////////////// -package com.intellectualcrafters.plot.commands; +package com.plotsquared.bukkit.commands; import java.io.File; import java.io.FilenameFilter; @@ -33,6 +33,9 @@ import java.util.Map.Entry; import java.util.UUID; import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.commands.CommandCategory; +import com.intellectualcrafters.plot.commands.RequiredType; +import com.intellectualcrafters.plot.commands.SubCommand; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.AbstractDB; import com.intellectualcrafters.plot.database.DBFunc; diff --git a/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java b/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java index 99537ebb2..9ba3fbcd0 100644 --- a/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java @@ -116,6 +116,7 @@ import com.plotsquared.bukkit.BukkitMain; import com.plotsquared.bukkit.object.BukkitLazyBlock; import com.plotsquared.bukkit.object.BukkitPlayer; import com.plotsquared.bukkit.util.BukkitUtil; +import com.plotsquared.listener.PlayerBlockEventType; /** * Player Events involving plots diff --git a/src/main/java/com/intellectualcrafters/plot/object/entity/AgeableStats.java b/src/main/java/com/plotsquared/bukkit/object/entity/AgeableStats.java similarity index 66% rename from src/main/java/com/intellectualcrafters/plot/object/entity/AgeableStats.java rename to src/main/java/com/plotsquared/bukkit/object/entity/AgeableStats.java index 829a201d1..068fde881 100644 --- a/src/main/java/com/intellectualcrafters/plot/object/entity/AgeableStats.java +++ b/src/main/java/com/plotsquared/bukkit/object/entity/AgeableStats.java @@ -1,4 +1,4 @@ -package com.intellectualcrafters.plot.object.entity; +package com.plotsquared.bukkit.object.entity; public class AgeableStats { public int age; diff --git a/src/main/java/com/intellectualcrafters/plot/object/entity/ArmorStandStats.java b/src/main/java/com/plotsquared/bukkit/object/entity/ArmorStandStats.java similarity index 88% rename from src/main/java/com/intellectualcrafters/plot/object/entity/ArmorStandStats.java rename to src/main/java/com/plotsquared/bukkit/object/entity/ArmorStandStats.java index 87cb4a971..0654b8509 100644 --- a/src/main/java/com/intellectualcrafters/plot/object/entity/ArmorStandStats.java +++ b/src/main/java/com/plotsquared/bukkit/object/entity/ArmorStandStats.java @@ -1,4 +1,4 @@ -package com.intellectualcrafters.plot.object.entity; +package com.plotsquared.bukkit.object.entity; public class ArmorStandStats { public float[] head = new float[3]; diff --git a/src/main/java/com/intellectualcrafters/plot/object/entity/EntityBaseStats.java b/src/main/java/com/plotsquared/bukkit/object/entity/EntityBaseStats.java similarity index 64% rename from src/main/java/com/intellectualcrafters/plot/object/entity/EntityBaseStats.java rename to src/main/java/com/plotsquared/bukkit/object/entity/EntityBaseStats.java index 27ea6090e..444a363e3 100644 --- a/src/main/java/com/intellectualcrafters/plot/object/entity/EntityBaseStats.java +++ b/src/main/java/com/plotsquared/bukkit/object/entity/EntityBaseStats.java @@ -1,6 +1,5 @@ -package com.intellectualcrafters.plot.object.entity; +package com.plotsquared.bukkit.object.entity; -import com.plotsquared.bukkit.object.entity.EntityWrapper; public class EntityBaseStats { public EntityWrapper passenger; diff --git a/src/main/java/com/plotsquared/bukkit/object/entity/EntityWrapper.java b/src/main/java/com/plotsquared/bukkit/object/entity/EntityWrapper.java index 9d1107f9d..353c7935e 100644 --- a/src/main/java/com/plotsquared/bukkit/object/entity/EntityWrapper.java +++ b/src/main/java/com/plotsquared/bukkit/object/entity/EntityWrapper.java @@ -32,10 +32,6 @@ import org.bukkit.util.EulerAngle; import org.bukkit.util.Vector; import com.intellectualcrafters.plot.PS; -import com.intellectualcrafters.plot.object.entity.AgeableStats; -import com.intellectualcrafters.plot.object.entity.ArmorStandStats; -import com.intellectualcrafters.plot.object.entity.EntityBaseStats; -import com.intellectualcrafters.plot.object.entity.HorseStats; public class EntityWrapper { public short id; diff --git a/src/main/java/com/intellectualcrafters/plot/object/entity/HorseStats.java b/src/main/java/com/plotsquared/bukkit/object/entity/HorseStats.java similarity index 73% rename from src/main/java/com/intellectualcrafters/plot/object/entity/HorseStats.java rename to src/main/java/com/plotsquared/bukkit/object/entity/HorseStats.java index 9265667f2..2c9f7b465 100644 --- a/src/main/java/com/intellectualcrafters/plot/object/entity/HorseStats.java +++ b/src/main/java/com/plotsquared/bukkit/object/entity/HorseStats.java @@ -1,4 +1,4 @@ -package com.intellectualcrafters.plot.object.entity; +package com.plotsquared.bukkit.object.entity; public class HorseStats { public double jump; diff --git a/src/main/java/com/plotsquared/object/schematic/StateWrapper.java b/src/main/java/com/plotsquared/bukkit/object/schematic/StateWrapper.java similarity index 98% rename from src/main/java/com/plotsquared/object/schematic/StateWrapper.java rename to src/main/java/com/plotsquared/bukkit/object/schematic/StateWrapper.java index 805467c36..d3a1c7cf8 100644 --- a/src/main/java/com/plotsquared/object/schematic/StateWrapper.java +++ b/src/main/java/com/plotsquared/bukkit/object/schematic/StateWrapper.java @@ -1,4 +1,4 @@ -package com.plotsquared.object.schematic; +package com.plotsquared.bukkit.object.schematic; import java.util.ArrayList; import java.util.HashMap; diff --git a/src/main/java/com/plotsquared/bukkit/util/BukkitCommand.java b/src/main/java/com/plotsquared/bukkit/util/BukkitCommand.java index 2b7a9823f..98a4037d3 100644 --- a/src/main/java/com/plotsquared/bukkit/util/BukkitCommand.java +++ b/src/main/java/com/plotsquared/bukkit/util/BukkitCommand.java @@ -12,12 +12,12 @@ import org.bukkit.command.CommandSender; import org.bukkit.command.TabCompleter; import org.bukkit.entity.Player; -import com.intellectualcrafters.plot.commands.DebugUUID; import com.intellectualcrafters.plot.commands.MainCommand; import com.intellectualcrafters.plot.object.ConsolePlayer; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.StringComparison; +import com.plotsquared.bukkit.commands.DebugUUID; import com.plotsquared.general.commands.Command; /** diff --git a/src/main/java/com/plotsquared/bukkit/util/BukkitSchematicHandler.java b/src/main/java/com/plotsquared/bukkit/util/BukkitSchematicHandler.java index 933e29613..8bfa607e8 100644 --- a/src/main/java/com/plotsquared/bukkit/util/BukkitSchematicHandler.java +++ b/src/main/java/com/plotsquared/bukkit/util/BukkitSchematicHandler.java @@ -48,7 +48,7 @@ import com.intellectualcrafters.plot.object.RunnableVal; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.SchematicHandler; import com.intellectualcrafters.plot.util.TaskManager; -import com.plotsquared.object.schematic.StateWrapper; +import com.plotsquared.bukkit.object.schematic.StateWrapper; /** * Schematic Handler @@ -327,4 +327,9 @@ public class BukkitSchematicHandler extends SchematicHandler { } }); } + + @Override + public void restoreTag(CompoundTag ct, short x, short y, short z, Schematic schem) { + new StateWrapper(ct).restoreTag(x, y, z, schem); + } } diff --git a/src/main/java/com/plotsquared/bukkit/listeners/PlayerBlockEventType.java b/src/main/java/com/plotsquared/listener/PlayerBlockEventType.java similarity index 94% rename from src/main/java/com/plotsquared/bukkit/listeners/PlayerBlockEventType.java rename to src/main/java/com/plotsquared/listener/PlayerBlockEventType.java index 52253d6b7..5f560ac83 100644 --- a/src/main/java/com/plotsquared/bukkit/listeners/PlayerBlockEventType.java +++ b/src/main/java/com/plotsquared/listener/PlayerBlockEventType.java @@ -1,4 +1,4 @@ -package com.plotsquared.bukkit.listeners; +package com.plotsquared.listener; public enum PlayerBlockEventType { // Non interactive