Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void onDamage(EntityDamageByEntityEvent ev) {
- if ((ev.getDamager() instanceof Projectile)) {
- Projectile bullit = (Projectile)ev.getDamager();
- if ((bullit.getShooter() instanceof Player && ev.getEntity() instanceof Player)) {
- Player pl = (Player)ev.getEntity();
- Player to = (Player)bullit.getShooter();
- 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(ChatColor.GOLD+"Leben von "+ChatColor.DARK_GREEN+pl.getName()+ChatColor.GOLD+": "+prefix+toPlayer);
- }
- }
- 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(ChatColor.GOLD+"Leben von "+ChatColor.DARK_GREEN+pl.getName()+ChatColor.GOLD+": "+prefix+toPlayer);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement