@NonnullByDefault public final class BungeeCordImpl extends Object implements BungeeCord, PluginMessageListener
ALL_SERVERS, ONLINE_SERVERS| Constructor and Description |
|---|
BungeeCordImpl(HelperPlugin plugin) |
| Modifier and Type | Method and Description |
|---|---|
void |
connect(Player player,
String serverName)
Connects a player to said subserver
|
void |
connectOther(String playerName,
String serverName)
Connects a named player to said subserver
|
void |
forward(String serverName,
String channelName,
byte[] data)
Sends a custom plugin message to a given server.
|
void |
forward(String serverName,
String channelName,
ByteArrayDataOutput data)
Sends a custom plugin message to a given server.
|
void |
forwardToPlayer(String playerName,
String channelName,
byte[] data)
Sends a custom plugin message to a given server.
|
void |
forwardToPlayer(String playerName,
String channelName,
ByteArrayDataOutput data)
Sends a custom plugin message to a given server.
|
Promise<String> |
getServer()
Gets this servers name, as defined in the BungeeCord config
|
Promise<List<String>> |
getServers()
Get a list of server name strings, as defined in the BungeeCord config
|
Promise<Map.Entry<String,Integer>> |
ip(Player player)
Get the real IP of a player
|
void |
kickPlayer(String playerName,
String reason)
Kick a player from the proxy
|
void |
message(String playerName,
String message)
Send a message (as in chat message) to the specified player
|
void |
onPluginMessageReceived(String channel,
Player player,
byte[] data) |
Promise<Integer> |
playerCount(String serverName)
Gets the amount of players on a certain server, or all servers
|
Promise<List<String>> |
playerList(String serverName)
Gets a list of players connected on a certain server, or all servers.
|
void |
registerForwardCallback(String channelName,
Predicate<ByteArrayDataInput> callback)
Registers a callback to listen for messages sent on forwarded subchannels.
|
void |
registerForwardCallbackRaw(String channelName,
Predicate<byte[]> callback)
Registers a callback to listen for messages sent on forwarded subchannels.
|
Promise<Map.Entry<String,Integer>> |
serverIp(String serverName)
Get the IP of any server connected to the proxy
|
Promise<UUID> |
uuid(Player player)
Get the UUID of a player
|
Promise<UUID> |
uuidOther(String playerName)
Get the UUID of any player connected to the proxy
|
public BungeeCordImpl(HelperPlugin plugin)
public void onPluginMessageReceived(String channel, Player player, byte[] data)
onPluginMessageReceived in interface PluginMessageListenerpublic void connect(Player player, String serverName)
BungeeCordconnect in interface BungeeCordplayer - the player to connectserverName - the name of the server to connect topublic void connectOther(String playerName, String serverName)
BungeeCordconnectOther in interface BungeeCordplayerName - the username of the player to connectserverName - the name of the server to connect topublic Promise<Map.Entry<String,Integer>> ip(Player player)
BungeeCordip in interface BungeeCordplayer - the player to get the IP ofpublic Promise<Integer> playerCount(String serverName)
BungeeCordplayerCount in interface BungeeCordserverName - the name of the server to get the player count for. Use BungeeCord.ALL_SERVERS to get the global countpublic Promise<List<String>> playerList(String serverName)
BungeeCordplayerList in interface BungeeCordserverName - the name of the server to get the player list for. Use BungeeCord.ALL_SERVERS to get the global listpublic Promise<List<String>> getServers()
BungeeCordgetServers in interface BungeeCordpublic void message(String playerName, String message)
BungeeCordmessage in interface BungeeCordplayerName - the username of the player to send the message tomessage - the message to sendpublic Promise<String> getServer()
BungeeCordgetServer in interface BungeeCordpublic Promise<UUID> uuid(Player player)
BungeeCorduuid in interface BungeeCordplayer - the player to get the uuid ofpublic Promise<UUID> uuidOther(String playerName)
BungeeCorduuidOther in interface BungeeCordplayerName - the username of the player to get the uuid ofpublic Promise<Map.Entry<String,Integer>> serverIp(String serverName)
BungeeCordserverIp in interface BungeeCordserverName - the name of the server to get the ip ofpublic void kickPlayer(String playerName, String reason)
BungeeCordkickPlayer in interface BungeeCordplayerName - the username of the player to kickreason - the reason to display to the player when they are kickedpublic void forward(String serverName, String channelName, byte[] data)
BungeeCordYou can use BungeeCord.registerForwardCallbackRaw(String, Predicate) to register listeners on a given subchannel.
forward in interface BungeeCordserverName - the name of the server to send to. use BungeeCord.ALL_SERVERS to send to all servers, or BungeeCord.ONLINE_SERVERS to only send to servers which are online.channelName - the name of the subchanneldata - the data to sendpublic void forward(String serverName, String channelName, ByteArrayDataOutput data)
BungeeCordYou can use BungeeCord.registerForwardCallback(String, Predicate) to register listeners on a given subchannel.
forward in interface BungeeCordserverName - the name of the server to send to. use BungeeCord.ALL_SERVERS to send to all servers, or BungeeCord.ONLINE_SERVERS to only send to servers which are online.channelName - the name of the subchanneldata - the data to sendpublic void forwardToPlayer(String playerName, String channelName, byte[] data)
BungeeCordYou can use BungeeCord.registerForwardCallbackRaw(String, Predicate) to register listeners on a given subchannel.
forwardToPlayer in interface BungeeCordplayerName - the username of a player. BungeeCord will send the forward message to their server.channelName - the name of the subchanneldata - the data to sendpublic void forwardToPlayer(String playerName, String channelName, ByteArrayDataOutput data)
BungeeCordYou can use BungeeCord.registerForwardCallback(String, Predicate) to register listeners on a given subchannel.
forwardToPlayer in interface BungeeCordplayerName - the username of a player. BungeeCord will send the forward message to their server.channelName - the name of the subchanneldata - the data to sendpublic void registerForwardCallbackRaw(String channelName, Predicate<byte[]> callback)
BungeeCordUse BungeeCord.forward(String, String, byte[]) to dispatch messages.
registerForwardCallbackRaw in interface BungeeCordchannelName - the name of the channel to listen oncallback - the callback. the predicate should return true when the callback should be unregistered.public void registerForwardCallback(String channelName, Predicate<ByteArrayDataInput> callback)
BungeeCordUse BungeeCord.forward(String, String, ByteArrayDataOutput) to dispatch messages.
registerForwardCallback in interface BungeeCordchannelName - the name of the channel to listen oncallback - the callback. the predicate should return true when the callback should be unregistered.Copyright © 2020. All rights reserved.