Not detecting skull with meta data.

Discussion in 'Plugin Development' started by JustNoHacks, Nov 13, 2016.

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

    JustNoHacks

    I am trying to create a plugin where if you have a NAMED SKULL in your inventory it'll give you an effect but that doesn't seem to work:

    Main: http://hastebin.com/ohilipamij.java

    Event: http://hastebin.com/odalijokev.java
    Skull: http://hastebin.com/uzafahihed.java

    I tried if statements like:
    Code:
    if (player.getInventory().getItem(8).isSimilar(this.pets.pigPet())) {
    Code:
    if (this.pets.pigPet.isSimilar(player.getInventory.getItem(8)) {
    Code:
    if (player.getInventory().getItem(8).equals(this.pets.pigPet())) {
    but they don't work.

    And If anybody asks if I have the right skull, I do. I have a command that gives me the same ItemStack. I also have the permission and I also have it in my last slot on the hotbar

    Any ideas why?
     
  2. @JustNoHacks I don't understand your logic between

    ChatColor.translateAlternateColorCodes('b', '&bSome text');
    Vs
    ChatColor.AQUA + "Some text"

    As for your issue, pets is never initialised hence why this wouldn't work and also why you will have errors in console.
    And why are you limiting the slot to 8, why not the hotbar?

    If you initialise pets and it still doesn't work, you may need to make your own method to compare them. Just see if it is a skull, check the name and you should be good.
     
  3. Offline

    AL_1

    I usually do this if im not sure about how i want it to look, or if i use a lot of color codes.
     
Thread Status:
Not open for further replies.

Share This Page