1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00

Implement more suggestions

This commit is contained in:
Patbox 2020-12-05 20:51:30 +01:00
parent ff634c0f5c
commit 7afb9b9791

View File

@ -41,6 +41,7 @@ import me.mrCookieSlime.Slimefun.api.Slimefun;
* *
* @author TheBusyBiscuit * @author TheBusyBiscuit
* @author Linox * @author Linox
* @author Patbox
* *
* @see BlockPlaceHandler * @see BlockPlaceHandler
* @see BlockBreakHandler * @see BlockBreakHandler
@ -59,12 +60,15 @@ public class BlockListener implements Listener {
// While this can cause ghost blocks it also prevents them from replacing grass // While this can cause ghost blocks it also prevents them from replacing grass
// or saplings etc... // or saplings etc...
Block block = e.getBlock(); Block block = e.getBlock();
if (e.getBlockReplacedState().getType().isAir()) {
SlimefunItem sfItem = BlockStorage.check(block); SlimefunItem sfItem = BlockStorage.check(block);
if (sfItem != null) { if (sfItem != null) {
if (e.getBlockReplacedState().getType().isAir()) {
for (ItemStack item : sfItem.getDrops()) { for (ItemStack item : sfItem.getDrops()) {
if (item != null && !item.getType().isAir()) { block.getWorld().dropItemNaturally(block.getLocation(), item); } if (!item.getType().isAir()) {
block.getWorld().dropItemNaturally(block.getLocation(), item);
}
} }
BlockStorage.clearBlockInfo(block); BlockStorage.clearBlockInfo(block);
} else { } else {