Plugin Development - HashMaps and double problems?

Discussion in 'Resources' started by WingsIsaac, Aug 23, 2011.

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

    WingsIsaac

    Hello, bukkit plugin developers. I've been working on a plugin recently, and while I seem to have conquered one of my old problems, I just ran into two more. They involve HashMaps, and a weird problem I'm getting from a double.


    So firstly, the double. I wanted to lower the probability of something happening accordingly to what you're wearing, so to generate this probability multiplier, I created this method:

    Code:
    public double getHeadShotProb(Player p) {
            int hat = p.getInventory().getHelmet().getTypeId();
            
            switch (hat) {
            case 298: return 1.25;
            case 302: return 1.5;
            case 306: return 1.75;
            case 310: return 2;
            default: return 1;
            }
        }
    I've used it in multiple different situations, and even when I just call it up alone, it always gives the same problem- Could not pass event <event>. It was ENTITY_DAMAGE in most cases, but that's irrelevant, it didn't work either way.

    So if you know what's wrong here, tell me.




    Next is with hashmaps.
    I've created a simple hashmap, HashMap<Player, Boolean> isImpaired. No errors came up in eclipse, but then when I tried
    Code:
    plugin.isImpaired.put(player, true);
    it gave me the same error as the other one- Could not pass even <event>.

    So, what am I doing wrong? Thanks ahead of time!




    ~Isaac
     
Thread Status:
Not open for further replies.

Share This Page