SteamWar/FightSystem
Archiviert
13
1

Spawn items on player block destruction
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2023-05-18 20:34:01 +02:00
Ursprung 5b76af19d1
Commit 089b702910

Datei anzeigen

@ -37,6 +37,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockDispenseEvent;
import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
@ -148,6 +149,14 @@ public class Permanent implements Listener {
e.setCancelled(true);
}
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent e) {
Block block = e.getBlock();
for(ItemStack stack : block.getDrops(e.getPlayer().getItemInHand()))
Config.world.dropItemNaturally(block.getLocation(), stack);
}
@EventHandler
public void onDropPickup(PlayerPickupItemEvent e) {
if(!(Config.ArenaRegion.inRegion(e.getItem().getLocation())))