Development Assistance Code not firing?

Discussion in 'Plugin Help/Development/Requests' started by BizarrePlatinum, Apr 22, 2015.

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

    BizarrePlatinum

    Without revealing too much about my current project (want to keep it private for some reason), I am trying to test if an item's lore contains stuff, and if it does, then some things would happen. I am not receiving any errors in console, just nothing's happening. I am testing some more things before this, and that code is working correctly, so I assume I am testing lore incorrectly in some way. Any help is appreciated.

    Code:
    if(item.getItemMeta().hasLore() && p.isSneaking()) {
        if(item.getItemMeta().getLore().contains("-snip-")) {
    
     
  2. Offline

    nverdier

    @BizarrePlatinum And we can help you with your code without seeing your code how exactly?
     
  3. Offline

    Corndogoz

    tons of people mess up in the same spot, please post just the next line of your code
     
  4. Offline

    timtower Administrator Administrator Moderator

    @BizarrePlatinum Did you check till which if statement it reaches? Did you check if any code is running?
     
  5. Offline

    BizarrePlatinum

    @nverdier I see no reason for any more, this is the only line that isnt working (am testing a bunch of different itemstacks in one "big" if). I suppose I will post more code however, in case my logic to why it isn't needed is incorrect (not trying to be a smart ass).
    Code:
    public void onInteract(PlayerInteractEvent e) {
        if(e.getAction().equals(Action.RIGHT_CLICK_AIR) || e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
                if(item != null) {
                [...]
                
                    if(item.getType().equals(Material.STICK)) {
                        if(item.getItemMeta().hasLore() && p.isSneaking()) {
                            if(item.getItemMeta().getLore().contains("-snip-")) {
                                -Doing stuff here-
                            }
                        }
                    }
                }
          }
    }
    
     
  6. Offline

    nverdier

    @BizarrePlatinum For some reason I didn't see the code in the OP, probably assumed it was your signature and didn't read it :p But just log debug messages to see where the code gets to, as @timtower said.
     
  7. Offline

    xTrollxDudex

    Is the event even firing? Have you registered your events? Does that method have @EventHandler?
     
Thread Status:
Not open for further replies.

Share This Page