From 0e188d57c82efeb40336114869a6adaa96f9ccd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=8F=E3=81=81=E3=83=BC=E3=82=8A=E3=81=83?= Date: Sun, 28 May 2023 21:51:03 +0900 Subject: [PATCH] add toggling teleporting to lobby option --- .../overcrafted/core/data/OCVariableData.java | 6 ++++++ .../quarri6343/overcrafted/core/ui/AdminMenuRow3.java | 11 +++++++++++ .../java/quarri6343/overcrafted/impl/OCStages.java | 4 ++-- .../overcrafted/impl/task/game/GameEndTask.java | 3 ++- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/main/java/quarri6343/overcrafted/core/data/OCVariableData.java b/src/main/java/quarri6343/overcrafted/core/data/OCVariableData.java index 942305f..1750196 100644 --- a/src/main/java/quarri6343/overcrafted/core/data/OCVariableData.java +++ b/src/main/java/quarri6343/overcrafted/core/data/OCVariableData.java @@ -54,4 +54,10 @@ public class OCVariableData { */ @Getter private final RangedFloat tipMultiplier = new RangedFloat(0.1f,0.1f,10); + + /** + * ゲーム終了時にプレイヤーをロビーに飛ばすかどうか + */ + @Getter @Setter + private boolean teleportPlayerWhenGameEnd = true; } \ No newline at end of file diff --git a/src/main/java/quarri6343/overcrafted/core/ui/AdminMenuRow3.java b/src/main/java/quarri6343/overcrafted/core/ui/AdminMenuRow3.java index f8973e5..fbdbccb 100644 --- a/src/main/java/quarri6343/overcrafted/core/ui/AdminMenuRow3.java +++ b/src/main/java/quarri6343/overcrafted/core/ui/AdminMenuRow3.java @@ -54,6 +54,12 @@ public static void addElements(PaginatedGui gui, Player player) { GuiItem setTipMultiplierButton = new GuiItem(setTipMultiplierItem, AdminMenuRow3::onSetTipMultiplierButton); gui.setItem(24, setTipMultiplierButton); + + ItemStack setTeleportToLobbyItem = new ItemCreator(Material.ENDER_PEARL).setName(Component.text("ゲーム終了時にプレイヤーをロビーに飛ばすかどうか")) + .setLore(Component.text("現在: " + (getData().isTeleportPlayerWhenGameEnd() ? "飛ばす" : "飛ばさない")).color(NamedTextColor.WHITE).decoration(TextDecoration.ITALIC, false)).create(); + GuiItem setTeleportToLobbyButton = new GuiItem(setTeleportToLobbyItem, + AdminMenuRow3::onSetTeleportToLobbyButton); + gui.setItem(26, setTeleportToLobbyButton); } private static void onSetCraftingTimeButton(InventoryClickEvent event) { @@ -91,4 +97,9 @@ private static void onSetTipMultiplierButton(InventoryClickEvent event) { UINumberConfiguration.openUI((Player) event.getWhoClicked(),getData().getTipMultiplier()); } + + private static void onSetTeleportToLobbyButton(InventoryClickEvent event) { + getData().setTeleportPlayerWhenGameEnd(!getData().isTeleportPlayerWhenGameEnd()); + UIAdminMenu.openUI((Player) event.getWhoClicked()); + } } diff --git a/src/main/java/quarri6343/overcrafted/impl/OCStages.java b/src/main/java/quarri6343/overcrafted/impl/OCStages.java index 419d3b1..c544f99 100644 --- a/src/main/java/quarri6343/overcrafted/impl/OCStages.java +++ b/src/main/java/quarri6343/overcrafted/impl/OCStages.java @@ -40,7 +40,7 @@ public enum OCStages { * ・ステージ3 * 皿洗いのやり方 */ - STAGE1(new OCStage("ステージ3", 420, true, + STAGE1(new OCStage("ステージ3", 300, true, Arrays.asList((ISubmittableOCItem) OCItems.DISH_IRON_INGOT.get(), (ISubmittableOCItem) OCItems.DISH_FURNACE.get()), Arrays.asList((ISupplier) OCItems.IRON_ORE.get(), (ISupplier) OCItems.COBBLESTONE.get()), null)), @@ -48,7 +48,7 @@ public enum OCStages { * ・ステージ4 * (原木->木材->棒 + 原木->木炭)->松明、鉄インゴット、かまど */ - STAGE2(new OCStage("ステージ4", 480, true, + STAGE2(new OCStage("ステージ4", 400, true, Arrays.asList((ISubmittableOCItem) OCItems.DISH_TORCH.get(), (ISubmittableOCItem) OCItems.DISH_IRON_INGOT.get(),(ISubmittableOCItem) OCItems.DISH_FURNACE.get()), Arrays.asList((ISupplier) OCItems.IRON_ORE.get(), (ISupplier) OCItems.COBBLESTONE.get(), (ISupplier) OCItems.WOOD.get()), null)), diff --git a/src/main/java/quarri6343/overcrafted/impl/task/game/GameEndTask.java b/src/main/java/quarri6343/overcrafted/impl/task/game/GameEndTask.java index 34dca7b..1f6590c 100644 --- a/src/main/java/quarri6343/overcrafted/impl/task/game/GameEndTask.java +++ b/src/main/java/quarri6343/overcrafted/impl/task/game/GameEndTask.java @@ -25,7 +25,8 @@ public GameEndTask(Runnable additionalAction, boolean isScheduled) { @Override public void run() { - getData().getTeams().teleportTeamToLobby(); + if(getData().isTeleportPlayerWhenGameEnd()) + getData().getTeams().teleportTeamToLobby(); getData().getTeams().clearDishPile(getData().getSelectedStage().ordinal()); if(ScoreBoardHandler.getHighestScore() > getData().getSelectedStage().get().getHighScore()) getData().getSelectedStage().get().setHighScore(ScoreBoardHandler.getHighestScore());