Advertisement
ClashWars

Untitled

Jul 10th, 2013
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.84 KB | None | 0 0
  1. public class MainEvents implements Listener {
  2.     private CWSmash cws;
  3.  
  4.     public MainEvents(CWSmash cws) {
  5.         this.cws = cws;
  6.     }
  7.    
  8.     @EventHandler
  9.     public void onDamage(EntityDamageByEntityEvent e) {
  10.         Entity attackede = e.getEntity();
  11.         Entity attackere = e.getDamager();
  12.         Player attacked = null;
  13.         Player attacker = null;
  14.        
  15.         if (attackere instanceof Player || attackere instanceof Arrow) {
  16.             attacked.setLevel(attacked.getLevel() + 1);
  17.            
  18.             if (attacked.getLevel() >= 250) {
  19.                 cws.setScore(ChatColor.BLACK + "test");
  20.                 cws.getObjective().setDisplayName(ChatColor.BLACK + "%");
  21.             } else if (attacked.getLevel() >= 200) {
  22.                 cws.setScore(ChatColor.DARK_RED + "test");
  23.                 cws.getObjective().setDisplayName(ChatColor.RED + "%");
  24.             } else if (attacked.getLevel() >= 160) {
  25.                 cws.setScore(ChatColor.RED + "test");
  26.                 cws.getObjective().setDisplayName(ChatColor.RED + "%");
  27.             } else if (attacked.getLevel() >= 120) {
  28.                 cws.setScore(ChatColor.GOLD + "test");
  29.                 cws.getObjective().setDisplayName(ChatColor.GOLD + "%");
  30.             } else if (attacked.getLevel() >= 80) {
  31.                 cws.setScore(ChatColor.YELLOW + "test");
  32.                 cws.getObjective().setDisplayName(ChatColor.YELLOW + "%");
  33.             } else if (attacked.getLevel() >= 40) {
  34.                 attacked.setVelocity(dir.multiply(-1.0D).setY(0.5D));
  35.                 cws.setScore(ChatColor.GREEN + "test");
  36.                 cws.getObjective().setDisplayName(ChatColor.GREEN + "%");
  37.             } else if (attacked.getLevel() >= 0) {
  38.                 cws.setScore(ChatColor.DARK_GREEN + "test");
  39.                 cws.getObjective().setDisplayName(ChatColor.DARK_GREEN + "%");
  40.             }
  41.             cws.getScore().setScore(attacked.getLevel());
  42.             cws.updateScoreBoard();
  43.         }
  44.     }
  45.    
  46.     @EventHandler
  47.     public void join(PlayerJoinEvent e) {
  48.         Player player = e.getPlayer();
  49.         player.setScoreboard(cws.getScoreBoard());
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement