From cc4c4d11137c25e3f2b7474c89b4c448501de3d2 Mon Sep 17 00:00:00 2001 From: Ellie Date: Sat, 19 Oct 2024 16:28:35 -0300 Subject: [PATCH] Players are now invisible during countdown Fixes #13 --- .../java/me/ellieis/Sabotage/game/phase/SabotageActive.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/ellieis/Sabotage/game/phase/SabotageActive.java b/src/main/java/me/ellieis/Sabotage/game/phase/SabotageActive.java index 59c457c..6ccb896 100644 --- a/src/main/java/me/ellieis/Sabotage/game/phase/SabotageActive.java +++ b/src/main/java/me/ellieis/Sabotage/game/phase/SabotageActive.java @@ -576,7 +576,7 @@ private ActionResult onDeath(ServerPlayerEntity plr, DamageSource damageSource) plrs.remove(attacker); } - plrs.sendMessage(Text.translatable("sabotage.kill_message", plr.getName(), plrs.size()).formatted(Formatting.YELLOW)); + plrs.sendMessage(Text.translatable("sabotage.kill_message", plr.getName(), getAlivePlayers().size()).formatted(Formatting.YELLOW)); } return ActionResult.FAIL; } @@ -640,6 +640,9 @@ public void onTick() { plrs.playSound(SoundEvents.BLOCK_RESPAWN_ANCHOR_CHARGE); plrs.sendMessage(Text.translatable("sabotage.game_start", config.gracePeriod()).formatted(Formatting.YELLOW)); } else { + for (ServerPlayerEntity plr : plrs) { + plr.setStatusEffect(new StatusEffectInstance(StatusEffects.INVISIBILITY, 40, 0, false, false), plr); + } plrs.showTitle(Text.literal(Integer.toString(countdownTime - secondsSinceStart)).formatted(Formatting.GOLD), 20); plrs.playSound(SoundEvents.BLOCK_NOTE_BLOCK_HARP.value(), SoundCategory.PLAYERS, 1.0F, 2.0F); }