Development Assistance Item isn't read properly somehow..

Discussion in 'Plugin Help/Development/Requests' started by Scorpionvssub, Mar 23, 2016.

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

    Scorpionvssub

    Code:
        @EventHandler
        public void onDropItem(PlayerDropItemEvent e) {
            Player p = e.getPlayer();
    
            if (!e.getItemDrop().getItemStack().hasItemMeta()) {
                p.sendMessage("meta was null");
                return;
            }
            p.sendMessage("Item Name: " + e.getItemDrop()); //returns CraftItem
            Item paper = e.getItemDrop();
            p.sendMessage("Name " +  paper.getItemStack().getItemMeta().getDisplayName()); //returns Clue (Orange colored)
            String pa = ChatColor.stripColor(paper.getItemStack().getItemMeta().getDisplayName());
            p.sendMessage("Uncolored " + pa); returns Clue
            p.sendMessage("config name: " + plugin.settings.getString("clue.name")); // returns &6Clue
            if (pa.equalsIgnoreCase(plugin.settings.getString("clue.name"))) {
                if (!plugin.dropattempt.containsKey(p.getUniqueId())) {
                    int fade = plugin.settings.getInt("Titles.playerdrop.fadein");
                    int stay = plugin.settings.getInt("Titles.playerdrop.stay");
                    int fadeout = plugin.settings.getInt("Titles.playerdrop.fadeout");
                    String title = plugin.settings.getString("Titles.playerdrop.title");
                    String subtitle = plugin.settings.getString("Titles.playerdrop.subtitle");
                    TitleAPI.sendTitle(p, fade, stay, fadeout, title, subtitle);
                    plugin.dropattempt.put(p.getUniqueId(), "yes");
                    e.setCancelled(true);
                }
            }
        }
    All sections point out exacly what it should in my eyes i don't see where its going wrong i tried to check colored and uncolored versions of the names but this: if (pa.equalsIgnoreCase(plugin.settings.getString("clue.name"))) {

    Never seems to work and im running out of idea's why it does so..

    Config section:

    clue:
    name: '&6Clue'
     
    Last edited: Mar 23, 2016
  2. Offline

    Lolmewn

    Put some breakpoints in your code and debug it maybe? Any modern IDE can do this.
     
  3. Offline

    Scorpionvssub

    im checking for itemmeta and displayname both are filled, i also checked if the location of the clue is filled and thats not null either
     
Thread Status:
Not open for further replies.

Share This Page