Solved else does not work?

Discussion in 'Plugin Development' started by HenkDeKipGaming, Jun 26, 2015.

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

    HenkDeKipGaming

    hey, i made a code that only allows people to fight when in the config the string "saturday" contains "yes"
    but when it does contain yes, it still executes everything that should happen when it's not saturday...
    this is my code:
    Code:
    @EventHandler
        public void onEntityDamage(EntityDamageByEntityEvent e) {
            if (e.getDamager() instanceof Player && e.getEntity() instanceof Player) {
                final Player p = (Player) e.getEntity();
                final Player hitter = (Player) e.getDamager();
               if(getConfig().getString("saturday").contains("yes")) {
                  e.setCancelled(true);
                  p.sendMessage(ChatColor.RED + "Speler " + hitter.getName() + " probeerde je te slaan");
                  hitter.sendMessage(ChatColor.RED + "Je mag alleen vechten op Warday");
               } else {
                 
               }
            }
    
    it's probably something really small :p and i will probably feel really dumb if someone solves this haha.

    i feel like the dumbest person on earth now... i placed it at the wrong place...
    shit xD

    SOLVED

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 10, 2016
Thread Status:
Not open for further replies.

Share This Page