SteamWar/FightSystem
Archiviert
13
1

Fix Items bugs
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2023-02-28 12:55:00 +01:00
Ursprung 1ba94af239
Commit 1890471609
3 geänderte Dateien mit 23 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -27,6 +27,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.block.*;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.inventory.InventoryMoveItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
@ -83,6 +84,10 @@ public class FreezeWorld implements Listener {
public void onBlockExplosion(BlockExplodeEvent e){
e.setCancelled(true);
}
@EventHandler
public void onBlockExplosion(ItemSpawnEvent e){
e.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOW)
public void handlePlayerInteract(PlayerInteractEvent event) {

Datei anzeigen

@ -35,6 +35,7 @@ import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.hanging.HangingBreakEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerKickEvent;
public class DenyWorldInteraction implements Listener {
@ -53,6 +54,14 @@ public class DenyWorldInteraction implements Listener {
}
}
@EventHandler
public void handleItemDrop(PlayerDropItemEvent event) {
Player player = event.getPlayer();
if(Fight.fighting(player)) {
event.setCancelled(true);
}
}
@EventHandler
public void handleHangingBreak(HangingBreakEvent event) {
if(Config.ArenaRegion.inRegion(event.getEntity().getLocation())) {

Datei anzeigen

@ -137,7 +137,7 @@ public class Permanent implements Listener {
@EventHandler
public void onDropPickup(EntityPickupItemEvent e) {
if(!(e.getEntity() instanceof Player || Config.ArenaRegion.inRegion(e.getItem().getLocation())))
if(!(e.getEntity() instanceof Player) || !(Config.ArenaRegion.inRegion(e.getItem().getLocation())))
return;
Player player = (Player) e.getEntity();
@ -159,10 +159,14 @@ public class Permanent implements Listener {
@EventHandler(priority = EventPriority.MONITOR)
public void onExplosion(EntityExplodeEvent e) {
for(Block block : e.blockList()) {
block.setType(Material.AIR);
}
e.blockList().clear();
e.blockList().removeIf(block -> {
if(block.getType() == Material.TNT) {
return false;
} else {
block.setType(Material.AIR);
return true;
}
});
}
@EventHandler