Util Jinx API

Discussion in 'Resources' started by PhantomUnicorns, Jun 5, 2017.

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

    PhantomUnicorns

    The Jinx API is just of methods that are usually version-dependant but I used reflection to make them not! (Note this is better to combine to one util like this so multiply classes do not get the same class over and over)

    Here is the class:
    https://hastebin.com/nijixinohe.java
    Here is an example of how to use it:
    https://hastebin.com/akajixuhut.java

    JSONMessages:
    • List of all clickEvent types: [open_url, run_command, suggest_command]
    • List of all hoverEvent types: [show_text, show_achievement, show_item, show_entity]
    NBTItems:
    • List of all slots: [mainhand, offhand, head, chest, legs, feet]
    • List of all generic values: [generic.attackSpeed, generic.attackDamage, generic.luck, generic.maxHealth, generic.movementSpeed, generic.armor, generic.armorToughness]
    • Don't know if a lot of people know this but when using hoverText you can do /n for a new line
    Changes:
    Added nbt setting support!
    Added changing a players name support! (Note this will make the server think that that player got a name change!)
    Added "show_item" support (Does displayname, lore, enchants!)
     
    Last edited: Jul 10, 2017
    AlvinB and Zombie_Striker like this.
  2. @PhantomUnicorns
    Good work! Can't believe there still isn't a bukkit method to do hotbar messages though... In fact, I'm going to make a feature request for it right now.
     
  3. Offline

    PhantomUnicorns

    XD Ik it was pretty annoying when I was searching it up :)
     
  4. Offline

    mine2012craft

    Some of you might run across an error in the Jinx class when you try to use it in-game. In the Jinx class on line 76, there should be this line of code:

    Code:
                CHAT_PACKET_DOUBLE_CONSTRUCTOR = CHAT_PACKET_CLASS.getConstructor(ICHATBASECOMPONENT_CLASS, byte.class);
    Change the "byte.class" part to "ChatMessageType.class", imported from 1_12, and not from spigot if you are using spigot

    Code:
    import net.minecraft.server.v1_12_R1.ChatMessageType;
               CHAT_PACKET_DOUBLE_CONSTRUCTOR = CHAT_PACKET_CLASS.getConstructor(ICHATBASECOMPONENT_CLASS, ChatMessageType.class);
     
  5. Offline

    PhantomUnicorns

    Updated code @mine2012craft try using the updated code I put, I know that this one works
     
    Last edited: Jun 30, 2017
  6. Offline

    mine2012craft

    Oh, I already updated the class myself before I put that post. It works fine for me now. The updated download should help players not be confused why it dosen't work though.
     
  7. Offline

    PhantomUnicorns

    Your update is redundant......
    1) This class is based on reflection and you made it version-dependant.
    2) Your code actually broke a method using that constructor, reflection is very exact

    So for your use, I would use the code I updated there. If the error still exists then put DM me the stacktrace, they might have changed the arguments for that constructor
     
Thread Status:
Not open for further replies.

Share This Page