From ffade2e7b86b66addb3d4ec7434599873f82d781 Mon Sep 17 00:00:00 2001 From: Zrips Date: Mon, 7 Mar 2022 15:10:52 +0200 Subject: [PATCH] Small changes --- src/main/java/com/gamingmesh/jobs/Jobs.java | 8 ++++---- .../com/gamingmesh/jobs/commands/JobsCommands.java | 14 ++++++++------ .../com/gamingmesh/jobs/commands/list/stats.java | 8 +++++++- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/Jobs.java b/src/main/java/com/gamingmesh/jobs/Jobs.java index f4560d6a..ede083c0 100644 --- a/src/main/java/com/gamingmesh/jobs/Jobs.java +++ b/src/main/java/com/gamingmesh/jobs/Jobs.java @@ -387,10 +387,10 @@ public final class Jobs extends JavaPlugin { return cManager; } -// @Deprecated -// public static ExploreManager getExplore() { -// return getExploreManager(); -// } + @Deprecated + public static ExploreManager getExplore() { + return getExploreManager(); + } public static ExploreManager getExploreManager() { if (exploreManager == null) diff --git a/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java b/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java index 267f1223..b9dd5f56 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java +++ b/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java @@ -25,6 +25,7 @@ import com.gamingmesh.jobs.stuff.Util; import net.Zrips.CMILib.ActionBar.CMIActionBar; import net.Zrips.CMILib.Container.PageInfo; +import net.Zrips.CMILib.Logs.CMIDebug; import net.Zrips.CMILib.RawMessages.RawMessage; public class JobsCommands implements CommandExecutor { @@ -406,6 +407,9 @@ public class JobsCommands implements CommandExecutor { return " " + (isMaxLevelReached ? "" : jobProgressMessage(jobProg.getMaxExperience(), jobProg.getExperience())) + " " + message; } + private String pos = ChatColor.DARK_GREEN + "\u258F"; + private String pros = ChatColor.YELLOW + "\u258F"; + public String jobProgressMessage(double max, double current) { if (current < 0) current = 0; @@ -416,21 +420,19 @@ public class JobsCommands implements CommandExecutor { if (max < 1) max = 2; - String message = ""; - String pos = ChatColor.DARK_GREEN + "\u258F"; - String pros = ChatColor.YELLOW + "\u258F"; + StringBuilder message = new StringBuilder(); int percentage = (int) ((current * 50.0) / max); for (int i = 0; i < percentage; i++) { - message += pos; + message.append(pos); } if (50 - percentage < 0) percentage = 50; for (int i = 0; i < 50 - percentage; i++) { - message += pros; + message.append(pros); } - return message; + return message.toString(); } /** diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/stats.java b/src/main/java/com/gamingmesh/jobs/commands/list/stats.java index 2fcb9cec..fa6822a3 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/stats.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/stats.java @@ -5,9 +5,11 @@ import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; +import com.gamingmesh.jobs.commands.JobsCommands; import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobsPlayer; +import net.Zrips.CMILib.Logs.CMIDebug; import net.Zrips.CMILib.RawMessages.RawMessage; public class stats implements Cmd { @@ -40,11 +42,15 @@ public class stats implements Cmd { String leftClick = Jobs.getLanguage().getMessage("command.info.gui.leftClick"); + String pref = JobsCommands.LABEL + " " + info.class.getSimpleName() + " "; + + RawMessage rm = new RawMessage(); for (JobProgression jobProg : jPlayer.progression) { for (String msg : Jobs.getCommandManager().jobStatsMessage(jobProg).split("\n")) { - new RawMessage().addText(msg).addHover(leftClick).addCommand("jobs info " + jobProg.getJob().getName()).show(sender); + rm.addText(msg).addHover(leftClick).addCommand(pref + jobProg.getJob().getName()); } } + rm.show(sender); sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator")); return true;