Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MainEvents implements Listener {
- private CWSmash cws;
- public MainEvents(CWSmash cws) {
- this.cws = cws;
- }
- @EventHandler
- public void onDamage(EntityDamageByEntityEvent e) {
- Entity attackede = e.getEntity();
- Entity attackere = e.getDamager();
- Player attacked = null;
- Player attacker = null;
- if (attackere instanceof Player || attackere instanceof Arrow) {
- attacked.setLevel(attacked.getLevel() + 1);
- if (attacked.getLevel() >= 250) {
- cws.setScore(ChatColor.BLACK + "test");
- cws.getObjective().setDisplayName(ChatColor.BLACK + "%");
- } else if (attacked.getLevel() >= 200) {
- cws.setScore(ChatColor.DARK_RED + "test");
- cws.getObjective().setDisplayName(ChatColor.RED + "%");
- } else if (attacked.getLevel() >= 160) {
- cws.setScore(ChatColor.RED + "test");
- cws.getObjective().setDisplayName(ChatColor.RED + "%");
- } else if (attacked.getLevel() >= 120) {
- cws.setScore(ChatColor.GOLD + "test");
- cws.getObjective().setDisplayName(ChatColor.GOLD + "%");
- } else if (attacked.getLevel() >= 80) {
- cws.setScore(ChatColor.YELLOW + "test");
- cws.getObjective().setDisplayName(ChatColor.YELLOW + "%");
- } else if (attacked.getLevel() >= 40) {
- attacked.setVelocity(dir.multiply(-1.0D).setY(0.5D));
- cws.setScore(ChatColor.GREEN + "test");
- cws.getObjective().setDisplayName(ChatColor.GREEN + "%");
- } else if (attacked.getLevel() >= 0) {
- cws.setScore(ChatColor.DARK_GREEN + "test");
- cws.getObjective().setDisplayName(ChatColor.DARK_GREEN + "%");
- }
- cws.getScore().setScore(attacked.getLevel());
- cws.updateScoreBoard();
- }
- }
- @EventHandler
- public void join(PlayerJoinEvent e) {
- Player player = e.getPlayer();
- player.setScoreboard(cws.getScoreBoard());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement