Avoid using default methods with null values (#754)

This commit is contained in:
Josua Parks authored and GitHub committed 2026-02-27 22:20:27 -08:00
1 parent 58b7b0d685
commit 2fab19d325
2 files changed
+9 -3

No files matched your search

@@ -52,6 +52,14 @@ public final class LocalPlayerChangePacket extends CarbonPacket {
this.changeType = changeType; this.changeType = changeType;
} }
@AssistedInject
public LocalPlayerChangePacket(final @ServerId UUID serverId, final @Assisted UUID playerId) {
super(serverId);
this.playerId = playerId;
this.playerName = null;
this.changeType = ChangeType.REMOVE;
}
public LocalPlayerChangePacket(final UUID sender, final ByteBuf data) { public LocalPlayerChangePacket(final UUID sender, final ByteBuf data) {
super(sender); super(sender);
this.read(data); this.read(data);
@@ -45,9 +45,7 @@ public interface PacketFactory {
return this.localPlayerChangePacket(id, name, LocalPlayerChangePacket.ChangeType.ADD); return this.localPlayerChangePacket(id, name, LocalPlayerChangePacket.ChangeType.ADD);
} }
default LocalPlayerChangePacket removeLocalPlayerPacket(final UUID id) { LocalPlayerChangePacket removeLocalPlayerPacket(final UUID id);
return this.localPlayerChangePacket(id, null, LocalPlayerChangePacket.ChangeType.REMOVE);
}
WhisperPacket whisperPacket(@Assisted("from") UUID from, @Assisted("to") UUID to, Component msg); WhisperPacket whisperPacket(@Assisted("from") UUID from, @Assisted("to") UUID to, Component msg);