diff options
author | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-12-14 18:31:24 +0900 |
---|---|---|
committer | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-12-14 18:31:24 +0900 |
commit | 299a569e6e37870bf7828500244916acefc3e1a0 (patch) | |
tree | 238597b930190b441382e73c4df0926fc757a799 /src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java | |
parent | 54b2804d7ff5c1d560893376070979d993ef0580 (diff) | |
download | Skyblock-Dungeons-Guide-299a569e6e37870bf7828500244916acefc3e1a0.tar.gz Skyblock-Dungeons-Guide-299a569e6e37870bf7828500244916acefc3e1a0.tar.bz2 Skyblock-Dungeons-Guide-299a569e6e37870bf7828500244916acefc3e1a0.zip |
oneway and two way
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java')
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java index 56826abd..a59b44b5 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java @@ -8,10 +8,8 @@ import lombok.Data; import net.minecraft.util.BlockPos; import java.awt.*; -import java.util.ArrayList; -import java.util.HashSet; +import java.util.*; import java.util.List; -import java.util.Set; @Data public class DungeonPressurePlate implements DungeonMechanic { @@ -22,6 +20,8 @@ public class DungeonPressurePlate implements DungeonMechanic { @Override public Set<Action> getAction(String state, DungeonRoom dungeonRoom) { if (!("triggered".equalsIgnoreCase(state) || "untriggered".equalsIgnoreCase(state))) throw new IllegalArgumentException(state+" is not valid state for secret"); + if (state.equalsIgnoreCase(getCurrentState(dungeonRoom))) return Collections.emptySet(); + Set<Action> base; Set<Action> preRequisites = base = new HashSet<Action>(); if ("triggered".equalsIgnoreCase(state)) { @@ -76,4 +76,14 @@ public class DungeonPressurePlate implements DungeonMechanic { } } } + + @Override + public Set<String> getPossibleStates(DungeonRoom dungeonRoom) { + String currentStatus = getCurrentState(dungeonRoom); + if (currentStatus.equalsIgnoreCase("triggered")) + return Collections.singleton("untriggered"); + else if (currentStatus.equalsIgnoreCase("untriggered")) + return Collections.singleton("triggered"); + return Collections.emptySet(); + } } |