Package de.marcely.bedwars.api.remote
Interface RemotePlayer
public interface RemotePlayer
Represents a player on the network.
This includes the ones that are online on this server and the ones who are online on other ones.
Also keep in mind that this instance gets replaced with an other one whenever he changes servers,
meaning that most of the methods won't work in that case. Use isOnline() to check that.
-
Method Summary
Modifier and TypeMethodDescription@Nullable PlayerasBukkit()Gets the Player instance in case he is playing on this server.default voidconnectTo(RemoteServer server) Makes the player connect with another server.voidMakes the player connect with another server.@Nullable RemoteArenagetArena()Returns the arena that he is currently playing in or spectating.Get the time since when we know that the player has joined the given server (not the network!).getName()The name of the player.Gets the server in which he's currently on.The unique id of the player.booleanisLocal()Gets whether the player is currently playing on this server and not on another one.booleanisOnline()Gets whether he is currently online.booleanReturns whether he is playing a match (also includes the lobby state).booleanReturns whether he is currently spectating an arena.voidsendMessage(String... messages) Sends messages to the player.voidsendMessage(net.md_5.bungee.api.chat.BaseComponent... components) Sends a message to the player.voidCauses a player to get teleported to the hub server.
-
Method Details
-
getName
String getName()The name of the player.Exactly the same as
Helper.getNickedPlayerRealName(org.bukkit.entity.Player).- Returns:
- His name
-
getUniqueId
UUID getUniqueId()The unique id of the player.Exactly the same as
Entity.getUniqueId().- Returns:
- His uuid
-
sendMessage
Sends messages to the player.- Parameters:
messages- The messages that shall be sent
-
sendMessage
void sendMessage(net.md_5.bungee.api.chat.BaseComponent... components) Sends a message to the player.- Parameters:
components- The components of the message that shall be sent
-
getServer
RemoteServer getServer()Gets the server in which he's currently on.- Returns:
- The server he is playing on
-
getArena
Returns the arena that he is currently playing in or spectating.- Returns:
- The arena he attends.
nullwhen he isn't
-
isPlaying
boolean isPlaying()Returns whether he is playing a match (also includes the lobby state).- Returns:
truewhen he's a part of a match
-
isSpectating
boolean isSpectating()Returns whether he is currently spectating an arena.- Returns:
truewhen he's spectating an arena
-
isOnline
boolean isOnline()Gets whether he is currently online.Keep in mind that this instance gets replaced with an other one when he switches the servers. In this case, this method will return
falsefor this one, while the new instance will returntrue.- Returns:
- Whether he is currently online
-
isLocal
boolean isLocal()Gets whether the player is currently playing on this server and not on another one.- Returns:
truehe is a player on this server
-
asBukkit
Gets the Player instance in case he is playing on this server.- Returns:
- Bukkit's player instance of this player.
nullwhen he's either not online or playing on another server.
-
connectTo
Makes the player connect with another server.- Parameters:
channelName- The name of the server that has been configured in BungeeCord's configs
-
connectTo
Makes the player connect with another server.- Parameters:
server- The target server
-
sendToHub
void sendToHub()Causes a player to get teleported to the hub server.It's possible that nothing will happen when he's already on a hub server.
-
getLoginTime
Instant getLoginTime()Get the time since when we know that the player has joined the given server (not the network!).- Returns:
- The time when the player has joined the given server
-