aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLéo Kosman <leo.kosman@proton.me>2024-08-22 20:45:38 +0200
committerLéo Kosman <leo.kosman@proton.me>2024-08-22 20:45:38 +0200
commit809bcecbdccf29a3c6a710590d22758431033ed9 (patch)
treea7c44a3f0b1f4d9781eca247f55d65dc6d2da244
parent64977f4392c79871ad252c6071d397c05c2f97ad (diff)
refactor: change `isStarted` to `hasStarted
-rw-r--r--src/main/java/world/anhgelus/molehunt/Game.java2
-rw-r--r--src/main/java/world/anhgelus/molehunt/Molehunt.java8
2 files changed, 5 insertions, 5 deletions
diff --git a/src/main/java/world/anhgelus/molehunt/Game.java b/src/main/java/world/anhgelus/molehunt/Game.java
index c2cb221..9c3910b 100644
--- a/src/main/java/world/anhgelus/molehunt/Game.java
+++ b/src/main/java/world/anhgelus/molehunt/Game.java
@@ -174,7 +174,7 @@ public class Game {
moles.add(newPlayer);
}
- public boolean isStarted() {
+ public boolean hasStarted() {
return started;
}
}
diff --git a/src/main/java/world/anhgelus/molehunt/Molehunt.java b/src/main/java/world/anhgelus/molehunt/Molehunt.java
index cbb415d..ad1fedd 100644
--- a/src/main/java/world/anhgelus/molehunt/Molehunt.java
+++ b/src/main/java/world/anhgelus/molehunt/Molehunt.java
@@ -49,7 +49,7 @@ public class Molehunt implements ModInitializer {
var player = context.getSource().getPlayer();
assert player != null;
- if (game == null || !game.isStarted()) {
+ if (game == null || !game.hasStarted()) {
player.networkHandler.sendPacket(new OverlayMessageS2CPacket(Text.of("§cGame has not started yet")));
} else {
player.networkHandler.sendPacket(new OverlayMessageS2CPacket(Text.of(game.getShortRemainingText())));
@@ -64,12 +64,12 @@ public class Molehunt implements ModInitializer {
return Command.SINGLE_SUCCESS;
})
));
- command.then(literal("moles").requires(source -> (game != null) && game.isStarted() && game.isAMole(source.getPlayer())).executes(context -> {
+ command.then(literal("moles").requires(source -> (game != null) && game.hasStarted() && game.isAMole(source.getPlayer())).executes(context -> {
context.getSource().sendFeedback(() -> Text.literal("List of moles: " + game.getMolesAsString()),false);
return Command.SINGLE_SUCCESS;
}));
command.then(literal("stop").requires(source -> source.hasPermissionLevel(1)).executes(context -> {
- if (game == null || !game.isStarted()) {
+ if (game == null || !game.hasStarted()) {
context.getSource().sendError(Text.of("Game has not started yet"));
}
@@ -89,7 +89,7 @@ public class Molehunt implements ModInitializer {
ServerPlayerEvents.AFTER_RESPAWN.register((oldPlayer, newPlayer, alive) -> {
if (game == null) return;
- if (!game.isStarted()) return;
+ if (!game.hasStarted()) return;
if (game.getMoles().contains(oldPlayer)) game.updateMole(oldPlayer, newPlayer);
newPlayer.changeGameMode(GameMode.SPECTATOR);
});