Interface ServerPlayer
- All Superinterfaces:
- ArmorEquipable,- AttributeHolder,- Audience,- Carrier,- Contextual,- CopyableDataHolder,- DataHolder,- DataHolder.Mutable,- DataSerializable,- Entity,- EntityProjectileSource,- Equipable,- HoverEventSource<HoverEvent.ShowEntity>,- Humanoid,- Identifiable,- Identified,- Living,- LocaleSource,- Locatable,- Nameable,- Player,- Pointered,- ProjectileSource,- RandomProvider,- SerializableDataHolder,- SerializableDataHolder.Mutable,- Sound.Emitter,- Subject,- Tamer,- TeamMember,- ValueContainer,- Viewer
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.spongepowered.api.data.DataHolderDataHolder.Immutable<I extends DataHolder.Immutable<I>>, DataHolder.MutableNested classes/interfaces inherited from interface org.spongepowered.api.util.RandomProviderRandomProvider.SourceNested classes/interfaces inherited from interface org.spongepowered.api.data.SerializableDataHolderSerializableDataHolder.Immutable<I extends SerializableDataHolder.Immutable<I>>, SerializableDataHolder.Mutable
- 
Method SummaryModifier and TypeMethodDescriptiondefault Value.Mutable<Boolean> default Value.Mutable<ChatVisibility> booleanCloses the currently viewed entity of this player, if it is currently viewing one.Gets the appropriateServerSideConnectionlinking this player to a client.Gets theCooldownTrackerfor this player, allowing control over the player's item cooldowns.default SetValue.Mutable<SkinPart> default Optional<Value.Mutable<Instant>> default Value.Mutable<GameMode> gameMode()default booleandefault Value.Mutable<Boolean> default Optional<Value.Mutable<Double>> booleanisOnline()Returns whether this player is online or not.default booleanReturns whether this player has an open inventory at the moment or not.booleankick()Kicks the player, showing the default kick reason (the translation keydisconnect.disconnected).booleanKicks the player given a reason.default Optional<Value.Mutable<Instant>> default Optional<Value.Mutable<Instant>> Gets the currently viewed inventory of this player, if it is currently viewing one.openInventory(Inventory inventory) Opens the given Inventory for the player to view.openInventory(Inventory inventory, Component displayName) Opens a given Inventory for the player to view with a custom displayName.progress(AdvancementTemplate advancement) Gets theAdvancementProgressfor the specifiedAdvancement.booleanrespawn()Manually respawns the player.Gets theScoreboarddisplayed to the player.voidsetScoreboard(Scoreboard scoreboard) Sets theScoreboarddisplayed to the player.setWorldBorder(@Nullable WorldBorder border) Sets theWorldBorderthat this player sees.voidsimulateChat(Component message, Cause cause) Simulates a chat message from a player.default Value.Mutable<Entity> default MapValue.Mutable<Statistic, Long> tabList()Gets this player'sTabList.Gets all theAdvancementTrees that thisPlayeralready unlocked.user()default Value.Mutable<Integer> world()Gets theWorld.Gets theWorldBorderfor this player, if present.Methods inherited from interface org.spongepowered.api.item.inventory.ArmorEquipablechest, feet, head, itemInHand, itemInHand, legs, setChest, setFeet, setHead, setItemInHand, setItemInHand, setLegsMethods inherited from interface org.spongepowered.api.entity.attribute.AttributeHolderattribute, attributeMethods inherited from interface net.kyori.adventure.audience.AudienceclearResourcePacks, clearTitle, deleteMessage, deleteMessage, filterAudience, forEachAudience, hideBossBar, openBook, openBook, playSound, playSound, playSound, removeResourcePacks, removeResourcePacks, removeResourcePacks, removeResourcePacks, removeResourcePacks, resetTitle, sendActionBar, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendPlayerListHeaderAndFooter, sendResourcePacks, sendResourcePacks, sendResourcePacks, sendTitlePart, showBossBar, showTitle, stopSound, stopSoundMethods inherited from interface org.spongepowered.api.service.context.ContextualfriendlyIdentifier, identifierMethods inherited from interface org.spongepowered.api.data.DataHolder.MutablecopyFrom, copyFrom, offer, offer, offer, offer, offerAll, offerAll, offerAll, offerAll, offerAll, offerAll, offerSingle, offerSingle, offerSingle, offerSingle, remove, remove, remove, removeAll, removeAll, removeAll, removeAll, removeAll, removeAll, removeKey, removeKey, removeSingle, removeSingle, transform, transform, tryOffer, tryOffer, tryOffer, undoMethods inherited from interface org.spongepowered.api.data.persistence.DataSerializablecontentVersion, toContainerMethods inherited from interface org.spongepowered.api.entity.Entityage, asHoverEvent, baseSize, baseVehicle, boundingBox, canSee, copy, createArchetype, createSnapshot, creator, customName, customNameVisible, damage, damage, direction, displayName, eyeHeight, eyePosition, fallDistance, fireImmuneTicks, fireTicks, frozenTime, glowing, gravityAffected, height, invisible, invulnerabilityTicks, invulnerable, isLoaded, isRemoved, isTransient, lookAt, maxAir, maxFrozenTime, nearbyEntities, nearbyEntities, notifier, onGround, passengers, position, remainingAir, remove, rotation, scale, scoreboardTags, setLocation, setLocationAndRotation, setLocationAndRotation, setPosition, setRotation, setScale, setTransform, silent, sneaking, sprinting, swiftness, transferToWorld, transferToWorld, transform, type, vanishState, vehicle, velocity, wetMethods inherited from interface org.spongepowered.api.item.inventory.EquipablecanEquip, canEquip, canEquip, canEquip, equip, equip, equipment, equipped, equippedMethods inherited from interface net.kyori.adventure.text.event.HoverEventSourceasHoverEventMethods inherited from interface org.spongepowered.api.entity.living.HumanoidskinProfileMethods inherited from interface org.spongepowered.api.util.IdentifiableuniqueIdMethods inherited from interface org.spongepowered.api.entity.living.Livingabsorption, activeItem, bodyRotations, canGrief, chestRotation, elytraFlying, headDirection, headRotation, health, lastAttacker, lastDamageReceived, maxHealth, potionEffects, stuckArrows, walkingSpeedMethods inherited from interface org.spongepowered.api.util.locale.LocaleSourcelocaleMethods inherited from interface org.spongepowered.api.world.LocatableblockPosition, location, serverLocationMethods inherited from interface org.spongepowered.api.entity.living.player.PlayeraffectsSpawning, canFly, dominantHand, enderChestInventory, exhaustion, experience, experienceFromStartToLevel, experienceLevel, experienceSinceLevel, flying, flyingSpeed, foodLevel, identity, inventory, maxExhaustion, maxFoodLevel, maxSaturation, profile, saturation, sleeping, sleepingIgnored, sleepTimerMethods inherited from interface net.kyori.adventure.pointer.Pointeredget, getOrDefault, getOrDefaultFrom, pointersMethods inherited from interface org.spongepowered.api.projectile.source.ProjectileSourcelaunchProjectile, launchProjectile, launchProjectile, launchProjectile, launchProjectileTo, launchProjectileToMethods inherited from interface org.spongepowered.api.util.RandomProviderrandomMethods inherited from interface org.spongepowered.api.data.SerializableDataHoldervalidateRawDataMethods inherited from interface org.spongepowered.api.data.SerializableDataHolder.MutablesetRawDataMethods inherited from interface org.spongepowered.api.service.permission.SubjectassociatedObject, asSubjectReference, containingCollection, contextCause, hasPermission, hasPermission, hasPermission, isChildOf, isChildOf, isChildOf, isSubjectDataPersisted, option, option, option, parents, parents, parents, permissionValue, permissionValue, permissionValue, subjectData, transientSubjectDataMethods inherited from interface org.spongepowered.api.scoreboard.TeamMemberteamRepresentationMethods inherited from interface org.spongepowered.api.data.value.ValueContainerget, getDouble, getInt, getKeys, getLong, getOrElse, getOrNull, getValue, getValues, require, requireValue, supports, supportsMethods inherited from interface org.spongepowered.api.effect.ViewerplayMusicDisc, playSound, resetBlockChange, resetBlockChange, sendBlockChange, sendBlockChange, sendWorldType, spawnParticles, spawnParticles, stopMusicDisc
- 
Method Details- 
worldServerWorld world()Description copied from interface:LocatableGets theWorld.
- 
userUser user()
- 
isOnlineboolean isOnline()Returns whether this player is online or not.If this returns false, this player should be considered stale and all references to it should be discarded immediately. - Returns:
- True if online, false if not
 
