Health Bar v1.5.3

Details

  • Filename
    HealthBar_v1.5.3.zip
  • Uploaded by
  • Uploaded
    May 9, 2013
  • Size
    48.22 KB
  • Downloads
    3,294
  • MD5
    be054a8fdfc629d4c91761516fc704a9

Supported Bukkit Versions

  • CB 1.5.2-R0.1

Changelog

For craftbukkit 1.5.2, not tested on previous builds!

  • Added a little API for developers (works only with scoreboard, not with tagAPI packets system), to know when the tag of a player restores after that the bar has been hidden.
    You can listen to the custom event: BarHideEvent.

    e.g.:
	public void barHideEvent(BarHideEvent event) {
        OfflinePlayer player = event.getOfflinePlayer();
        //more stuff, like restoring the tag of your plugin.
        }


If you're not a developer, you may download this if other plugins requires that. If you find a scoreboard plugin not compatible with this, now you can to the authors to make it compatible.


Full example of a plugin that uses the custom event:

package your.packege;

import org.bukkit.OfflinePlayer;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;

import com.gmail.filoghost.api.BarHideEvent; //the import

public class Main extends JavaPlugin implements Listener {

public void onEnable() {

//check if the plugin is loaded
if (getServer().getPluginManager().getPlugin("HealthBar") != null)
	getServer().getPluginManager().registerEvents(this, this);
}
	
public void onDisable() {}
	
@EventHandler
public void barHideEvent(BarHideEvent event) {
//you don't need the online player for scoreboards
OfflinePlayer player = event.getOfflinePlayer();

//prints the name of the player whose tag has been restored.
System.out.println(player.getName());

//more stuff
//...
//add the player to a team for example
}
	
}


Finally, you can add these lines to plugin.yml to make it load after HealthBar:
softdepend: [HealthBar]