Skip to content

Commit bc7a13c

Browse files
committed
refactor(plugin26): FieldState names
1 parent 2f255b7 commit bc7a13c

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

plugin2026/src/main/kotlin/sc/plugin2026/Field.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ class Field @JvmOverloads constructor(
4242

4343
val piranha: Optional<PlayerColor>
4444
get() {
45-
if(state == FieldState.RED) return Optional.of(Team.ONE)
46-
else if(state == FieldState.BLUE) return Optional.of(Team.TWO)
45+
if(state == FieldState.ONE) return Optional.of(Team.ONE)
46+
else if(state == FieldState.TWO) return Optional.of(Team.TWO)
4747

4848
return Optional.empty()
4949
}

plugin2026/src/main/kotlin/sc/plugin2026/FieldState.kt

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
11
package sc.plugin2026
22

3+
import sc.api.plugins.Team
4+
35
enum class FieldState {
4-
RED,
5-
BLUE,
6+
ONE,
7+
TWO,
68
OBSTRUCTED,
79
EMPTY;
810

911
override fun toString() = when(this) {
10-
OBSTRUCTED -> "Obstructed"
11-
RED -> "Red"
12-
BLUE -> "Blue"
12+
OBSTRUCTED -> "Krake"
13+
ONE -> "Eins"
14+
TWO -> "Zwei"
1315
else -> "empty"
1416
}
1517

1618
fun asLetter() = when(this) {
1719
OBSTRUCTED -> 'O'
18-
RED -> 'R'
19-
BLUE -> 'B'
20+
ONE -> 'R'
21+
TWO -> 'B'
2022
else -> ' '
2123
}
2224

2325
companion object {
2426
@JvmStatic
25-
fun from(color: PlayerColor): FieldState {
26-
return when(color) {
27-
Team.ONE -> RED
28-
Team.TWO -> BLUE
27+
fun from(team: Team): FieldState {
28+
return when(team) {
29+
Team.ONE -> ONE
30+
Team.TWO -> TWO
2931
}
3032
}
3133
}

0 commit comments

Comments
 (0)