Tag with 16+ characters

Discussion in 'Plugin Development' started by PVP9dc, Nov 4, 2013.

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

    PVP9dc

    I need an API that I can use more than 16 characters in one tag.

    Please help mee :)
     
  2. Offline

    The_Doctor_123

    Tags can't be 16+ characters? If that's the case, then no API will be able to do it..
     
  3. Offline

    PVP9dc

  4. Offline

    The_Doctor_123

  5. Offline

    Goblom

    PVP9dc NameTagEdit does not look outdated to me... It doesn't import directly into org.bukkit.craftbukkit craftbukkit or net.minecraft. So, the plugin should still work.

    In any case, if you need an API for 16+ characters why not use this and if doesn't work you should update it ;)
     
  6. Offline

    blablubbabc

    But it uses reflection to get access to methods and fields in craftbukkit and net.minecraft, which could have changed names/meaning. So that doesn't mean anything.
     
  7. Offline

    Goblom

    blablubbabc
    It uses Reflection to get the correct classes for the current version of CraftBukkit you are using... How Do i Know!?
    Edit: Just re-read your post... Yes, these imports will only work if names have not changed but i seriously doubt that they have changed since 1.6.1
     
  8. Offline

    PVP9dc

  9. Offline

    Goblom

    PVP9dc Yes, but you don't know until you have tried. (Which im guessing you havent)
     
  10. Offline

    1Rogue

    Can you show your code? The objective name cannot be above 16 characters, but the Display name can be.
     
  11. Offline

    PVP9dc

    It can be 32 characters
     
  12. PVP9dc If you want to depend on another plugin then you can add my AnimationLib. It contains a Packet framework which allows you to easily craft and send packets.

    You can use it like this:
    Code:java
    1. Packet packet = new Packet(PacketType.TEAMS);
    2. //then you can set values by doing:
    3. packet.write(<key>, <value>);


    The library is still a massive work in progress but you can just add the jar to your plugin; I will soon set up a dev-bukkit page where people can download it so if you decide to use it then you can tell them to get it there.
    Anyways; here is a mediafire download: <Edit by Moderator: Redacted mediafire url>
     
    Last edited by a moderator: Nov 4, 2016
  13. Offline

    PVP9dc

  14. PVP9dc PlayerUtil.sendPacket(<player>, <packet>);
     
  15. Offline

    PVP9dc

    Code:java
    1. Random r = new Random();
    2. Packet packet = new Packet(PacketType.UPDATE_SIGN);
    3. //then you can set values by doing:
    4. packet.write("X", -505);
    5. packet.write("Y",(short) 13);
    6. packet.write("Z", -41);
    7. packet.write("Line 1", "§c" + p.getName());
    8. packet.write("Line 2", "§e" + r.nextInt(10000));
    9. packet.write("Line 3", "§e" + r.nextInt(10000));
    10. packet.write("Line 4", "§e" + r.nextInt(10000));
    11. PlayerUtil.sendPacket(p, packet);

    What is wrong CaptainBern
    or is the problem that i use the new 1.7 spigot build?
     
  16. PVP9dc Well first of all, I do not work with Spigot and it is not supported here, so I do not know if the packet fields are correct. (if Spigot didn't touched the packet fields then I'm sure those are incorrect)

    In the source code the fields are: x, y, z and "lines", a string array that contains the 4 lines on the sign. In this case your code should be:
    Code:java
    1. Random r = new Random();
    2. Packet packet = new Packet(PacketType.UPDATE_SIGN);
    3. packet.write("x", -505);
    4. packet.write("y", 13); //the fields are integers
    5. packet.write("z", -41);
    6.  
    7. String[] lines = new String[]{
    8. "§c" + p.getName(),
    9. "§e" + String.parseString(r.nextInt(10000),
    10. "§e" + String.parseString(r.nextInt(10000),
    11. "§e" +String.parseString(r.nextInt(10000)
    12. }
    13.  
    14. packet.write("lines", lines);
    15.  
    16. PlayerUtil.sendPacket(player, packet);
     
  17. Offline

    PVP9dc

  18. PVP9dc No problem, happy coding!
     
  19. Offline

    PVP9dc

    CaptainBern
    Code:java
    1. Caused by: java.lang.IllegalArgumentException: Can not set int field net.minecraft.server.v1_6_R3.Packet130UpdateSign.x to java.lang.Double
    2.  

    Idk...
    My Code:
    Code:java
    1.  
    2. double X = Double.parseDouble(getConfig().getString("signrefresh.X"));
    3. double Y = Double.parseDouble(getConfig().getString("signrefresh.Y"));
    4. double Z = Double.parseDouble(getConfig().getString("signrefresh.Z"));
    5.  
    6. Random r = new Random();
    7. Packet packet = new Packet(PacketType.UPDATE_SIGN);
    8. packet.write("x", X);
    9. packet.write("y", Y); //the fields are integers
    10. packet.write("z", Z);
    11.  
    12. String[] lines = new String[]{
    13. "§c" + p.getName(),
    14. "§e" + "game",
    15. "§e" + "leer",
    16. "§e" + "none"
    17. };
    18.  
    19. packet.write("lines", lines);
    20.  
    21. PlayerUtil.sendPacket(p, packet);
     
  20. PVP9dc do Integer.parseInteger(x) y and z, the field requires a an Integer and you're passing doubles.
     
  21. Offline

    PVP9dc

    Ok ! Now its working :D Thanks :)

    Code:java
    1. int X = Integer.parseInt(getConfig().getString("signrefresh.X"));
    2. int Y = Integer.parseInt(getConfig().getString("signrefresh.Y"));
    3. int Z = Integer.parseInt(getConfig().getString("signrefresh.Z"));
    4.  
    5. Random r = new Random();
    6. Packet packet = new Packet(PacketType.UPDATE_SIGN);
    7. packet.write("x", X);
    8. packet.write("y", Y); //the fields are integers
    9. packet.write("z", Z);
    10.  
    11. String[] lines = new String[]{
    12. "§c" + p.getName(),
    13. "§e" + "game",
    14. "§e" + "leer",
    15. "§e" + "none"
    16. };
    17.  
    18. packet.write("lines", lines);
    19.  
    20. PlayerUtil.sendPacket(p, packet);
     
Thread Status:
Not open for further replies.

Share This Page