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

项目:CrazyLogin    文件:CrazyLogin.java   
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");
}
项目:Debuggery    文件:OutputFormatter.java   
@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);
    }
}
项目:Debuggery    文件:OutputFormatter.java   
@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;
}
项目:Debuggery    文件:OutputFormatterTest.java   
@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));

}
项目:Almura-Server    文件:CraftPlayer.java   
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));
}
项目:parchment    文件:Bungee.java   
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);
    }
}
项目:PluginMessageAPI-Plus-LEGACY    文件:BukkitPacketManager.java   
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);
}
项目:ScoreboardStats    文件:BungeeCordVariables.java   
@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);
}
项目:AuthMeReloaded    文件:BungeeSender.java   
@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");
        }
    }
}
项目:AuthMeReloaded    文件:BungeeReceiver.java   
@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);
        }
    }
}
项目:Craft-city    文件:CraftPlayer.java   
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));
}
项目:MCPBukkit    文件:CraftPlayer.java   
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));
}
项目:PluginMessageAPI-Plus-LEGACY    文件:BukkitPacketManager.java   
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);
}
项目:Uranium    文件:CraftServer.java   
@Override
public Messenger getMessenger() {
    return messenger;
}
项目:ProjectAres    文件:PlayerServerChanger.java   
@Inject PlayerServerChanger(Plugin plugin, Messenger messenger, Server localServer) {
    this.plugin = plugin;
    this.messenger = messenger;
    this.localServer = localServer;
}
项目:MockBukkit    文件:ServerMock.java   
@Override
public Messenger getMessenger()
{
    // TODO Auto-generated method stub
    throw new UnimplementedOperationException();
}
项目:FlexMC    文件:FlexServerImpl.java   
@Override
public Messenger getMessenger() {
    throw new UnsupportedOperationException();
}
项目:Bukkit2Sponge    文件:FakeServer.java   
@Override
public Messenger getMessenger() {
    return null; // TODO: Create Messenger
}
项目:netherrack    文件:NetherServer.java   
@Override
public Messenger getMessenger() {
    // TODO Auto-generated method stub
    return null;
}
项目:Karus-Commons    文件:StubServer.java   
@Override
public Messenger getMessenger() {
    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
项目:ThermosRebased    文件:CraftServer.java   
@Override
public Messenger getMessenger() {
    return messenger;
}
项目:Thermos-Bukkit    文件:Bukkit.java   
/**
 * @see Server#getMessenger()
 */
public static Messenger getMessenger() {
    return server.getMessenger();
}
项目:Brynhildr    文件:NukkitServer.java   
@Override
public Messenger getMessenger() {
    return null;
}
项目:ExilePearl    文件:TestServer.java   
@Override
public Messenger getMessenger() {
       return messenger;
}
项目:SaneEconomy    文件:MockServer.java   
@Override
public Messenger getMessenger() {
    return null;
}
项目:Pokkit    文件:CraftServer.java   
@Override
public Messenger getMessenger() {
    return messenger;
}
项目:Bukkit_Bungee_PluginLib    文件:TestBukkitServer.java   
@Override
public Messenger getMessenger()
{
    return null;
}
项目:Thermos    文件:CraftServer.java   
@Override
public Messenger getMessenger() {
    return messenger;
}
项目:KCauldron    文件:CraftServer.java   
@Override
public Messenger getMessenger() {
    return messenger;
}
项目:CauldronGit    文件:Bukkit.java   
/**
 * @see Server#getMessenger()
 */
public static Messenger getMessenger() {
    return server.getMessenger();
}
项目:CauldronGit    文件:CraftServer.java   
@Override
public Messenger getMessenger() {
    return messenger;
}
项目:CanaryBukkit    文件:CanaryServer.java   
public Messenger getMessenger() {
    return messenger;
}
项目:Cauldron-Old    文件:CraftServer.java   
@Override
public Messenger getMessenger() {
    return messenger;
}
项目:DiffUtils    文件:CraftServer_188.java   
@Override
public Messenger getMessenger() {
    return messenger;
}
项目:DiffUtils    文件:CraftServer_1710.java   
@Override
public Messenger getMessenger() {
    return messenger;
}
项目:Cauldron-Reloaded    文件:CraftServer.java   
@Override
public Messenger getMessenger() {
    return messenger;
}
项目:FFoKC    文件:CraftServer.java   
@Override
public Messenger getMessenger() {
    return messenger;
}
项目:CraftBukkit    文件:CraftServer.java   
@Override
public Messenger getMessenger() {
    return messenger;
}
项目:Craftbukkit    文件:CraftServer.java   
@Override
public Messenger getMessenger() {
    return messenger;
}
项目:Almura-Server    文件:CraftServer.java   
public Messenger getMessenger() {
    return messenger;
}