Class Connector<P extends ConnectorPlugin,R>
java.lang.Object
de.themoep.connectorplugin.connector.Connector<P,R>
- Direct Known Subclasses:
BukkitConnector
,BungeeConnector
,VelocityConnector
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected R
getReceiver
(String name) protected abstract R
protected void
protected void
protected boolean
protected boolean
BiConsumer<R,
byte[]> registerHandler
(ConnectingPlugin plugin, String action, BiConsumer<R, byte[]> handler) Deprecated.Since 1.5.registerMessageHandler
(ConnectingPlugin plugin, String action, BiConsumer<R, Message> handler) Register a handler for a certain messageboolean
Whether this connector requires a player on the target server.void
sendData
(ConnectingPlugin sender, String action, MessageTarget target, byte[] data) Send data to a specific targetvoid
sendData
(ConnectingPlugin sender, String action, MessageTarget target, String targetData, byte[] data) Send data to a specific targetvoid
sendData
(ConnectingPlugin sender, String action, MessageTarget target, R player, byte[] data) Send data to a specific targetprotected abstract void
sendDataImplementation
(Object targetData, Message message) void
sendDataInternal
(ConnectingPlugin sender, String action, MessageTarget target, Object targetData, byte[] data) BiConsumer<R,
byte[]> unregisterHandler
(ConnectingPlugin plugin, String action) Deprecated.Since 1.5.Map<String,
BiConsumer<R, byte[]>> unregisterHandlers
(ConnectingPlugin plugin) Deprecated.Since 1.5.unregisterMessageHandler
(ConnectingPlugin plugin, String action) Unregister a handler from a certain actionUnregister all handlers of a certain plugin
-
Field Details
-
plugin
-
PROXY_ID_PREFIX
Use for prefixing the ID of the proxy- See Also:
-
SERVER_PREFIX
Used for identifying the target type- See Also:
-
PLAYER_PREFIX
- See Also:
-
-
Constructor Details
-
Connector
-
-
Method Details
-
handle
-
handle
-
sendData
Send data to a specific target- Parameters:
sender
- The plugin which sends the dataaction
- The action for which data is senttarget
- Where to send data todata
- The data
-
sendData
public void sendData(ConnectingPlugin sender, String action, MessageTarget target, R player, byte[] data) Send data to a specific target- Parameters:
sender
- The plugin which sends the dataaction
- The action for which data is senttarget
- Where to send data toplayer
- Additional player data to use for sending (required in case the target isMessageTarget.SERVER
orMessageTarget.PROXY
)data
- The data
-
sendData
public void sendData(ConnectingPlugin sender, String action, MessageTarget target, String targetData, byte[] data) Send data to a specific target- Parameters:
sender
- The plugin which sends the dataaction
- The action for which data is senttarget
- Where to send data totargetData
- Additional data to use for sending (required in case the target isMessageTarget.SERVER
)data
- The data
-
sendDataInternal
public void sendDataInternal(ConnectingPlugin sender, String action, MessageTarget target, Object targetData, byte[] data) -
sendDataImplementation
-
hasPrefix
-
getReceiver
-
getReceiverImplementation
-
isThis
-
registerHandler
@Deprecated public BiConsumer<R,byte[]> registerHandler(ConnectingPlugin plugin, String action, BiConsumer<R, byte[]> handler) Deprecated.Since 1.5. UseregisterMessageHandler(ConnectingPlugin, String, BiConsumer)
Register a handler for a certain action- Parameters:
plugin
- The plugin to register the handler foraction
- The action to register (case sensitive)handler
- A BiConsumer which takes the receiving player and the data- Returns:
- The previously registered handler if there was one
-
unregisterHandler
Deprecated.Since 1.5. UseunregisterMessageHandler(ConnectingPlugin, String)
Unregister a handler from a certain action- Parameters:
plugin
- The plugin to unregister the handler ofaction
- The action to unregister (case sensitive)- Returns:
- The previously registered handler if there was one or null
-
unregisterHandlers
Deprecated.Since 1.5. UseunregisterMessageHandlers(ConnectingPlugin)
Unregister a all handlers of a certain plugin- Parameters:
plugin
- The plugin to unregister the handlers of- Returns:
- The previously registered handlers if there were some or null
-
registerMessageHandler
public BiConsumer<R,Message> registerMessageHandler(ConnectingPlugin plugin, String action, BiConsumer<R, Message> handler) Register a handler for a certain message- Parameters:
plugin
- The plugin to register the handler foraction
- The action to register (case sensitive)handler
- A BiConsumer which takes the receiving player and the Message- Returns:
- The previously registered handler if there was one
- Since:
- 1.5
-
unregisterMessageHandler
Unregister a handler from a certain action- Parameters:
plugin
- The plugin to unregister the handler ofaction
- The action to unregister (case sensitive)- Returns:
- The previously registered handler if there was one or null
- Since:
- 1.5
-
unregisterMessageHandlers
Unregister all handlers of a certain plugin- Parameters:
plugin
- The plugin to unregister the handlers of- Returns:
- The previously registered handlers if there were some or null
- Since:
- 1.5
-
requiresPlayer
public boolean requiresPlayer()Whether this connector requires a player on the target server. (Mostly for plugin message usage)- Returns:
- Whether this connector requires at least one player on the target server
-
close
public void close()
-