Skip to content

Commit 6c46a1a

Browse files
committed
add random mode
1 parent 66d6242 commit 6c46a1a

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

src/main/java/net/azisaba/lgw/core/util/MatchMode.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ public enum MatchMode {
4949
Chat.f("&7終了時に &cキャプチャーポイント &7が多いチームの勝利"),
5050
Duration.ofMinutes(10),
5151
Arrays.asList("hijack", "hj", "h")
52+
),
53+
54+
RANDOM(
55+
Chat.f("&7ランダム"),
56+
Chat.f("&7RANDOM"),
57+
Chat.f("&7ランダムでモードを選択"),
58+
Duration.ofMinutes(10),
59+
Arrays.asList("random", "r")
5260
);
5361

5462

@@ -67,7 +75,9 @@ public enum MatchMode {
6775
}
6876

6977
public static MatchMode getFromString(String text) {
70-
if (text.equalsIgnoreCase("[random]") || text.equalsIgnoreCase("r")) {
78+
String suggest = text.replace(" ", "").toLowerCase();
79+
80+
if (text.equalsIgnoreCase("r")) {
7181
int rand = (int) (Math.random() * 2);
7282
if (rand == 0) {
7383
return LEADER_DEATH_MATCH_POINT;
@@ -76,7 +86,6 @@ public static MatchMode getFromString(String text) {
7686
}
7787
}
7888

79-
String suggest = text.replace(" ", "").toLowerCase();
8089
return Arrays.stream(values())
8190
.filter(mode -> mode.suggests.contains(suggest))
8291
.findAny()

0 commit comments

Comments
 (0)