Skip to content

Commit

Permalink
fix(block): SlimefunPlaceEvent is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
StarWishsama committed Apr 2, 2024
1 parent d6f1a90 commit d549937
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,18 @@ public void onBlockPlace(BlockPlaceEvent e) {
var placeEvent = new SlimefunBlockPlaceEvent(e.getPlayer(), item, e.getBlock(), sfItem);
Bukkit.getPluginManager().callEvent(placeEvent);

Slimefun.getDatabaseManager()
.getBlockDataController()
.createBlock(e.getBlock().getLocation(), sfItem.getId());
sfItem.callItemHandler(BlockPlaceHandler.class, handler -> handler.onPlayerPlace(e));
if (placeEvent.isCancelled()) {
e.setCancelled(true);
} else {
if (Slimefun.getBlockDataService().isTileEntity(e.getBlock().getType())) {
Slimefun.getBlockDataService().setBlockData(e.getBlock(), sfItem.getId());
}

Slimefun.getDatabaseManager()
.getBlockDataController()
.createBlock(e.getBlock().getLocation(), sfItem.getId());
sfItem.callItemHandler(BlockPlaceHandler.class, handler -> handler.onPlayerPlace(e));
}
}
}
}
Expand Down

0 comments on commit d549937

Please sign in to comment.