SteamWar/BauSystem2.0
Archiviert
12
0

Fix ShieldPrinting setting air on click on block
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2024-03-14 17:01:56 +01:00
Ursprung 5a835acb80
Commit 6abeed0b02
2 geänderte Dateien mit 2 neuen und 29 gelöschten Zeilen

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.bausystem.features.shieldprinting; package de.steamwar.bausystem.features.shieldprinting;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.features.shieldprinting.impl.*; import de.steamwar.bausystem.features.shieldprinting.impl.*;
import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.utils.BauMemberUpdateEvent; import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
@ -44,6 +45,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockCanBuildEvent;
import org.bukkit.event.block.BlockPistonExtendEvent; import org.bukkit.event.block.BlockPistonExtendEvent;
import org.bukkit.event.block.BlockPistonRetractEvent; import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.EntityChangeBlockEvent;
@ -259,16 +261,6 @@ public class ShieldPrinting implements Listener {
updateBossbars(); 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 @EventHandler
public void onPlayerJoin(PlayerJoinEvent event) { public void onPlayerJoin(PlayerJoinEvent event) {
updateBossbar(event.getPlayer()); updateBossbar(event.getPlayer());

Datei anzeigen

@ -26,9 +26,7 @@ import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeValidator; import de.steamwar.command.TypeValidator;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -120,21 +118,4 @@ public class ShieldPrintingCommand extends SWCommand implements Listener {
return true; 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);
}
} }