Interface RemoteServer
-
Method Summary
Modifier and TypeMethodDescriptionvoid
executeBedwarsCommand
(RemotePlayer sender, String label, String[] args) Executes a command on the server, as if a player would run it.void
executeBedwarsCommandAsConsole
(String label, String[] args) Executes a command on the server, as if a console would run it.int
Gets the version of the API of the Bedwars plugin that is running on the server.@Nullable RemoteArena
Looks for an arena from this server whose real name is identical to the given parameter.Collection
<? extends RemoteArena> Gets all the arena that the server holds.@Nullable String
Gets the name of this server that has been configured in Bungeecord's config.int
Gets the maximum amount of players that the server is able to hold.int
Returns the patch version of the running server software.int
Returns the minor version of the running server software.int
Gets the total amount of players that are currently on this server.Gets the version of the Bedwars plugin that is running on the server.boolean
isHub()
Whether this server represents a location to which the player gets teleported when he leaves the arena (or when the match ends).boolean
isLocal()
Gets whether this instance represents the server on which you are accessing the API with-boolean
isOnline()
Gets whether the arena is still online.void
sendConsoleMessage
(String... messages) Sends a message to the console of the given server usingCommandSender.sendMessage(String)
)void
sendCustomMessage
(String channel, byte[] payload) Sends a custom message to this server.
-
Method Details
-
getArenas
Collection<? extends RemoteArena> getArenas()Gets all the arena that the server holds.- Returns:
- The server that are being managed by the server
-
isLocal
boolean isLocal()Gets whether this instance represents the server on which you are accessing the API with-- Returns:
true
when it is local
-
isOnline
boolean isOnline()Gets whether the arena is still online.- Returns:
true
in case it is online
-
getBungeeChannelName
Gets the name of this server that has been configured in Bungeecord's config.The default implementation (the one without the ProxySync) addon, might return
null
. Reason being, that it has to fetch the info manually. And it's possible that the server is not running in bungee mode.- Returns:
- The channel name of the arena. May be
null
-
isHub
boolean isHub()Whether this server represents a location to which the player gets teleported when he leaves the arena (or when the match ends).- Returns:
true
when it's a hub server
-
getMinecraftVersion
int getMinecraftVersion()Returns the minor version of the running server software.Example: If it's running 1.8.6, then this method returns 8
- Returns:
- The minor version of the running server software
- See Also:
-
getMinecraftPatchVersion
int getMinecraftPatchVersion()Returns the patch version of the running server software.Example: If it's running 1.8.6, then this method returns 6
- Returns:
- The patch version of the running server software
- See Also:
-
getPlayersCount
int getPlayersCount()Gets the total amount of players that are currently on this server.This includes ALL players, not only spectating and playing players.
- Returns:
- The amount of players on the server
-
getMaxPlayersCount
int getMaxPlayersCount()Gets the maximum amount of players that the server is able to hold.- Returns:
- The max amount of players
-
getAPIVersion
int getAPIVersion()Gets the version of the API of the Bedwars plugin that is running on the server.Obtains the info from
BedwarsAPI.getAPIVersion()
.- Returns:
- The version of the API on the server
-
getPluginVersion
String getPluginVersion()Gets the version of the Bedwars plugin that is running on the server.- Returns:
- The version of the Bedwars plugin on the server
-
executeBedwarsCommand
Executes a command on the server, as if a player would run it.Keep in mind that not all commands support that. The handler must be implemented using
CommandHandlerWrappedSender
.- Parameters:
sender
- The player who run itlabel
- The lable of the command. May be e.g. "mbedwars"args
- The arguments that he has passed
-
executeBedwarsCommandAsConsole
Executes a command on the server, as if a console would run it.Keep in mind that not all commands support that. The handler must be implemented using
CommandHandlerWrappedSender
.- Parameters:
label
- The lable of the command. May be e.g. "mbedwars"args
- The arguments that he has passed
-
sendConsoleMessage
Sends a message to the console of the given server usingCommandSender.sendMessage(String)
)- Parameters:
messages
- The messages that shall be printed into the console
-
sendCustomMessage
Sends a custom message to this server.This method is useful when you want to communicate between servers. Use
RemoteCustomMessageReceiveEvent
to listen to the message.The
channel
parameter is useful as it allows you to be distant from other plugins that make use of the messaging system as well. You may e.g. insert the name of your plugin. Note that encoded as UTF-8. You may later useRemoteCustomMessageReceiveEvent.getChannel()
to identify the channel again.- Parameters:
channel
- The channel in which you want to communicatepayload
- The actual message that you want to send. Use e.g.String.getBytes()
to pass a String.- Throws:
IllegalStateException
- When trying to send it to a local server (isLocal()
returns true)IllegalArgumentException
- When channel name is larger than 255 bytes or when payload is larger than 10MB (not a typo)- See Also:
-
getArenaByExactRealName
Looks for an arena from this server whose real name is identical to the given parameter.- Parameters:
name
- The name of the arena we are looking- Returns:
- The arena whose
RemoteArena.getRealName()
on this server matches with the parameter.null
if there is none
-