From 6abeed0b02ba0aeaed9204fb4f5878fe3611d2a3 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 14 Mar 2024 17:01:56 +0100 Subject: [PATCH] Fix ShieldPrinting setting air on click on block --- .../shieldprinting/ShieldPrinting.java | 12 ++---------- .../shieldprinting/ShieldPrintingCommand.java | 19 ------------------- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/shieldprinting/ShieldPrinting.java b/BauSystem_Main/src/de/steamwar/bausystem/features/shieldprinting/ShieldPrinting.java index 1e3fd6e1..1aa4149a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/shieldprinting/ShieldPrinting.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/shieldprinting/ShieldPrinting.java @@ -20,6 +20,7 @@ package de.steamwar.bausystem.features.shieldprinting; import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.features.shieldprinting.impl.*; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.utils.BauMemberUpdateEvent; @@ -44,6 +45,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockCanBuildEvent; import org.bukkit.event.block.BlockPistonExtendEvent; import org.bukkit.event.block.BlockPistonRetractEvent; import org.bukkit.event.entity.EntityChangeBlockEvent; @@ -259,16 +261,6 @@ public class ShieldPrinting implements Listener { updateBossbars(); } - @EventHandler - public void onPlayerInteract(PlayerInteractEvent event) { - if (event.getClickedBlock() == null) return; - if (event.getItem() == null) return; - if (Region.getRegion(event.getClickedBlock().getLocation()) != region) return; - Vector vector = event.getClickedBlock().getLocation().toVector(); - if (!shieldMap.containsKey(vector)) return; - event.getClickedBlock().setType(Material.AIR); - } - @EventHandler public void onPlayerJoin(PlayerJoinEvent event) { updateBossbar(event.getPlayer()); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/shieldprinting/ShieldPrintingCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/shieldprinting/ShieldPrintingCommand.java index 20bbd8df..5bb60219 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/shieldprinting/ShieldPrintingCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/shieldprinting/ShieldPrintingCommand.java @@ -26,9 +26,7 @@ import de.steamwar.command.SWCommand; import de.steamwar.command.TypeValidator; import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerInteractEvent; import java.util.HashMap; import java.util.Map; @@ -120,21 +118,4 @@ public class ShieldPrintingCommand extends SWCommand implements Listener { return true; }; } - - @EventHandler - public void onPlayerInteract(PlayerInteractEvent event) { - if(!Permission.BUILD.hasPermission(event.getPlayer())) return; - if (event.getClickedBlock() == null) { - return; - } - Region region = Region.getRegion(event.getClickedBlock().getLocation()); - if (region.isGlobal()) { - return; - } - ShieldPrinting shieldPrinting = SHIELD_PRINTING_MAP.get(region); - if (shieldPrinting == null) { - return; - } - shieldPrinting.onPlayerInteract(event); - } }