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
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetName()Get the channel's nameorg.bukkit.plugin.PluginGet the plugin providing the channelabstract voidhandleMessage(org.bukkit.entity.Player player, byte[] data) Handle the received data from plugin messagingvoidonPluginMessageReceived(String channel, org.bukkit.entity.Player player, byte[] data) voidregister()Register the channelvoidsend(byte[] data) Send the data via the channelvoidsend(org.bukkit.plugin.messaging.PluginMessageRecipient recipient, byte[] data) Send the data via the channel with the recipientvoidUnregister 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:
onPluginMessageReceivedin 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
-