Record Class Spectator
java.lang.Object
java.lang.Record
com.pixelmonmod.pixelmon.battles.controller.participants.Spectator
- All Implemented Interfaces:
BattleViewer
public record Spectator(net.minecraft.server.level.ServerPlayer player, UUID target)
extends Record
implements BattleViewer
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.net.minecraft.world.entity.Entity
Gets the entity this is representing.@Nullable net.minecraft.server.level.ServerPlayer
Gets the player this is representing.final int
hashCode()
Returns a hash code value for this object.net.minecraft.server.level.ServerPlayer
player()
Returns the value of theplayer
record component.target()
Returns the value of thetarget
record component.final String
toString()
Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.pixelmonmod.pixelmon.battles.controller.BattleViewer
sendBattleMessage, sendBattleMessage, sendBattleMessage, sendDamagePacket, sendHealPacket, sendPacket
-
Constructor Details
-
Spectator
Creates an instance of aSpectator
record class.- Parameters:
player
- the value for theplayer
record componenttarget
- the value for thetarget
record component
-
-
Method Details
-
getEntity
public net.minecraft.world.entity.Entity getEntity()Description copied from interface:BattleViewer
Gets the entity this is representing.- Specified by:
getEntity
in interfaceBattleViewer
- Returns:
- The entity this is representing.
-
getPlayer
@Nullable public @Nullable net.minecraft.server.level.ServerPlayer getPlayer()Description copied from interface:BattleViewer
Gets the player this is representing.
Note: this method may return null if the entity is not a player.- Specified by:
getPlayer
in interfaceBattleViewer
- Returns:
- The player this is representing.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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)
. -
player
public net.minecraft.server.level.ServerPlayer player()Returns the value of theplayer
record component.- Returns:
- the value of the
player
record component
-
target
Returns the value of thetarget
record component.- Returns:
- the value of the
target
record component
-