Skip to content

Commit

Permalink
fix: 修复两个玩家同时发射火箭复制物品的bug (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
ExpertSneeker authored Jun 7, 2024
1 parent 8e97c63 commit 6ea0694
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ private void openGUI(@Nonnull Player p, @Nonnull Block b) {
}, (player, destination) -> {
player.closeInventory();
int usedFuel = (int) Math.ceil(destination.distanceTo(currentWorld) / (DISTANCE_PER_FUEL * eff));

if (BSUtils.getStoredBoolean(b.getLocation(), "isLaunching")) {
p.sendMessage(ChatColor.RED + "火箭正在发射!");
return;
}
BSUtils.addBlockInfo(b.getLocation().getBlock(), "isLaunching", true);

p.sendMessage(ChatColor.YELLOW + "请输入你要降落的坐标 <x> <z> (例如: -123 456) 或输入其他内容取消:");
ChatUtils.awaitInput(p, s -> {
if (Util.COORD_PATTERN.matcher(s).matches()) {
Expand Down Expand Up @@ -182,6 +189,7 @@ private void openGUI(@Nonnull Player p, @Nonnull Block b) {
}
} else {
p.sendMessage(ChatColor.RED + "已取消发射");
BSUtils.addBlockInfo(b.getLocation().getBlock(), "isLaunching", false);
}
});
}).open(p);
Expand Down

0 comments on commit 6ea0694

Please sign in to comment.