@@ -18,30 +18,29 @@ public class serverInfoPackets {
1818 * new serverInfoPacket(
1919 * ServerInfoData.MINIGAME_TYPES.BATTLE,
2020 * ServerInfoData.GAME_MODES.CASUAL,
21- * false ,
21+ * ServerInfoData.MINIGAME_PHASES.NONE ,
2222 * new byte[]{0,0,1,1}
2323 * );</code>
2424 * </pre>
2525 *
2626 * @param minigame {@link ServerInfoData.MINIGAME_TYPES}. Minigame the client is in.
2727 *
28- * @param gamemode {@link ServerInfoData.GAME_MODES}. Gamemode the client is in.
28+ * @param gamemode {@link ServerInfoData.GAME_MODES}. Gamemode the game is in.
2929 *
30- * @param inRound boolean, Is the client in a round?
30+ * @param phase {@link ServerInfoData.MINIGAME_PHASES}, Phase the game is in.
3131 *
32- * @param playerStatus byte[]. In Round: 0 - Dead; 1 - Alive; -1 - Spectating;<br>
33- * In Lobby: 0 - Not Ready; 1 - Ready
32+ * @param playerStatus byte[], -1 — Spectating; 0 — Dead/Not Ready; 1 — Alive/Ready;
3433 *
3534 * @see gamemodePacket gamemodePacket
3635 * @see playerStatusPacket playerStatusPacket
37- * @see inRoundPacket inRoundPacket
36+ * @see phasePacket phasePacket
3837 */
39- public record serverInfoPacket (ServerInfoData .MINIGAME_TYPES minigame , ServerInfoData .GAME_MODES gamemode , boolean inRound , byte [] playerStatus ) implements CustomPayload {
38+ public record serverInfoPacket (ServerInfoData .MINIGAME_TYPES minigame , ServerInfoData .GAME_MODES gamemode , ServerInfoData . MINIGAME_PHASES phase , byte [] playerStatus ) implements CustomPayload {
4039 public static final Id <serverInfoPacket > PACKET_ID = new Id <>(Identifier .of ("serverinfo" , "serverinfo_set" ));
4140 public static final PacketCodec <RegistryByteBuf , serverInfoPacket > codec = PacketCodec .tuple (
4241 PacketCodecs .indexed (i -> ServerInfoData .MINIGAME_TYPES .values ()[i ], ServerInfoData .MINIGAME_TYPES ::ordinal ), serverInfoPacket ::minigame ,
4342 PacketCodecs .indexed (i -> ServerInfoData .GAME_MODES .values ()[i ], ServerInfoData .GAME_MODES ::ordinal ), serverInfoPacket ::gamemode ,
44- PacketCodecs .BOOL , serverInfoPacket ::inRound ,
43+ PacketCodecs .indexed ( i -> ServerInfoData . MINIGAME_PHASES . values ()[ i ], ServerInfoData . MINIGAME_PHASES :: ordinal ), serverInfoPacket ::phase ,
4544 PacketCodecs .BYTE_ARRAY , serverInfoPacket ::playerStatus ,
4645 serverInfoPacket ::new
4746 );
@@ -96,16 +95,16 @@ public Id<? extends CustomPayload> getId() {
9695 }
9796
9897 /**
99- * <pre>inRoundPacket, sends the current inRound status to client.
100- * Intended for use at begining & end of round.</pre>
98+ * phasePacket, sends phase to client
99+ *
100+ * @param phase {@link ServerInfoData.MINIGAME_PHASES}. Phase the game is in.
101101 *
102- * @param inRound boolean, Is the client in a round?
103102 */
104- public record inRoundPacket ( boolean inRound ) implements CustomPayload {
105- public static final Id <inRoundPacket > PACKET_ID = new Id <>(Identifier .of ("serverinfo" , "inround_set " ));
106- public static final PacketCodec <RegistryByteBuf , inRoundPacket > codec = PacketCodec .tuple (
107- PacketCodecs .BOOL , inRoundPacket :: inRound ,
108- inRoundPacket ::new
103+ public record phasePacket ( ServerInfoData . MINIGAME_PHASES phase ) implements CustomPayload {
104+ public static final Id <phasePacket > PACKET_ID = new Id <>(Identifier .of ("serverinfo" , "phase_set " ));
105+ public static final PacketCodec <RegistryByteBuf , phasePacket > codec = PacketCodec .tuple (
106+ PacketCodecs .indexed ( i -> ServerInfoData . MINIGAME_PHASES . values ()[ i ], ServerInfoData . MINIGAME_PHASES :: ordinal ), phasePacket :: phase ,
107+ phasePacket ::new
109108 );
110109
111110 @ Override
@@ -120,8 +119,7 @@ public Id<? extends CustomPayload> getId() {
120119 * <code>new byte[]{0,1,0,-1}</code> 4 players, players 1 & 3 are either not ready or dead, player 4 is spectating.
121120 * </pre>
122121 *
123- * @param playerStatus byte[]. In Round: 0 - Dead; 1 - Alive; -1 - Spectating;<br>
124- * In Lobby: 0 - Not Ready; 1 - Ready
122+ * @param playerStatus byte[], -1 — Spectating; 0 — Dead/Not Ready; 1 — Alive/Ready;
125123 */
126124 public record playerStatusPacket (byte [] playerStatus ) implements CustomPayload {
127125 public static final Id <playerStatusPacket > PACKET_ID = new Id <>(Identifier .of ("serverinfo" , "playerstatus_set" ));
0 commit comments