Archiviert
13
0

Fix IngameListener.onPlayerInteract
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed

Dieser Commit ist enthalten in:
yoyosource 2023-09-24 16:24:21 +02:00
Ursprung 23577a28fb
Commit d1e73f9d2a

Datei anzeigen

@ -33,7 +33,6 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPhysicsEvent; import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.ItemSpawnEvent;
@ -136,16 +135,14 @@ public class IngameListener extends GameStateBukkitListener {
} }
@EventHandler @EventHandler
public void onBlockPlace(BlockPlaceEvent event) { public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getBlockPlaced().getType() == Material.LEVER) { if (!event.hasItem()) return;
if (event.getItem().getType() != Material.LEVER) return;
event.setCancelled(true); event.setCancelled(true);
if (event.getBlockAgainst().getType() == Material.IRON_DOOR) { if (!event.hasBlock()) return;
event.setCancelled(false); if (event.getClickedBlock().getType() != Material.IRON_DOOR) return;
event.getBlockPlaced().breakNaturally(); event.getPlayer().getInventory().setItemInMainHand(null);
event.getBlockAgainst().breakNaturally(); event.getClickedBlock().breakNaturally();
event.getItemInHand().setType(Material.AIR);
}
}
} }
@EventHandler @EventHandler