Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void onDamage(EntityDamageByEntityEvent ev) {
- if (ev.getDamager() instanceof Player && ev.getEntity() instanceof Player) {
- Player pl = (Player)ev.getEntity();
- Player to = (Player)ev.getDamager();
- String toPlayer = "";
- if(pl.getHealth()%2 != 0) {
- for(int i = 0; i < (pl.getHealth()-1)/2; i++) {
- toPlayer = toPlayer + "❤";
- }
- toPlayer = toPlayer + "♥";
- }
- else {
- for(int i = 0; i < pl.getHealth()/2; i++) {
- toPlayer = toPlayer + "❤";
- }
- }
- ChatColor prefix;
- if(toPlayer.length() > 7)
- prefix = ChatColor.GREEN;
- else if(toPlayer.length() > 4)
- prefix = ChatColor.YELLOW;
- else
- prefix = ChatColor.RED;
- to.sendMessage("Health: "+prefix+toPlayer);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement