1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00

This should work (#4234)

This commit is contained in:
JustAHuman-xD 2024-09-06 00:37:06 -05:00 committed by GitHub
parent 2fd0f8a0d8
commit 7d4ed2b335
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -70,18 +70,18 @@ public class BlockListener implements Listener {
Block block = e.getBlock();
// Fixes #2636 - This will solve the "ghost blocks" issue
if (e.getBlockReplacedState().getType().isAir()) {
if (e.getBlockReplacedState().getType().isAir() && BlockStorage.hasBlockInfo(block) && !Slimefun.getTickerTask().isDeletedSoon(block.getLocation())) {
SlimefunItem sfItem = BlockStorage.check(block);
if (sfItem != null && !Slimefun.getTickerTask().isDeletedSoon(block.getLocation())) {
if (sfItem != null) {
for (ItemStack item : sfItem.getDrops()) {
if (item != null && !item.getType().isAir()) {
block.getWorld().dropItemNaturally(block.getLocation(), item);
}
}
}
BlockStorage.clearBlockInfo(block);
}
} else if (BlockStorage.hasBlockInfo(e.getBlock())) {
// If there is no air (e.g. grass) then don't let the block be placed
e.setCancelled(true);