getShooter() deprecated

Discussion in 'Plugin Development' started by CraftCreeper6, May 19, 2014.

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


    Hey! I was just trying to figure out a way to get the shooter without getShooter() as it is deprecated in CraftBukkit 1.7.9.
    Can Anyone help? :)
    Any help appreciated! :D
  2. Offline


    getShooter() in Projectile interface is deprecated if you use the LivingEntity return type, you may now use ProjectileSource return type instead (which, I think, is casteable to Player).

    Links: ProjectileSource here, Projectile here
  3. Offline


    Hello, I don't understand, it says it returns the shooter then it says it launches a projectile... I do not understand :/
    Could you maybe elaborate on what you are saying? :)
  4. Offline


    ProjectileSource is a type (actually an Interface) that allows you to get methods to launch projectiles from any Entity type, like Player, Skeleton, Ghast, etc. (check Subclasses for a complete list)

    ProjectileSource ps projectile.getShooter();
    Player shooter = (Player)ps;
    And then to do something like:
    System.out.println("Player " + shooter.getName() + " launched a projectile");
  5. Hey, I'm running on Eclipse and also having this issue, and can't seem to resolve it with anything I've found online or the given code above. For some reason, projectile.getShooter() always returns the LivingEntity (deprecated) version, no matter what arguments are before it.

    EDIT: Fixed using Bukkit over CraftBukkit. Sorry for bumping the thread.
Thread Status:
Not open for further replies.

Share This Page