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


Java Messenger類代碼示例

本文整理匯總了Java中org.bukkit.plugin.messaging.Messenger的典型用法代碼示例。如果您正苦於以下問題:Java Messenger類的具體用法?Java Messenger怎麽用?Java Messenger使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Messenger類屬於org.bukkit.plugin.messaging包,在下文中一共展示了Messenger類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: registerHooks

import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
protected void registerHooks()
{
	this.playerListener = new PlayerListener(this);
	if (VersionHelper.hasRequiredVersion("1.4.7"))
		this.dynamicPlayerListener = new DynamicPlayerListener_1_5(this, playerListener);
	else
		this.dynamicPlayerListener = new DynamicPlayerListener_1_4_2(this, playerListener);
	this.dynamicVehicleListener = new DynamicVehicleListener(this);
	final CrazyListener crazylistener = new CrazyListener(this, playerListener);
	final PluginManager pm = Bukkit.getPluginManager();
	pm.registerEvents(playerListener, this);
	pm.registerEvents(crazylistener, this);
	pm.registerEvents(new WorldListener(this), this);
	registerDynamicHooks();
	messageListener = new MessageListener(this);
	final Messenger ms = getServer().getMessenger();
	ms.registerIncomingPluginChannel(this, "CrazyLogin", messageListener);
	ms.registerOutgoingPluginChannel(this, "CrazyLogin");
}
 
開發者ID:ST-DDT,項目名稱:CrazyLogin,代碼行數:20,代碼來源:CrazyLogin.java

示例2: getOutput

import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
@Nullable
public static String getOutput(@Nullable Object object) {

    if (object == null) {
        return null;
    }

    if (object instanceof String) {
        return (String) object;
    } else if (object instanceof Collection) {
        return handleCollection((Collection) object);
    } else if (object instanceof Map) {
        return handleMap((Map) object);
    } else if (object.getClass().isArray()) {
        return handleArray(object);
    } else if (object instanceof OfflinePlayer) {
        return handleOfflinePlayer((OfflinePlayer) object);
    } else if (object instanceof BlockState) {
        return handleBlockState((BlockState) object);
    } else if (object instanceof Inventory) {
        return handleInventory((Inventory) object);
    } else if (object instanceof WorldBorder) {
        return handleWorldBorder((WorldBorder) object);
    } else if (object instanceof CommandSender) {
        return handleCommandSender((CommandSender) object);
    } else if (object instanceof Messenger) {
        return handleMessenger((Messenger) object);
    } else if (object instanceof HelpMap) {
        return handleHelpMap((HelpMap) object);
    } else {
        return String.valueOf(object);
    }
}
 
開發者ID:zachbr,項目名稱:Debuggery,代碼行數:34,代碼來源:OutputFormatter.java

示例3: handleMessenger

import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
@Nonnull
private static String handleMessenger(Messenger messenger) {
    String incomingBanner = "-- Incoming Channels --\n";
    String incomingChannels = handleCollection(messenger.getIncomingChannels());
    String outgoingBanner = "\n-- Outgoing Channels --\n";
    String outgoingChannels = handleCollection(messenger.getOutgoingChannels());

    return incomingBanner + incomingChannels + outgoingBanner + outgoingChannels;
}
 
開發者ID:zachbr,項目名稱:Debuggery,代碼行數:10,代碼來源:OutputFormatter.java

示例4: testMessenger

import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
@Test
public void testMessenger() {
    String debuggeryIn = "Debuggery In";
    String debuggeryOut = "Debuggery Out";
    String tacoInOut = "Taco Listener";
    String stuffIn = "Other stuff";
    String stuffOut = "Something here";

    Set<String> messengersIn = new HashSet<>();
    Set<String> messengersOut = new HashSet<>();

    messengersIn.add(debuggeryIn);
    messengersIn.add(tacoInOut);
    messengersIn.add(stuffIn);

    messengersOut.add(debuggeryOut);
    messengersOut.add(tacoInOut);
    messengersOut.add(stuffOut);

    Messenger messenger = new TestMessenger(messengersIn, messengersOut);

    String out = OutputFormatter.getOutput(messenger);

    assertNotNull(out);

    String[] sections = out.split("}\\n");
    String incoming = sections[0];
    String outgoing = sections[1];

    assertTrue(incoming.contains(debuggeryIn));
    assertTrue(incoming.contains(tacoInOut));
    assertTrue(incoming.contains(stuffIn));

    assertTrue(outgoing.contains(debuggeryOut));
    assertTrue(outgoing.contains(tacoInOut));
    assertTrue(outgoing.contains(stuffOut));

}
 
開發者ID:zachbr,項目名稱:Debuggery,代碼行數:39,代碼來源:OutputFormatterTest.java

示例5: setTexturePack

import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
public void setTexturePack(String url) {
    Validate.notNull(url, "Texture pack URL cannot be null");

    byte[] message = (url + "\0" + "16").getBytes();
    Validate.isTrue(message.length <= Messenger.MAX_MESSAGE_SIZE, "Texture pack URL is too long");

    getHandle().playerConnection.sendPacket(new Packet250CustomPayload("MC|TPack", message));
}
 
