Interface IPlayer
- All Superinterfaces:
ISender
-
Method Summary
Modifier and TypeMethodDescriptionvoid
executeCommands
(List<String> commands) Execute the commands that are bundled with this MessageCompoundReturns the locale the player is using.Returns the name of the server the player is on.@Nullable ServerVersion
Gets the MC version the player is using.identity()
Gets the UserIdentity associated with this IPlayer.boolean
isOnline()
Checks if this player is currently onlinevoid
kick
(net.kyori.adventure.text.Component reason) Kicks the player from the server.void
openBook
(net.kyori.adventure.inventory.Book book) Shows a book to the player.boolean
Checks if the encapsulated player is the same object as theother
.default CompletableFuture<Void>
send
(MessageConfiguration.MessageCompound message) default CompletableFuture<Void>
send
(MessageConfiguration.MessageSlot slot, String message, int time) Show the message to the user in the given slot.void
sendActionBar
(String message) Shows the text in the action bar of the player.void
sendActionBar
(net.kyori.adventure.text.Component message) Shows the text in the action bar of the player.sendBossbar
(String message, MessageConfiguration.BossBarStyle style, MessageConfiguration.BossBarColor color, int time) Shows a boss bar to the player.void
sendMessage
(String message) Shows the text in the chat of the player.Shows the text as a title to the player.Methods inherited from interface com.gamersafer.minecraft.auth.common.abstraction.ISender
hasPermission, sendMessage
-
Method Details
-
send
default CompletableFuture<Void> send(MessageConfiguration.MessageSlot slot, String message, int time) Show the message to the user in the given slot. Bossbar and Title use time as parameter for how long they should be displayed.- Parameters:
slot
- the slot the display the message inmessage
- the message to showtime
- how long the title or bossbar should be displayed- Returns:
- a
CompletableFuture
,complete
it to remove the bossbar
-
send
-
sendActionBar
Shows the text in the action bar of the player.- Parameters:
message
- the message to show
-
sendActionBar
void sendActionBar(net.kyori.adventure.text.Component message) Shows the text in the action bar of the player.- Parameters:
message
- the message to show
-
sendBossbar
CompletableFuture<Void> sendBossbar(String message, MessageConfiguration.BossBarStyle style, MessageConfiguration.BossBarColor color, int time) Shows a boss bar to the player.- Parameters:
message
- the message to showstyle
- the style of the bossbarcolor
- the color of the bossbartime
- how many seconds should it be shown- Returns:
- a
CompletableFuture
,complete
it to remove the bossbar
-
sendMessage
Shows the text in the chat of the player.- Specified by:
sendMessage
in interfaceISender
- Parameters:
message
- the message to show
-
sendTitle
Shows the text as a title to the player.- Parameters:
message
- the title to showsubmessage
- the subtitle to showtime
- how many seconds should it be shown- Returns:
- a
CompletableFuture
,complete
it to remove the title
-
openBook
void openBook(net.kyori.adventure.inventory.Book book) Shows a book to the player.- Parameters:
book
- the book
-
executeCommands
Execute the commands that are bundled with this MessageCompound- Parameters:
commands
- the commands to execute. Supported placeholders will be replaced. %player% will be replaced with the players name
-
identity
UserIdentity identity()Gets the UserIdentity associated with this IPlayer.- Returns:
- the associated UserIdentity
-
kick
void kick(net.kyori.adventure.text.Component reason) Kicks the player from the server. -
same
Checks if the encapsulated player is the same object as theother
.- Parameters:
other
- the other IPlayer- Returns:
- whether the encapsulated players objects are the same
-
getLocale
Locale getLocale()Returns the locale the player is using.- Returns:
- the locale the player is using.
-
getServerName
Returns the name of the server the player is on.- Returns:
- the name of the server the player is on. Optional is empty on non-proxy servers or when the player is not connected to a backend server.
-
isOnline
boolean isOnline()Checks if this player is currently online- Returns:
- true if they are online
-
getServerVersion
@Nullable ServerVersion getServerVersion()Gets the MC version the player is using. The value returned by the proxy implementations may be inaccurate, especially for older version.- Returns:
- the protocol version the player is currently using or
null
if the player is using a not recognized protocol version
-