Solved Messaging channel

Discussion in 'Spigot Plugin Development' started by JoeyPlayzTV, Jun 10, 2019.

Thread Status:
Not open for further replies.
  1. Hello i have this exception by using the plugin channels on 1.14.2 java.lang.IllegalArgumentException: Channel must contain : separator

    i dont understand how to use the seperator

    can someone help me?
     
  2. what is your code ?
     
  3. Literally just do "<pluginName>:<Channel>". For example if you wanted to call the channel "messages" you can do "plugin:messages"
     
  4. My recive listener


    Code (Java):
    @Override
        public void onPluginMessageReceived(String channel, Player arg1, byte[] data) {
            if(channel.equals("cbsystemin")) {
                ByteArrayDataInput input = ByteStreams.newDataInput(data);
                String command = input.readUTF();
                String args1 = input.readUTF();
                Bukkit.getConsoleSender().sendMessage("§a[CityBuildSystem] §2Pluginmessage empfangen: CMD:" + command + " Arg1:" + args1);
                if(command.equals("deleteclan")) {
                    deleteCommand(args1);
                }else if(command.equals("kickmember")) {
                    kickMemberCommand(args1);
                }
            }
        }

    And my sender
    Code (Java):
    public void sendClanDelete(Player player, String clan) {
            ByteArrayDataOutput out = ByteStreams.newDataOutput();
            out.writeUTF("deleteclan");
            out.writeUTF(clan);
            player.sendPluginMessage(CityBuildSystem.getPlugin(), "cbsystemout", out.toByteArray());
        }
    Can you give a example on my code?
     
  5. I will comunicate betwee spigot and bungeecord
     
  6. try to do
    Code (Java):
    if(channel.equals("yourpluginname:cbsystemin")) {
    and
    Code (Java):
    player.sendPluginMessage(CityBuildSystem.getPlugin(), "yourpluginname:cbsystemout", out.toByteArray());
     
  7. thank you very much :)
    and by register i must use ?

    Code (Java):
    Bukkit.getMessenger().registerOutgoingPluginChannel(this, "pluginame:cbsystemin");
     
  8. Yes, but be sure the use the same name for out and in channels (cbsystemin is different from cbsystemout)
     
  9. Ok thank you. I will test it
     
  10. Thanks Solved
     
    • Like Like x 1
Thread Status:
Not open for further replies.