diff --git a/src/main/java/com/gamingmesh/jobs/Placeholders/Placeholder.java b/src/main/java/com/gamingmesh/jobs/Placeholders/Placeholder.java index 53685d0d..ddf843ad 100644 --- a/src/main/java/com/gamingmesh/jobs/Placeholders/Placeholder.java +++ b/src/main/java/com/gamingmesh/jobs/Placeholders/Placeholder.java @@ -534,7 +534,7 @@ public class Placeholder { for (TopList l : Jobs.getJobsDAO().getGlobalTopList(jobLevel.get())) { if (l.getPlayerInfo().getName().equals(user.getName())) { JobProgression prog = l.getPlayerInfo().getJobsPlayer().getJobProgression(job); - return prog == null ? "" : Integer.toString(prog.getLevel()); + return prog == null ? "" : prog.getLevelFormatted(); } } @@ -555,7 +555,7 @@ public class Placeholder { } JobProgression archivedJobProg = user.getArchivedJobProgression(job); - return archivedJobProg == null ? "" : Integer.toString(archivedJobProg.getLevel()); + return archivedJobProg == null ? "" : archivedJobProg.getLevelFormatted(); case user_archived_jobs_exp_$1: if (job == null) return ""; diff --git a/src/main/java/com/gamingmesh/jobs/PlayerManager.java b/src/main/java/com/gamingmesh/jobs/PlayerManager.java index 727b17e6..ff40360b 100644 --- a/src/main/java/com/gamingmesh/jobs/PlayerManager.java +++ b/src/main/java/com/gamingmesh/jobs/PlayerManager.java @@ -677,7 +677,7 @@ public class PlayerManager { message = message.replace("%jobname%", job.getJobDisplayName()); message = message.replace("%playername%", player != null ? plugin.getComplement().getDisplayName(player) : jPlayer.getName()); - message = message.replace("%joblevel%", Integer.toString(prog.getLevel())); + message = message.replace("%joblevel%", prog.getLevelFormatted()); message = message.replace("%lostLevel%", Integer.toString(oldLevel)); if (player != null && (Jobs.getGCManager().LevelChangeActionBar || Jobs.getGCManager().LevelChangeChat)) { @@ -785,7 +785,7 @@ public class PlayerManager { .getChatColor().toString() + levelUpEvent.getOldTitle().getName()); message = message.replace("%playername%", player != null ? plugin.getComplement().getDisplayName(player) : jPlayer.getName()); - message = message.replace("%joblevel%", Integer.toString(prog.getLevel())); + message = message.replace("%joblevel%", prog.getLevelFormatted()); if (Jobs.getGCManager().isBroadcastingLevelups() || Jobs.getGCManager().LevelChangeActionBar || Jobs.getGCManager().LevelChangeChat) { for (String line : message.split("\n")) { diff --git a/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java b/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java index c0752b53..e9606435 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java +++ b/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java @@ -393,7 +393,7 @@ public class JobsCommands implements CommandExecutor { Title title = Jobs.getTitleManager().getTitle(jobProg.getLevel(), jobProg.getJob().getName()); String message = Jobs.getLanguage().getMessage(path, - "%joblevel%", jobProg.getLevel(), + "%joblevel%", jobProg.getLevelFormatted(), "%jobname%", jobProg.getJob().getJobDisplayName(), "%jobxp%", Math.round(jobProg.getExperience() * 100.0) / 100.0, "%jobmaxxp%", jobProg.getMaxExperience(), diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/exp.java b/src/main/java/com/gamingmesh/jobs/commands/list/exp.java index c6bb8729..ecbeb74e 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/exp.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/exp.java @@ -81,7 +81,7 @@ public class exp implements Cmd { Player player = jPlayer.getPlayer(); if (player != null) - player.sendMessage(Jobs.getLanguage().getMessage("command.exp.output.target", "%jobname%", job.getJobDisplayName(), "%level%", prog.getLevel(), "%exp%", prog + player.sendMessage(Jobs.getLanguage().getMessage("command.exp.output.target", "%jobname%", job.getJobDisplayName(), "%level%", prog.getLevelFormatted(), "%exp%", prog .getExperience())); sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success")); } else diff --git a/src/main/java/com/gamingmesh/jobs/config/BossBarManager.java b/src/main/java/com/gamingmesh/jobs/config/BossBarManager.java index 4434d784..08e404ec 100644 --- a/src/main/java/com/gamingmesh/jobs/config/BossBarManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/BossBarManager.java @@ -65,7 +65,7 @@ public class BossBarManager { } String message = Jobs.getLanguage().getMessage("command.stats.bossBarOutput", - "%joblevel%", Integer.toString(jobProg.getLevel()), + "%joblevel%", jobProg.getLevelFormatted(), "%jobname%", jobProg.getJob().getJobDisplayName(), "%jobxp%", formatter.format(Math.round(jobProg.getExperience() * 100.0) / 100.0), "%jobmaxxp%", jobProg.getMaxExperience(), diff --git a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java index 9f723d6b..35c82ac0 100644 --- a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java @@ -97,7 +97,7 @@ public class GeneralConfigManager { JobsGUIOpenOnBrowse, JobsGUIShowChatBrowse, JobsGUISwitcheButtons, ShowActionNames, hideItemAttributes, DisableJoiningJobThroughGui, FireworkLevelupUse, UseRandom, UsePerPermissionForLeaving, EnableConfirmation, jobsInfoOpensBrowse, MonsterDamageUse, useMaxPaymentCurve, - hideJobsInfoWithoutPermission, UseTaxes, TransferToServerAccount, TakeFromPlayersPayment, AutoJobJoinUse, AllowDelevel, + hideJobsInfoWithoutPermission, UseTaxes, TransferToServerAccount, TakeFromPlayersPayment, AutoJobJoinUse, AllowDelevel, RomanNumbers, BossBarEnabled = false, BossBarShowOnEachAction = false, BossBarsMessageByDefault = false, ExploreCompact, DBCleaningJobsUse, DBCleaningUsersUse, DisabledWorldsUse, UseAsWhiteListWorldList, PaymentMethodsMoney, PaymentMethodsPoints, PaymentMethodsExp, MythicMobsEnabled, LoggingUse, payForCombiningItems, BlastFurnacesReassign = false, SmokerReassign = false, payForStackedEntities, payForAbove = false, @@ -376,6 +376,9 @@ public class GeneralConfigManager { "ATTENTION! Set it to true only if you certain that commands performed on level up will not cause issues if player start level and delevel in a row."); AllowDelevel = c.get("Optimizations.AllowDelevel", false); + c.addComment("Optimizations.RomanNumbers", "Enabling this option some places will indicate players level as XIV instead of 14", "Only or player levels"); + RomanNumbers = c.get("Optimizations.RomanNumbers", false); + // c.addComment("Optimizations.UseLocalOfflinePlayersData", "With this set to true, offline player data will be taken from local player data files", // "This will eliminate small lag spikes when request is being send to mojangs servers for offline players data", // "Theroticali this should work without issues, but if you havving some, just disable", diff --git a/src/main/java/com/gamingmesh/jobs/container/JobProgression.java b/src/main/java/com/gamingmesh/jobs/container/JobProgression.java index 354566f0..164de32e 100644 --- a/src/main/java/com/gamingmesh/jobs/container/JobProgression.java +++ b/src/main/java/com/gamingmesh/jobs/container/JobProgression.java @@ -21,7 +21,9 @@ package com.gamingmesh.jobs.container; import java.util.HashMap; import java.util.Map; +import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.stuff.TimeManage; +import com.gamingmesh.jobs.stuff.Util; public class JobProgression { private Job job; @@ -136,6 +138,16 @@ public class JobProgression { return level; } + /** + * Get the current level of this job in formatted way + * @return the level of this job + */ + public String getLevelFormatted() { + if (Jobs.getGCManager().RomanNumbers) + return Util.toRoman(level); + return String.valueOf(level); + } + /** * Sets the level of this job progression * diff --git a/src/main/java/com/gamingmesh/jobs/stuff/Util.java b/src/main/java/com/gamingmesh/jobs/stuff/Util.java index ec80d5e8..9b5b15dc 100644 --- a/src/main/java/com/gamingmesh/jobs/stuff/Util.java +++ b/src/main/java/com/gamingmesh/jobs/stuff/Util.java @@ -9,6 +9,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.TreeMap; import java.util.UUID; import java.util.jar.JarEntry; import java.util.jar.JarFile; @@ -48,6 +49,32 @@ public final class Util { public static final List LEAVECONFIRM = new ArrayList<>(); + private final static TreeMap map = new TreeMap(); + + static { + map.put(1000, "M"); + map.put(900, "CM"); + map.put(500, "D"); + map.put(400, "CD"); + map.put(100, "C"); + map.put(90, "XC"); + map.put(50, "L"); + map.put(40, "XL"); + map.put(10, "X"); + map.put(9, "IX"); + map.put(5, "V"); + map.put(4, "IV"); + map.put(1, "I"); + } + + public final static String toRoman(int number) { + int l = map.floorKey(number); + if (number == l) { + return map.get(number); + } + return map.get(l) + toRoman(number - l); + } + public static List getPistonRetractBlocks(BlockPistonRetractEvent event) { if (Version.isCurrentEqualOrHigher(Version.v1_8_R1)) { return new ArrayList<>(event.getBlocks()); @@ -101,7 +128,7 @@ public final class Util { if (zombie.getVillagerProfession().toString().equals("HUSK")) return "ZombieHusk"; } else if (zombie.isVillager()) { - return "ZombieVillager"; + return "ZombieVillager"; } break;