Java 类org.bukkit.plugin.messaging.PluginMessageListener 实例源码

项目:FreeBungeeChat    文件:FreeBungeeChatBukkit.java   
@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();
}
项目:Debuggery    文件:TestMessenger.java   
@Override
public PluginMessageListenerRegistration registerIncomingPluginChannel(Plugin plugin, String channel, PluginMessageListener listener) {
    throw new UnsupportedOperationException();
}
项目:Debuggery    文件:TestMessenger.java   
@Override
public void unregisterIncomingPluginChannel(Plugin plugin, String channel, PluginMessageListener listener) {
    throw new UnsupportedOperationException();
}
项目:Pokkit    文件:PokkitPluginMessenger.java   
@Override
public PluginMessageListenerRegistration registerIncomingPluginChannel(Plugin plugin, String channel,
        PluginMessageListener listener) {
    return new PluginMessageListenerRegistration(this, plugin, channel, listener);
}
项目:Pokkit    文件:PokkitPluginMessenger.java   
@Override
public void unregisterIncomingPluginChannel(Plugin plugin, String channel, PluginMessageListener listener) {
    // Do nothing
}
项目:Junket    文件:MessengerImpl.java   
@Override
public PluginMessageListenerRegistration registerIncomingPluginChannel(Plugin plugin, String channel, PluginMessageListener listener) {
    return null;  //To change body of implemented methods use File | Settings | File Templates.
}
项目:Junket    文件:MessengerImpl.java   
@Override
public void unregisterIncomingPluginChannel(Plugin plugin, String channel, PluginMessageListener listener) {
    //To change body of implemented methods use File | Settings | File Templates.
}
项目:BedrockAPI    文件:StandardMessenger.java   
public PluginMessageListenerRegistration registerIncomingPluginChannel(Plugin plugin, String channel, PluginMessageListener listener) {
    return null;
}
项目:BedrockAPI    文件:StandardMessenger.java   
public void unregisterIncomingPluginChannel(Plugin plugin, String channel, PluginMessageListener listener) {
}
项目:BedrockAPI    文件:PluginMessageListenerRegistration.java   
public PluginMessageListenerRegistration(Messenger messenger, Plugin plugin, String channel, PluginMessageListener listener) {
}
项目:BedrockAPI    文件:PluginMessageListenerRegistration.java   
public PluginMessageListener getListener() {
    return null;
}
项目:BedrockAPI    文件:Messenger.java   
PluginMessageListenerRegistration registerIncomingPluginChannel(Plugin plugin, String channel, PluginMessageListener listener);
项目:BedrockAPI    文件:Messenger.java   
void unregisterIncomingPluginChannel(Plugin plugin, String channel, PluginMessageListener listener);