aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/world
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/world')
-rw-r--r--src/main/java/world/anhgelus/molehunt/Game.java4
-rw-r--r--src/main/java/world/anhgelus/molehunt/Molehunt.java3
2 files changed, 4 insertions, 3 deletions
diff --git a/src/main/java/world/anhgelus/molehunt/Game.java b/src/main/java/world/anhgelus/molehunt/Game.java
index 89ee9b3..ce6f335 100644
--- a/src/main/java/world/anhgelus/molehunt/Game.java
+++ b/src/main/java/world/anhgelus/molehunt/Game.java
@@ -89,7 +89,6 @@ public class Game {
// reset time and weather
server.getOverworld().setTimeOfDay(0);
server.getOverworld().resetWeather();
-
started = true;
timer.scheduleAtFixedRate(new TimerTask() {
@@ -137,6 +136,7 @@ public class Game {
pm.sendToAll(new SubtitleS2CPacket(Text.translatable("molehunt.game.end.winners.subtitle").append(getMolesAsString())));
pm.sendToAll(winner);
pm.sendToAll(timing);
+ moles.clear();
}
}, 4*1000);
}
@@ -158,7 +158,7 @@ public class Game {
}
public boolean isAMole(ServerPlayerEntity player) {
- return hasStarted() && moles.contains(player);
+ return moles.contains(player);
}
public boolean gameWonByMoles() {
diff --git a/src/main/java/world/anhgelus/molehunt/Molehunt.java b/src/main/java/world/anhgelus/molehunt/Molehunt.java
index 7a55450..c6ce7c7 100644
--- a/src/main/java/world/anhgelus/molehunt/Molehunt.java
+++ b/src/main/java/world/anhgelus/molehunt/Molehunt.java
@@ -102,7 +102,7 @@ public class Molehunt implements ModInitializer {
if (game == null || !game.hasStarted()) {
player.networkHandler.sendPacket(new OverlayMessageS2CPacket(
- Text.translatable("commands.molehunt.stop.failed").setStyle(Style.EMPTY.withColor(16733525))
+ Text.translatable("commands.molehunt.stop.failed").setStyle(Style.EMPTY.withColor(16733525))
));
} else {
player.networkHandler.sendPacket(new OverlayMessageS2CPacket(Text.of(game.getShortRemainingText())));
@@ -144,6 +144,7 @@ public class Molehunt implements ModInitializer {
ServerLivingEntityEvents.AFTER_DEATH.register((entity, damageSource) -> {
if (!(entity instanceof ServerPlayerEntity) || game == null) return;
+ if (!game.hasStarted()) return;
if (game.gameWonByMoles()) game.end();
});