diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antistack/AntiStack.java b/Plugins/Mineplex.Core/src/mineplex/core/antistack/AntiStack.java deleted file mode 100644 index adfd31e2b..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/antistack/AntiStack.java +++ /dev/null @@ -1,138 +0,0 @@ -package mineplex.core.antistack; - -import java.util.HashSet; - -import mineplex.core.MiniPlugin; -import mineplex.core.common.util.UtilMath; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; - -import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack; -import org.bukkit.entity.Item; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.entity.ItemSpawnEvent; -import org.bukkit.event.inventory.InventoryPickupItemEvent; -import org.bukkit.event.player.PlayerPickupItemEvent; -import org.bukkit.plugin.java.JavaPlugin; - -public class AntiStack extends MiniPlugin -{ - private boolean _enabled = true; - - private HashSet _ignoreAround = new HashSet(); - - public AntiStack(JavaPlugin plugin) - { - super("AntiStack", plugin); - } - - @EventHandler(priority = EventPriority.MONITOR) - public void BlockBreak(BlockBreakEvent event) - { - if (!_enabled) - return; - - if (event.isCancelled()) - return; - - _ignoreAround.add(event.getBlock().getLocation().add(0.5, 0.5, 0.5)); - } - - @EventHandler - public void ClearIgnoreAround(UpdateEvent event) - { - if (!_enabled) - return; - - if (event.getType() != UpdateType.TICK) - return; - - _ignoreAround.clear(); - } - - @EventHandler (priority=EventPriority.HIGHEST) - public void ItemSpawn(ItemSpawnEvent event) - { - if (!_enabled) - return; - - if (event.isCancelled()) - return; - - Item item = event.getEntity(); - - for (Location loc : _ignoreAround) - if (UtilMath.offset(loc, event.getLocation()) < 2) - return; - - //ItemName() - if (item.getLocation().getY() < -10) - return; - - //Get Name - String name = ((CraftItemStack)item.getItemStack()).getHandle().getName(); - - //Append UID - name += ":" + item.getUniqueId(); - - //Set Name - ((CraftItemStack)item.getItemStack()).getHandle().c(name); - } - - @EventHandler (priority=EventPriority.HIGHEST) - public void PlayerPickup(PlayerPickupItemEvent event) - { - if (!_enabled) - return; - - if (event.isCancelled()) - return; - - Item item = event.getItem(); - - removeUID(item); - } - - @EventHandler - public void HopperPickup(InventoryPickupItemEvent event) - { - if (!_enabled) - return; - - if (event.isCancelled()) - return; - - Item item = event.getItem(); - - //Get Name - String name = ((CraftItemStack)item.getItemStack()).getHandle().getName(); - - //Remove UID - if (name.contains(":")) - name = name.substring(0, name.indexOf(":" + item.getUniqueId())); - - //Set Name - ((CraftItemStack)item.getItemStack()).getHandle().c(name); - } - - public void SetEnabled(boolean var) - { - _enabled = var; - } - - public static void removeUID(Item item) - { - //Get Name - String name = ((CraftItemStack)item.getItemStack()).getHandle().getName(); - - //Remove UID - if (name.contains(":")) - name = name.substring(0, name.indexOf(":" + item.getUniqueId())); - - //Set Name - ((CraftItemStack)item.getItemStack()).getHandle().c(name); - } -} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java index 11586d5e9..fa8e116e9 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java @@ -7,7 +7,6 @@ import mineplex.core.CustomTagFix; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; import mineplex.core.antihack.AntiHack; -import mineplex.core.antistack.AntiStack; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.chat.Chat; import mineplex.core.command.CommandCenter; @@ -92,7 +91,6 @@ public class Hub extends JavaPlugin implements IRelation Creature creature = new Creature(this); NpcManager npcManager = new NpcManager(this, creature); PetManager petManager = new PetManager(this, clientManager, donationManager, creature, webServerAddress); - new AntiStack(this); PollManager pollManager = new PollManager(this, donationManager); //Main Modules diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 5d2fc3925..b6b280f65 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -158,6 +158,8 @@ public class HubManager extends MiniClientPlugin _portal = portal; _spawn = new Location(UtilWorld.getWorld("world"), 0.5, 74, 0.5); + // Disable item merging + ((CraftWorld) _spawn.getWorld()).getHandle().spigotConfig.itemMerge = 0; _textCreator = new TextManager(this); _parkour = new ParkourManager(this, donationManager, taskManager); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java index 92a5c5e06..b0371a6b1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -9,7 +9,6 @@ import net.minecraft.server.v1_7_R4.MinecraftServer; import mineplex.core.CustomTagFix; import mineplex.core.account.CoreClientManager; import mineplex.core.antihack.AntiHack; -import mineplex.core.antistack.AntiStack; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blood.Blood; import mineplex.core.command.CommandCenter; @@ -90,7 +89,6 @@ public class Arcade extends JavaPlugin PreferencesManager preferenceManager = new PreferencesManager(this, _clientManager, _donationManager); new MessageManager(this, _clientManager, preferenceManager); - AntiStack antistack = new AntiStack(this); Creature creature = new Creature(this); Spawn spawn = new Spawn(this); Teleport teleport = new Teleport(this, _clientManager, spawn); @@ -121,7 +119,7 @@ public class Arcade extends JavaPlugin cosmeticManager.setInterfaceSlot(7); //Arcade Manager - _gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, disguiseManager, creature, teleport, new Blood(this), antistack, portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, petManager, hologramManager, webServerAddress); + _gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, disguiseManager, creature, teleport, new Blood(this), portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, petManager, hologramManager, webServerAddress); new MemoryFix(this); new CustomTagFix(this, packetHandler); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index 9f4a52c42..9d961711b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -36,7 +36,6 @@ import org.bukkit.event.server.ServerListPingEvent; import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; -import mineplex.core.antistack.AntiStack; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blood.Blood; import mineplex.core.chat.Chat; @@ -117,7 +116,6 @@ import nautilus.game.arcade.shop.ArcadeShop; public class ArcadeManager extends MiniPlugin implements IRelation { // Modules - private AntiStack _antistack; private BlockRestore _blockRestore; private Blood _blood; private Chat _chat; @@ -174,7 +172,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation public ArcadeManager(Arcade plugin, ServerStatusManager serverStatusManager, GameServerConfig serverConfig, CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager, - DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, AntiStack antistack, + DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, Portal portal, PreferencesManager preferences, InventoryManager inventoryManager, PacketHandler packetHandler, CosmeticManager cosmeticManager, ProjectileManager projectileManager, PetManager petManager, HologramManager hologramManager, String webAddress) { @@ -183,8 +181,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation _serverConfig = serverConfig; // Modules - _antistack = antistack; - _blockRestore = new BlockRestore(plugin); _blood = blood; @@ -302,11 +298,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation return _achievementManager; } - public AntiStack GetAntiStack() - { - return _antistack; - } - public Blood GetBlood() { return _blood; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index c3832eae2..bab474a95 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -14,6 +14,7 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.BlockFace; +import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.Hanging; @@ -33,6 +34,7 @@ import org.bukkit.event.hanging.HangingPlaceEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerLoginEvent; +import org.bukkit.event.world.WorldLoadEvent; import org.bukkit.scoreboard.Objective; import org.bukkit.util.Vector; @@ -203,6 +205,7 @@ public abstract class Game implements Listener public boolean RepairWeapons = true; + private double _itemMergeRadius = 0; public boolean AnnounceStay = true; public boolean AnnounceJoinQuit = true; @@ -1286,8 +1289,34 @@ public abstract class Game implements Listener loc.getY() >= WorldData.MaxY || loc.getY() <= WorldData.MinY); } - - - - + + public void setItemMerge(boolean itemMerge) + { + setItemMergeRadius(itemMerge ? 3.5 : 0); + } + + public void setItemMergeRadius(double mergeRadius) + { + _itemMergeRadius = mergeRadius; + + if (WorldData.World != null) + { + ((CraftWorld) WorldData.World).getHandle().spigotConfig.itemMerge = _itemMergeRadius; + } + } + + public double getItemMergeRadius() + { + return _itemMergeRadius; + } + + @EventHandler + public void applyItemMerge(WorldLoadEvent event) + { + if (event.getWorld().getName().equals(WorldData.GetFolder())) + { + System.out.println("Setting item merge radius for game to " + _itemMergeRadius); + ((CraftWorld) event.getWorld()).getHandle().spigotConfig.itemMerge = _itemMergeRadius; + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java index b1ba4a5bc..59e6eeb5a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java @@ -57,7 +57,6 @@ import org.bukkit.scoreboard.Team; import org.bukkit.scoreboard.TeamNameTagVisibility; import org.bukkit.util.Vector; -import mineplex.core.antistack.AntiStack; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; @@ -898,8 +897,6 @@ public class MineStrike extends TeamGame if (UtilInv.contains(event.getPlayer(), Material.SHEARS, (byte)0, 1)) return; - AntiStack.removeUID(event.getItem()); - event.getPlayer().getInventory().setItem(8, event.getItem().getItemStack()); UtilPlayer.message(event.getPlayer(), F.main("Game", "You equipped Defusal Kit.")); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java index 0f90adf98..9f1719883 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java @@ -149,7 +149,8 @@ public class SurvivalGamesTeams extends TeamGame C.cAqua + "Compass finds Players during day time.", }; - Manager.GetAntiStack().SetEnabled(false); + setItemMerge(true); +// Manager.GetAntiStack().SetEnabled(false); this.GameTimeout = 9600000; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java index b7e4f87d1..ab74aa916 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java @@ -174,7 +174,8 @@ public class UHC extends TeamGame Manager.GetCreature().SetDisableCustomDrops(true); //Disable Anti-Stack - Manager.GetAntiStack().SetEnabled(false); + setItemMerge(true); +// Manager.GetAntiStack().SetEnabled(false); //Damage Settings Manager.GetDamage().SetEnabled(false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java index a7a6ce2cc..5ab646033 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java @@ -159,7 +159,7 @@ public class GameCreationManager implements Listener Manager.GetDamage().SetEnabled(true); Manager.GetExplosion().SetRegenerate(false); Manager.GetExplosion().SetTNTSpread(true); - Manager.GetAntiStack().SetEnabled(true); +// Manager.GetAntiStack().SetEnabled(true); Manager.getCosmeticManager().setHideParticles(false); HashMap pastTeams = null; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java index b1e5c7536..1f64962ad 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java @@ -23,6 +23,7 @@ import org.bukkit.Difficulty; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.WorldCreator; +import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; import org.bukkit.event.world.ChunkUnloadEvent; public class WorldData @@ -84,7 +85,7 @@ public class WorldData TimingManager.stop("WorldData loading world."); World.setDifficulty(Difficulty.HARD); - + TimingManager.start("WorldData loading WorldConfig."); //Load World Data worldData.LoadWorldConfig(); @@ -116,7 +117,7 @@ public class WorldData return File; } - protected String GetFolder() + public String GetFolder() { if (Folder == null) Folder = "Game" + Id + "_" + Host.GetName() + "_" + GetFile();