Class Bridge
java.lang.Object
de.themoep.connectorplugin.BridgeCommon<BukkitConnectorPlugin,org.bukkit.entity.Player>
de.themoep.connectorplugin.bukkit.Bridge
- All Implemented Interfaces:
org.bukkit.event.Listener
public class Bridge
extends BridgeCommon<BukkitConnectorPlugin,org.bukkit.entity.Player>
implements org.bukkit.event.Listener
-
Nested Class Summary
Nested classes/interfaces inherited from class de.themoep.connectorplugin.BridgeCommon
BridgeCommon.Action, BridgeCommon.BridgeMessage, BridgeCommon.PlayerInfo
-
Field Summary
Fields inherited from class de.themoep.connectorplugin.BridgeCommon
consumers, playerInfoMap, plugin, RANDOM, responses
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.Location
adapt
(LocationInfo location) adapt
(org.bukkit.Location location) getLocation
(org.bukkit.entity.Player player) Get the location a player is connected togetServer
(org.bukkit.entity.Player player) Get the server a player is connected tovoid
onPlayerJoin
(org.bukkit.event.player.PlayerJoinEvent event) void
onPlayerQuit
(org.bukkit.event.player.PlayerQuitEvent event) void
onSpawnLocationEvent
(org.spigotmc.event.player.PlayerSpawnLocationEvent event) runProxyConsoleCommand
(String command, Consumer<String>... consumer) Run a console command on the connected proxiesrunProxyPlayerCommand
(org.bukkit.entity.Player player, String command) Run a command for a player on the proxy they are connected to.protected void
sendResponseData
(String target, byte[] out) sendToServer
(String playerName, String serverName, Consumer<String>... consumer) Teleport a player to a certain server in the networkteleport
(String playerName, LocationInfo location, Consumer<String>... consumer) Teleport a player to a certain location in the networkTeleport a player to a certain location in the networkTeleport a player to a certain other player in the networkteleport
(org.bukkit.entity.Player player, LocationInfo location, Consumer<String>... consumer) Teleport a player to a certain location in the networkteleport
(org.bukkit.entity.Player player, String serverName, String worldName, Consumer<String>... consumer) Teleport a player to a certain location in the networkteleport
(org.bukkit.entity.Player player, org.bukkit.entity.Player target, Consumer<String>... consumer) Teleport a player to a certain other player in the networkMethods inherited from class de.themoep.connectorplugin.BridgeCommon
addPlayerInfo, getLocation, getServer, handleResponse, isTeleporting, markTeleporting, registerHandler, registerMessageHandler, removePlayerInfo, runProxyConsoleCommand, runServerConsoleCommand, sendData, sendData, sendData, sendResponse, sendResponseMessage, unmarkTeleporting
-
Constructor Details
-
Bridge
-
-
Method Details
-
onSpawnLocationEvent
public void onSpawnLocationEvent(org.spigotmc.event.player.PlayerSpawnLocationEvent event) -
onPlayerJoin
public void onPlayerJoin(org.bukkit.event.player.PlayerJoinEvent event) -
onPlayerQuit
public void onPlayerQuit(org.bukkit.event.player.PlayerQuitEvent event) -
adapt
-
adapt
-
sendResponseData
- Specified by:
sendResponseData
in classBridgeCommon<BukkitConnectorPlugin,
org.bukkit.entity.Player>
-
sendToServer
public CompletableFuture<Boolean> sendToServer(String playerName, String serverName, Consumer<String>... consumer) Teleport a player to a certain server in the network- Parameters:
playerName
- The name of the player to sendserverName
- The name of the server to send toconsumer
- Details about the sending- Returns:
- A future about whether the player could be sent
-
teleport
public CompletableFuture<Boolean> teleport(org.bukkit.entity.Player player, LocationInfo location, Consumer<String>... consumer) Description copied from class:BridgeCommon
Teleport a player to a certain location in the network- Specified by:
teleport
in classBridgeCommon<BukkitConnectorPlugin,
org.bukkit.entity.Player> - Parameters:
player
- The player to teleportlocation
- The location to teleport toconsumer
- Details about the teleport- Returns:
- A future about whether the player could be teleported
-
teleport
public CompletableFuture<Boolean> teleport(String playerName, LocationInfo location, Consumer<String>... consumer) Description copied from class:BridgeCommon
Teleport a player to a certain location in the network- Specified by:
teleport
in classBridgeCommon<BukkitConnectorPlugin,
org.bukkit.entity.Player> - Parameters:
playerName
- The name of the player to teleportlocation
- The location to teleport toconsumer
- Details about the teleport- Returns:
- A future about whether the player could be teleported
-
teleport
public CompletableFuture<Boolean> teleport(org.bukkit.entity.Player player, String serverName, String worldName, Consumer<String>... consumer) Description copied from class:BridgeCommon
Teleport a player to a certain location in the network- Specified by:
teleport
in classBridgeCommon<BukkitConnectorPlugin,
org.bukkit.entity.Player> - Parameters:
player
- The player to teleportserverName
- The target serverworldName
- The target worldconsumer
- Details about the teleport- Returns:
- A future about whether the player could be teleported
-
teleport
public CompletableFuture<Boolean> teleport(String playerName, String serverName, String worldName, Consumer<String>... consumer) Description copied from class:BridgeCommon
Teleport a player to a certain location in the network- Specified by:
teleport
in classBridgeCommon<BukkitConnectorPlugin,
org.bukkit.entity.Player> - Parameters:
playerName
- The name of the player to teleportserverName
- The target serverworldName
- The target worldconsumer
- Details about the teleport- Returns:
- A future about whether the player could be teleported
-
teleport
public CompletableFuture<Boolean> teleport(org.bukkit.entity.Player player, org.bukkit.entity.Player target, Consumer<String>... consumer) Description copied from class:BridgeCommon
Teleport a player to a certain other player in the network- Specified by:
teleport
in classBridgeCommon<BukkitConnectorPlugin,
org.bukkit.entity.Player> - Parameters:
player
- The player to teleporttarget
- The target playerconsumer
- Details about the teleport- Returns:
- A future about whether the player could be teleported
-
teleport
public CompletableFuture<Boolean> teleport(String playerName, String targetName, Consumer<String>... consumer) Description copied from class:BridgeCommon
Teleport a player to a certain other player in the network- Specified by:
teleport
in classBridgeCommon<BukkitConnectorPlugin,
org.bukkit.entity.Player> - Parameters:
playerName
- The name of the player to teleporttargetName
- The name of the target playerconsumer
- Details about the teleport- Returns:
- A future about whether the player could be teleported
-
getServer
Get the server a player is connected to- Specified by:
getServer
in classBridgeCommon<BukkitConnectorPlugin,
org.bukkit.entity.Player> - Parameters:
player
- The player to get the server for- Returns:
- A future for when the server was queried
-
getLocation
Get the location a player is connected to- Specified by:
getLocation
in classBridgeCommon<BukkitConnectorPlugin,
org.bukkit.entity.Player> - Parameters:
player
- The player to get the location for- Returns:
- A future for when the location was queried
-
runProxyPlayerCommand
public CompletableFuture<Boolean> runProxyPlayerCommand(org.bukkit.entity.Player player, String command) Run a command for a player on the proxy they are connected to. The player needs to have access to that command!- Parameters:
player
- The player to run the command forcommand
- The command to run- Returns:
- A future for whether the command was run successfully
-
runProxyConsoleCommand
public CompletableFuture<Boolean> runProxyConsoleCommand(String command, Consumer<String>... consumer) Run a console command on the connected proxies- Parameters:
command
- The command to runconsumer
- Optional Consumer (or multiple) for the messages triggered by the command- Returns:
- A future for whether the command was run successfully
-