Packages

Discussion in 'Plugin Development' started by joatin37, Sep 7, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    joatin37

    Is it possible to somehow acces the packages bukkit is using for sending ant retrieving data from the client?
     
  2. Offline

    germanchocolate

    ya its called using there methods and implementing them or extending them in your classes :p
     
  3. Offline

    joatin37

    I need a way to send custom packages from the server. In a normal cliant mod I do that by modding the NetClientHandler, and sending a costum package with it. Can that be done with bukkit somehow?
     
  4. use the mod channels, they designed for mods
     
  5. Offline

    ase34

    If you want to send raw packets, look at the craftbukkit api
     
  6. Offline

    jtjj222

    The simplest way to do this is:
    Code:
    // Register plugin channel (in your onEnable)
    getServer().getMessenger().registerOutgoingPluginChannel(this, "MyMod");
     
    //to send to the player (when you need to send them data)
    if (player.getListeningPluginChannels().contains("MyMod")) {
        player.sendPluginMessage(plugin, "MyMod", "message");
    }
    Then, in the netClientHandler, in handleCustomPayload(Packet250CustomPayload par1Packet250CustomPayload), add an extra check to see if par1Packet250CustomPayload.channel = "MyMod". Then, you can do whatever you like with the data in the message. To receive data from the client, I am not sure, but I think there is an event for it.
     
  7. Offline

    joatin37

    Thanks. My plan is to integrate my clientmod for custom chat with the server. And also to make a minimap sent directly from the server instead of generated from the chunks in the client recieved(it might be a mix, but the server can "see" things further away) it would be usefull in my town plugin since it would allow you to find your plot at greater distances.

    It is maybe stupid how I make my mod with 500 difrent functions in one thing. I am mainly making a replecemant for towny advanced. But I am also adding functions like arenas, animal protection, multiworld, portals, economy....
     
Thread Status:
Not open for further replies.

Share This Page