From a6493ed18a31a68c49307e6b1fa079b6ae00a959 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 23 Jun 2017 13:55:48 +1000 Subject: [PATCH] Update MapParser to 1.12, refactor out some common base utilities. --- Plugins/Mineplex.Core.Common.Base/pom.xml | 20 ++++ .../mineplex/core/common/DefaultHashMap.java | 0 .../mineplex/core/common/GenericRunnable.java | 0 .../mineplex/core/common/GsonLocation.java | 0 .../mineplex/core/common/MaterialData.java | 0 .../core/common/MinecraftVersion.java | 0 .../src/mineplex/core/common/Pair.java | 0 .../mineplex/core/common/ProcessRunner.java | 0 .../core/common/RangeShuffleIterator.java | 0 .../src/mineplex/core/common/Rank.java | 4 +- .../src/mineplex/core/common/TriConsumer.java | 0 .../core/common/currency/Currency.java | 0 .../core/common/currency/GlobalCurrency.java | 0 .../events/EntityVelocityChangeEvent.java | 0 .../common/events/PlayerMessageEvent.java | 0 .../events/PlayerRecieveBroadcastEvent.java | 0 .../common/events/ServerShutdownEvent.java | 0 .../src/mineplex/core/common/util/C.java | 0 .../mineplex/core/common/util/Callback.java | 0 .../src/mineplex/core/common/util/F.java | 0 .../core/common/util/NautArrayList.java | 0 .../core/common/util/NautHashMap.java | 2 +- .../core/common/util/UtilBlockBase.java | 38 ++++++++ .../core/common/util/UtilCollections.java | 0 .../mineplex/core/common/util/UtilEvent.java | 0 .../mineplex/core/common/util/UtilGear.java | 0 .../mineplex/core/common/util/UtilMath.java | 0 .../core/common/util/UtilPlayerBase.java | 97 +++++++++++++++++++ .../mineplex/core/common/util/UtilTime.java | 11 --- .../mineplex/core/common/util/UtilWorld.java | 24 +---- .../mineplex/core/common/util/ZipUtil.java | 0 Plugins/Mineplex.Core.Common/pom.xml | 5 + .../mineplex/core/common/util/UtilBlock.java | 25 +---- .../mineplex/core/common/util/UtilPlayer.java | 67 +------------ .../candycane/ArrowTrailCandyCane.java | 5 +- .../game/clans/world/WorldManager.java | 10 +- Plugins/Mineplex.MapParser/pom.xml | 6 +- .../src/mineplex/mapparser/MapParser.java | 12 +-- .../src/mineplex/mapparser/WorldManager.java | 5 +- .../mapparser/command/AdminCommand.java | 4 +- .../mapparser/command/BaseCommand.java | 4 +- .../mapparser/command/CopyCommand.java | 3 +- .../mapparser/command/DeleteCommand.java | 3 +- .../mapparser/command/GameTypeCommand.java | 3 +- .../mapparser/command/ListCommand.java | 6 +- .../mapparser/command/MapCommand.java | 12 +-- .../mineplex/mapparser/command/PMCommand.java | 5 +- .../mapparser/command/RenameCommand.java | 3 +- .../mapparser/command/SaveCommand.java | 7 +- .../mapparser/command/WorldsCommand.java | 2 - .../module/modules/CommandModule.java | 8 +- .../mapparser/module/modules/EventModule.java | 18 ++-- .../game/games/halloween2016/Crypt.java | 7 +- Plugins/pom.xml | 21 +++- 54 files changed, 254 insertions(+), 183 deletions(-) create mode 100644 Plugins/Mineplex.Core.Common.Base/pom.xml rename Plugins/{Mineplex.Core.Common => Mineplex.Core.Common.Base}/src/mineplex/core/common/DefaultHashMap.java (100%) rename Plugins/{Mineplex.Core.Common => Mineplex.Core.Common.Base}/src/mineplex/core/common/GenericRunnable.java (100%) rename Plugins/{Mineplex.Core.Common => Mineplex.Core.Common.Base}/src/mineplex/core/common/GsonLocation.java (100%) rename Plugins/{Mineplex.Core.Common => Mineplex.Core.Common.Base}/src/mineplex/core/common/MaterialData.java (100%) rename Plugins/{Mineplex.Core.Common => Mineplex.Core.Common.Base}/src/mineplex/core/common/MinecraftVersion.java (100%) rename Plugins/{Mineplex.Core.Common => Mineplex.Core.Common.Base}/src/mineplex/core/common/Pair.java (100%) rename Plugins/{Mineplex.Core.Common => Mineplex.Core.Common.Base}/src/mineplex/core/common/ProcessRunner.java (100%) rename Plugins/{Mineplex.Core.Common => Mineplex.Core.Common.Base}/src/mineplex/core/common/RangeShuffleIterator.java (100%) rename Plugins/{Mineplex.Core.Common => Mineplex.Core.Common.Base}/src/mineplex/core/common/Rank.java (98%) rename Plugins/{Mineplex.Core.Common => Mineplex.Core.Common.Base}/src/mineplex/core/common/TriConsumer.java (100%) rename Plugins/{Mineplex.Core.Common => Mineplex.Core.Common.Base}/src/mineplex/core/common/currency/Currency.java (100%) rename Plugins/{Mineplex.Core.Common => Mineplex.Core.Common.Base}/src/mineplex/core/common/currency/GlobalCurrency.java (100%) rename Plugins/{Mineplex.Core.Common => Mineplex.Core.Common.Base}/src/mineplex/core/common/events/EntityVelocityChangeEvent.java (100%) rename Plugins/{Mineplex.Core.Common => Mineplex.Core.Common.Base}/src/mineplex/core/common/events/PlayerMessageEvent.java (100%) rename Plugins/{Mineplex.Core.Common => Mineplex.Core.Common.Base}/src/mineplex/core/common/events/PlayerRecieveBroadcastEvent.java (100%) rename Plugins/{Mineplex.Core.Common => Mineplex.Core.Common.Base}/src/mineplex/core/common/events/ServerShutdownEvent.java (100%) rename Plugins/{Mineplex.Core.Common => Mineplex.Core.Common.Base}/src/mineplex/core/common/util/C.java (100%) rename Plugins/{Mineplex.Core.Common => Mineplex.Core.Common.Base}/src/mineplex/core/common/util/Callback.java (100%) rename Plugins/{Mineplex.Core.Common => Mineplex.Core.Common.Base}/src/mineplex/core/common/util/F.java (100%) rename Plugins/{Mineplex.Core.Common => Mineplex.Core.Common.Base}/src/mineplex/core/common/util/NautArrayList.java (100%) rename Plugins/{Mineplex.Core.Common => Mineplex.Core.Common.Base}/src/mineplex/core/common/util/NautHashMap.java (97%) create mode 100644 Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilBlockBase.java rename Plugins/{Mineplex.Core.Common => Mineplex.Core.Common.Base}/src/mineplex/core/common/util/UtilCollections.java (100%) rename Plugins/{Mineplex.Core.Common => Mineplex.Core.Common.Base}/src/mineplex/core/common/util/UtilEvent.java (100%) rename Plugins/{Mineplex.Core.Common => Mineplex.Core.Common.Base}/src/mineplex/core/common/util/UtilGear.java (100%) rename Plugins/{Mineplex.Core.Common => Mineplex.Core.Common.Base}/src/mineplex/core/common/util/UtilMath.java (100%) create mode 100644 Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilPlayerBase.java rename Plugins/{Mineplex.Core.Common => Mineplex.Core.Common.Base}/src/mineplex/core/common/util/UtilTime.java (96%) rename Plugins/{Mineplex.Core.Common => Mineplex.Core.Common.Base}/src/mineplex/core/common/util/UtilWorld.java (88%) rename Plugins/{Mineplex.Core.Common => Mineplex.Core.Common.Base}/src/mineplex/core/common/util/ZipUtil.java (100%) diff --git a/Plugins/Mineplex.Core.Common.Base/pom.xml b/Plugins/Mineplex.Core.Common.Base/pom.xml new file mode 100644 index 000000000..e3697fb8a --- /dev/null +++ b/Plugins/Mineplex.Core.Common.Base/pom.xml @@ -0,0 +1,20 @@ + + + 4.0.0 + + + com.mineplex + mineplex-parent + dev-SNAPSHOT + + + mineplex-core-common-base + + + + org.spigotmc + spigot-api + + + diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/DefaultHashMap.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/DefaultHashMap.java similarity index 100% rename from Plugins/Mineplex.Core.Common/src/mineplex/core/common/DefaultHashMap.java rename to Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/DefaultHashMap.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/GenericRunnable.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/GenericRunnable.java similarity index 100% rename from Plugins/Mineplex.Core.Common/src/mineplex/core/common/GenericRunnable.java rename to Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/GenericRunnable.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/GsonLocation.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/GsonLocation.java similarity index 100% rename from Plugins/Mineplex.Core.Common/src/mineplex/core/common/GsonLocation.java rename to Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/GsonLocation.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/MaterialData.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/MaterialData.java similarity index 100% rename from Plugins/Mineplex.Core.Common/src/mineplex/core/common/MaterialData.java rename to Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/MaterialData.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/MinecraftVersion.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/MinecraftVersion.java similarity index 100% rename from Plugins/Mineplex.Core.Common/src/mineplex/core/common/MinecraftVersion.java rename to Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/MinecraftVersion.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Pair.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/Pair.java similarity index 100% rename from Plugins/Mineplex.Core.Common/src/mineplex/core/common/Pair.java rename to Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/Pair.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/ProcessRunner.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/ProcessRunner.java similarity index 100% rename from Plugins/Mineplex.Core.Common/src/mineplex/core/common/ProcessRunner.java rename to Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/ProcessRunner.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/RangeShuffleIterator.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/RangeShuffleIterator.java similarity index 100% rename from Plugins/Mineplex.Core.Common/src/mineplex/core/common/RangeShuffleIterator.java rename to Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/RangeShuffleIterator.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/Rank.java similarity index 98% rename from Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java rename to Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/Rank.java index 834c1eff4..9b2a37f9a 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java +++ b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/Rank.java @@ -6,7 +6,7 @@ import org.bukkit.entity.Player; import mineplex.core.common.util.C; import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilPlayerBase; public enum Rank { @@ -122,7 +122,7 @@ public enum Rank if (inform) { - UtilPlayer.message(player, C.mHead + "Permissions> " + + UtilPlayerBase.message(player, C.mHead + "Permissions> " + C.mBody + "This requires Permission Rank [" + C.mHead + rank.Name.toUpperCase() + C.mBody + "]."); diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/TriConsumer.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/TriConsumer.java similarity index 100% rename from Plugins/Mineplex.Core.Common/src/mineplex/core/common/TriConsumer.java rename to Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/TriConsumer.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/currency/Currency.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/currency/Currency.java similarity index 100% rename from Plugins/Mineplex.Core.Common/src/mineplex/core/common/currency/Currency.java rename to Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/currency/Currency.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/currency/GlobalCurrency.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/currency/GlobalCurrency.java similarity index 100% rename from Plugins/Mineplex.Core.Common/src/mineplex/core/common/currency/GlobalCurrency.java rename to Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/currency/GlobalCurrency.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/events/EntityVelocityChangeEvent.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/events/EntityVelocityChangeEvent.java similarity index 100% rename from Plugins/Mineplex.Core.Common/src/mineplex/core/common/events/EntityVelocityChangeEvent.java rename to Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/events/EntityVelocityChangeEvent.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/events/PlayerMessageEvent.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/events/PlayerMessageEvent.java similarity index 100% rename from Plugins/Mineplex.Core.Common/src/mineplex/core/common/events/PlayerMessageEvent.java rename to Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/events/PlayerMessageEvent.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/events/PlayerRecieveBroadcastEvent.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/events/PlayerRecieveBroadcastEvent.java similarity index 100% rename from Plugins/Mineplex.Core.Common/src/mineplex/core/common/events/PlayerRecieveBroadcastEvent.java rename to Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/events/PlayerRecieveBroadcastEvent.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/events/ServerShutdownEvent.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/events/ServerShutdownEvent.java similarity index 100% rename from Plugins/Mineplex.Core.Common/src/mineplex/core/common/events/ServerShutdownEvent.java rename to Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/events/ServerShutdownEvent.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/C.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/C.java similarity index 100% rename from Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/C.java rename to Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/C.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/Callback.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/Callback.java similarity index 100% rename from Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/Callback.java rename to Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/Callback.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/F.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/F.java similarity index 100% rename from Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/F.java rename to Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/F.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/NautArrayList.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/NautArrayList.java similarity index 100% rename from Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/NautArrayList.java rename to Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/NautArrayList.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/NautHashMap.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/NautHashMap.java similarity index 97% rename from Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/NautHashMap.java rename to Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/NautHashMap.java index 2f43abed9..41f9d442c 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/NautHashMap.java +++ b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/NautHashMap.java @@ -4,7 +4,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.Map.Entry; -import org.apache.commons.lang3.Validate; +import org.apache.commons.lang.Validate; import java.util.Set; diff --git a/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilBlockBase.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilBlockBase.java new file mode 100644 index 000000000..12c090a72 --- /dev/null +++ b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilBlockBase.java @@ -0,0 +1,38 @@ +package mineplex.core.common.util; + +import java.util.ArrayList; + +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; + +public class UtilBlockBase +{ + + public static ArrayList getSurrounding(Block block, boolean diagonals) + { + ArrayList blocks = new ArrayList(); + + if (diagonals) + { + for (int x = -1; x <= 1; x++) + for (int z = -1; z <= 1; z++) + for (int y = 1; y >= -1; y--) + { + if (x == 0 && y == 0 && z == 0) continue; + + blocks.add(block.getRelative(x, y, z)); + } + } + else + { + blocks.add(block.getRelative(BlockFace.UP)); + blocks.add(block.getRelative(BlockFace.NORTH)); + blocks.add(block.getRelative(BlockFace.SOUTH)); + blocks.add(block.getRelative(BlockFace.EAST)); + blocks.add(block.getRelative(BlockFace.WEST)); + blocks.add(block.getRelative(BlockFace.DOWN)); + } + + return blocks; + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilCollections.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilCollections.java similarity index 100% rename from Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilCollections.java rename to Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilCollections.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEvent.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilEvent.java similarity index 100% rename from Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEvent.java rename to Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilEvent.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilGear.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilGear.java similarity index 100% rename from Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilGear.java rename to Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilGear.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilMath.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilMath.java similarity index 100% rename from Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilMath.java rename to Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilMath.java diff --git a/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilPlayerBase.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilPlayerBase.java new file mode 100644 index 000000000..9b2d2b5df --- /dev/null +++ b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilPlayerBase.java @@ -0,0 +1,97 @@ +package mineplex.core.common.util; + +import java.util.LinkedList; + +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; + +import mineplex.core.common.events.PlayerMessageEvent; +import org.bukkit.Bukkit; + +public class UtilPlayerBase +{ + + public static void message(Entity client, LinkedList messageList) + { + message(client, messageList, false); + } + + public static void message(Entity client, String message) + { + message(client, message, false); + } + + public static void message(Entity client, LinkedList messageList, boolean wiki) + { + for (String curMessage : messageList) + { + message(client, curMessage, wiki); + } + } + + public static void message(Entity client, String message, boolean wiki) + { + if (client == null) + return; + + if (!(client instanceof Player)) + return; + + /* + if (wiki) + message = UtilWiki.link(message); + */ + + PlayerMessageEvent event = new PlayerMessageEvent((Player) client, message); + Bukkit.getPluginManager().callEvent(event); + + if (event.isCancelled()) + return; + + + ((Player) client).sendMessage(message); + } + + public static Player searchOnline(Player caller, String player, boolean inform) + { + LinkedList matchList = new LinkedList(); + + for (Player cur : Bukkit.getOnlinePlayers()) + { + if (cur.getName().equalsIgnoreCase(player)) + return cur; + + if (cur.getName().toLowerCase().contains(player.toLowerCase())) + matchList.add(cur); + } + + // No / Non-Unique + if (matchList.size() != 1) + { + if (!inform) + return null; + + // Inform + message(caller, + F.main("Online Player Search", "" + C.mCount + matchList.size() + C.mBody + " matches for [" + C.mElem + + player + C.mBody + "].")); + + if (matchList.size() > 0) + { + String matchString = ""; + for (Player cur : matchList) + matchString += F.elem(cur.getName()) + ", "; + if (matchString.length() > 1) + matchString = matchString.substring(0, matchString.length() - 2); + + message(caller, + F.main("Online Player Search", "" + C.mBody + "Matches [" + C.mElem + matchString + C.mBody + "].")); + } + + return null; + } + + return matchList.get(0); + } + +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTime.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilTime.java similarity index 96% rename from Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTime.java rename to Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilTime.java index 815c56f5e..712e73b3d 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTime.java +++ b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilTime.java @@ -6,8 +6,6 @@ import java.time.LocalDateTime; import java.time.ZoneId; import java.util.Calendar; -import net.minecraft.server.v1_8_R3.MinecraftServer; - public class UtilTime { public static final ZoneId CENTRAL_ZONE = ZoneId.of("America/Chicago"); // This means "CST" @@ -54,15 +52,6 @@ public class UtilTime } } - /** - * - * @return Returns the current global server tick. Is reset on server restart. Starts out negative. Counts upwards. - */ - public static int getServerTick() - { - return MinecraftServer.currentTick; - } - /** * Converts a {@link Timestamp} to a {@link LocalDateTime}. * This method will only work for timestamp's stored using {@link #CENTRAL_ZONE}, if stored using diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilWorld.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilWorld.java similarity index 88% rename from Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilWorld.java rename to Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilWorld.java index 86c6083f2..b0d4bd9bc 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilWorld.java +++ b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilWorld.java @@ -3,6 +3,7 @@ package mineplex.core.common.util; import java.util.Collection; import java.util.List; +import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.Location; import org.bukkit.World; @@ -10,19 +11,16 @@ import org.bukkit.World.Environment; import org.bukkit.WorldBorder; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.entity.Entity; import org.bukkit.util.Vector; import com.google.common.collect.Lists; -import net.minecraft.server.v1_8_R3.AxisAlignedBB; - public class UtilWorld { public static World getWorld(String world) { - return UtilServer.getServer().getWorld(world); + return Bukkit.getServer().getWorld(world); } public static boolean areChunksEqual(Location first, Location second) @@ -100,7 +98,7 @@ public class UtilWorld try { - for (World cur : UtilServer.getServer().getWorlds()) + for (World cur : Bukkit.getServer().getWorlds()) { if (cur.getName().equalsIgnoreCase(parts[0])) { @@ -154,7 +152,7 @@ public class UtilWorld try { - for (World cur : UtilServer.getServer().getWorlds()) + for (World cur : Bukkit.getServer().getWorlds()) { if (cur.getName().equalsIgnoreCase(tokens[0])) { @@ -188,7 +186,7 @@ public class UtilWorld public static World getWorldType(Environment env) { - for (World cur : UtilServer.getServer().getWorlds()) + for (World cur : Bukkit.getServer().getWorlds()) if (cur.getEnvironment() == env) return cur; @@ -305,16 +303,4 @@ public class UtilWorld return startX >= minX && startZ <= maxX && endX >= minZ && endZ <= maxZ; } - - public static double distanceSquared(Entity a, Entity b) - { - if (a.getWorld() != b.getWorld()) - throw new IllegalArgumentException("Different worlds: " + a.getWorld().getName() + " and " + b.getWorld().getName()); - net.minecraft.server.v1_8_R3.Entity entityA = ((CraftEntity) a).getHandle(); - net.minecraft.server.v1_8_R3.Entity entityB = ((CraftEntity) b).getHandle(); - double dx = entityA.locX - entityB.locX; - double dy = entityA.locY - entityB.locY; - double dz = entityA.locZ - entityB.locZ; - return (dx * dx) + (dy * dy) + (dz * dz); - } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/ZipUtil.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/ZipUtil.java similarity index 100% rename from Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/ZipUtil.java rename to Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/ZipUtil.java diff --git a/Plugins/Mineplex.Core.Common/pom.xml b/Plugins/Mineplex.Core.Common/pom.xml index 65ec63dd8..99340a056 100644 --- a/Plugins/Mineplex.Core.Common/pom.xml +++ b/Plugins/Mineplex.Core.Common/pom.xml @@ -20,6 +20,11 @@ org.apache.httpcomponents httpclient + + ${project.groupId} + mineplex-core-common-base + ${project.version} + com.mineplex mineplex-serverdata diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java index acfa65274..4370f1a2a 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java @@ -615,30 +615,7 @@ public class UtilBlock public static ArrayList getSurrounding(Block block, boolean diagonals) { - ArrayList blocks = new ArrayList(); - - if (diagonals) - { - for (int x = -1; x <= 1; x++) - for (int z = -1; z <= 1; z++) - for (int y = 1; y >= -1; y--) - { - if (x == 0 && y == 0 && z == 0) continue; - - blocks.add(block.getRelative(x, y, z)); - } - } - else - { - blocks.add(block.getRelative(BlockFace.UP)); - blocks.add(block.getRelative(BlockFace.NORTH)); - blocks.add(block.getRelative(BlockFace.SOUTH)); - blocks.add(block.getRelative(BlockFace.EAST)); - blocks.add(block.getRelative(BlockFace.WEST)); - blocks.add(block.getRelative(BlockFace.DOWN)); - } - - return blocks; + return UtilBlockBase.getSurrounding(block, diagonals); } public static boolean isVisible(Block block) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java index 0bb9502f6..2ddd54f42 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java @@ -348,42 +348,22 @@ public class UtilPlayer public static void message(Entity client, LinkedList messageList) { - message(client, messageList, false); + UtilPlayerBase.message(client, messageList); } public static void message(Entity client, String message) { - message(client, message, false); + UtilPlayerBase.message(client, message); } public static void message(Entity client, LinkedList messageList, boolean wiki) { - for (String curMessage : messageList) - { - message(client, curMessage, wiki); - } + UtilPlayerBase.message(client, messageList, wiki); } public static void message(Entity client, String message, boolean wiki) { - if (client == null) - return; - - if (!(client instanceof Player)) - return; - - /* - if (wiki) - message = UtilWiki.link(message); - */ - - PlayerMessageEvent event = UtilServer.CallEvent(new PlayerMessageEvent((Player) client, message)); - - if (event.isCancelled()) - return; - - - ((Player) client).sendMessage(message); + UtilPlayerBase.message(client, message, wiki); } public static Player searchExact(String name) @@ -454,44 +434,7 @@ public class UtilPlayer public static Player searchOnline(Player caller, String player, boolean inform) { - LinkedList matchList = new LinkedList(); - - for (Player cur : UtilServer.getPlayers()) - { - if (cur.getName().equalsIgnoreCase(player)) - return cur; - - if (cur.getName().toLowerCase().contains(player.toLowerCase())) - matchList.add(cur); - } - - // No / Non-Unique - if (matchList.size() != 1) - { - if (!inform) - return null; - - // Inform - message(caller, - F.main("Online Player Search", "" + C.mCount + matchList.size() + C.mBody + " matches for [" + C.mElem - + player + C.mBody + "].")); - - if (matchList.size() > 0) - { - String matchString = ""; - for (Player cur : matchList) - matchString += F.elem(cur.getName()) + ", "; - if (matchString.length() > 1) - matchString = matchString.substring(0, matchString.length() - 2); - - message(caller, - F.main("Online Player Search", "" + C.mBody + "Matches [" + C.mElem + matchString + C.mBody + "].")); - } - - return null; - } - - return matchList.get(0); + return UtilPlayerBase.searchOnline(caller, player, inform); } public static void searchOffline(List matches, final Callback callback, final Player caller, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/candycane/ArrowTrailCandyCane.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/candycane/ArrowTrailCandyCane.java index 73010a753..d45b1b023 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/candycane/ArrowTrailCandyCane.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/candycane/ArrowTrailCandyCane.java @@ -10,10 +10,11 @@ import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilText; -import mineplex.core.common.util.UtilTime; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.ArrowEffectGadget; +import net.minecraft.server.v1_8_R3.MinecraftServer; + public class ArrowTrailCandyCane extends ArrowEffectGadget { @@ -29,7 +30,7 @@ public class ArrowTrailCandyCane extends ArrowEffectGadget public void doTrail(Arrow arrow) { int data = 15; - int tick = Math.abs(UtilTime.getServerTick()%3); + int tick = Math.abs(MinecraftServer.currentTick%3); if(tick == 1) data = 1; if(tick == 2) data = 2; Location loc = arrow.getLocation(); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/world/WorldManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/world/WorldManager.java index e302d1a26..141e52cb0 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/world/WorldManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/world/WorldManager.java @@ -13,6 +13,7 @@ import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.MiniPlugin; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import org.bukkit.Location; public class WorldManager extends MiniPlugin { @@ -77,6 +78,9 @@ public class WorldManager extends MiniPlugin { List players = world.getPlayers(); Map> entities = new HashMap<>(); + // For optimization reasons reuse location objects + Location entityLocation = new Location(world, 0, 0, 0); + Location playerLocation = new Location(world, 0, 0, 0); for (Entity entity : world.getEntities()) { @@ -104,11 +108,11 @@ public class WorldManager extends MiniPlugin else if (CULL_LIMITS.containsKey(entityType)) { boolean cull = true; + entity.getLocation(entityLocation); for (Player player : players) { - // Using NMS because this is going to be called quite a few times - // and each getLocation() call creates a new Location object - if (UtilWorld.distanceSquared(player, entity) <= MIN_RANGE_SQUARED) + player.getLocation(playerLocation); + if (playerLocation.distanceSquared(entityLocation) <= MIN_RANGE_SQUARED) { cull = false; break; diff --git a/Plugins/Mineplex.MapParser/pom.xml b/Plugins/Mineplex.MapParser/pom.xml index 65a7236aa..1fd1baade 100644 --- a/Plugins/Mineplex.MapParser/pom.xml +++ b/Plugins/Mineplex.MapParser/pom.xml @@ -14,9 +14,13 @@ mineplex-mapparser + + commons-io + commons-io + ${project.groupId} - mineplex-core-common + mineplex-core-common-base ${project.version} diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java index 6fa838da5..5d62fdf65 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; @@ -23,9 +24,8 @@ import com.google.common.collect.Sets; import mineplex.core.common.util.C; import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilBlockBase; +import mineplex.core.common.util.UtilPlayerBase; import mineplex.mapparser.command.AddLoreCommand; import mineplex.mapparser.command.AddSplashTextCommand; import mineplex.mapparser.command.AdminCommand; @@ -144,7 +144,7 @@ public class MapParser extends JavaPlugin public void sendValidGameTypes(Player player) { - UtilPlayer.message(player, F.main("Parser", "Valid Game Types;")); + UtilPlayerBase.message(player, F.main("Parser", "Valid Game Types;")); String gameTypes = ""; @@ -256,7 +256,7 @@ public class MapParser extends JavaPlugin public void announce(String msg) { - for (Player player : UtilServer.getPlayers()) + for (Player player : Bukkit.getOnlinePlayers()) { player.sendMessage(C.cGold + msg); } @@ -390,7 +390,7 @@ public class MapParser extends JavaPlugin if (!blocks.add(current)) return blocks; - for (Block other : UtilBlock.getSurrounding(current, true)) + for (Block other : UtilBlockBase.getSurrounding(current, true)) { if (current.getType() != Material.LOG && current.getType() != Material.LEAVES) continue; diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/WorldManager.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/WorldManager.java index 56e3b7218..2ae2e1561 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/WorldManager.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/WorldManager.java @@ -1,6 +1,5 @@ package mineplex.mapparser; -import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.ZipUtil; import org.apache.commons.io.FileUtils; import org.bukkit.Bukkit; @@ -24,7 +23,7 @@ public class WorldManager public World prepMapParse(World world) { //Unload World - MapUtil.UnloadWorld(Host, world, true); + Host.getServer().unloadWorld(world, true); //Delete Non-Map Files String[] folders = new File(world.getName()).list(); @@ -69,7 +68,7 @@ public class WorldManager public void finalizeParsedWorld(World world) { - MapUtil.UnloadWorld(Host, world, true); + Host.getServer().unloadWorld(world, true); ArrayList fileList = new ArrayList(); ArrayList dirList = new ArrayList(); diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/AdminCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/AdminCommand.java index 962a5813a..b808c2796 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/AdminCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/AdminCommand.java @@ -4,7 +4,7 @@ import org.bukkit.World; import org.bukkit.entity.Player; import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilPlayerBase; import mineplex.mapparser.MapData; import mineplex.mapparser.MapParser; @@ -42,7 +42,7 @@ public class AdminCommand extends BaseCommand return true; } - Player other = UtilPlayer.searchOnline(player, args[0], true); + Player other = UtilPlayerBase.searchOnline(player, args[0], true); if (player != null) { diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/BaseCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/BaseCommand.java index 16552b9b0..951c0f6a4 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/BaseCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/BaseCommand.java @@ -6,7 +6,7 @@ import java.util.List; import org.bukkit.entity.Player; import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilPlayerBase; import mineplex.mapparser.MapParser; /** @@ -59,6 +59,6 @@ public abstract class BaseCommand protected void message(Player player, String message) { - UtilPlayer.message(player, F.main("Parser", message)); + UtilPlayerBase.message(player, F.main("Parser", message)); } } diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/CopyCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/CopyCommand.java index 4354a90a1..ea1b4e6ea 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/CopyCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/CopyCommand.java @@ -7,7 +7,6 @@ import org.bukkit.World; import org.bukkit.entity.Player; import mineplex.core.common.util.F; -import mineplex.core.common.util.MapUtil; import mineplex.mapparser.GameType; import mineplex.mapparser.MapParser; import org.apache.commons.io.FileUtils; @@ -73,7 +72,7 @@ public class CopyCommand extends BaseCommand other.teleport(getPlugin().getSpawnLocation()); message(other, "Unloading world for copy..."); } - MapUtil.UnloadWorld(getPlugin(), world, true); + getPlugin().getServer().unloadWorld(world, true); } File source = new File(worldName); diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/DeleteCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/DeleteCommand.java index 59b357c42..c3e1b48fd 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/DeleteCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/DeleteCommand.java @@ -6,7 +6,6 @@ import org.bukkit.World; import org.bukkit.entity.Player; import mineplex.core.common.util.F; -import mineplex.core.common.util.MapUtil; import mineplex.mapparser.GameType; import mineplex.mapparser.MapParser; import org.apache.commons.io.FileUtils; @@ -66,7 +65,7 @@ public class DeleteCommand extends BaseCommand //Unload World //Things break if this isn't set to true for saving the world - MapUtil.UnloadWorld(getPlugin(), world, true); + getPlugin().getServer().unloadWorld(world, true); } //Delete diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/GameTypeCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/GameTypeCommand.java index 4b01a03c9..5d4139b5b 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/GameTypeCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/GameTypeCommand.java @@ -6,7 +6,6 @@ import org.bukkit.World; import org.bukkit.entity.Player; import mineplex.core.common.util.F; -import mineplex.core.common.util.MapUtil; import mineplex.mapparser.GameType; import mineplex.mapparser.MapData; import mineplex.mapparser.MapParser; @@ -69,7 +68,7 @@ public class GameTypeCommand extends BaseCommand other.teleport(getPlugin().getSpawnLocation()); message(player, "Unloading world for rename..."); } - MapUtil.UnloadWorld(getPlugin(), world, true); + getPlugin().getServer().unloadWorld(world, true); File typeFolder = new File("map/" + type.GetName()); if (!typeFolder.exists()) diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ListCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ListCommand.java index 8935eb777..1edb4ad81 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ListCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ListCommand.java @@ -7,7 +7,7 @@ import org.bukkit.entity.Player; import mineplex.core.common.util.C; import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilPlayerBase; import mineplex.mapparser.GameType; import mineplex.mapparser.MapParser; @@ -28,7 +28,7 @@ public class ListCommand extends BaseCommand { if (args.length == 0) { - UtilPlayer.message(player, F.main("Parser", "Listing Maps;")); + UtilPlayerBase.message(player, F.main("Parser", "Listing Maps;")); boolean colorSwitch = false; @@ -60,7 +60,7 @@ public class ListCommand extends BaseCommand } } - UtilPlayer.message(player, F.main("Parser", "Listing Maps for gametype " + F.elem(gameType.GetName()))); + UtilPlayerBase.message(player, F.main("Parser", "Listing Maps for gametype " + F.elem(gameType.GetName()))); listMaps(player, gameType, false); } diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/MapCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/MapCommand.java index 6c504b634..56d98de06 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/MapCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/MapCommand.java @@ -1,7 +1,7 @@ package mineplex.mapparser.command; import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilPlayerBase; import mineplex.mapparser.GameType; import mineplex.mapparser.MapData; import mineplex.mapparser.MapParser; @@ -32,7 +32,7 @@ public class MapCommand extends BaseCommand { if (args.length < 1) { - //UtilPlayer.message(event.getPlayer(), F.main("Parser", "Invalid Input. " + F.elem("/map [GameType]"))); + //UtilPlayerBase.message(event.getPlayer(), F.main("Parser", "Invalid Input. " + F.elem("/map [GameType]"))); return false; } @@ -50,7 +50,7 @@ public class MapCommand extends BaseCommand { message(player, "Found more than one possible match:"); for (String s : possibleMaps) - UtilPlayer.message(player, s); + UtilPlayerBase.message(player, s); return true; } @@ -126,9 +126,9 @@ public class MapCommand extends BaseCommand MapData data = getPlugin().getData(worldName); - UtilPlayer.message(player, F.value("Map Name", data.MapName)); - UtilPlayer.message(player, F.value("Author", data.MapCreator)); - UtilPlayer.message(player, F.value("Game Type", data.MapGameType.GetName())); + UtilPlayerBase.message(player, F.value("Map Name", data.MapName)); + UtilPlayerBase.message(player, F.value("Author", data.MapCreator)); + UtilPlayerBase.message(player, F.value("Game Type", data.MapGameType.GetName())); return true; } } diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/PMCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/PMCommand.java index 86c4db4f2..f18483199 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/PMCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/PMCommand.java @@ -2,7 +2,6 @@ package mineplex.mapparser.command; import mineplex.core.common.util.C; import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilServer; import mineplex.mapparser.MapParser; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -38,14 +37,14 @@ public class PMCommand extends BaseCommand { builder.append(s).append(" "); } - for (Player ops : UtilServer.getPlayers()) + for (Player ops : getPlugin().getServer().getOnlinePlayers()) { if (!ops.isOp()) { continue; } ops.sendMessage(F.main("Message", builder.toString().trim())); - ops.playSound(ops.getLocation(), Sound.NOTE_PLING, 1.0f, 1.0f); + ops.playSound(ops.getLocation(), Sound.BLOCK_NOTE_PLING, 1.0f, 1.0f); } return true; diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/RenameCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/RenameCommand.java index 2f66500c2..dfb0cb030 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/RenameCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/RenameCommand.java @@ -6,7 +6,6 @@ import org.bukkit.World; import org.bukkit.entity.Player; import mineplex.core.common.util.F; -import mineplex.core.common.util.MapUtil; import mineplex.mapparser.MapData; import mineplex.mapparser.MapParser; @@ -56,7 +55,7 @@ public class RenameCommand extends BaseCommand other.teleport(getPlugin().getSpawnLocation()); message(other, "Unloading world for rename..."); } - MapUtil.UnloadWorld(getPlugin(), world, true); + getPlugin().getServer().unloadWorld(world, true); message(player, "World unloaded!"); diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/SaveCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/SaveCommand.java index c201f152c..46f52a35f 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/SaveCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/SaveCommand.java @@ -6,8 +6,7 @@ import org.bukkit.World; import org.bukkit.entity.Player; import mineplex.core.common.util.F; -import mineplex.core.common.util.MapUtil; -import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilPlayerBase; import mineplex.mapparser.MapParser; /** @@ -37,7 +36,7 @@ public class SaveCommand extends BaseCommand { message(player, "More than one map found:"); for (String s : possibleMaps) - UtilPlayer.message(player, s); + UtilPlayerBase.message(player, s); return true; } @@ -63,7 +62,7 @@ public class SaveCommand extends BaseCommand other.teleport(getPlugin().getSpawnLocation()); //Unload World - MapUtil.UnloadWorld(getPlugin(), world, true); + getPlugin().getServer().unloadWorld(world, true); } else { diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/WorldsCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/WorldsCommand.java index 2b9d6331c..1af45bfaa 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/WorldsCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/WorldsCommand.java @@ -3,8 +3,6 @@ package mineplex.mapparser.command; import org.bukkit.World; import org.bukkit.entity.Player; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; import mineplex.mapparser.MapParser; /** diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/module/modules/CommandModule.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/module/modules/CommandModule.java index 368b24df9..3cfe1ac73 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/module/modules/CommandModule.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/module/modules/CommandModule.java @@ -2,7 +2,7 @@ package mineplex.mapparser.module.modules; import com.google.common.collect.Maps; import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilPlayerBase; import mineplex.mapparser.MapParser; import mineplex.mapparser.command.BaseCommand; import mineplex.mapparser.module.Module; @@ -38,7 +38,7 @@ public class CommandModule extends Module if (getPlugin().getCurParse() != null) { - UtilPlayer.message(player, F.main("Parser", "Cannot use commands during Map Parse!")); + UtilPlayerBase.message(player, F.main("Parser", "Cannot use commands during Map Parse!")); return; } if (event.getMessage().toLowerCase().startsWith("/help")) @@ -83,8 +83,8 @@ public class CommandModule extends Module if (!baseCommand.execute(player, commandLabel, args)) { - UtilPlayer.message(player, F.main("Parser", "Invalid Input.")); - UtilPlayer.message(player, F.elem(baseCommand.getUsage())); + UtilPlayerBase.message(player, F.main("Parser", "Invalid Input.")); + UtilPlayerBase.message(player, F.elem(baseCommand.getUsage())); } } diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/module/modules/EventModule.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/module/modules/EventModule.java index 1595b9886..2b617a039 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/module/modules/EventModule.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/module/modules/EventModule.java @@ -27,9 +27,7 @@ import com.google.common.collect.Lists; import mineplex.core.common.util.C; import mineplex.core.common.util.F; -import mineplex.core.common.util.MapUtil; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilPlayerBase; import mineplex.mapparser.BackupTask; import mineplex.mapparser.MapData; import mineplex.mapparser.MapParser; @@ -135,7 +133,7 @@ public class EventModule extends Module if (world.getPlayers().isEmpty()) { getPlugin().announce("Saving & Closing World: " + F.elem(world.getName())); - MapUtil.UnloadWorld(getPlugin(), world, true); + getPlugin().getServer().unloadWorld(world, true); _updated.remove(world); getPlugin()._mapsBeingZipped.add(world.getName()); System.out.println("Starting backup of " + world); @@ -164,7 +162,7 @@ public class EventModule extends Module String grayName = C.cBlue + event.getPlayer().getName(); String grayWorld = C.cBlue + C.Bold + event.getPlayer().getWorld().getName(); - for (Player player : UtilServer.getPlayers()) + for (Player player : getPlugin().getServer().getOnlinePlayers()) { if (player.getWorld().equals(event.getPlayer().getWorld())) { @@ -212,7 +210,7 @@ public class EventModule extends Module event.setCancelled(true); - Player target = UtilPlayer.searchOnline(player, tokens[1], true); + Player target = UtilPlayerBase.searchOnline(player, tokens[1], true); if (target != null) { if (!target.getWorld().getName().equals("world")) @@ -224,7 +222,7 @@ public class EventModule extends Module return; } } - UtilPlayer.message(player, F.main("Game", "You teleported to " + F.name(target.getName()) + ".")); + UtilPlayerBase.message(player, F.main("Game", "You teleported to " + F.name(target.getName()) + ".")); player.teleport(target); } } @@ -246,7 +244,7 @@ public class EventModule extends Module //Permission if (!getPlugin().getData(event.getPlayer().getWorld().getName()).HasAccess(event.getPlayer())) { - UtilPlayer.message(event.getPlayer(), F.main("Parser", "You do not have Build-Access for this Map.")); + UtilPlayerBase.message(event.getPlayer(), F.main("Parser", "You do not have Build-Access for this Map.")); event.setCancelled(true); } } @@ -276,10 +274,10 @@ public class EventModule extends Module player.setFlySpeed(speed); - UtilPlayer.message(player, F.main("Game", "Fly Speed set to " + F.elem("" + speed) + ".")); + UtilPlayerBase.message(player, F.main("Game", "Fly Speed set to " + F.elem("" + speed) + ".")); } catch (Exception e) { - UtilPlayer.message(player, F.main("Game", "Invalid Speed Input.")); + UtilPlayerBase.message(player, F.main("Game", "Invalid Speed Input.")); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/Crypt.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/Crypt.java index 562bd08cc..9057da773 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/Crypt.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/Crypt.java @@ -14,7 +14,8 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextTop; -import mineplex.core.common.util.UtilTime; + +import net.minecraft.server.v1_8_R3.MinecraftServer; public class Crypt { @@ -42,10 +43,10 @@ public class Crypt { if(isDestroyed()) return false; Integer lastTime = _damageCooldown.get(mob); - if(lastTime != null && lastTime > UtilTime.getServerTick()) return false; + if(lastTime != null && lastTime > MinecraftServer.currentTick) return false; _health -= damage; - _damageCooldown.put(mob, UtilTime.getServerTick() + cooldown); + _damageCooldown.put(mob, MinecraftServer.currentTick + cooldown); updateState(damage); diff --git a/Plugins/pom.xml b/Plugins/pom.xml index bbf652166..95880e508 100644 --- a/Plugins/pom.xml +++ b/Plugins/pom.xml @@ -21,6 +21,7 @@ Mineplex.Cache Mineplex.Core Mineplex.Core.Common + Mineplex.Core.Common.Base Mineplex.Database Mineplex.DDoSProtectionSwitcher Mineplex.EnjinTranslator @@ -36,7 +37,7 @@ Mineplex.ServerData Mineplex.ServerMonitor Mineplex.StaffServer - Mineplex.Votifier + Mineplex.Votifier Nautilus.Game.Arcade Nautilus.Game.Arcade.UHC.WorldGen @@ -51,10 +52,20 @@ mineplex http://dev.mineplex.com:8081/nexus/content/groups/public/ + + spigotmc-public + https://hub.spigotmc.org/nexus/content/groups/public/ + + + commons-io + commons-io + 2.5 + compile + commons-codec commons-codec @@ -68,7 +79,7 @@ compile - com.vexsoftware + com.vexsoftware votifier 1.9 provided @@ -133,6 +144,12 @@ 3.5.2 compile + + org.spigotmc + spigot-api + 1.12-R0.1-SNAPSHOT + compile + com.mineplex spigot