9
0
mirror of https://github.com/Xiao-MoMi/Custom-Fishing.git synced 2025-12-19 15:09:24 +00:00

Fix some issues

This commit is contained in:
XiaoMoMi
2024-08-04 16:51:41 +08:00
parent 4d3e8f7b62
commit 6731d1f668
3 changed files with 6 additions and 5 deletions

View File

@@ -241,7 +241,8 @@ public class BukkitBlockManager implements BlockManager, Listener {
} }
Location hookLocation = requireNonNull(context.arg(ContextKeys.OTHER_LOCATION)); Location hookLocation = requireNonNull(context.arg(ContextKeys.OTHER_LOCATION));
Location playerLocation = requireNonNull(context.getHolder()).getLocation(); 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( fallingBlock.getPersistentDataContainer().set(
requireNonNull(NamespacedKey.fromString("block", plugin.getBoostrap())), requireNonNull(NamespacedKey.fromString("block", plugin.getBoostrap())),
PersistentDataType.STRING, PersistentDataType.STRING,

View File

@@ -414,17 +414,17 @@ public class BukkitItemManager implements ItemManager, Listener {
@EventHandler (ignoreCancelled = true) @EventHandler (ignoreCancelled = true)
public void onBreakBlock(BlockBreakEvent event) { public void onBreakBlock(BlockBreakEvent event) {
final Block block = event.getBlock(); final Block block = event.getBlock();
if (event.getPlayer().getGameMode() == GameMode.CREATIVE)
return;
if (block.getState() instanceof Skull) { if (block.getState() instanceof Skull) {
PersistentDataContainer pdc = block.getChunk().getPersistentDataContainer(); PersistentDataContainer pdc = block.getChunk().getPersistentDataContainer();
NamespacedKey key = new NamespacedKey(plugin.getBoostrap(), LocationUtils.toChunkPosString(block.getLocation())); NamespacedKey key = new NamespacedKey(plugin.getBoostrap(), LocationUtils.toChunkPosString(block.getLocation()));
String base64 = pdc.get(key, PersistentDataType.STRING); String base64 = pdc.get(key, PersistentDataType.STRING);
if (base64 != null) { if (base64 != null) {
pdc.remove(key);
if (event.getPlayer().getGameMode() == GameMode.CREATIVE)
return;
ItemStack itemStack = ItemStackUtils.fromBase64(base64); ItemStack itemStack = ItemStackUtils.fromBase64(base64);
event.setDropItems(false); event.setDropItems(false);
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), itemStack); block.getLocation().getWorld().dropItemNaturally(block.getLocation(), itemStack);
pdc.remove(key);
} }
} }
} }

View File

@@ -1,6 +1,6 @@
# Project settings # Project settings
# Rule: [major update].[feature update].[bug fix] # Rule: [major update].[feature update].[bug fix]
project_version=2.2.14 project_version=2.2.15
config_version=35 config_version=35
project_group=net.momirealms project_group=net.momirealms