- 
isViewingInventorydefault boolean isViewingInventory()Returns whether this player has an open inventory at the moment or not.- Returns:
- Whether this player is viewing an inventory or not
 
- 
openInventoryGets the currently viewed inventory of this player, if it is currently viewing one.- Returns:
- An inventory if this player is viewing one, otherwise
 Optional.empty()
 
- 
openInventoryOpens the given Inventory for the player to view.- Parameters:
- inventory- The inventory to view
- Returns:
- The opened Container if the inventory was opened, otherwise
      Optional.empty()
- Throws:
- IllegalArgumentException- if a- PluginContaineris not the root of the cause
 
- 
openInventoryOpens a given Inventory for the player to view with a custom displayName.Note that not all inventories support a custom display name. - Parameters:
- inventory- The inventory to view
- displayName- The display name to set
- Returns:
- The opened Container if the inventory was opened, otherwise Optional.empty()
 
- 
closeInventoryCloses the currently viewed entity of this player, if it is currently viewing one.- Returns:
- whether or not closing the inventory succeeded
- Throws:
- IllegalArgumentException- if a- PluginContaineris not the root of the cause
 
- 
viewDistance- Returns:
- The player's view distance
 
- 
chatVisibility- Returns:
- Chat visibility setting
 
- 
chatColorsEnabled- Returns:
- Whether colors are enabled in chat
 
