1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 14:05:25 +01:00

Lets accept Null as command perform return for more control over it

This commit is contained in:
Zrips 2023-05-03 12:04:00 +03:00
parent 84cb2cef92
commit 9b935c53e9
56 changed files with 98 additions and 88 deletions

View File

@ -5,5 +5,5 @@ import org.bukkit.command.CommandSender;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
public interface Cmd { public interface Cmd {
boolean perform(Jobs plugin, CommandSender sender, String[] args); Boolean perform(Jobs plugin, CommandSender sender, String[] args);
} }

View File

@ -114,7 +114,12 @@ public class JobsCommands implements CommandExecutor {
return true; return true;
} }
return cmdClass.perform(plugin, sender, myArgs) || help(sender, 1); Boolean result = cmdClass.perform(plugin, sender, myArgs);
if (result != null && !result)
sendUsage(sender, cmd);
return result == null || !result ? false : true;
} }
private static String[] reduceArgs(String[] args) { private static String[] reduceArgs(String[] args) {
@ -417,6 +422,10 @@ public class JobsCommands implements CommandExecutor {
* @return the message * @return the message
*/ */
public String jobStatsMessage(JobProgression jobProg) { public String jobStatsMessage(JobProgression jobProg) {
return jobStatsMessage(jobProg, true);
}
public String jobStatsMessage(JobProgression jobProg, boolean progressBar) {
boolean isMaxLevelReached = jobProg.getLevel() == jobProg.getJob().getMaxLevel(); boolean isMaxLevelReached = jobProg.getLevel() == jobProg.getJob().getMaxLevel();
String path = "command.stats.output." + (isMaxLevelReached ? "max-level" String path = "command.stats.output." + (isMaxLevelReached ? "max-level"
: "message"); : "message");
@ -428,7 +437,7 @@ public class JobsCommands implements CommandExecutor {
"%jobxp%", Math.round(jobProg.getExperience() * 100.0) / 100.0, "%jobxp%", Math.round(jobProg.getExperience() * 100.0) / 100.0,
"%jobmaxxp%", jobProg.getMaxExperience(), "%jobmaxxp%", jobProg.getMaxExperience(),
"%titlename%", title == null ? "Unknown" : title.getName()); "%titlename%", title == null ? "Unknown" : title.getName());
return " " + (isMaxLevelReached ? "" : jobProgressMessage(jobProg.getMaxExperience(), jobProg.getExperience())) + " " + message; return " " + (isMaxLevelReached ? "" : progressBar ? jobProgressMessage(jobProg.getMaxExperience(), jobProg.getExperience()) : "") + " " + message;
} }
public String jobProgressMessage(double max, double current) { public String jobProgressMessage(double max, double current) {

View File

@ -16,11 +16,11 @@ import net.Zrips.CMILib.RawMessages.RawMessage;
public class archive implements Cmd { public class archive implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
JobsPlayer jPlayer = null; JobsPlayer jPlayer = null;
if (args.length >= 1) { if (args.length >= 1) {
if (!Jobs.hasPermission(sender, "jobs.command.admin.archive", true)) { if (!Jobs.hasPermission(sender, "jobs.command.admin.archive", true)) {
return true; return null;
} }
jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]); jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
@ -31,13 +31,13 @@ public class archive implements Cmd {
if (jPlayer == null) { if (jPlayer == null) {
if (args.length >= 1) if (args.length >= 1)
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0])); sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0]));
return true; return null;
} }
Set<JobProgression> allJobs = jPlayer.getArchivedJobs().getArchivedJobs(); Set<JobProgression> allJobs = jPlayer.getArchivedJobs().getArchivedJobs();
if (allJobs.isEmpty()) { if (allJobs.isEmpty()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.archive.error.nojob")); sender.sendMessage(Jobs.getLanguage().getMessage("command.archive.error.nojob"));
return true; return null;
} }
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.toplineseparator", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getDisplayName())); sender.sendMessage(Jobs.getLanguage().getMessage("general.info.toplineseparator", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getDisplayName()));

View File

