From 064bc2c412f6e6653a3487af9179b9a9da1f14ef Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 27 Jul 2018 20:58:12 +0100 Subject: [PATCH] Remove NewInteractionsManager because it's stupid --- .../interactions/NewInteractionsManager.java | 84 ------------------- .../src/mineplex/hub/HubManager.java | 2 - .../mineplex/hub/world/HubWorldManager.java | 3 +- 3 files changed, 2 insertions(+), 87 deletions(-) delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/interactions/NewInteractionsManager.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/interactions/NewInteractionsManager.java b/Plugins/Mineplex.Core/src/mineplex/core/interactions/NewInteractionsManager.java deleted file mode 100644 index 90609b397..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/interactions/NewInteractionsManager.java +++ /dev/null @@ -1,84 +0,0 @@ -package mineplex.core.interactions; - -import mineplex.core.MiniPlugin; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.Event.Result; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.hanging.HangingBreakEvent; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.inventory.InventoryType; -import org.bukkit.event.player.PlayerArmorStandManipulateEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.inventory.Inventory; - -/** - * Manages interactions with Armor stands, paintings, and in the main hub, taking items out of chests. - */ -public class NewInteractionsManager extends MiniPlugin -{ - - public NewInteractionsManager() - { - super("Interactions Manager"); - registerEvents(this); - } - - @EventHandler - public void onInteract(PlayerArmorStandManipulateEvent event) - { - event.setCancelled(true); - } - - @EventHandler - public void onClickBrewingStand(PlayerInteractEvent event) - { - if(event.getClickedBlock() != null && event.getClickedBlock().getType() == Material.BREWING_STAND) - { - event.setCancelled(true); - event.setUseInteractedBlock(Result.DENY); - } - } - - @EventHandler - public void onPainting(HangingBreakEvent event) - { - event.setCancelled(true); - } - - @EventHandler(priority = EventPriority.HIGHEST) - public void onChestInteract(InventoryClickEvent event) - { - Player player = (Player) event.getWhoClicked(); - Inventory inventory = event.getClickedInventory(); - - if(inventory == null) - { - return; - } - - if(event.getCurrentItem() == null || event.getCurrentItem().getType() == Material.AIR) - { - return; - } - - if(inventory.getType() != InventoryType.CHEST) - { - return; - } - - if(inventory.getSize() != 27 && inventory.getSize() != 54) - { - return; - } - - if(inventory.getTitle() != null) - { - return; - } - - event.setCancelled(true); - event.setResult(Result.DENY); - } -} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 57b54369b..8263c499d 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -64,7 +64,6 @@ import mineplex.core.gadget.event.GadgetCollideEntityEvent; import mineplex.core.gadget.event.GadgetSelectLocationEvent; import mineplex.core.hologram.HologramManager; import mineplex.core.incognito.events.IncognitoHidePlayerEvent; -import mineplex.core.interactions.NewInteractionsManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.menu.MenuManager; import mineplex.core.message.PrivateMessageEvent; @@ -198,7 +197,6 @@ public class HubManager extends MiniClientPlugin implements IChatMess //new SoccerManager(this, _gadgetManager); new MenuManager(_plugin); - new NewInteractionsManager(); AntiSpamManager antiSpam = new AntiSpamManager(); antiSpam.setMessageFormatter(this); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/world/HubWorldManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/world/HubWorldManager.java index d589328da..fb013e710 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/world/HubWorldManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/world/HubWorldManager.java @@ -48,6 +48,7 @@ import org.bukkit.event.weather.WeatherChangeEvent; import org.bukkit.event.world.ChunkUnloadEvent; import org.bukkit.event.world.StructureGrowEvent; import org.bukkit.inventory.BeaconInventory; +import org.bukkit.inventory.BrewerInventory; import mineplex.core.MiniPlugin; import mineplex.core.ReflectivelyCreateMiniPlugin; @@ -425,7 +426,7 @@ public class HubWorldManager extends MiniPlugin @EventHandler public void openBeacon(InventoryOpenEvent event) { - if (event.getInventory() instanceof BeaconInventory) + if (event.getInventory() instanceof BeaconInventory || event.getInventory() instanceof BrewerInventory) { event.setCancelled(true); }