diff --git a/src/main/java/com/Acrobot/ChestShop/Listeners/TeleportFixListener.java b/src/main/java/com/Acrobot/ChestShop/Listeners/TeleportFixListener.java deleted file mode 100644 index 26c6265..0000000 --- a/src/main/java/com/Acrobot/ChestShop/Listeners/TeleportFixListener.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.Acrobot.ChestShop.Listeners; - -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerTeleportEvent; - -/** - * @author Acrobot - */ -public class TeleportFixListener implements Listener { - - @EventHandler(priority = EventPriority.MONITOR) - public static void onTeleport(PlayerTeleportEvent event) { - if (event.isCancelled()) { - return; - } - - event.getPlayer().closeInventory(); - } -} diff --git a/src/main/java/com/Acrobot/ChestShop/Plugins/LightweightChestProtection.java b/src/main/java/com/Acrobot/ChestShop/Plugins/LightweightChestProtection.java index cd612d4..8751813 100644 --- a/src/main/java/com/Acrobot/ChestShop/Plugins/LightweightChestProtection.java +++ b/src/main/java/com/Acrobot/ChestShop/Plugins/LightweightChestProtection.java @@ -8,7 +8,7 @@ import com.Acrobot.ChestShop.Events.ShopCreatedEvent; import com.Acrobot.ChestShop.Security; import com.griefcraft.lwc.LWC; import com.griefcraft.model.Protection; -import com.griefcraft.modules.limits.LimitsV2; +import com.griefcraft.scripting.event.LWCProtectionRegisterEvent; import org.bukkit.Bukkit; import org.bukkit.block.Block; import org.bukkit.block.Chest; @@ -23,11 +23,9 @@ import org.bukkit.event.Listener; */ public class LightweightChestProtection implements Listener { private LWC lwc; - private LimitsV2 limitsModule; public LightweightChestProtection() { this.lwc = LWC.getInstance(); - limitsModule = new LimitsV2(); } @EventHandler @@ -76,7 +74,7 @@ public class LightweightChestProtection implements Listener { Block block = event.getBlock(); Player player = Bukkit.getPlayerExact(event.getName()); - if (player == null || limitsModule.hasReachedLimit(player, block.getType())) { + if (player == null) { return; } @@ -93,6 +91,13 @@ public class LightweightChestProtection implements Listener { return; } + LWCProtectionRegisterEvent protectionEvent = new LWCProtectionRegisterEvent(player, block); + lwc.getModuleLoader().dispatchEvent(protectionEvent); + + if (protectionEvent.isCancelled()) { + return; + } + Protection protection = lwc.getPhysicalDatabase().registerProtection(block.getTypeId(), Protection.Type.PRIVATE, worldName, event.getName(), "", x, y, z); if (protection != null) {