mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-25 20:16:13 +01:00
Lets accept Null as command perform return for more control over it
This commit is contained in:
parent
84cb2cef92
commit
9b935c53e9
@ -5,5 +5,5 @@ import org.bukkit.command.CommandSender;
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
|
||||
public interface Cmd {
|
||||
boolean perform(Jobs plugin, CommandSender sender, String[] args);
|
||||
Boolean perform(Jobs plugin, CommandSender sender, String[] args);
|
||||
}
|
||||
|
@ -114,7 +114,12 @@ public class JobsCommands implements CommandExecutor {
|
||||
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) {
|
||||
@ -417,6 +422,10 @@ public class JobsCommands implements CommandExecutor {
|
||||
* @return the message
|
||||
*/
|
||||
public String jobStatsMessage(JobProgression jobProg) {
|
||||
return jobStatsMessage(jobProg, true);
|
||||
}
|
||||
|
||||
public String jobStatsMessage(JobProgression jobProg, boolean progressBar) {
|
||||
boolean isMaxLevelReached = jobProg.getLevel() == jobProg.getJob().getMaxLevel();
|
||||
String path = "command.stats.output." + (isMaxLevelReached ? "max-level"
|
||||
: "message");
|
||||
@ -428,7 +437,7 @@ public class JobsCommands implements CommandExecutor {
|
||||
"%jobxp%", Math.round(jobProg.getExperience() * 100.0) / 100.0,
|
||||
"%jobmaxxp%", jobProg.getMaxExperience(),
|
||||
"%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) {
|
||||
|
@ -16,11 +16,11 @@ import net.Zrips.CMILib.RawMessages.RawMessage;
|
||||
public class archive implements Cmd {
|
||||
|
||||
@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;
|
||||
if (args.length >= 1) {
|
||||
if (!Jobs.hasPermission(sender, "jobs.command.admin.archive", true)) {
|
||||
return true;
|
||||
return null;
|
||||
}
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
|
||||
|
||||
@ -31,13 +31,13 @@ public class archive implements Cmd {
|
||||
if (jPlayer == null) {
|
||||
if (args.length >= 1)
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0]));
|
||||
return true;
|
||||
return null;
|
||||
}
|
||||
|
||||
Set<JobProgression> allJobs = jPlayer.getArchivedJobs().getArchivedJobs();
|
||||
if (allJobs.isEmpty()) {
|
||||
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()));
|
||||
|
@ -20,7 +20,7 @@ import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
public class area implements Cmd {
|
||||
|
||||
@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)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
return false;
|
||||
|
@ -18,7 +18,7 @@ public class blockinfo implements Cmd {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
return false;
|
||||
|
@ -21,7 +21,7 @@ import net.Zrips.CMILib.RawMessages.RawMessage;
|
||||
public class bonus implements Cmd {
|
||||
|
||||
@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)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
return false;
|
||||
|
@ -16,7 +16,7 @@ import net.Zrips.CMILib.Time.timeModifier;
|
||||
public class boost implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
|
||||
Double rate = null;
|
||||
Long timeDuration = null;
|
||||
|
@ -23,7 +23,7 @@ public class bp implements Cmd {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@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)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
|
@ -17,7 +17,7 @@ import net.Zrips.CMILib.RawMessages.RawMessage;
|
||||
public class browse implements Cmd {
|
||||
|
||||
@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;
|
||||
|
||||
if (Jobs.getGCManager().BrowseUseNewLook) {
|
||||
|
@ -18,7 +18,7 @@ import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
public class clearownership implements Cmd {
|
||||
|
||||
@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;
|
||||
String location = null;
|
||||
|
||||
|
@ -14,7 +14,7 @@ import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
public class convert implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
CMIMessages.sendMessage(sender, LC.info_FromConsole);
|
||||
return true;
|
||||
|
@ -13,7 +13,7 @@ import net.Zrips.CMILib.Colors.CMIChatColor;
|
||||
public class demote implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
if (args.length < 3) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "demote");
|
||||
return true;
|
||||
|
@ -35,7 +35,7 @@ public class edititembonus implements Cmd {
|
||||
}
|
||||
|
||||
@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)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
return false;
|
||||
|
@ -27,7 +27,7 @@ public class editjobs implements Cmd {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
|
||||
if (!(sender instanceof Player))
|
||||
return false;
|
||||
|
@ -12,7 +12,7 @@ import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
public class editpoints implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
if (args.length != 3) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "editpoints");
|
||||
return true;
|
||||
|
@ -50,7 +50,7 @@ public class editquests implements Cmd {
|
||||
static HashMap<String, List<String>> tempObjectives = new HashMap<String, List<String>>();
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, String[] args) {
|
||||
|
||||
int page = 0;
|
||||
|
||||
|
@ -11,7 +11,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
public class employ implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
if (args.length < 2) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "employ");
|
||||
return true;
|
||||
|
@ -11,7 +11,7 @@ import net.Zrips.CMILib.Colors.CMIChatColor;
|
||||
public class entitylist implements Cmd {
|
||||
|
||||
@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) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "entitylist");
|
||||
return true;
|
||||
|
@ -21,7 +21,7 @@ public class exp implements Cmd {
|
||||
Random rand = new Random();
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
|
||||
if (args.length < 4) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "exp");
|
||||
|
@ -14,7 +14,7 @@ import com.gamingmesh.jobs.container.PlayerInfo;
|
||||
public class explored implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
if (!(sender instanceof Player))
|
||||
return false;
|
||||
|
||||
|
@ -11,7 +11,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
public class fire implements Cmd {
|
||||
|
||||
@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) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "fire");
|
||||
return true;
|
||||
|
@ -15,7 +15,7 @@ import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
public class fireall implements Cmd {
|
||||
|
||||
@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) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "fireall");
|
||||
return true;
|
||||
|
@ -27,7 +27,7 @@ public class give implements Cmd {
|
||||
}
|
||||
|
||||
@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;
|
||||
Job job = null;
|
||||
actions name = null;
|
||||
|
@ -22,7 +22,7 @@ import net.Zrips.CMILib.Time.CMITimeManager;
|
||||
public class glog implements Cmd {
|
||||
|
||||
@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) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "glog");
|
||||
return true;
|
||||
|
@ -12,7 +12,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
public class grantxp implements Cmd {
|
||||
|
||||
@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) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "grantxp");
|
||||
return true;
|
||||
|
@ -19,7 +19,7 @@ import net.Zrips.CMILib.Scoreboards.CMIScoreboard;
|
||||
public class gtop implements Cmd {
|
||||
|
||||
@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)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
return false;
|
||||
|
@ -15,7 +15,7 @@ import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
public class info implements Cmd {
|
||||
|
||||
@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)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
|
@ -27,7 +27,7 @@ import net.Zrips.CMILib.RawMessages.RawMessage;
|
||||
public class itembonus implements Cmd {
|
||||
|
||||
@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)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
return false;
|
||||
|
@ -19,7 +19,7 @@ public class iteminfo implements Cmd {
|
||||
|
||||
@Override
|
||||
@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)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
return false;
|
||||
|
@ -16,7 +16,7 @@ import net.Zrips.CMILib.RawMessages.RawMessage;
|
||||
public class join implements Cmd {
|
||||
|
||||
@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)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
return false;
|
||||
|
@ -15,7 +15,7 @@ import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
public class leave implements Cmd {
|
||||
|
||||
@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))
|
||||
return false;
|
||||
|
||||
|
@ -17,7 +17,7 @@ import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
public class leaveall implements Cmd {
|
||||
|
||||
@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)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
return false;
|
||||
|
@ -17,7 +17,7 @@ public class level implements Cmd {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
if (args.length < 4) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "level");
|
||||
return true;
|
||||
|
@ -17,7 +17,7 @@ import net.Zrips.CMILib.Time.CMITimeManager;
|
||||
public class limit implements Cmd {
|
||||
|
||||
@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) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "limit");
|
||||
return true;
|
||||
|
@ -23,7 +23,7 @@ import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
public class log implements Cmd {
|
||||
|
||||
@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) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
return false;
|
||||
|
@ -26,7 +26,7 @@ import net.Zrips.CMILib.RawMessages.RawMessage;
|
||||
public class ownedblocks implements Cmd {
|
||||
|
||||
@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;
|
||||
if (args.length >= 1) {
|
||||
if (!Jobs.hasPermission(sender, "jobs.command.admin.ownedblocks", true))
|
||||
|
@ -16,7 +16,7 @@ import net.Zrips.CMILib.RawMessages.RawMessage;
|
||||
public class placeholders implements Cmd {
|
||||
|
||||
@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;
|
||||
Player player = isPlayer ? (Player) sender : null;
|
||||
|
||||
|
@ -10,7 +10,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
public class playerinfo implements Cmd {
|
||||
|
||||
@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) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "playerinfo");
|
||||
Jobs.getCommandManager().sendValidActions(sender);
|
||||
|
@ -14,7 +14,7 @@ import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
public class points implements Cmd {
|
||||
|
||||
@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) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "points");
|
||||
|
@ -11,7 +11,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
public class promote implements Cmd {
|
||||
|
||||
@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) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "promote");
|
||||
return true;
|
||||
|
@ -23,7 +23,7 @@ import net.Zrips.CMILib.Time.CMITimeManager;
|
||||
public class quests implements Cmd {
|
||||
|
||||
@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) {
|
||||
LC.info_FeatureNotEnabled.sendMessage(sender);
|
||||
|
@ -8,7 +8,7 @@ import com.gamingmesh.jobs.commands.Cmd;
|
||||
public class reload implements Cmd {
|
||||
|
||||
@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();
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
|
||||
return true;
|
||||
|
@ -11,7 +11,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
public class removexp implements Cmd {
|
||||
|
||||
@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) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "removexp");
|
||||
return true;
|
||||
|
@ -11,7 +11,7 @@ public class resetexploreregion implements Cmd {
|
||||
private static String REGEX = "^[0-9a-zA-Z_-]+$";
|
||||
|
||||
@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])) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "resetexploreregion");
|
||||
return true;
|
||||
|
@ -8,7 +8,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
public class resetlimit implements Cmd {
|
||||
|
||||
@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) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "resetlimit");
|
||||
return true;
|
||||
|
@ -16,7 +16,7 @@ import net.Zrips.CMILib.Locale.LC;
|
||||
public class resetquest implements Cmd {
|
||||
|
||||
@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) {
|
||||
LC.info_FeatureNotEnabled.sendMessage(sender);
|
||||
|
@ -16,7 +16,7 @@ import net.Zrips.CMILib.Locale.LC;
|
||||
public class resetquesttotal implements Cmd {
|
||||
|
||||
@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) {
|
||||
LC.info_FeatureNotEnabled.sendMessage(sender);
|
||||
return true;
|
||||
|
@ -13,7 +13,7 @@ import com.gamingmesh.jobs.commands.Cmd;
|
||||
public class schedule implements Cmd {
|
||||
|
||||
@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) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "schedule");
|
||||
return true;
|
||||
|
@ -11,7 +11,7 @@ import net.Zrips.CMILib.Locale.LC;
|
||||
public class shop implements Cmd {
|
||||
|
||||
@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) {
|
||||
LC.info_FeatureNotEnabled.sendMessage(sender);
|
||||
|
@ -10,7 +10,7 @@ import com.gamingmesh.jobs.container.Job;
|
||||
public class signupdate implements Cmd {
|
||||
|
||||
@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)
|
||||
return true;
|
||||
|
||||
|
@ -18,7 +18,7 @@ import net.Zrips.CMILib.Locale.LC;
|
||||
public class skipquest implements Cmd {
|
||||
|
||||
@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) {
|
||||
LC.info_FeatureNotEnabled.sendMessage(sender);
|
||||
return true;
|
||||
|
@ -8,6 +8,7 @@ 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 com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
@ -16,42 +17,42 @@ import net.Zrips.CMILib.RawMessages.RawMessage;
|
||||
public class stats implements Cmd {
|
||||
|
||||
@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;
|
||||
if (args.length >= 1) {
|
||||
if (!Jobs.hasPermission(sender, "jobs.command.admin.stats", true))
|
||||
return true;
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
|
||||
} else if (sender instanceof Player)
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
||||
JobsPlayer jPlayer = null;
|
||||
if (args.length >= 1) {
|
||||
if (!Jobs.hasPermission(sender, "jobs.command.admin.stats", true))
|
||||
return true;
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
|
||||
} else if (sender instanceof Player p)
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer(p);
|
||||
|
||||
if (jPlayer == null) {
|
||||
if (args.length >= 1)
|
||||
CMIMessages.sendMessage(sender, LC.info_NoInformation);
|
||||
else
|
||||
Jobs.getCommandManager().sendUsage(sender, "stats");
|
||||
return true;
|
||||
}
|
||||
if (jPlayer == null) {
|
||||
if (args.length >= 1)
|
||||
CMIMessages.sendMessage(sender, LC.info_NoInformation);
|
||||
else
|
||||
Jobs.getCommandManager().sendUsage(sender, "stats");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (jPlayer.progression.isEmpty()) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.stats.error.nojob"));
|
||||
return true;
|
||||
}
|
||||
if (jPlayer.progression.isEmpty()) {
|
||||
Language.sendMessage(sender, "command.stats.error.nojob");
|
||||
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 (String msg : Jobs.getCommandManager().jobStatsMessage(jobProg).split("\n")) {
|
||||
new RawMessage().addText(msg).addHover(leftClick).addCommand(pref + jobProg.getJob().getName()).show(sender);
|
||||
}
|
||||
}
|
||||
for (JobProgression jobProg : jPlayer.getJobProgression()) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator"));
|
||||
return true;
|
||||
Language.sendMessage(sender, "general.info.separator");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
public class toggle implements Cmd {
|
||||
|
||||
@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)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
return false;
|
||||
|
@ -21,7 +21,7 @@ import net.Zrips.CMILib.Scoreboards.CMIScoreboard;
|
||||
public class top implements Cmd {
|
||||
|
||||
@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) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "top");
|
||||
|
@ -11,7 +11,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
public class transfer implements Cmd {
|
||||
|
||||
@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) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "transfer");
|
||||
return true;
|
||||
|
@ -18,7 +18,7 @@ import net.milkbowl.vault.economy.Economy;
|
||||
public class version implements Cmd {
|
||||
|
||||
@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() {
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user