From baeae473d1da1f1f6ec4bc3af92b0b93c3309d3f Mon Sep 17 00:00:00 2001 From: anhgelus Date: Thu, 22 Aug 2024 15:57:45 +0000 Subject: feat(game): color for all titles --- src/main/java/world/anhgelus/molehunt/Game.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/world/anhgelus/molehunt/Game.java b/src/main/java/world/anhgelus/molehunt/Game.java index 68ac511..6156b59 100644 --- a/src/main/java/world/anhgelus/molehunt/Game.java +++ b/src/main/java/world/anhgelus/molehunt/Game.java @@ -35,7 +35,9 @@ public class Game { } public void start() { + if (started) return; final int n = (server.getCurrentPlayerCount() - server.getCurrentPlayerCount() % 4)/4; +// final int n = 0; final var playerManager = server.getPlayerManager(); final var players = playerManager.getPlayerList(); for (int i = 0; i < n; i++) { @@ -54,7 +56,7 @@ public class Game { gamerules.get(GameRules.DO_IMMEDIATE_RESPAWN).set(true, server); gamerules.get(GameRules.DO_ENTITY_DROPS).set(false, server); - final var title = new TitleS2CPacket(Text.of("You are...")); + final var title = new TitleS2CPacket(Text.of("§eYou are...")); playerManager.getPlayerList().forEach(p -> { p.kill(); p.networkHandler.sendPacket(timing); @@ -70,10 +72,10 @@ public class Game { playerManager.getPlayerList().forEach(p -> { p.networkHandler.sendPacket(timing); if (moles.contains(p)) { - p.networkHandler.sendPacket(new TitleS2CPacket(Text.of("The Mole!"))); - p.networkHandler.sendPacket(new SubtitleS2CPacket(Text.of("get the list of moles with /molehunt moles"))); + p.networkHandler.sendPacket(new TitleS2CPacket(Text.of("§cThe Mole!"))); + p.networkHandler.sendPacket(new SubtitleS2CPacket(Text.of("§6get the list of moles with /molehunt moles"))); } else { - p.networkHandler.sendPacket(new TitleS2CPacket(Text.of("Not the Mole!"))); + p.networkHandler.sendPacket(new TitleS2CPacket(Text.of("§aNot the Mole!"))); } // reset health and food level p.setHealth(p.getMaxHealth()); @@ -114,7 +116,7 @@ public class Game { timer = new Timer(); started = false; final var pm = server.getPlayerManager(); - final var winnerSuspense = new TitleS2CPacket(Text.of("And the winners are...")); + final var winnerSuspense = new TitleS2CPacket(Text.of("§eAnd the winners are...")); pm.getPlayerList().forEach(p -> { p.networkHandler.sendPacket(timing); p.networkHandler.sendPacket(winnerSuspense); @@ -125,11 +127,11 @@ public class Game { public void run() { TitleS2CPacket winner; if (gameWonByMoles()) { - winner = new TitleS2CPacket(Text.of("The Moles!")); + winner = new TitleS2CPacket(Text.of("§cThe Moles!")); } else { - winner = new TitleS2CPacket(Text.of("Not the Mole!")); + winner = new TitleS2CPacket(Text.of("§aNot the Mole!")); } - pm.sendToAll(new SubtitleS2CPacket(Text.of("Moles were " + getMolesAsString()))); + pm.sendToAll(new SubtitleS2CPacket(Text.of("§6Moles were " + getMolesAsString()))); pm.sendToAll(winner); pm.sendToAll(timing); } -- cgit v1.2.3