// Permet de récupérer le nombre de mobs tués private int getMobToKill(AchievementKillMob achiev, String userName) throws IOException { String userUUID = core.getGame().getServer().getPlayer(userName).get().getUniqueId().toString(); WebService ws = new WebService(core); String badges = ws.getUserBadges(userUUID); if (badges.contains(achiev.getName())) { int indexStart = badges.indexOf(achiev.getName()); int index = badges.indexOf("remaining", indexStart); String remaining = badges.substring(badges.indexOf(":", index) + 1, badges.indexOf("}", index)); int mobToKill = Integer.valueOf(remaining); return mobToKill; } return 0; }
// Ajoute un monstre tué au compteur du joueur private void addKilledMob(String userUUID, int badgeID, int mobKilled) throws IOException { WebService ws = new WebService(core); ws.updateAchievement(userUUID, badgeID, mobKilled); }