mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2025-12-28 03:19:12 +00:00
Fix some issues
This commit is contained in:
@@ -241,7 +241,8 @@ public class BukkitBlockManager implements BlockManager, Listener {
|
||||
}
|
||||
Location hookLocation = requireNonNull(context.arg(ContextKeys.OTHER_LOCATION));
|
||||
Location playerLocation = requireNonNull(context.getHolder()).getLocation();
|
||||
FallingBlock fallingBlock = hookLocation.getWorld().spawn(hookLocation, FallingBlock.class, (fb -> fb.setBlockData(blockData)));
|
||||
FallingBlock fallingBlock = hookLocation.getWorld().spawn(hookLocation, FallingBlock.class);
|
||||
fallingBlock.setBlockData(blockData);
|
||||
fallingBlock.getPersistentDataContainer().set(
|
||||
requireNonNull(NamespacedKey.fromString("block", plugin.getBoostrap())),
|
||||
PersistentDataType.STRING,
|
||||
|
||||
@@ -414,17 +414,17 @@ public class BukkitItemManager implements ItemManager, Listener {
|
||||
@EventHandler (ignoreCancelled = true)
|
||||
public void onBreakBlock(BlockBreakEvent event) {
|
||||
final Block block = event.getBlock();
|
||||
if (event.getPlayer().getGameMode() == GameMode.CREATIVE)
|
||||
return;
|
||||
if (block.getState() instanceof Skull) {
|
||||
PersistentDataContainer pdc = block.getChunk().getPersistentDataContainer();
|
||||
NamespacedKey key = new NamespacedKey(plugin.getBoostrap(), LocationUtils.toChunkPosString(block.getLocation()));
|
||||
String base64 = pdc.get(key, PersistentDataType.STRING);
|
||||
if (base64 != null) {
|
||||
pdc.remove(key);
|
||||
if (event.getPlayer().getGameMode() == GameMode.CREATIVE)
|
||||
return;
|
||||
ItemStack itemStack = ItemStackUtils.fromBase64(base64);
|
||||
event.setDropItems(false);
|
||||
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), itemStack);
|
||||
pdc.remove(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user