當前位置: 首頁>>代碼示例>>Java>>正文


Java PluginMessageListener類代碼示例

本文整理匯總了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();
}
 
開發者ID:CodeCrafter47,項目名稱:FreeBungeeChat,代碼行數:34,代碼來源:FreeBungeeChatBukkit.java

示例2: registerIncomingPluginChannel

import org.bukkit.plugin.messaging.PluginMessageListener; //導入依賴的package包/類
@Override
public PluginMessageListenerRegistration registerIncomingPluginChannel(Plugin plugin, String channel, PluginMessageListener listener) {
    throw new UnsupportedOperationException();
}
 
開發者ID:zachbr,項目名稱:Debuggery,代碼行數:5,代碼來源:TestMessenger.java

示例3: unregisterIncomingPluginChannel

import org.bukkit.plugin.messaging.PluginMessageListener; //導入依賴的package包/類
@Override
public void unregisterIncomingPluginChannel(Plugin plugin, String channel, PluginMessageListener listener) {
    throw new UnsupportedOperationException();
}
 
開發者ID:zachbr,項目名稱:Debuggery,代碼行數:5,代碼來源:TestMessenger.java

示例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);
}
 
開發者ID:rutgerkok,項目名稱:Pokkit,代碼行數:6,代碼來源:PokkitPluginMessenger.java

示例5: unregisterIncomingPluginChannel

import org.bukkit.plugin.messaging.PluginMessageListener; //導入依賴的package包/類
@Override
public void unregisterIncomingPluginChannel(Plugin plugin, String channel, PluginMessageListener listener) {
	// Do nothing
}
 
開發者ID:rutgerkok,項目名稱:Pokkit,代碼行數:5,代碼來源:PokkitPluginMessenger.java

示例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.
}
 
開發者ID:deathcap,項目名稱:Junket,代碼行數:5,代碼來源:MessengerImpl.java

示例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.
}
 
開發者ID:deathcap,項目名稱:Junket,代碼行數:5,代碼來源:MessengerImpl.java

示例8: registerIncomingPluginChannel

import org.bukkit.plugin.messaging.PluginMessageListener; //導入依賴的package包/類
public PluginMessageListenerRegistration registerIncomingPluginChannel(Plugin plugin, String channel, PluginMessageListener listener) {
	return null;
}
 
開發者ID:deathcap,項目名稱:BedrockAPI,代碼行數:4,代碼來源:StandardMessenger.java

示例9: unregisterIncomingPluginChannel

import org.bukkit.plugin.messaging.PluginMessageListener; //導入依賴的package包/類
public void unregisterIncomingPluginChannel(Plugin plugin, String channel, PluginMessageListener listener) {
}
 
開發者ID:deathcap,項目名稱:BedrockAPI,代碼行數:3,代碼來源:StandardMessenger.java

示例10: PluginMessageListenerRegistration

import org.bukkit.plugin.messaging.PluginMessageListener; //導入依賴的package包/類
public PluginMessageListenerRegistration(Messenger messenger, Plugin plugin, String channel, PluginMessageListener listener) {
}
 
開發者ID:deathcap,項目名稱:BedrockAPI,代碼行數:3,代碼來源:PluginMessageListenerRegistration.java

示例11: getListener

import org.bukkit.plugin.messaging.PluginMessageListener; //導入依賴的package包/類
public PluginMessageListener getListener() {
	return null;
}
 
開發者ID:deathcap,項目名稱:BedrockAPI,代碼行數:4,代碼來源:PluginMessageListenerRegistration.java

示例12: registerIncomingPluginChannel

import org.bukkit.plugin.messaging.PluginMessageListener; //導入依賴的package包/類
PluginMessageListenerRegistration registerIncomingPluginChannel(Plugin plugin, String channel, PluginMessageListener listener); 
開發者ID:deathcap,項目名稱:BedrockAPI,代碼行數:2,代碼來源:Messenger.java

示例13: unregisterIncomingPluginChannel

import org.bukkit.plugin.messaging.PluginMessageListener; //導入依賴的package包/類
void unregisterIncomingPluginChannel(Plugin plugin, String channel, PluginMessageListener listener); 
開發者ID:deathcap,項目名稱:BedrockAPI,代碼行數:2,代碼來源:Messenger.java


注:本文中的org.bukkit.plugin.messaging.PluginMessageListener類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。