Skip to content

Commit

Permalink
add toggling teleporting to lobby option
Browse files Browse the repository at this point in the history
  • Loading branch information
Quarri6343 committed May 28, 2023
1 parent 1f4ce0d commit 0e188d5
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
11 changes: 11 additions & 0 deletions src/main/java/quarri6343/overcrafted/core/ui/AdminMenuRow3.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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());
}
}
4 changes: 2 additions & 2 deletions src/main/java/quarri6343/overcrafted/impl/OCStages.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ 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)),

/**
* ・ステージ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)),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 0e188d5

Please sign in to comment.