Development Assistance Error?

Discussion in 'Plugin Help/Development/Requests' started by bubblefat_, Jun 4, 2015.

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

    bubblefat_

    Why is there an error here?

    Code:
        @EventHandler
        public void onEntityDamage(EntityDamageByEntityEvent e) {
                if (e.getDamager() instanceof Fireball) {
                        Fireball f = (Fireball) e.getDamager();
                        if (f.getShooter() instanceof Player) {
                                Player shooter = (Player) f.getShooter();
                                if (shooter.getItemInHand().getType() == Material.IRON_SPADE) {
                                        e.setDamage(10.0);
                                }
                        }
                }
        }
    [​IMG]
     
  2. @bubblefat_ Generally we need what the actual error is in order to properly help. Fortunately, this is something I've seen enough that I can guess at the problem. You want to build against Bukkit, not CraftBukkit. Or if you have to use CB code, then make sure Bukkit has a higher priority.
     
  3. Offline

    bubblefat_

    @AdamQpzm

    Actually I am using Spigot.
     
  4. Offline

    Zombie_Striker

    @bubblefat_
    This is for Bukkit problems only. My only advice to you is to add Nullchecks and try to use another method besides f.getShooter.
     
  5. @Zombie_Striker Wrong. My advice is still valid. Program against an interface, not an implementation still applies here :)
     
  6. Offline

    timtower Administrator Administrator Moderator

    Moved to Bukkit alternatives
     
Thread Status:
Not open for further replies.

Share This Page