本文整理匯總了Java中org.bukkit.plugin.messaging.PluginMessageListener類的典型用法代碼示例。如果您正苦於以下問題:Java PluginMessageListener類的具體用法?Java PluginMessageListener怎麽用?Java PluginMessageListener使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PluginMessageListener類屬於org.bukkit.plugin.messaging包,在下文中一共展示了PluginMessageListener類的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onEnable
import org.bukkit.plugin.messaging.PluginMessageListener; //導入依賴的package包/類
@Override
public void onEnable() {
registerVariables();
getServer().getMessenger().registerOutgoingPluginChannel(this,
Constants.channel);
getServer().getMessenger().registerIncomingPluginChannel(this,
Constants.channel, new PluginMessageListener() {
@Override
@SneakyThrows
public void onPluginMessageReceived(String string,
Player player, byte[] bytes) {
try {
ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes));
Object object = in.readObject();
Class c = Class.forName((String) object);
Constructor[] constructors = c.getConstructors();
if (constructors.length == 1) {
Object[] args = (Object[]) in.readObject();
BukkitTask task = (BukkitTask) constructors[0].newInstance(args);
task.execute(FreeBungeeChatBukkit.this, player);
} else {
getLogger().severe("received invalid task from bungee: " + c);
}
} catch (Throwable th) {
getLogger().log(Level.SEVERE, "failed to parse data from bungee", th);
}
}
});
getServer().getPluginManager().registerEvents(this, this);
initPlayerConnections();
}
示例2: registerIncomingPluginChannel
import org.bukkit.plugin.messaging.PluginMessageListener; //導入依賴的package包/類
@Override
public PluginMessageListenerRegistration registerIncomingPluginChannel(Plugin plugin, String channel, PluginMessageListener listener) {
throw new UnsupportedOperationException();
}
示例3: unregisterIncomingPluginChannel
import org.bukkit.plugin.messaging.PluginMessageListener; //導入依賴的package包/類
@Override
public void unregisterIncomingPluginChannel(Plugin plugin, String channel, PluginMessageListener listener) {
throw new UnsupportedOperationException();
}
示例4: registerIncomingPluginChannel
import org.bukkit.plugin.messaging.PluginMessageListener; //導入依賴的package包/類
@Override
public PluginMessageListenerRegistration registerIncomingPluginChannel(Plugin plugin, String channel,
PluginMessageListener listener) {
return new PluginMessageListenerRegistration(this, plugin, channel, listener);
}
示例5: unregisterIncomingPluginChannel
import org.bukkit.plugin.messaging.PluginMessageListener; //導入依賴的package包/類
@Override
public void unregisterIncomingPluginChannel(Plugin plugin, String channel, PluginMessageListener listener) {
// Do nothing
}
示例6: registerIncomingPluginChannel
import org.bukkit.plugin.messaging.PluginMessageListener; //導入依賴的package包/類
@Override
public PluginMessageListenerRegistration registerIncomingPluginChannel(Plugin plugin, String channel, PluginMessageListener listener) {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
示例7: unregisterIncomingPluginChannel
import org.bukkit.plugin.messaging.PluginMessageListener; //導入依賴的package包/類
@Override
public void unregisterIncomingPluginChannel(Plugin plugin, String channel, PluginMessageListener listener) {
//To change body of implemented methods use File | Settings | File Templates.
}
示例8: registerIncomingPluginChannel
import org.bukkit.plugin.messaging.PluginMessageListener; //導入依賴的package包/類
public PluginMessageListenerRegistration registerIncomingPluginChannel(Plugin plugin, String channel, PluginMessageListener listener) {
return null;
}
示例9: unregisterIncomingPluginChannel
import org.bukkit.plugin.messaging.PluginMessageListener; //導入依賴的package包/類
public void unregisterIncomingPluginChannel(Plugin plugin, String channel, PluginMessageListener listener) {
}
示例10: PluginMessageListenerRegistration
import org.bukkit.plugin.messaging.PluginMessageListener; //導入依賴的package包/類
public PluginMessageListenerRegistration(Messenger messenger, Plugin plugin, String channel, PluginMessageListener listener) {
}
示例11: getListener
import org.bukkit.plugin.messaging.PluginMessageListener; //導入依賴的package包/類
public PluginMessageListener getListener() {
return null;
}
示例12: registerIncomingPluginChannel
import org.bukkit.plugin.messaging.PluginMessageListener; //導入依賴的package包/類
PluginMessageListenerRegistration registerIncomingPluginChannel(Plugin plugin, String channel, PluginMessageListener listener);
示例13: unregisterIncomingPluginChannel
import org.bukkit.plugin.messaging.PluginMessageListener; //導入依賴的package包/類
void unregisterIncomingPluginChannel(Plugin plugin, String channel, PluginMessageListener listener);