Why won't this work? Comparing hashmap value to a name

Discussion in 'Plugin Development' started by Magestickown, Feb 23, 2012.

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


                            Sombies.betaZombies.containsValue(damager.getName()) == true || 
                            damager.getName() == Sombies.alphaZombie && 
                            Sombies.betaZombies.get(damaged.getName()) == null && 
                            Sombies.alphaZombie.equalsIgnoreCase(damaged.getName())) {
    Also, "Sombies.alphaZombie.equalsIgnoreCase(damaged.getName())" refuses to work aswell..
    Any ideas?

    Here's my variables in Sombies.java (main class):

     public static boolean isSombiesEnabled = false;
        public static String alphaZombie = null;
        public static String[] messages = {    "ate his brains and gained his knowledge", 
                                            "ate him for breakfast", 
                                            "took him out for a nice seafood dinner... then ate him",
                                            "had a nice brain casserole"};
        public static HashMap<String, String> betaZombies = new HashMap<String, String>();
        public final CommandHandler commandhandler = new CommandHandler(this);
        public final PlayerListener playerlistener = new PlayerListener();
        public final EntityListener entitylistener = new EntityListener();
  2. This line : damager.getName() == Sombies.alphaZombie
    Might be the problem, try use .equals /.equalsIgnoreCase?
  3. Offline


    The problem is, a zombie can infect another zombie. They should not be able to infect people who are already infected :(
  4. hmm so if I am reading this correctly:
    Sombies.betaZombies.containsValue(damager.getName()) == true  ||  <-- attacker must be a zombie [B]OR[/B]
    damager.getName() == Sombies.alphaZombie &&  <--Not too sure what this line checks [B]AND[/B]
    Sombies.betaZombies.get(damaged.getName()) == null &&  <--attacked player is not a zombie [B]AND[/B]
    Sombies.alphaZombie.equalsIgnoreCase(damaged.getName()) <--attacked player is an alpha 
    now, assuming zombies cannot attack zombies of any type (alpha or beta), the if statement should be this
    !Sombies.betaZombies.containsValue(damaged.getName()) && <-- attacked is not an beta zombie [B]AND[/B]
    !Sombies.alphaZombies.containsValue(damaged.getName()) && <--  attacked  is not an alpha zombie [B]AND[/B]
    Sombies.betaZombies.containsValue(damager.getName()) || <-- attacker is a beta zombie [B]OR[/B]
    Sombies.alphaZombies.containsValue(damager.getName())  <--  attacker is a alpha zombie
    ){...code goes here
  5. Offline


    alphaZombies is not a hashmap, so I'll just change it to .equalsIgnoreCase then?
Thread Status:
Not open for further replies.

Share This Page