- 
simulateChatSimulates a chat message from a player.This method sends a message as if it came from this player. To send a message to this player instead, see Audience.sendMessage(Identity, Component).If text formatting is not supported in the implementation it will be displayed as plain text. - Parameters:
- message- The message to send
- cause- The cause for the message
 
- 
displayedSkinParts- Returns:
- A set of skin parts displayed
 
- 
connectionServerSideConnection connection()Gets the appropriateServerSideConnectionlinking this player to a client.- Returns:
- The connection
 
- 
tabListTabList tabList()Gets this player'sTabList.- Returns:
- This player's TabList
 
- 
kickboolean kick()Kicks the player, showing the default kick reason (the translation keydisconnect.disconnected).- Returns:
- whether or not kicking the player succeeded
 
- 
kickKicks the player given a reason.- Parameters:
- reason- The reason for the kick
- Returns:
- whether or not kicking the player succeeded
 
- 
scoreboardScoreboard scoreboard()Gets theScoreboarddisplayed to the player.- Returns:
- The scoreboard displayed to the player
 
- 
setScoreboardSets theScoreboarddisplayed to the player.- Parameters:
- scoreboard- The scoreboard to display
 
- 
respawnboolean respawn()Manually respawns the player.If the player is not dead, this method will return false- Returns:
- Whether the respawn was successful
 
- 
worldBorderOptional<WorldBorder> worldBorder()Gets theWorldBorderfor this player, if present. If no border is set, an emptyOptionalis returned.- Returns:
- The WorldBorderof this player as anOptional, if present
 
- 
setWorldBorderSets theWorldBorderthat this player sees. Ifnull, the border is unset, reverting to the border of the world the player is currently in.The values that are set may be altered by events, so users should check the returned value if they need to know if an event altered the values in some way. If no alterations were made, the supplied object and the returned object (within the optional) will be the same. - Parameters:
- border- The world border to be used, may be- null
- Returns:
- the values that were actually set, which may be different from those requested. If the result is an empty optional, then the player does not have a personal border, and uses that of the world they are in instead.
 
- 
cooldownTrackerCooldownTracker cooldownTracker()Gets theCooldownTrackerfor this player, allowing control over the player's item cooldowns.- Returns:
- This player's cooldown tracker
 
- 
progressGets theAdvancementProgressfor the specifiedAdvancement.- Parameters:
- advancement- The advancement
- Returns:
- The advancement progress
 
- 
unlockedAdvancementTreesCollection<AdvancementTree> unlockedAdvancementTrees()Gets all theAdvancementTrees that thisPlayeralready unlocked.- Returns:
- The advancement trees
 
- 
hasViewedCredits- Returns:
- True if this player has viewed the credits
 
- 
hasPlayedBeforedefault boolean hasPlayedBefore()- Returns:
- True if played before, false otherwise
 
- 
spectatorTarget- Returns:
- The entity this player is "spectating"
 
- 
gameMode- Returns:
- The game mode the player has
 
- 
previousGameMode- Returns:
- The previous game mode of the player
 
- 
statistics- Returns:
- The statistics of the player
 
- 
healthScale- Returns:
- The value the player max-health (excluding absorption) in the GUI will scale to
 
- 
firstJoined- Returns:
- The timestamp value when this player first joined
 
- 
lastJoined- Returns:
- The last timestamp value when this player has joined
 
- 
lastPlayed- Returns:
- The last timestamp value when this player has played
 
 
-