Solved Heed help with fixing error on plugin

Discussion in 'Plugin Help/Development/Requests' started by yourmaster01, Sep 25, 2015.

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

    yourmaster01

  2. @yourmaster01 I have just attempted to re-create your trouble, but it just errors saying there was an error writing to the file. I can't help you with this. Sorry.
     
  3. Offline

    pie_flavor

    @yourmaster01 First, a tip:
    Code:
    String c(String s) {
        return ChatColor.translateAlternateColorCodes('&', s);
    }
    //...
    player.sendMessage(c("&cYou failed. &4lol"));
    //...
    ((Sign) block.getState()).setLine(1, c("&aPrice&0: &6$&d600"));
    Second, that is possibly the most impossible error I have seen. The only method that is called on that line is PlayerInteractEvent#getPlayer(), which can only throw a NullPointerException if the PlayerInteractEvent itself is null. So either you have a plugin improperly calling PlayerInteractEvents itself, or your Bukkit is fail.
     
  4. Offline

    Boomer

    The way i see it, the error is this line with the NPE
    if(signs.containsKey(e.getClickedBlock().getLocation())){

    Only dereferencing null objects will throw an npe, and in that, that means:
    Either
    1) signs is null at this point in execution (which is not possible with your setup)
    2) event is null -- impossible
    3) e.getClickedBlock is null - possible

    Possible? Yes- Interact event can trigger when there is a click made but if a block is not within distance and selected, then it registers as an air click, which isn't a clicked block, hence getClickedBlock returns null in this event
     
Thread Status:
Not open for further replies.

Share This Page