From 63eb5d65729e556f2fc537af3ef5f4d8ff831919 Mon Sep 17 00:00:00 2001 From: YuTian <2953516620@qq.com> Date: Tue, 13 Aug 2024 11:21:39 +0800 Subject: [PATCH] 1.1 --- .../yutian/thewardungeon/TheWarDungeon.java | 1 - .../dungeon/DungeonInstance.java | 13 +++++++++++ .../dungeon/config/DungeonOption.java | 7 ------ .../thewardungeon/gui/DungeonRoomGui.java | 1 - .../script/list/SetTotalCountdownScript.java | 22 +++++++++++++++++++ src/main/resources/template/config.yml | 1 + 6 files changed, 36 insertions(+), 9 deletions(-) create mode 100644 src/main/java/com/io/yutian/thewardungeon/script/list/SetTotalCountdownScript.java diff --git a/src/main/java/com/io/yutian/thewardungeon/TheWarDungeon.java b/src/main/java/com/io/yutian/thewardungeon/TheWarDungeon.java index d2e91c0..2c38f95 100644 --- a/src/main/java/com/io/yutian/thewardungeon/TheWarDungeon.java +++ b/src/main/java/com/io/yutian/thewardungeon/TheWarDungeon.java @@ -15,7 +15,6 @@ import com.io.yutian.thewardungeon.papi.DungeonPAPI; import com.io.yutian.thewarskyblocklib.gui.GuiListener; import com.io.yutian.thewarskyblocklib.manager.CommandManager; import com.io.yutian.thewarskyblocklib.util.FileUtil; -import me.clip.placeholderapi.PlaceholderAPI; import org.bukkit.Bukkit; import org.bukkit.plugin.java.JavaPlugin; diff --git a/src/main/java/com/io/yutian/thewardungeon/dungeon/DungeonInstance.java b/src/main/java/com/io/yutian/thewardungeon/dungeon/DungeonInstance.java index ded99b4..48cfe8c 100644 --- a/src/main/java/com/io/yutian/thewardungeon/dungeon/DungeonInstance.java +++ b/src/main/java/com/io/yutian/thewardungeon/dungeon/DungeonInstance.java @@ -53,6 +53,7 @@ public class DungeonInstance { private int time; + protected int totalCountdown = -1; protected int countdown = -1; private List activeMobs = new ArrayList<>(); @@ -415,4 +416,16 @@ public class DungeonInstance { return Objects.hash(uuid); } + public int getTotalCountdown() { + return totalCountdown; + } + + public void setTotalCountdown(int totalCountdown) { + this.totalCountdown = totalCountdown; + } + + public void setCountdown(int countdown) { + this.countdown = countdown; + } + } diff --git a/src/main/java/com/io/yutian/thewardungeon/dungeon/config/DungeonOption.java b/src/main/java/com/io/yutian/thewardungeon/dungeon/config/DungeonOption.java index c18ed31..029615b 100644 --- a/src/main/java/com/io/yutian/thewardungeon/dungeon/config/DungeonOption.java +++ b/src/main/java/com/io/yutian/thewardungeon/dungeon/config/DungeonOption.java @@ -12,8 +12,6 @@ public class DungeonOption { private int lobbyWaitTime; - private int countdown; - private GameMode gameMode; private boolean revive; @@ -33,7 +31,6 @@ public class DungeonOption { min = configurationSection.getInt("min", 1); max = configurationSection.getInt("max", 8); lobbyWaitTime = configurationSection.getInt("lobbyWaitTime", 60); - countdown = configurationSection.getInt("countdown", -1); gameMode = GameMode.valueOf(configurationSection.getString("gamemode", GameMode.ADVENTURE.toString())); revive = configurationSection.getBoolean("revive", true); reviveAmount = configurationSection.getInt("reviveAmount", -1); @@ -55,10 +52,6 @@ public class DungeonOption { return max; } - public int getCountdown() { - return countdown; - } - public int getLobbyWaitTime() { return lobbyWaitTime; } diff --git a/src/main/java/com/io/yutian/thewardungeon/gui/DungeonRoomGui.java b/src/main/java/com/io/yutian/thewardungeon/gui/DungeonRoomGui.java index 5ace51b..021d445 100644 --- a/src/main/java/com/io/yutian/thewardungeon/gui/DungeonRoomGui.java +++ b/src/main/java/com/io/yutian/thewardungeon/gui/DungeonRoomGui.java @@ -2,7 +2,6 @@ package com.io.yutian.thewardungeon.gui; import com.io.yutian.thewardungeon.dungeon.Dungeon; import com.io.yutian.thewardungeon.dungeon.DungeonInstance; -import com.io.yutian.thewardungeon.manager.DungeonManager; import com.io.yutian.thewarskyblocklib.gui.Gui; import com.io.yutian.thewarskyblocklib.gui.button.Button; import com.io.yutian.thewarskyblocklib.gui.button.ClickType; diff --git a/src/main/java/com/io/yutian/thewardungeon/script/list/SetTotalCountdownScript.java b/src/main/java/com/io/yutian/thewardungeon/script/list/SetTotalCountdownScript.java new file mode 100644 index 0000000..fb731b5 --- /dev/null +++ b/src/main/java/com/io/yutian/thewardungeon/script/list/SetTotalCountdownScript.java @@ -0,0 +1,22 @@ +package com.io.yutian.thewardungeon.script.list; + +import com.io.yutian.thewardungeon.data.LineMetadata; +import com.io.yutian.thewardungeon.dungeon.DungeonInstance; +import com.io.yutian.thewardungeon.script.Script; + +public class SetTotalCountdownScript extends Script { + + private int countdown; + + public SetTotalCountdownScript(LineMetadata metadata) { + super(metadata); + this.countdown = metadata.getInt("countdown"); + } + + + @Override + public void execute(DungeonInstance dungeonInstance) { + dungeonInstance.setTotalCountdown(countdown); + } + +} diff --git a/src/main/resources/template/config.yml b/src/main/resources/template/config.yml index 3206d4d..8c42196 100644 --- a/src/main/resources/template/config.yml +++ b/src/main/resources/template/config.yml @@ -3,6 +3,7 @@ options: min: 1 max: 8 lobbyWaitTime: 60 + countdown: 10 gamemode: ADVENTURE revive: true reviveAmount: -1