Record Class PlayerMessage
java.lang.Object
java.lang.Record
dev.ua.theroer.magicutils.platform.PlayerMessage
- Record Components:
playerId- stable player id when availableplayerName- current player display/login namemessage- raw chat content or raw command linetype- source message type
public record PlayerMessage(UUID playerId, String playerName, String message, PlayerMessageType type)
extends Record
Normalized player-originated message emitted by the platform layer.
-
Constructor Summary
ConstructorsConstructorDescriptionPlayerMessage(UUID playerId, String playerName, String message, PlayerMessageType type) Creates an instance of aPlayerMessagerecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisValid()Returns true when the payload contains enough data to process safely.message()Returns the value of themessagerecord component.playerId()Returns the value of theplayerIdrecord component.Returns the value of theplayerNamerecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.
-
Constructor Details
-
PlayerMessage
Creates an instance of aPlayerMessagerecord class.- Parameters:
playerId- the value for theplayerIdrecord componentplayerName- the value for theplayerNamerecord componentmessage- the value for themessagerecord componenttype- the value for thetyperecord component
-
-
Method Details
-
isValid
public boolean isValid()Returns true when the payload contains enough data to process safely.- Returns:
- true for non-empty player name and message
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
playerId
-
playerName
Returns the value of theplayerNamerecord component.- Returns:
- the value of the
playerNamerecord component
-
message
-
type
-