use of enums.Job in project KaellyBot by Kaysoro.
the class JobUser method getJobs.
private static synchronized Map<Triple<Long, ServerDofus, Job>, JobUser> getJobs() {
if (jobs == null) {
jobs = new ConcurrentHashMap<>();
Connexion connexion = Connexion.getInstance();
Connection connection = connexion.getConnection();
try {
PreparedStatement query = connection.prepareStatement("SELECT id_user, server_dofus, name_job, level FROM Job_User;");
ResultSet resultSet = query.executeQuery();
while (resultSet.next()) {
Long idUser = resultSet.getLong("id_user");
ServerDofus server = ServerDofus.getServersMap().get(resultSet.getString("server_dofus"));
Job job = Job.getJob(resultSet.getString("name_job"));
int level = resultSet.getInt("level");
jobs.put(Triple.of(idUser, server, job), new JobUser(idUser, server, job, level));
}
} catch (SQLException e) {
Reporter.report(e);
LOG.error("getJobs", e);
}
}
return jobs;
}
use of enums.Job in project KaellyBot by Kaysoro.
the class JobCommand method getJob.
private List<String> getJob(Language lg, String nameProposed) {
nameProposed = Normalizer.normalize(nameProposed, Normalizer.Form.NFD).replaceAll("\\p{InCombiningDiacriticalMarks}+", "").toLowerCase();
nameProposed = nameProposed.replaceAll("\\W+", "");
List<String> jobs = new ArrayList<>();
for (Job job : Job.values()) if (Normalizer.normalize(job.getLabel(lg), Normalizer.Form.NFD).replaceAll("\\p{InCombiningDiacriticalMarks}+", "").toLowerCase().replaceAll("\\W+", "").startsWith(nameProposed))
jobs.add(job.getName());
return jobs;
}
Aggregations