Skip to content

Commit

Permalink
fix(CtrlX): 主线程检查权限
Browse files Browse the repository at this point in the history
  • Loading branch information
ybw0014 committed Jul 26, 2024
1 parent 284c2a5 commit 3f552c9
Showing 1 changed file with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,18 @@ private void tryBreakBlock(@Nonnull BlockMenu blockMenu) {
final UUID uuid = UUID.fromString(StorageCacheUtils.getData(blockMenu.getLocation(), OWNER_KEY));
final OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(uuid);

if (!Slimefun.getProtectionManager().hasPermission(offlinePlayer, targetBlock, Interaction.BREAK_BLOCK)) {
return;
}
Bukkit.getScheduler().runTask(Networks.getInstance(), bukkitTask -> {
if (!Slimefun.getProtectionManager().hasPermission(offlinePlayer, targetBlock, Interaction.BREAK_BLOCK)) {
return;
}

final ItemStack resultStack = new ItemStack(material, 1);
final ItemStack resultStack = new ItemStack(material, 1);

definition.getNode().getRoot().addItemStack(resultStack);
definition.getNode().getRoot().addItemStack(resultStack);

if (resultStack.getAmount() == 0) {
this.blockCache.add(targetPosition);

if (resultStack.getAmount() == 0) {
this.blockCache.add(targetPosition);
Bukkit.getScheduler().runTask(Networks.getInstance(), bukkitTask -> {
final BlockStateSnapshotResult blockState = PaperLib.getBlockState(targetBlock, true);

if (blockState.getState() instanceof InventoryHolder) {
Expand All @@ -154,8 +155,8 @@ private void tryBreakBlock(@Nonnull BlockMenu blockMenu) {
DUST_OPTIONS
);
definition.getNode().getRoot().removeRootPower(REQUIRED_POWER);
});
}
}
});
}

@Nonnull
Expand Down

0 comments on commit 3f552c9

Please sign in to comment.