1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-02 14:29:07 +01:00

Small changes

This commit is contained in:
Zrips 2022-03-07 15:10:52 +02:00
parent 1cb965c833
commit ffade2e7b8
3 changed files with 19 additions and 11 deletions

View File

@ -387,10 +387,10 @@ public final class Jobs extends JavaPlugin {
return cManager; return cManager;
} }
// @Deprecated @Deprecated
// public static ExploreManager getExplore() { public static ExploreManager getExplore() {
// return getExploreManager(); return getExploreManager();
// } }
public static ExploreManager getExploreManager() { public static ExploreManager getExploreManager() {
if (exploreManager == null) if (exploreManager == null)

View File

@ -25,6 +25,7 @@ import com.gamingmesh.jobs.stuff.Util;
import net.Zrips.CMILib.ActionBar.CMIActionBar; import net.Zrips.CMILib.ActionBar.CMIActionBar;
import net.Zrips.CMILib.Container.PageInfo; import net.Zrips.CMILib.Container.PageInfo;
import net.Zrips.CMILib.Logs.CMIDebug;
import net.Zrips.CMILib.RawMessages.RawMessage; import net.Zrips.CMILib.RawMessages.RawMessage;
public class JobsCommands implements CommandExecutor { public class JobsCommands implements CommandExecutor {
@ -406,6 +407,9 @@ public class JobsCommands implements CommandExecutor {
return " " + (isMaxLevelReached ? "" : jobProgressMessage(jobProg.getMaxExperience(), jobProg.getExperience())) + " " + message; 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) { public String jobProgressMessage(double max, double current) {
if (current < 0) if (current < 0)
current = 0; current = 0;
@ -416,21 +420,19 @@ public class JobsCommands implements CommandExecutor {
if (max < 1) if (max < 1)
max = 2; max = 2;
String message = ""; StringBuilder message = new StringBuilder();
String pos = ChatColor.DARK_GREEN + "\u258F";
String pros = ChatColor.YELLOW + "\u258F";
int percentage = (int) ((current * 50.0) / max); int percentage = (int) ((current * 50.0) / max);
for (int i = 0; i < percentage; i++) { for (int i = 0; i < percentage; i++) {
message += pos; message.append(pos);
} }
if (50 - percentage < 0) if (50 - percentage < 0)
percentage = 50; percentage = 50;
for (int i = 0; i < 50 - percentage; i++) { for (int i = 0; i < 50 - percentage; i++) {
message += pros; message.append(pros);
} }
return message; return message.toString();
} }
/** /**

View File

@ -5,9 +5,11 @@ import org.bukkit.entity.Player;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.commands.JobsCommands;
import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobProgression;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import net.Zrips.CMILib.Logs.CMIDebug;
import net.Zrips.CMILib.RawMessages.RawMessage; import net.Zrips.CMILib.RawMessages.RawMessage;
public class stats implements Cmd { public class stats implements Cmd {
@ -40,11 +42,15 @@ public class stats implements Cmd {
String leftClick = Jobs.getLanguage().getMessage("command.info.gui.leftClick"); 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 (JobProgression jobProg : jPlayer.progression) {
for (String msg : Jobs.getCommandManager().jobStatsMessage(jobProg).split("\n")) { 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")); sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator"));
return true; return true;