Oops, you broke my plugins!

Discussion in 'Plugin Development' started by DeMaggo, Sep 27, 2013.

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

    DeMaggo

    Greetings everyone,

    The Bukkit developers recently created the ambigous getHealth() and getMaxHealth() method for not breaking older plugins. Since the last stable Bukkit version (1.6.2 R 1.0) this is killing my plugins that are already updated to use doubles. I cannot find a way to properly use the getHealth() method and eclipse will also not compile with such a problem.

    Examples for that problem, none of them is compileable:
    Code:java
    1. public void setHP(double d) {
    2.  
    3. if (d>e.getMaxHealth()) d=e.getMaxHealth();
    4.  
    5. e.setHealth(d);
    6. }


    Code:java
    1. public double getHP() {
    2. return e.getHealth();
    3. }


    Code:java
    1. double gainedHP=e.getHealth()-dragonlives;


    Code:java
    1. double d=e.getHealth();


    I somehow cannot edit my post to add the following issue:
    You marked the EntityType.getByName() as deprecated but offer no alternatives at all. Spamming supress warnings is against my sense of clean programming.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  2. Offline

    The_Doctor_123

    You can suppress warnings to the whole class.
     
  3. Offline

    DeMaggo

    Supressing warnings is not the way it's meant to be at all. It's not about the amount of them.
     
  4. Offline

    The_Doctor_123

    DeMaggo
    I know, I agree with you. Bukkit shouldn't have deprecated a ton of things that they did.
     
  5. for you gethealth problem, use the recommend way of building a plugin, build with the bukkit.jar and not the craftbukkit.jar
     
    DeMaggo likes this.
  6. Offline

    DeMaggo

    Thank you, this helped me out a lot. ;)
     
Thread Status:
Not open for further replies.

Share This Page