public void switchClass(SkillClass skillClass) { DatabaseUtil.saveClass(id, getUserSkillClass()); setUserSkillClass(DatabaseUtil.loadUserClass(id, skillClass)); if (board.getObjective(ChatColor.AQUA + userSkillClass.getSkillClass().getName()) != null) { boardClass = board.getObjective(ChatColor.AQUA + userSkillClass.getSkillClass().getName()); } else { boardClass = board.registerNewObjective( ChatColor.AQUA + userSkillClass.getSkillClass().getName(), "dummy"); } scoreboard(); }
public User(UUID id) { this.player = Bukkit.getPlayer(id); this.id = id; loadData(); boardClass = board.registerNewObjective( ChatColor.AQUA + userSkillClass.getSkillClass().getName(), "dummy"); }
public void scoreboard() { boardClass.setDisplaySlot(DisplaySlot.SIDEBAR); Score rank = boardClass.getScore(ChatColor.GREEN + "Rank:"); Score power = boardClass.getScore(ChatColor.GOLD + "Power:"); rank.setScore(userSkillClass.getRank()); power.setScore(userSkillClass.getPower()); Score[] score = new Score[userSkillClass.getSkillClass().getSkills().size()]; for (int i = 0; i < userSkillClass.getSkillClass().getSkills().size(); i++) { Skill skill = userSkillClass.getSkillClass().getSkills().get(i); score[i] = boardClass.getScore(ChatColor.GREEN + skill.getScoreboardName() + ":"); score[i].setScore(userSkillClass.getLevel(skill)); } player.setScoreboard(board); }