Package me.hsgamer.hscore.bukkit.channel
Class Channel
java.lang.Object
me.hsgamer.hscore.bukkit.channel.Channel
- All Implemented Interfaces:
org.bukkit.plugin.messaging.PluginMessageListener
- Direct Known Subclasses:
BungeeSubChannel
public abstract class Channel
extends Object
implements org.bukkit.plugin.messaging.PluginMessageListener
The base channel
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetName()
Get the channel's nameorg.bukkit.plugin.Plugin
Get the plugin providing the channelabstract void
handleMessage
(org.bukkit.entity.Player player, byte[] data) Handle the received data from plugin messagingvoid
onPluginMessageReceived
(String channel, org.bukkit.entity.Player player, byte[] data) void
register()
Register the channelvoid
send
(byte[] data) Send the data via the channelvoid
send
(org.bukkit.plugin.messaging.PluginMessageRecipient recipient, byte[] data) Send the data via the channel with the recipientvoid
Unregister the channel
-
Constructor Details
-
Channel
Create a new channel- Parameters:
name
- the channel nameplugin
- the plugin
-
-
Method Details
-
register
public void register()Register the channel -
unregister
public void unregister()Unregister the channel -
handleMessage
public abstract void handleMessage(org.bukkit.entity.Player player, byte[] data) Handle the received data from plugin messaging- Parameters:
player
- the player involveddata
- the data
-
send
public void send(byte[] data) Send the data via the channel- Parameters:
data
- the data
-
send
public void send(org.bukkit.plugin.messaging.PluginMessageRecipient recipient, byte[] data) Send the data via the channel with the recipient- Parameters:
recipient
- the recipientdata
- the data
-
onPluginMessageReceived
- Specified by:
onPluginMessageReceived
in interfaceorg.bukkit.plugin.messaging.PluginMessageListener
-
getName
Get the channel's name- Returns:
- the name
-
getPlugin
public org.bukkit.plugin.Plugin getPlugin()Get the plugin providing the channel- Returns:
- the plugin
-