@ -20,7 +20,7 @@ import net.Zrips.CMILib.Messages.CMIMessages;
public class area implements Cmd { public class area implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return false;

View File

@ -18,7 +18,7 @@ public class blockinfo implements Cmd {
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public boolean perform(Jobs plugin, CommandSender sender, String[] args) { public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return false;

View File

@ -21,7 +21,7 @@ import net.Zrips.CMILib.RawMessages.RawMessage;
public class bonus implements Cmd { public class bonus implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return false;

View File

@ -16,7 +16,7 @@ import net.Zrips.CMILib.Time.timeModifier;
public class boost implements Cmd { public class boost implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, CommandSender sender, String[] args) { public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
Double rate = null; Double rate = null;
Long timeDuration = null; Long timeDuration = null;

View File

@ -23,7 +23,7 @@ public class bp implements Cmd {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame); CMIMessages.sendMessage(sender, LC.info_Ingame);

View File

@ -17,7 +17,7 @@ import net.Zrips.CMILib.RawMessages.RawMessage;
public class browse implements Cmd { public class browse implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, CommandSender sender, final String[] args) {
boolean senderIsPlayer = sender instanceof Player; boolean senderIsPlayer = sender instanceof Player;
if (Jobs.getGCManager().BrowseUseNewLook) { if (Jobs.getGCManager().BrowseUseNewLook) {

View File

@ -18,7 +18,7 @@ import net.Zrips.CMILib.Messages.CMIMessages;
public class clearownership implements Cmd { public class clearownership implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
JobsPlayer jPlayer = null; JobsPlayer jPlayer = null;
String location = null; String location = null;

View File

@ -14,7 +14,7 @@ import net.Zrips.CMILib.Messages.CMIMessages;
public class convert implements Cmd { public class convert implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, CommandSender sender, String[] args) { public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
if (sender instanceof Player) { if (sender instanceof Player) {
CMIMessages.sendMessage(sender, LC.info_FromConsole); CMIMessages.sendMessage(sender, LC.info_FromConsole);
return true; return true;

View File

@ -13,7 +13,7 @@ import net.Zrips.CMILib.Colors.CMIChatColor;
public class demote implements Cmd { public class demote implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, CommandSender sender, String[] args) { public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
if (args.length < 3) { if (args.length < 3) {
Jobs.getCommandManager().sendUsage(sender, "demote"); Jobs.getCommandManager().sendUsage(sender, "demote");
return true; return true;

View File

@ -35,7 +35,7 @@ public class edititembonus implements Cmd {
} }
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return false;

View File

@ -27,7 +27,7 @@ public class editjobs implements Cmd {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@Override @Override
public boolean perform(Jobs plugin, CommandSender sender, String[] args) { public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
if (!(sender instanceof Player)) if (!(sender instanceof Player))
return false; return false;

View File

@ -12,7 +12,7 @@ import net.Zrips.CMILib.Messages.CMIMessages;
public class editpoints implements Cmd { public class editpoints implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, CommandSender sender, String[] args) { public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
if (args.length != 3) { if (args.length != 3) {
Jobs.getCommandManager().sendUsage(sender, "editpoints"); Jobs.getCommandManager().sendUsage(sender, "editpoints");
return true; return true;

View File

@ -50,7 +50,7 @@ public class editquests implements Cmd {
static HashMap<String, List<String>> tempObjectives = new HashMap<String, List<String>>(); static HashMap<String, List<String>> tempObjectives = new HashMap<String, List<String>>();
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, String[] args) {
int page = 0; int page = 0;

View File

@ -11,7 +11,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
public class employ implements Cmd { public class employ implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, CommandSender sender, String[] args) { public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
if (args.length < 2) { if (args.length < 2) {
Jobs.getCommandManager().sendUsage(sender, "employ"); Jobs.getCommandManager().sendUsage(sender, "employ");
return true; return true;

View File

@ -11,7 +11,7 @@ import net.Zrips.CMILib.Colors.CMIChatColor;
public class entitylist implements Cmd { public class entitylist implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length != 0) { if (args.length != 0) {
Jobs.getCommandManager().sendUsage(sender, "entitylist"); Jobs.getCommandManager().sendUsage(sender, "entitylist");
return true; return true;

View File

@ -21,7 +21,7 @@ public class exp implements Cmd {
Random rand = new Random(); Random rand = new Random();
@Override @Override
public boolean perform(Jobs plugin, CommandSender sender, String[] args) { public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
if (args.length < 4) { if (args.length < 4) {
Jobs.getCommandManager().sendUsage(sender, "exp"); Jobs.getCommandManager().sendUsage(sender, "exp");

View File

@ -14,7 +14,7 @@ import com.gamingmesh.jobs.container.PlayerInfo;
public class explored implements Cmd { public class explored implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, CommandSender sender, String[] args) { public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
if (!(sender instanceof Player)) if (!(sender instanceof Player))
return false; return false;

View File

@ -11,7 +11,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
public class fire implements Cmd { public class fire implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length < 2) { if (args.length < 2) {
Jobs.getCommandManager().sendUsage(sender, "fire"); Jobs.getCommandManager().sendUsage(sender, "fire");
return true; return true;

View File

@ -15,7 +15,7 @@ import net.Zrips.CMILib.Messages.CMIMessages;
public class fireall implements Cmd { public class fireall implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length < 1) { if (args.length < 1) {
Jobs.getCommandManager().sendUsage(sender, "fireall"); Jobs.getCommandManager().sendUsage(sender, "fireall");
return true; return true;

View File

@ -27,7 +27,7 @@ public class give implements Cmd {
} }
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
Player player = null; Player player = null;
Job job = null; Job job = null;
actions name = null; actions name = null;

View File

@ -22,7 +22,7 @@ import net.Zrips.CMILib.Time.CMITimeManager;
public class glog implements Cmd { public class glog implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length != 0) { if (args.length != 0) {
Jobs.getCommandManager().sendUsage(sender, "glog"); Jobs.getCommandManager().sendUsage(sender, "glog");
return true; return true;

View File

@ -12,7 +12,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
public class grantxp implements Cmd { public class grantxp implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length < 3) { if (args.length < 3) {
Jobs.getCommandManager().sendUsage(sender, "grantxp"); Jobs.getCommandManager().sendUsage(sender, "grantxp");
return true; return true;

View File

@ -19,7 +19,7 @@ import net.Zrips.CMILib.Scoreboards.CMIScoreboard;
public class gtop implements Cmd { public class gtop implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return false;

View File

@ -15,7 +15,7 @@ import net.Zrips.CMILib.Messages.CMIMessages;
public class info implements Cmd { public class info implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame); CMIMessages.sendMessage(sender, LC.info_Ingame);

View File

@ -27,7 +27,7 @@ import net.Zrips.CMILib.RawMessages.RawMessage;
public class itembonus implements Cmd { public class itembonus implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return false;

View File

@ -19,7 +19,7 @@ public class iteminfo implements Cmd {
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return false;

View File

@ -16,7 +16,7 @@ import net.Zrips.CMILib.RawMessages.RawMessage;
public class join implements Cmd { public class join implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return false;

View File

@ -15,7 +15,7 @@ import net.Zrips.CMILib.Messages.CMIMessages;
public class leave implements Cmd { public class leave implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) if (!(sender instanceof Player))
return false; return false;

View File

@ -17,7 +17,7 @@ import net.Zrips.CMILib.Messages.CMIMessages;
public class leaveall implements Cmd { public class leaveall implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return false;

View File

@ -17,7 +17,7 @@ public class level implements Cmd {
} }
@Override @Override
public boolean perform(Jobs plugin, CommandSender sender, String[] args) { public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
if (args.length < 4) { if (args.length < 4) {
Jobs.getCommandManager().sendUsage(sender, "level"); Jobs.getCommandManager().sendUsage(sender, "level");
return true; return true;

View File

@ -17,7 +17,7 @@ import net.Zrips.CMILib.Time.CMITimeManager;
public class limit implements Cmd { public class limit implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length != 0 && args.length != 1) { if (args.length != 0 && args.length != 1) {
Jobs.getCommandManager().sendUsage(sender, "limit"); Jobs.getCommandManager().sendUsage(sender, "limit");
return true; return true;

View File

@ -23,7 +23,7 @@ import net.Zrips.CMILib.Messages.CMIMessages;
public class log implements Cmd { public class log implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player) && args.length != 1) { if (!(sender instanceof Player) && args.length != 1) {
CMIMessages.sendMessage(sender, LC.info_Ingame); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return false;

View File

@ -26,7 +26,7 @@ import net.Zrips.CMILib.RawMessages.RawMessage;
public class ownedblocks implements Cmd { public class ownedblocks implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
JobsPlayer jPlayer = null; JobsPlayer jPlayer = null;
if (args.length >= 1) { if (args.length >= 1) {
if (!Jobs.hasPermission(sender, "jobs.command.admin.ownedblocks", true)) if (!Jobs.hasPermission(sender, "jobs.command.admin.ownedblocks", true))

View File

@ -16,7 +16,7 @@ import net.Zrips.CMILib.RawMessages.RawMessage;
public class placeholders implements Cmd { public class placeholders implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
boolean isPlayer = sender instanceof Player; boolean isPlayer = sender instanceof Player;
Player player = isPlayer ? (Player) sender : null; Player player = isPlayer ? (Player) sender : null;

View File

@ -10,7 +10,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
public class playerinfo implements Cmd { public class playerinfo implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length < 2) { if (args.length < 2) {
Jobs.getCommandManager().sendUsage(sender, "playerinfo"); Jobs.getCommandManager().sendUsage(sender, "playerinfo");
Jobs.getCommandManager().sendValidActions(sender); Jobs.getCommandManager().sendValidActions(sender);

View File

@ -14,7 +14,7 @@ import net.Zrips.CMILib.Messages.CMIMessages;
public class points implements Cmd { public class points implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length != 0 && args.length != 1) { if (args.length != 0 && args.length != 1) {
Jobs.getCommandManager().sendUsage(sender, "points"); Jobs.getCommandManager().sendUsage(sender, "points");

View File

@ -11,7 +11,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
public class promote implements Cmd { public class promote implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length < 3) { if (args.length < 3) {
Jobs.getCommandManager().sendUsage(sender, "promote"); Jobs.getCommandManager().sendUsage(sender, "promote");
return true; return true;

View File

@ -23,7 +23,7 @@ import net.Zrips.CMILib.Time.CMITimeManager;
public class quests implements Cmd { public class quests implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, String[] args) {
if (!Jobs.getGCManager().DailyQuestsEnabled) { if (!Jobs.getGCManager().DailyQuestsEnabled) {
LC.info_FeatureNotEnabled.sendMessage(sender); LC.info_FeatureNotEnabled.sendMessage(sender);

View File

@ -8,7 +8,7 @@ import com.gamingmesh.jobs.commands.Cmd;
public class reload implements Cmd { public class reload implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
Jobs.reload(); Jobs.reload();
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success")); sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
return true; return true;

View File

@ -11,7 +11,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
public class removexp implements Cmd { public class removexp implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length < 3) { if (args.length < 3) {
Jobs.getCommandManager().sendUsage(sender, "removexp"); Jobs.getCommandManager().sendUsage(sender, "removexp");
return true; return true;

View File

@ -11,7 +11,7 @@ public class resetexploreregion implements Cmd {
private static String REGEX = "^[0-9a-zA-Z_-]+$"; private static String REGEX = "^[0-9a-zA-Z_-]+$";
@Override @Override
public boolean perform(Jobs plugin, CommandSender sender, String[] args) { public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
if (args.length != 2 || !WORLD.equals(args[0])) { if (args.length != 2 || !WORLD.equals(args[0])) {
Jobs.getCommandManager().sendUsage(sender, "resetexploreregion"); Jobs.getCommandManager().sendUsage(sender, "resetexploreregion");
return true; return true;

View File

@ -8,7 +8,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
public class resetlimit implements Cmd { public class resetlimit implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length != 1) { if (args.length != 1) {
Jobs.getCommandManager().sendUsage(sender, "resetlimit"); Jobs.getCommandManager().sendUsage(sender, "resetlimit");
return true; return true;

View File

@ -16,7 +16,7 @@ import net.Zrips.CMILib.Locale.LC;
public class resetquest implements Cmd { public class resetquest implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!Jobs.getGCManager().DailyQuestsEnabled) { if (!Jobs.getGCManager().DailyQuestsEnabled) {
LC.info_FeatureNotEnabled.sendMessage(sender); LC.info_FeatureNotEnabled.sendMessage(sender);

View File

@ -16,7 +16,7 @@ import net.Zrips.CMILib.Locale.LC;
public class resetquesttotal implements Cmd { public class resetquesttotal implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!Jobs.getGCManager().DailyQuestsEnabled) { if (!Jobs.getGCManager().DailyQuestsEnabled) {
LC.info_FeatureNotEnabled.sendMessage(sender); LC.info_FeatureNotEnabled.sendMessage(sender);
return true; return true;

View File

@ -13,7 +13,7 @@ import com.gamingmesh.jobs.commands.Cmd;
public class schedule implements Cmd { public class schedule implements Cmd {
@Override @Override
public boolean perform(final Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(final Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length < 2) { if (args.length < 2) {
Jobs.getCommandManager().sendUsage(sender, "schedule"); Jobs.getCommandManager().sendUsage(sender, "schedule");
return true; return true;

View File

@ -11,7 +11,7 @@ import net.Zrips.CMILib.Locale.LC;
public class shop implements Cmd { public class shop implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!Jobs.getGCManager().jobsshopenabled) { if (!Jobs.getGCManager().jobsshopenabled) {
LC.info_FeatureNotEnabled.sendMessage(sender); LC.info_FeatureNotEnabled.sendMessage(sender);

View File

@ -10,7 +10,7 @@ import com.gamingmesh.jobs.container.Job;
public class signupdate implements Cmd { public class signupdate implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!Jobs.getGCManager().SignsEnabled) if (!Jobs.getGCManager().SignsEnabled)
return true; return true;

View File

@ -18,7 +18,7 @@ import net.Zrips.CMILib.Locale.LC;
public class skipquest implements Cmd { public class skipquest implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!Jobs.getGCManager().DailyQuestsEnabled) { if (!Jobs.getGCManager().DailyQuestsEnabled) {
LC.info_FeatureNotEnabled.sendMessage(sender); LC.info_FeatureNotEnabled.sendMessage(sender);
return true; return true;

View File

@ -8,6 +8,7 @@ import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.commands.JobsCommands; 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 com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Locale.LC; import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.Messages.CMIMessages;
@ -16,42 +17,42 @@ import net.Zrips.CMILib.RawMessages.RawMessage;
public class stats implements Cmd { public class stats implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
JobsPlayer jPlayer = null; JobsPlayer jPlayer = null;
if (args.length >= 1) { if (args.length >= 1) {
if (!Jobs.hasPermission(sender, "jobs.command.admin.stats", true)) if (!Jobs.hasPermission(sender, "jobs.command.admin.stats", true))
return true; return true;
jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]); jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
} else if (sender instanceof Player) } else if (sender instanceof Player p)
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender); jPlayer = Jobs.getPlayerManager().getJobsPlayer(p);
if (jPlayer == null) { if (jPlayer == null) {
if (args.length >= 1) if (args.length >= 1)
CMIMessages.sendMessage(sender, LC.info_NoInformation); CMIMessages.sendMessage(sender, LC.info_NoInformation);
else else
Jobs.getCommandManager().sendUsage(sender, "stats"); Jobs.getCommandManager().sendUsage(sender, "stats");
return true; return true;
} }
if (jPlayer.progression.isEmpty()) { if (jPlayer.progression.isEmpty()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.stats.error.nojob")); Language.sendMessage(sender, "command.stats.error.nojob");
return true; return true;
} }
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.toplineseparator", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getDisplayName())); Language.sendMessage(sender, "general.info.toplineseparator", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getDisplayName());
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() + " "; String pref = JobsCommands.LABEL + " " + info.class.getSimpleName() + " ";
for (JobProgression jobProg : jPlayer.getJobProgression()) { for (JobProgression jobProg : jPlayer.getJobProgression()) {
for (String msg : Jobs.getCommandManager().jobStatsMessage(jobProg).split("\n")) { for (String msg : Jobs.getCommandManager().jobStatsMessage(jobProg, sender instanceof Player).split("\n")) {
new RawMessage().addText(msg).addHover(leftClick).addCommand(pref + jobProg.getJob().getName()).show(sender); new RawMessage().addText(msg).addHover(leftClick).addCommand(pref + jobProg.getJob().getName()).show(sender);
} }
} }
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator")); Language.sendMessage(sender, "general.info.separator");
return true; return true;
} }
} }

View File

@ -15,7 +15,7 @@ import net.Zrips.CMILib.Messages.CMIMessages;
public class toggle implements Cmd { public class toggle implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return false;

View File

@ -21,7 +21,7 @@ import net.Zrips.CMILib.Scoreboards.CMIScoreboard;
public class top implements Cmd { public class top implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length != 1 && args.length != 2) { if (args.length != 1 && args.length != 2) {
Jobs.getCommandManager().sendUsage(sender, "top"); Jobs.getCommandManager().sendUsage(sender, "top");

View File

@ -11,7 +11,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
public class transfer implements Cmd { public class transfer implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length < 3) { if (args.length < 3) {
Jobs.getCommandManager().sendUsage(sender, "transfer"); Jobs.getCommandManager().sendUsage(sender, "transfer");
return true; return true;

View File

@ -18,7 +18,7 @@ import net.milkbowl.vault.economy.Economy;
public class version implements Cmd { public class version implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override @Override