開發者ID:AlmuraDev,項目名稱:Almura-Server,代碼行數:9,代碼來源:CraftPlayer.java

示例6: init

import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
private void init() {
	Messenger m = Bukkit.getServer().getMessenger();
	if ( !m.isOutgoingChannelRegistered(ParchmentPluginLite.instance(), channel) )
		m.registerOutgoingPluginChannel(ParchmentPluginLite.instance(), channel);

	if ( !m.isIncomingChannelRegistered(ParchmentPluginLite.instance(), channel) ) {
		m.registerIncomingPluginChannel(ParchmentPluginLite.instance(), channel, this);
	}
}
 
開發者ID:basicer,項目名稱:parchment,代碼行數:10,代碼來源:Bungee.java

示例7: BukkitPacketManager

import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
public BukkitPacketManager(JavaPlugin bukkitPlugin, String channel){
    super(channel);
    this.bukkitPlugin = bukkitPlugin;

    Messenger messenger = Bukkit.getMessenger();

    messenger.registerOutgoingPluginChannel(bukkitPlugin, channel);
    messenger.registerIncomingPluginChannel(bukkitPlugin, channel, this);
    messenger.registerIncomingPluginChannel(bukkitPlugin, "BungeeCord", this);
    messenger.registerOutgoingPluginChannel(bukkitPlugin, "BungeeCord");

    Bukkit.getPluginManager().registerEvents(this, bukkitPlugin);
}
 
開發者ID:iKeirNez,項目名稱:PluginMessageAPI-Plus-LEGACY,代碼行數:14,代碼來源:BukkitPacketManager.java

示例8: register

import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
@Override
public void register() {
    Messenger messenger = Bukkit.getMessenger();
    messenger.registerOutgoingPluginChannel(plugin, BUNGEE_CHANNEL);
    messenger.registerIncomingPluginChannel(plugin, BUNGEE_CHANNEL, this);

    Bukkit.getScheduler().runTaskTimer(plugin, this, UPDATE_INTERVAL, UPDATE_INTERVAL);

    register("bungee-online").scoreSupply(() -> onlinePlayers);
}
 
開發者ID:games647,項目名稱:ScoreboardStats,代碼行數:11,代碼來源:BungeeCordVariables.java

示例9: reload

import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
@Override
public void reload(Settings settings) {
    this.isEnabled = settings.getProperty(HooksSettings.BUNGEECORD);
    this.destinationServerOnLogin = settings.getProperty(HooksSettings.BUNGEECORD_SERVER);

    if (this.isEnabled) {
        Messenger messenger = plugin.getServer().getMessenger();
        if (!messenger.isOutgoingChannelRegistered(plugin, "BungeeCord")) {
            messenger.registerOutgoingPluginChannel(plugin, "BungeeCord");
        }
    }
}
 
開發者ID:AuthMe,項目名稱:AuthMeReloaded,代碼行數:13,代碼來源:BungeeSender.java

示例10: reload

import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
@Override
public void reload(Settings settings) {
    this.isEnabled = settings.getProperty(HooksSettings.BUNGEECORD);

    if (this.isEnabled) {
        Messenger messenger = plugin.getServer().getMessenger();
        if (!messenger.isIncomingChannelRegistered(plugin, "BungeeCord")) {
            messenger.registerIncomingPluginChannel(plugin, "BungeeCord", this);
        }
    }
}
 
開發者ID:AuthMe,項目名稱:AuthMeReloaded,代碼行數:12,代碼來源:BungeeReceiver.java

示例11: setTexturePack

import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
public void setTexturePack(String url) {
    Validate.notNull(url, "Texture pack URL cannot be null");

    byte[] message = (url + "\0" + "16").getBytes();
    Validate.isTrue(message.length <= Messenger.MAX_MESSAGE_SIZE, "Texture pack URL is too long");

    getHandle().field_71135_a.func_72567_b(new net.minecraft.network.packet.Packet250CustomPayload("MC|TPack", message));
}
 
開發者ID:agaricusb,項目名稱:MCPBukkit,代碼行數:9,代碼來源:CraftPlayer.java

示例12: getMessenger

import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
@Override
public Messenger getMessenger() {
    return messenger;
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:5,代碼來源:CraftServer.java

示例13: PlayerServerChanger

import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
@Inject PlayerServerChanger(Plugin plugin, Messenger messenger, Server localServer) {
    this.plugin = plugin;
    this.messenger = messenger;
    this.localServer = localServer;
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:6,代碼來源:PlayerServerChanger.java

示例14: getMessenger

import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
@Override
public Messenger getMessenger()
{
	// TODO Auto-generated method stub
	throw new UnimplementedOperationException();
}
 
開發者ID:seeseemelk,項目名稱:MockBukkit,代碼行數:7,代碼來源:ServerMock.java

示例15: getMessenger

import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
@Override
public Messenger getMessenger() {
    throw new UnsupportedOperationException();
}
 
開發者ID:lukas81298,項目名稱:FlexMC,代碼行數:5,代碼來源:FlexServerImpl.java


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