1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-25 20:16:13 +01:00

Message handling cleanup

This commit is contained in:
Zrips 2023-05-03 13:38:08 +03:00
parent 9b935c53e9
commit e2b9f370af
54 changed files with 1841 additions and 1838 deletions

View File

@ -24,6 +24,7 @@ import com.gamingmesh.jobs.container.JobInfo;
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.container.Title; import com.gamingmesh.jobs.container.Title;
import com.gamingmesh.jobs.i18n.Language;
import com.gamingmesh.jobs.stuff.Util; import com.gamingmesh.jobs.stuff.Util;
import net.Zrips.CMILib.ActionBar.CMIActionBar; import net.Zrips.CMILib.ActionBar.CMIActionBar;
@ -267,7 +268,7 @@ public class JobsCommands implements CommandExecutor {
public void jobInfoMessage(CommandSender sender, JobsPlayer player, Job job, String type, int page) { public void jobInfoMessage(CommandSender sender, JobsPlayer player, Job job, String type, int page) {
if (job == null) { if (job == null) {
// job doesn't exist // job doesn't exist
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job")); Language.sendMessage(sender, "general.error.job");
return; return;
} }
@ -316,7 +317,7 @@ public class JobsCommands implements CommandExecutor {
PageInfo pi = new PageInfo(15, message.size(), page); PageInfo pi = new PageInfo(15, message.size(), page);
if (page > pi.getTotalPages()) { if (page > pi.getTotalPages()) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.invalidPage")); Language.sendMessage(sender, "general.info.invalidPage");
return; return;
} }

View File

@ -10,6 +10,7 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.commands.Cmd;
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.RawMessages.RawMessage; import net.Zrips.CMILib.RawMessages.RawMessage;
@ -30,17 +31,17 @@ 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])); Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args[0]);
return null; 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")); Language.sendMessage(sender, "command.archive.error.nojob");
return null; return null;
} }
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());
for (JobProgression jobInfo : allJobs) { for (JobProgression jobInfo : allJobs) {
RawMessage rm = new RawMessage(); RawMessage rm = new RawMessage();
if (jobInfo.canRejoin()) if (jobInfo.canRejoin())
@ -53,7 +54,7 @@ public class archive implements Cmd {
rm.show(sender); rm.show(sender);
} }
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator")); Language.sendMessage(sender, "general.info.separator");
return true; return true;
} }
} }

View File

@ -12,6 +12,7 @@ import com.gamingmesh.jobs.config.RestrictedAreaManager;
import com.gamingmesh.jobs.container.CuboidArea; import com.gamingmesh.jobs.container.CuboidArea;
import com.gamingmesh.jobs.container.RestrictedArea; import com.gamingmesh.jobs.container.RestrictedArea;
import com.gamingmesh.jobs.hooks.HookManager; import com.gamingmesh.jobs.hooks.HookManager;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Items.CMIMaterial; import net.Zrips.CMILib.Items.CMIMaterial;
import net.Zrips.CMILib.Locale.LC; import net.Zrips.CMILib.Locale.LC;
@ -51,20 +52,20 @@ public class area implements Cmd {
RestrictedAreaManager ra = Jobs.getRestrictedAreaManager(); RestrictedAreaManager ra = Jobs.getRestrictedAreaManager();
if (ra.isExist(name)) { if (ra.isExist(name)) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.exist")); Language.sendMessage(sender, "command.area.output.exist");
return true; return true;
} }
if (!wg && !Jobs.getSelectionManager().hasPlacedBoth(player)) { if (!wg && !Jobs.getSelectionManager().hasPlacedBoth(player)) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.select", Language.sendMessage(sender, "command.area.output.select",
"%tool%", CMIMaterial.get(Jobs.getGCManager().getSelectionTool()).getName())); "%tool%", CMIMaterial.get(Jobs.getGCManager().getSelectionTool()).getName());
return true; return true;
} }
if (wg && HookManager.getWorldGuardManager() != null) { if (wg && HookManager.getWorldGuardManager() != null) {
com.sk89q.worldguard.protection.regions.ProtectedRegion protectedRegion = HookManager.getWorldGuardManager().getProtectedRegionByName(name); com.sk89q.worldguard.protection.regions.ProtectedRegion protectedRegion = HookManager.getWorldGuardManager().getProtectedRegionByName(name);
if (protectedRegion == null) { if (protectedRegion == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.wgDontExist")); Language.sendMessage(sender, "command.area.output.wgDontExist");
return true; return true;
} }
name = protectedRegion.getId(); name = protectedRegion.getId();
@ -74,7 +75,7 @@ public class area implements Cmd {
ra.addNew(new RestrictedArea(name, Jobs.getSelectionManager().getSelectionCuboid(player), bonus), true); ra.addNew(new RestrictedArea(name, Jobs.getSelectionManager().getSelectionCuboid(player), bonus), true);
else else
ra.addNew(new RestrictedArea(name, name, bonus), true); ra.addNew(new RestrictedArea(name, name, bonus), true);
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.addedNew", "%bonus%", bonus)); Language.sendMessage(sender, "command.area.output.addedNew", "%bonus%", bonus);
return true; return true;
} }
} }
@ -88,12 +89,12 @@ public class area implements Cmd {
String name = args[1]; String name = args[1];
if (!ra.isExist(name)) { if (!ra.isExist(name)) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.dontExist")); Language.sendMessage(sender, "command.area.output.dontExist");
return true; return true;
} }
ra.remove(name); ra.remove(name);
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.removed", "%name%", name)); Language.sendMessage(sender, "command.area.output.removed", "%name%", name);
return true; return true;
} }
} }
@ -111,10 +112,10 @@ public class area implements Cmd {
} }
if (msg.isEmpty()) { if (msg.isEmpty()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.noAreasByLoc")); Language.sendMessage(sender, "command.area.output.noAreasByLoc");
return true; return true;
} }
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.areaList", "%list%", msg)); Language.sendMessage(sender, "command.area.output.areaList", "%list%", msg);
return true; return true;
} }
@ -132,7 +133,7 @@ public class area implements Cmd {
i++; i++;
CuboidArea cuboid = area.getValue().getCuboidArea(); CuboidArea cuboid = area.getValue().getCuboidArea();
if (area.getValue().getWgName() == null) { if (area.getValue().getWgName() == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.list", "%number%", i, Language.sendMessage(sender, "command.area.output.list", "%number%", i,
"%areaname%", area.getKey(), "%areaname%", area.getKey(),
"%worldname%", cuboid.getWorld().getName(), "%worldname%", cuboid.getWorld().getName(),
"%x1%", cuboid.getLowLoc().getBlockX(), "%x1%", cuboid.getLowLoc().getBlockX(),
@ -141,25 +142,25 @@ public class area implements Cmd {
"%x2%", cuboid.getHighLoc().getBlockX(), "%x2%", cuboid.getHighLoc().getBlockX(),
"%y2%", cuboid.getHighLoc().getBlockY(), "%y2%", cuboid.getHighLoc().getBlockY(),
"%z2%", cuboid.getHighLoc().getBlockZ(), "%z2%", cuboid.getHighLoc().getBlockZ(),
"%bonus%", area.getValue().getMultiplier())); "%bonus%", area.getValue().getMultiplier());
} else { } else {
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.wgList", "%number%", i, Language.sendMessage(sender, "command.area.output.wgList", "%number%", i,
"%areaname%", area.getKey(), "%areaname%", area.getKey(),
"%bonus%", area.getValue().getMultiplier())); "%bonus%", area.getValue().getMultiplier());
} }
} }
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator")); Language.sendMessage(sender, "general.info.separator");
return true; return true;
} }
if (args.length > 0) { if (args.length > 0) {
if (args[0].equalsIgnoreCase("add")) { if (args[0].equalsIgnoreCase("add")) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.help.addUsage")); Language.sendMessage(sender, "command.area.help.addUsage");
return true; return true;
} }
if (args[0].equalsIgnoreCase("remove")) { if (args[0].equalsIgnoreCase("remove")) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.help.removeUsage")); Language.sendMessage(sender, "command.area.help.removeUsage");
return true; return true;
} }
} }

View File

@ -21,12 +21,7 @@ public class blockinfo implements Cmd {
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 null;
}
if (args.length != 0) {
Jobs.getCommandManager().sendUsage(sender, "blockinfo");
return true;
} }
Block block = Util.getTargetBlock((Player) sender, 15); Block block = Util.getTargetBlock((Player) sender, 15);

View File

@ -13,6 +13,7 @@ import com.gamingmesh.jobs.container.CurrencyType;
import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.hooks.HookManager; import com.gamingmesh.jobs.hooks.HookManager;
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;
@ -24,7 +25,7 @@ public class bonus implements Cmd {
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 null;
} }
if (args.length != 1) { if (args.length != 1) {
@ -35,7 +36,7 @@ public class bonus implements Cmd {
Player player = (Player) sender; Player player = (Player) sender;
Job job = Jobs.getJob(args[0]); Job job = Jobs.getJob(args[0]);
if (job == null) { if (job == null) {
player.sendMessage(Jobs.getLanguage().getMessage("general.error.job")); Language.sendMessage(sender, "general.error.job");
return true; return true;
} }
@ -45,7 +46,7 @@ public class bonus implements Cmd {
Boost boost = Jobs.getPlayerManager().getFinalBonus(jPlayer, job, true, true); Boost boost = Jobs.getPlayerManager().getFinalBonus(jPlayer, job, true, true);
player.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.topline")); Language.sendMessage(sender, "command.bonus.output.topline");
printBoost(sender, boost, BoostOf.Permission); printBoost(sender, boost, BoostOf.Permission);
printBoost(sender, boost, BoostOf.Item); printBoost(sender, boost, BoostOf.Item);
@ -61,7 +62,7 @@ public class bonus implements Cmd {
HookManager.getMcMMOManager().mcMMOOverHaul && boost.get(BoostOf.McMMO, CurrencyType.EXP) != 0D) HookManager.getMcMMOManager().mcMMOOverHaul && boost.get(BoostOf.McMMO, CurrencyType.EXP) != 0D)
printBoost(sender, boost, BoostOf.McMMO); printBoost(sender, boost, BoostOf.McMMO);
player.sendMessage(Jobs.getLanguage().getMessage("general.info.separator")); Language.sendMessage(sender, "general.info.separator");
RawMessage rm = new RawMessage(); RawMessage rm = new RawMessage();
String msg = Jobs.getLanguage().getMessage("command.bonus.output.final", String msg = Jobs.getLanguage().getMessage("command.bonus.output.final",
@ -76,8 +77,6 @@ public class bonus implements Cmd {
rm.addText(msg).addHover(Arrays.asList(Jobs.getLanguage().getMessage("command.bonus.output.finalExplanation"), msg2)); rm.addText(msg).addHover(Arrays.asList(Jobs.getLanguage().getMessage("command.bonus.output.finalExplanation"), msg2));
rm.build(); rm.build();
rm.show(player); rm.show(player);
@ -97,7 +96,7 @@ public class bonus implements Cmd {
if ((type == BoostOf.NearSpawner || type == BoostOf.PetPay) && msg.startsWith(" ")) if ((type == BoostOf.NearSpawner || type == BoostOf.PetPay) && msg.startsWith(" "))
msg = msg.substring(1, msg.length()); msg = msg.substring(1, msg.length());
sender.sendMessage(prefix + msg); CMIMessages.sendMessage(sender, prefix + msg);
} }
private static String formatText(double amount) { private static String formatText(double amount) {

View File

@ -6,6 +6,7 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.CurrencyType; import com.gamingmesh.jobs.container.CurrencyType;
import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Locale.LC; import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Logs.CMIDebug; import net.Zrips.CMILib.Logs.CMIDebug;
@ -95,22 +96,22 @@ public class boost implements Cmd {
one.addBoost(curr, 1.0); one.addBoost(curr, 1.0);
} }
} }
sender.sendMessage(Jobs.getLanguage().getMessage("command.boost.output.allreset")); Language.sendMessage(sender, "command.boost.output.allreset");
} else { } else {
for (Job one : Jobs.getJobs()) { for (Job one : Jobs.getJobs()) {
one.addBoost(type, 1.0); one.addBoost(type, 1.0);
} }
sender.sendMessage(Jobs.getLanguage().getMessage("command.boost.output.alltypereset", "%type%", type.getDisplayName())); Language.sendMessage(sender, "command.boost.output.alltypereset", "%type%", type.getDisplayName());
} }
} else if (job != null) { } else if (job != null) {
if (type == null) { if (type == null) {
for (CurrencyType curr : CurrencyType.values()) { for (CurrencyType curr : CurrencyType.values()) {
job.addBoost(curr, 1.0); job.addBoost(curr, 1.0);
} }
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.jobsboostreset", "%jobname%", job.getName())); Language.sendMessage(sender, "command.moneyboost.output.jobsboostreset", "%jobname%", job.getName());
} else { } else {
job.addBoost(type, 1.0); job.addBoost(type, 1.0);
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.jobstypeboostreset", "%jobname%", job.getName(), "%type%", type.getDisplayName())); Language.sendMessage(sender, "command.moneyboost.output.jobstypeboostreset", "%jobname%", job.getName(), "%type%", type.getDisplayName());
} }
} else { } else {
return false; return false;
@ -128,7 +129,7 @@ public class boost implements Cmd {
one.addBoost(type, rate, timeDuration); one.addBoost(type, rate, timeDuration);
} }
sender.sendMessage(Jobs.getLanguage().getMessage("command.boost.output.boostadded", "%boost%", rate, "%jobname%", one.getName())); Language.sendMessage(sender, "command.boost.output.boostadded", "%boost%", rate, "%jobname%", one.getName());
} }
} else { } else {
if (type == null) { if (type == null) {
@ -138,14 +139,13 @@ public class boost implements Cmd {
} else { } else {
job.addBoost(type, rate, timeDuration); job.addBoost(type, rate, timeDuration);
} }
CMIDebug.d(timeDuration); Language.sendMessage(sender, "command.boost.output.boostadded", "%boost%", rate, "%jobname%", job.getName());
sender.sendMessage(Jobs.getLanguage().getMessage("command.boost.output.boostadded", "%boost%", rate, "%jobname%", job.getName()));
} }
return true; return true;
} }
private void showBoosts(CommandSender sender, Job job) { private static void showBoosts(CommandSender sender, Job job) {
RawMessage rm = new RawMessage(); RawMessage rm = new RawMessage();
String msg = Jobs.getLanguage().getMessage("command.boost.output.boostStats", "%jobname%", job.getDisplayName()); String msg = Jobs.getLanguage().getMessage("command.boost.output.boostStats", "%jobname%", job.getDisplayName());
String[] split = msg.split("%payments%"); String[] split = msg.split("%payments%");

View File

@ -13,6 +13,7 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.BlockProtection; import com.gamingmesh.jobs.container.BlockProtection;
import com.gamingmesh.jobs.container.DBAction; import com.gamingmesh.jobs.container.DBAction;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Items.CMIMaterial; import net.Zrips.CMILib.Items.CMIMaterial;
import net.Zrips.CMILib.Locale.LC; import net.Zrips.CMILib.Locale.LC;
@ -73,9 +74,9 @@ public class bp implements Cmd {
} }
if (changedBlocks.isEmpty()) if (changedBlocks.isEmpty())
sender.sendMessage(Jobs.getLanguage().getMessage("command.bp.output.notFound")); Language.sendMessage(sender, "command.bp.output.notFound");
else else
sender.sendMessage(Jobs.getLanguage().getMessage("command.bp.output.found", "%amount%", changedBlocks.size())); Language.sendMessage(sender, "command.bp.output.found", "%amount%", changedBlocks.size());
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@Override @Override

View File

@ -9,9 +9,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.container.Job; import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Colors.CMIChatColor; import net.Zrips.CMILib.Colors.CMIChatColor;
import net.Zrips.CMILib.Container.PageInfo; import net.Zrips.CMILib.Container.PageInfo;
import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.RawMessages.RawMessage; import net.Zrips.CMILib.RawMessages.RawMessage;
public class browse implements Cmd { public class browse implements Cmd {
@ -22,7 +24,7 @@ public class browse implements Cmd {
if (Jobs.getGCManager().BrowseUseNewLook) { if (Jobs.getGCManager().BrowseUseNewLook) {
if (Jobs.getJobs().isEmpty()) { if (Jobs.getJobs().isEmpty()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.error.nojobs")); Language.sendMessage(sender, "command.browse.error.nojobs");
return true; return true;
} }
@ -60,7 +62,7 @@ public class browse implements Cmd {
if (senderIsPlayer) { if (senderIsPlayer) {
if (j == null) { if (j == null) {
PageInfo pi = new PageInfo(Jobs.getGCManager().getBrowseAmountToShow(), jobList.size(), page); PageInfo pi = new PageInfo(Jobs.getGCManager().getBrowseAmountToShow(), jobList.size(), page);
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.newHeader", "[amount]", jobList.size())); Language.sendMessage(sender, "command.browse.output.newHeader", "[amount]", jobList.size());
for (Job one : jobList) { for (Job one : jobList) {
if (!pi.isEntryOk()) if (!pi.isEntryOk())
continue; continue;
@ -116,25 +118,25 @@ public class browse implements Cmd {
pi.autoPagination(sender, "jobs browse", "-p:"); pi.autoPagination(sender, "jobs browse", "-p:");
} else { } else {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.jobHeader", "[jobname]", j.getName())); Language.sendMessage(sender, "command.browse.output.jobHeader", "[jobname]", j.getName());
int maxLevel = j.getMaxLevel(sender); int maxLevel = j.getMaxLevel(sender);
if (maxLevel > 0) if (maxLevel > 0)
sender.sendMessage(Jobs.getLanguage().getMessage("command.info.help.newMax", "[max]", maxLevel)); Language.sendMessage(sender, "command.info.help.newMax", "[max]", maxLevel);
if (Jobs.getGCManager().ShowTotalWorkers) if (Jobs.getGCManager().ShowTotalWorkers)
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", j.getTotalPlayers())); Language.sendMessage(sender, "command.browse.output.totalWorkers", "[amount]", j.getTotalPlayers());
if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) { if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) {
int bonus = (int) (j.getBonus() * 100); int bonus = (int) (j.getBonus() * 100);
if (bonus < 0) if (bonus < 0)
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.penalty", "[amount]", bonus * -1)); Language.sendMessage(sender, "command.browse.output.penalty", "[amount]", bonus * -1);
else else
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", bonus)); Language.sendMessage(sender, "command.browse.output.bonus", "[amount]", bonus);
} }
for (String one : j.getFullDescription()) { for (String one : j.getFullDescription()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.description", "[description]", one)); Language.sendMessage(sender, "command.browse.output.description", "[description]", one);
} }
RawMessage rm = new RawMessage(); RawMessage rm = new RawMessage();
@ -148,7 +150,7 @@ public class browse implements Cmd {
} }
} else { } else {
if (j == null) { if (j == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.console.newHeader", "[amount]", jobList.size(), "\\n", "\n")); Language.sendMessage(sender, "command.browse.output.console.newHeader", "[amount]", jobList.size(), "\\n", "\n");
for (Job one : jobList) { for (Job one : jobList) {
String msg = ""; String msg = "";
@ -177,14 +179,14 @@ public class browse implements Cmd {
msg += Jobs.getLanguage().getMessage("command.browse.output.console.list", "[jobname]", one.getName()); msg += Jobs.getLanguage().getMessage("command.browse.output.console.list", "[jobname]", one.getName());
sender.sendMessage(msg); CMIMessages.sendMessage(sender, msg);
} }
} else { } else {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.jobHeader", "[jobname]", j.getName())); Language.sendMessage(sender, "command.browse.output.jobHeader", "[jobname]", j.getName());
int maxLevel = j.getMaxLevel(sender); int maxLevel = j.getMaxLevel(sender);
if (maxLevel > 0) if (maxLevel > 0)
sender.sendMessage(Jobs.getLanguage().getMessage("command.info.help.newMax", "[max]", maxLevel)); Language.sendMessage(sender, "command.info.help.newMax", "[max]", maxLevel);
if (Jobs.getGCManager().ShowTotalWorkers) if (Jobs.getGCManager().ShowTotalWorkers)
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", j.getTotalPlayers())); sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", j.getTotalPlayers()));
@ -192,13 +194,13 @@ public class browse implements Cmd {
if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) { if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) {
int bonus = (int) (j.getBonus() * 100); int bonus = (int) (j.getBonus() * 100);
if (bonus < 0) if (bonus < 0)
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.penalty", "[amount]", bonus * -1)); Language.sendMessage(sender, "command.browse.output.penalty", "[amount]", bonus * -1);
else else
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", bonus)); Language.sendMessage(sender, "command.browse.output.bonus", "[amount]", bonus);
} }
for (String one : j.getFullDescription()) { for (String one : j.getFullDescription()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.description", "[description]", one)); Language.sendMessage(sender, "command.browse.output.description", "[description]", one);
} }
} }
} }
@ -245,7 +247,7 @@ public class browse implements Cmd {
} }
if (lines.isEmpty()) { if (lines.isEmpty()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.error.nojobs")); Language.sendMessage(sender, "command.browse.error.nojobs");
return true; return true;
} }
@ -260,9 +262,9 @@ public class browse implements Cmd {
} }
if (Jobs.getGCManager().JobsGUIShowChatBrowse) { if (Jobs.getGCManager().JobsGUIShowChatBrowse) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.header")); Language.sendMessage(sender, "command.browse.output.header");
lines.forEach(sender::sendMessage); lines.forEach(sender::sendMessage);
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.footer")); Language.sendMessage(sender, "command.browse.output.footer");
} }
} }
return true; return true;

View File

@ -11,6 +11,7 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.container.blockOwnerShip.BlockTypes; import com.gamingmesh.jobs.container.blockOwnerShip.BlockTypes;
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;
@ -47,8 +48,8 @@ public class clearownership implements Cmd {
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, "clearownership"); return false;
return true; return null;
} }
final UUID uuid = jPlayer.getUniqueId(); final UUID uuid = jPlayer.getUniqueId();
@ -64,8 +65,8 @@ public class clearownership implements Cmd {
} }
} }
sender.sendMessage(Jobs.getLanguage().getMessage("command.clearownership.output.cleared", "[furnaces]", amounts.getOrDefault(BlockTypes.FURNACE, 0), "[brewing]", amounts.getOrDefault( Language.sendMessage(sender,"command.clearownership.output.cleared", "[furnaces]", amounts.getOrDefault(BlockTypes.FURNACE, 0), "[brewing]", amounts.getOrDefault(
BlockTypes.BREWING_STAND, 0), "[smoker]", amounts.getOrDefault(BlockTypes.SMOKER, 0), "[blast]", amounts.getOrDefault(BlockTypes.BLAST_FURNACE, 0))); BlockTypes.BREWING_STAND, 0), "[smoker]", amounts.getOrDefault(BlockTypes.SMOKER, 0), "[blast]", amounts.getOrDefault(BlockTypes.BLAST_FURNACE, 0));
return true; return true;
} }
} }

View File

@ -21,8 +21,7 @@ public class convert implements Cmd {
} }
if (args.length > 0) { if (args.length > 0) {
Jobs.getCommandManager().sendUsage(sender, "convert"); return false;
return true;
} }
String from = Jobs.getDBManager().getDbType() == DataBaseType.SqLite ? "SQLite" : "MySQL"; String from = Jobs.getDBManager().getDbType() == DataBaseType.SqLite ? "SQLite" : "MySQL";

View File

@ -7,6 +7,7 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Colors.CMIChatColor; import net.Zrips.CMILib.Colors.CMIChatColor;
@ -15,19 +16,18 @@ 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"); return false;
return true;
} }
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]); JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
if (jPlayer == null) { if (jPlayer == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0])); Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args[0]);
return true; return true;
} }
Job job = Jobs.getJob(args[1]); Job job = Jobs.getJob(args[1]);
if (job == null) { if (job == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job")); Language.sendMessage(sender, "general.error.job");
return true; return true;
} }
@ -45,16 +45,15 @@ public class demote implements Cmd {
Player player = jPlayer.getPlayer(); Player player = jPlayer.getPlayer();
if (player != null) { if (player != null) {
String message = Jobs.getLanguage().getMessage("command.demote.output.target", Language.sendMessage(sender, "command.demote.output.target",
"%jobname%", job.getDisplayName() + CMIChatColor.WHITE, "%jobname%", job.getDisplayName() + CMIChatColor.WHITE,
"%levelslost%", levelsLost); "%levelslost%", levelsLost);
player.sendMessage(message);
} }
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success")); Language.sendMessage(sender, "general.admin.success");
} }
} catch (Throwable e) { } catch (Throwable e) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error")); Language.sendMessage(sender, "general.admin.error");
} }
return true; return true;
} }

View File

@ -13,6 +13,7 @@ import com.gamingmesh.jobs.container.CurrencyType;
import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobItems; import com.gamingmesh.jobs.container.JobItems;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Colors.CMIChatColor; import net.Zrips.CMILib.Colors.CMIChatColor;
import net.Zrips.CMILib.Items.CMIItemStack; import net.Zrips.CMILib.Items.CMIItemStack;
@ -38,7 +39,7 @@ public class edititembonus implements Cmd {
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 null;
} }
if (args.length < 1) if (args.length < 1)
@ -94,7 +95,7 @@ public class edititembonus implements Cmd {
break; break;
} }
sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.topline")); Language.sendMessage(sender, "command.bonus.output.topline");
Object key = new CMINBT(iih).getString("JobsItemBoost"); Object key = new CMINBT(iih).getString("JobsItemBoost");
if (key == null) if (key == null)
@ -106,17 +107,16 @@ public class edititembonus implements Cmd {
BoostMultiplier boost = item.getBoost(); BoostMultiplier boost = item.getBoost();
String mc = CMIChatColor.DARK_GREEN.toString(), String mc = CMIChatColor.DARK_GREEN.toString();
pc = CMIChatColor.GOLD.toString(), String pc = CMIChatColor.GOLD.toString();
ec = CMIChatColor.YELLOW.toString(); String ec = CMIChatColor.YELLOW.toString();
for (Job one : item.getJobs()) { for (Job one : item.getJobs()) {
String msg = Jobs.getLanguage().getMessage("command.itembonus.output.list", Language.sendMessage(sender, "command.itembonus.output.list",
"[jobname]", one.getName(), "[jobname]", one.getName(),
"%money%", mc + formatText((int) (boost.get(CurrencyType.MONEY) * 100)), "%money%", mc + formatText((int) (boost.get(CurrencyType.MONEY) * 100)),
"%points%", pc + formatText((int) (boost.get(CurrencyType.POINTS) * 100)), "%points%", pc + formatText((int) (boost.get(CurrencyType.POINTS) * 100)),
"%exp%", ec + formatText((int) (boost.get(CurrencyType.EXP) * 100))); "%exp%", ec + formatText((int) (boost.get(CurrencyType.EXP) * 100)));
sender.sendMessage(msg);
} }
return true; return true;
} }

View File

@ -20,6 +20,7 @@ import net.Zrips.CMILib.Colors.CMIChatColor;
import net.Zrips.CMILib.Container.PageInfo; import net.Zrips.CMILib.Container.PageInfo;
import net.Zrips.CMILib.Items.CMIItemStack; import net.Zrips.CMILib.Items.CMIItemStack;
import net.Zrips.CMILib.Items.CMIMaterial; import net.Zrips.CMILib.Items.CMIMaterial;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.RawMessages.RawMessage; import net.Zrips.CMILib.RawMessages.RawMessage;
import net.Zrips.CMILib.Version.Version; import net.Zrips.CMILib.Version.Version;
@ -29,8 +30,10 @@ public class editjobs 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)) {
LC.info_Ingame.sendMessage(sender);
return false; return false;
}
Player player = (Player) sender; Player player = (Player) sender;
@ -44,7 +47,9 @@ public class editjobs implements Cmd {
for (Job one : Jobs.getJobs()) { for (Job one : Jobs.getJobs()) {
RawMessage rm = new RawMessage(); RawMessage rm = new RawMessage();
rm.add(Jobs.getLanguage().getMessage("command.editjobs.help.list.jobs", "%jobname%", one.getJobDisplayName()), one.getName(), "jobs editjobs list " + one.getName()); rm.addText(Jobs.getLanguage().getMessage("command.editjobs.help.list.jobs", "%jobname%", one.getDisplayName()))
.addHover(one.getName())
.addCommand("jobs editjobs list " + one.getName());
rm.show(sender); rm.show(sender);
} }
@ -65,8 +70,9 @@ public class editjobs implements Cmd {
continue; continue;
RawMessage rm = new RawMessage(); RawMessage rm = new RawMessage();
rm.add(Jobs.getLanguage().getMessage("command.editjobs.help.list.actions", "%actionname%", oneI.getName()), oneI.getName(), "jobs editjobs list " + job.getName() + " " + oneI.getName() rm.addText(Jobs.getLanguage().getMessage("command.editjobs.help.list.actions", "%actionname%", oneI.getName()))
+ " 1"); .addHover(oneI.getName())
.addCommand("jobs editjobs list " + job.getName() + " " + oneI.getName() + " 1");
rm.show(sender); rm.show(sender);
} }

View File

@ -5,6 +5,7 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.container.PlayerPoints; import com.gamingmesh.jobs.container.PlayerPoints;
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;
@ -14,13 +15,12 @@ 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"); return false;
return true;
} }
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[1]); JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[1]);
if (jPlayer == null) { if (jPlayer == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[1])); Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args[1]);
return true; return true;
} }
@ -29,33 +29,33 @@ public class editpoints implements Cmd {
amount = Double.parseDouble(args[2]); amount = Double.parseDouble(args[2]);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
CMIMessages.sendMessage(sender, LC.info_UseInteger); CMIMessages.sendMessage(sender, LC.info_UseInteger);
return true; return false;
} }
PlayerPoints pointInfo = jPlayer.getPointsData(); PlayerPoints pointInfo = jPlayer.getPointsData();
switch (args[0].toLowerCase()) { switch (args[0].toLowerCase()) {
case "take": case "take":
pointInfo.takePoints(amount); pointInfo.takePoints(amount);
sender.sendMessage(Jobs.getLanguage().getMessage("command.editpoints.output.take", Language.sendMessage(sender, "command.editpoints.output.take",
"%playername%", jPlayer.getName(), "%playername%", jPlayer.getName(),
"%playerdisplayname%", jPlayer.getDisplayName(), "%playerdisplayname%", jPlayer.getDisplayName(),
"%amount%", amount, "%amount%", amount,
"%total%", (int) (pointInfo.getCurrentPoints() * 100) / 100D)); "%total%", (int) (pointInfo.getCurrentPoints() * 100) / 100D);
break; break;
case "add": case "add":
pointInfo.addPoints(amount); pointInfo.addPoints(amount);
sender.sendMessage(Jobs.getLanguage().getMessage("command.editpoints.output.add", Language.sendMessage(sender, "command.editpoints.output.add",
"%playername%", jPlayer.getName(), "%playername%", jPlayer.getName(),
"%playerdisplayname%", jPlayer.getDisplayName(), "%playerdisplayname%", jPlayer.getDisplayName(),
"%amount%", amount, "%amount%", amount,
"%total%", (int) (pointInfo.getCurrentPoints() * 100) / 100D)); "%total%", (int) (pointInfo.getCurrentPoints() * 100) / 100D);
break; break;
case "set": case "set":
pointInfo.setPoints(amount); pointInfo.setPoints(amount);
sender.sendMessage(Jobs.getLanguage().getMessage("command.editpoints.output.set", Language.sendMessage(sender, "command.editpoints.output.set",
"%playername%", jPlayer.getName(), "%playername%", jPlayer.getName(),
"%playerdisplayname%", jPlayer.getDisplayName(), "%playerdisplayname%", jPlayer.getDisplayName(),
"%amount%", amount)); "%amount%", amount);
break; break;
default: default:
break; break;

View File

@ -28,7 +28,6 @@ import net.Zrips.CMILib.Container.CMIText;
import net.Zrips.CMILib.Container.PageInfo; import net.Zrips.CMILib.Container.PageInfo;
import net.Zrips.CMILib.FileHandler.ConfigReader; import net.Zrips.CMILib.FileHandler.ConfigReader;
import net.Zrips.CMILib.Locale.LC; import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Logs.CMIDebug;
import net.Zrips.CMILib.RawMessages.RawMessage; import net.Zrips.CMILib.RawMessages.RawMessage;
import net.Zrips.CMILib.RawMessages.RawMessageCommand; import net.Zrips.CMILib.RawMessages.RawMessageCommand;
@ -56,6 +55,7 @@ public class editquests implements Cmd {
Action action = null; Action action = null;
// Only informing here and not canceling command
if (!Jobs.getGCManager().DailyQuestsEnabled) { if (!Jobs.getGCManager().DailyQuestsEnabled) {
LC.info_FeatureNotEnabled.sendMessage(sender); LC.info_FeatureNotEnabled.sendMessage(sender);
} }

View File

@ -7,38 +7,36 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.i18n.Language;
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"); return false;
return true;
} }
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]); JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
if (jPlayer == null) { if (jPlayer == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0])); Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args[0]);
return true; return true;
} }
Job job = Jobs.getJob(args[1]); Job job = Jobs.getJob(args[1]);
if (job == null) { if (job == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job")); Language.sendMessage(sender, "general.error.job");
return true; return true;
} }
if (jPlayer.isInJob(job)) { if (jPlayer.isInJob(job)) {
// already in job message // already in job message
sender.sendMessage(Jobs.getLanguage().getMessage("command.employ.error.alreadyin", "%jobname%", job.getDisplayName())); Language.sendMessage(sender, "command.employ.error.alreadyin", "%jobname%", job.getDisplayName());
return true; return true;
} }
if (job.getMaxSlots() != null && Jobs.getUsedSlots(job) >= job.getMaxSlots()) { if (job.getMaxSlots() != null && Jobs.getUsedSlots(job) >= job.getMaxSlots()) {
String message = Jobs.getLanguage().getMessage("command.employ.error.fullslots"); Language.sendMessage(sender, "command.employ.error.fullslots", "%jobname%", job.getDisplayName());
message = message.replace("%jobname%", job.getDisplayName());
sender.sendMessage(message);
return true; return true;
} }
@ -47,11 +45,11 @@ public class employ implements Cmd {
Jobs.getPlayerManager().joinJob(jPlayer, job); Jobs.getPlayerManager().joinJob(jPlayer, job);
Player player = jPlayer.getPlayer(); Player player = jPlayer.getPlayer();
if (player != null) if (player != null)
player.sendMessage(Jobs.getLanguage().getMessage("command.employ.output.target", "%jobname%", job.getDisplayName())); Language.sendMessage(player, "command.employ.output.target", "%jobname%", job.getDisplayName());
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success")); Language.sendMessage(sender, "general.admin.success");
} catch (Throwable e) { } catch (Throwable e) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error")); Language.sendMessage(sender, "general.admin.error");
} }
return true; return true;
} }

View File

@ -6,20 +6,18 @@ import org.bukkit.entity.EntityType;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.commands.Cmd;
import net.Zrips.CMILib.Colors.CMIChatColor; import net.Zrips.CMILib.Container.CMIText;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
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) {
Jobs.getCommandManager().sendUsage(sender, "entitylist");
return true;
}
String msg = "", StringBuilder msg = new StringBuilder();
c1 = "&e", String c1 = "&e";
c2 = "&6"; String c2 = "&6";
int i = 0; int i = 0;
for (EntityType type : EntityType.values()) { for (EntityType type : EntityType.values()) {
@ -29,19 +27,19 @@ public class entitylist implements Cmd {
i++; i++;
if (!msg.isEmpty()) if (!msg.isEmpty())
msg += ", "; msg.append(LC.info_ListSpliter.getLocale());
if (i > 1) { if (i > 1) {
msg += c1; msg.append(c1);
i = 0; i = 0;
} else { } else {
msg += c2; msg.append(c2);
} }
msg += type.name().toLowerCase(); msg.append(CMIText.firstToUpperCase(type.name()));
} }
sender.sendMessage(CMIChatColor.translate(msg)); CMIMessages.sendMessage(sender, msg.toString());
return true; return true;
} }

View File

@ -24,8 +24,7 @@ public class exp implements Cmd {
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"); return false;
return true;
} }
boolean silent = false; boolean silent = false;
@ -120,20 +119,20 @@ public class exp implements Cmd {
Player player = jPlayer.getPlayer(); Player player = jPlayer.getPlayer();
if (player == null) { if (player == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.give.output.notonline")); Language.sendMessage(sender, "general.give.output.notonline");
return true; return true;
} }
if (!silent) if (!silent)
player.sendMessage(Jobs.getLanguage().getMessage("command.exp.output.target", "%jobname%", job.getDisplayName(), "%level%", prog.getLevelFormatted(), "%exp%", prog Language.sendMessage(player, "command.exp.output.target", "%jobname%", job.getDisplayName(), "%level%", prog.getLevelFormatted(), "%exp%", prog
.getExperience())); .getExperience());
if (!silentAdmin) if (!silentAdmin)
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success")); Language.sendMessage(sender, "general.admin.success");
} catch (Exception e) { } catch (Exception e) {
if (!silentAdmin) if (!silentAdmin)
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error")); Language.sendMessage(sender, "general.admin.error");
e.printStackTrace(); e.printStackTrace();
} }
return true; return true;

View File

@ -10,19 +10,24 @@ import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.ExploreChunk; import com.gamingmesh.jobs.container.ExploreChunk;
import com.gamingmesh.jobs.container.ExploreRegion; import com.gamingmesh.jobs.container.ExploreRegion;
import com.gamingmesh.jobs.container.PlayerInfo; import com.gamingmesh.jobs.container.PlayerInfo;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Locale.LC;
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; LC.info_Ingame.sendMessage(sender);
return null;
}
Player player = (Player) sender; Player player = (Player) sender;
Map<String, ExploreRegion> exploreRegion = Jobs.getExploreManager().getWorlds().get(player.getWorld().getName()); Map<String, ExploreRegion> exploreRegion = Jobs.getExploreManager().getWorlds().get(player.getWorld().getName());
if (exploreRegion == null) { if (exploreRegion == null) {
player.sendMessage(Jobs.getLanguage().getMessage("command.explored.error.noexplore")); Language.sendMessage(sender, "command.explored.error.noexplore");
return true; return true;
} }
@ -30,19 +35,19 @@ public class explored implements Cmd {
int RegionZ = (int) Math.floor(player.getLocation().getChunk().getZ() / 32D); int RegionZ = (int) Math.floor(player.getLocation().getChunk().getZ() / 32D);
ExploreRegion region = exploreRegion.get(RegionX + ":" + RegionZ); ExploreRegion region = exploreRegion.get(RegionX + ":" + RegionZ);
if (region == null) { if (region == null) {
player.sendMessage(Jobs.getLanguage().getMessage("command.explored.error.noexplore")); Language.sendMessage(sender, "command.explored.error.noexplore");
return true; return true;
} }
ExploreChunk chunk = region.getChunk(player.getLocation().getChunk()); ExploreChunk chunk = region.getChunk(player.getLocation().getChunk());
if (chunk == null) { if (chunk == null) {
player.sendMessage(Jobs.getLanguage().getMessage("command.explored.error.noexplore")); Language.sendMessage(sender, "command.explored.error.noexplore");
return true; return true;
} }
if (Jobs.getGCManager().ExploreCompact && chunk.isFullyExplored()) { if (Jobs.getGCManager().ExploreCompact && chunk.isFullyExplored()) {
player.sendMessage(Jobs.getLanguage().getMessage("command.explored.fullExplore")); Language.sendMessage(sender, "command.explored.fullExplore");
return true; return true;
} }
@ -51,9 +56,9 @@ public class explored implements Cmd {
for (int i = 0; i < players.size(); i++) { for (int i = 0; i < players.size(); i++) {
PlayerInfo ji = Jobs.getPlayerManager().getPlayerInfo(players.get(i)); PlayerInfo ji = Jobs.getPlayerManager().getPlayerInfo(players.get(i));
if (ji != null) if (ji != null)
player.sendMessage(Jobs.getLanguage().getMessage("command.explored.list", "%place%", i + 1, "%playername%", ji.getName())); Language.sendMessage(sender, "command.explored.list", "%place%", i + 1, "%playername%", ji.getName());
} }
player.sendMessage(Jobs.getLanguage().getMessage("general.info.separator")); Language.sendMessage(sender, "general.info.separator");
return true; return true;
} }

View File

@ -7,39 +7,39 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.i18n.Language;
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"); return false;
return true;
} }
Job job = Jobs.getJob(args[1]); Job job = Jobs.getJob(args[1]);
if (job == null) { if (job == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job")); Language.sendMessage(sender, "general.error.job");
return true; return true;
} }
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]); JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
if (jPlayer == null) { if (jPlayer == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0])); Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args[0]);
return true; return true;
} }
if (!jPlayer.isInJob(job)) { if (!jPlayer.isInJob(job)) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.fire.error.nojob", "%jobname%", job.getDisplayName())); Language.sendMessage(sender, "command.fire.error.nojob", "%jobname%", job.getDisplayName());
return true; return true;
} }
if (Jobs.getPlayerManager().leaveJob(jPlayer, job)) { if (Jobs.getPlayerManager().leaveJob(jPlayer, job)) {
Player player = jPlayer.getPlayer(); Player player = jPlayer.getPlayer();
if (player != null) if (player != null)
player.sendMessage(Jobs.getLanguage().getMessage("command.fire.output.target", "%jobname%", job.getDisplayName())); Language.sendMessage(player, "command.fire.output.target", "%jobname%", job.getDisplayName());
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success")); Language.sendMessage(sender, "general.admin.success");
} }
return true; return true;

View File

@ -8,6 +8,7 @@ import com.gamingmesh.jobs.commands.Cmd;
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.dao.JobsDAO.DBTables; import com.gamingmesh.jobs.dao.JobsDAO.DBTables;
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;
@ -17,8 +18,7 @@ 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"); return false;
return true;
} }
if (args[0].equalsIgnoreCase("all")) { if (args[0].equalsIgnoreCase("all")) {
@ -38,27 +38,27 @@ public class fireall implements Cmd {
one.setSaved(true); one.setSaved(true);
} }
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success")); Language.sendMessage(sender, "general.admin.success");
return true; return true;
} }
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]); JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
if (jPlayer == null) { if (jPlayer == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0])); Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args[0]);
return true; return true;
} }
if (jPlayer.progression.isEmpty()) { if (jPlayer.progression.isEmpty()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.fireall.error.nojobs")); Language.sendMessage(sender, "command.fireall.error.nojobs");
return true; return true;
} }
Jobs.getPlayerManager().leaveAllJobs(jPlayer); Jobs.getPlayerManager().leaveAllJobs(jPlayer);
Player player = jPlayer.getPlayer(); Player player = jPlayer.getPlayer();
if (player != null) if (player != null)
player.sendMessage(Jobs.getLanguage().getMessage("command.fireall.output.target")); Language.sendMessage(player, "command.fireall.output.target");
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success")); Language.sendMessage(sender, "general.admin.success");
return true; return true;
} }
} }

View File

@ -11,12 +11,14 @@ import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobItems; import com.gamingmesh.jobs.container.JobItems;
import com.gamingmesh.jobs.container.JobLimitedItems; import com.gamingmesh.jobs.container.JobLimitedItems;
import com.gamingmesh.jobs.i18n.Language;
import com.gamingmesh.jobs.stuff.GiveItem; import com.gamingmesh.jobs.stuff.GiveItem;
public class give implements Cmd { public class give implements Cmd {
private enum actions { private enum actions {
items, limiteditems; items, limiteditems;
public static actions getByname(String name) { public static actions getByname(String name) {
for (actions one : actions.values()) { for (actions one : actions.values()) {
if (one.name().equalsIgnoreCase(name)) if (one.name().equalsIgnoreCase(name))
@ -58,8 +60,8 @@ public class give implements Cmd {
player = (Player) sender; player = (Player) sender;
if (player == null) { if (player == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.give.output.notonline")); Language.sendMessage(sender, "command.give.output.notonline");
return true; return null;
} }
if (name == null) if (name == null)
@ -76,7 +78,7 @@ public class give implements Cmd {
ItemStack item = jItem == null ? null : jItem.getItemStack(player); ItemStack item = jItem == null ? null : jItem.getItemStack(player);
if (item == null) { if (item == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.give.output.noitem")); Language.sendMessage(sender, "command.give.output.noitem");
return true; return true;
} }
@ -92,7 +94,7 @@ public class give implements Cmd {
ItemStack limItem = jLItem == null ? null : jLItem.getItemStack(player); ItemStack limItem = jLItem == null ? null : jLItem.getItemStack(player);
if (limItem == null) { if (limItem == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.give.output.noitem")); Language.sendMessage(sender, "command.give.output.noitem");
return true; return true;
} }

View File

@ -15,6 +15,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.container.Log; import com.gamingmesh.jobs.container.Log;
import com.gamingmesh.jobs.container.LogAmounts; import com.gamingmesh.jobs.container.LogAmounts;
import com.gamingmesh.jobs.container.PlayerInfo; import com.gamingmesh.jobs.container.PlayerInfo;
import com.gamingmesh.jobs.i18n.Language;
import com.gamingmesh.jobs.stuff.Sorting; import com.gamingmesh.jobs.stuff.Sorting;
import net.Zrips.CMILib.Time.CMITimeManager; import net.Zrips.CMILib.Time.CMITimeManager;
@ -24,8 +25,7 @@ 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"); return false;
return true;
} }
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@ -62,7 +62,7 @@ public class glog implements Cmd {
unsortMap = Sorting.sortDoubleDESCByLog(unsortMap); unsortMap = Sorting.sortDoubleDESCByLog(unsortMap);
if (unsortMap.isEmpty()) { if (unsortMap.isEmpty()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.glog.output.nodata")); Language.sendMessage(sender, "command.glog.output.nodata");
return; return;
} }
@ -72,7 +72,7 @@ public class glog implements Cmd {
totalExp = 0, totalExp = 0,
totalPoints = 0; totalPoints = 0;
sender.sendMessage(Jobs.getLanguage().getMessage("command.glog.output.topline")); Language.sendMessage(sender, "command.glog.output.topline");
for (LogAmounts info : unsortMap.keySet()) { for (LogAmounts info : unsortMap.keySet()) {
double money = info.get(CurrencyType.MONEY); double money = info.get(CurrencyType.MONEY);
totalMoney += money; totalMoney += money;
@ -95,14 +95,14 @@ public class glog implements Cmd {
if (points != 0D) if (points != 0D)
pointsS = Jobs.getLanguage().getMessage("command.glog.output.points", "%amount%", points); pointsS = Jobs.getLanguage().getMessage("command.glog.output.points", "%amount%", points);
sender.sendMessage(Jobs.getLanguage().getMessage("command.glog.output.ls", Language.sendMessage(sender, "command.glog.output.ls",
"%number%", count, "%number%", count,
"%action%", info.getAction(), "%action%", info.getAction(),
"%item%", info.getItemName().replace(":0", "").replace('_', ' ').toLowerCase(), "%item%", info.getItemName().replace(":0", "").replace('_', ' ').toLowerCase(),
"%qty%", info.getCount(), "%qty%", info.getCount(),
"%money%", moneyS, "%money%", moneyS,
"%exp%", expS, "%exp%", expS,
"%points%", pointsS)); "%points%", pointsS);
count++; count++;
@ -111,10 +111,10 @@ public class glog implements Cmd {
} }
NumberFormat format = NumberFormat.getInstance(Locale.ENGLISH); NumberFormat format = NumberFormat.getInstance(Locale.ENGLISH);
sender.sendMessage(Jobs.getLanguage().getMessage("command.glog.output.totalIncomes", "%money%", format.format(totalMoney), Language.sendMessage(sender, "command.glog.output.totalIncomes", "%money%", format.format(totalMoney),
"%exp%", format.format(totalExp), "%points%", format.format(totalPoints))); "%exp%", format.format(totalExp), "%points%", format.format(totalPoints));
sender.sendMessage(Jobs.getLanguage().getMessage("command.glog.output.bottomline")); Language.sendMessage(sender, "command.glog.output.bottomline");
} }
}); });
return true; return true;

View File

@ -8,36 +8,36 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.i18n.Language;
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"); return false;
return true;
} }
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]); JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
if (jPlayer == null) { if (jPlayer == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0])); Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args[0]);
return true; return true;
} }
Job job = Jobs.getJob(args[1]); Job job = Jobs.getJob(args[1]);
if (job == null) { if (job == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job")); Language.sendMessage(sender, "general.error.job");
return true; return true;
} }
double xpGained; double xpGained;
try { try {
xpGained = Double.parseDouble(args[2]); xpGained = Double.parseDouble(args[2]);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error")); Language.sendMessage(sender, "general.admin.error");
return true; return true;
} }
if (xpGained <= 0) { if (xpGained <= 0) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error")); Language.sendMessage(sender, "general.admin.error");
return true; return true;
} }
@ -53,7 +53,7 @@ public class grantxp implements Cmd {
player.sendMessage(message); player.sendMessage(message);
} }
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success")); Language.sendMessage(sender, "general.admin.success");
} }
return true; return true;
} }

View File

@ -10,6 +10,7 @@ import org.bukkit.scoreboard.DisplaySlot;
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.container.TopList; import com.gamingmesh.jobs.container.TopList;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Container.PageInfo; import net.Zrips.CMILib.Container.PageInfo;
import net.Zrips.CMILib.Locale.LC; import net.Zrips.CMILib.Locale.LC;
@ -22,12 +23,11 @@ public class gtop implements Cmd {
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 null;
} }
if (args.length > 1) { if (args.length > 1) {
Jobs.getCommandManager().sendUsage(sender, "gtop"); return false;
return true;
} }
Player player = (Player) sender; Player player = (Player) sender;
@ -54,24 +54,24 @@ public class gtop implements Cmd {
List<TopList> FullList = Jobs.getJobsDAO().getGlobalTopList(pi.getStart()); List<TopList> FullList = Jobs.getJobsDAO().getGlobalTopList(pi.getStart());
if (FullList.isEmpty()) { if (FullList.isEmpty()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.gtop.error.nojob")); Language.sendMessage(sender, "command.gtop.error.nojob");
return true; return true;
} }
if (!Jobs.getGCManager().ShowToplistInScoreboard) { if (!Jobs.getGCManager().ShowToplistInScoreboard) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.gtop.output.topline", "%amount%", amount)); Language.sendMessage(sender, "command.gtop.output.topline", "%amount%", amount);
int i = 0; int i = 0;
for (TopList One : FullList) { for (TopList One : FullList) {
if (i >= amount) if (i >= amount)
break; break;
sender.sendMessage(Jobs.getLanguage().getMessage("command.gtop.output.list", Language.sendMessage(sender, "command.gtop.output.list",
"%number%", pi.getPositionForOutput(i), "%number%", pi.getPositionForOutput(i),
"%playername%", One.getPlayerInfo().getName(), "%playername%", One.getPlayerInfo().getName(),
"%playerdisplayname%", One.getPlayerInfo().getDisplayName(), "%playerdisplayname%", One.getPlayerInfo().getDisplayName(),
"%level%", One.getLevel(), "%level%", One.getLevel(),
"%exp%", One.getExp())); "%exp%", One.getExp());
++i; ++i;
} }
} else { } else {

View File

@ -8,6 +8,7 @@ import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.ActionType; import com.gamingmesh.jobs.container.ActionType;
import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.Job;
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;
@ -19,25 +20,24 @@ public class info implements Cmd {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return null;
} }
if (args.length < 1) { if (args.length < 1) {
Jobs.getCommandManager().sendUsage(sender, "info");
Jobs.getCommandManager().sendValidActions(sender); Jobs.getCommandManager().sendValidActions(sender);
return true; return false;
} }
Player pSender = (Player) sender; Player pSender = (Player) sender;
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(pSender); JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(pSender);
if (jPlayer == null) { if (jPlayer == null) {
pSender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", pSender.getName())); Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", pSender.getName());
return true; return true;
} }
Job job = Jobs.getJob(args[0]); Job job = Jobs.getJob(args[0]);
if (job == null) { if (job == null) {
pSender.sendMessage(Jobs.getLanguage().getMessage("general.error.job")); Language.sendMessage(sender, "general.error.job");
return true; return true;
} }

View File

@ -30,7 +30,7 @@ public class itembonus implements Cmd {
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 null;
} }
Player player = (Player) sender; Player player = (Player) sender;

View File

@ -22,12 +22,11 @@ public class iteminfo implements Cmd {
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 null;
} }
if (args.length != 0) { if (args.length != 0) {
Jobs.getCommandManager().sendUsage(sender, "iteminfo"); return false;
return true;
} }
ItemStack iih = CMIItemStack.getItemInMainHand((Player) sender); ItemStack iih = CMIItemStack.getItemInMainHand((Player) sender);

View File

@ -8,6 +8,7 @@ import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.Job;
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;
@ -19,17 +20,16 @@ public class join implements Cmd {
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 null;
} }
if (args.length != 1 && args.length != 0 && args.length != 2) { if (args.length != 1 && args.length != 0 && args.length != 2) {
Jobs.getCommandManager().sendUsage(sender, "join"); return false;
return true;
} }
if (args.length == 0) { if (args.length == 0) {
plugin.getServer().dispatchCommand(sender, "jobs browse"); plugin.getServer().dispatchCommand(sender, "jobs browse");
return true; return null;
} }
Job job = Jobs.getJob(args[0]); Job job = Jobs.getJob(args[0]);
@ -58,17 +58,17 @@ public class join implements Cmd {
if (jPlayer.isInJob(job)) { if (jPlayer.isInJob(job)) {
// already in job message // already in job message
pSender.sendMessage(Jobs.getLanguage().getMessage("command.join.error.alreadyin", "%jobname%", job.getDisplayName())); Language.sendMessage(sender, "command.join.error.alreadyin", "%jobname%", job.getDisplayName());
return true; return true;
} }
if (job.getMaxSlots() != null && Jobs.getUsedSlots(job) >= job.getMaxSlots()) { if (job.getMaxSlots() != null && Jobs.getUsedSlots(job) >= job.getMaxSlots()) {
pSender.sendMessage(Jobs.getLanguage().getMessage("command.join.error.fullslots", "%jobname%", job.getDisplayName())); Language.sendMessage(sender, "command.join.error.fullslots", "%jobname%", job.getDisplayName());
return true; return true;
} }
if (!job.isIgnoreMaxJobs() && !Jobs.getPlayerManager().getJobsLimit(jPlayer, (short) jPlayer.progression.size())) { if (!job.isIgnoreMaxJobs() && !Jobs.getPlayerManager().getJobsLimit(jPlayer, (short) jPlayer.progression.size())) {
pSender.sendMessage(Jobs.getLanguage().getMessage("command.join.error.maxjobs")); Language.sendMessage(sender, "command.join.error.maxjobs");
return true; return true;
} }
@ -81,12 +81,12 @@ public class join implements Cmd {
JobProgression ajp = jPlayer.getArchivedJobProgression(job); JobProgression ajp = jPlayer.getArchivedJobProgression(job);
if (ajp != null && !ajp.canRejoin()) { if (ajp != null && !ajp.canRejoin()) {
pSender.sendMessage(Jobs.getLanguage().getMessage("command.join.error.rejoin", "[time]", ajp.getRejoinTimeMessage())); Language.sendMessage(sender, "command.join.error.rejoin", "[time]", ajp.getRejoinTimeMessage());
return true; return true;
} }
Jobs.getPlayerManager().joinJob(jPlayer, job); Jobs.getPlayerManager().joinJob(jPlayer, job);
pSender.sendMessage(Jobs.getLanguage().getMessage("command.join.success", "%jobname%", job.getDisplayName())); Language.sendMessage(sender, "command.join.success", "%jobname%", job.getDisplayName());
return true; return true;
} }
} }

View File

@ -7,6 +7,7 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.i18n.Language;
import com.gamingmesh.jobs.stuff.Util; import com.gamingmesh.jobs.stuff.Util;
import net.Zrips.CMILib.Locale.LC; import net.Zrips.CMILib.Locale.LC;
@ -16,23 +17,24 @@ 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; LC.info_Ingame.sendMessage(sender);
return null;
}
if (args.length < 1) { if (args.length < 1) {
Jobs.getCommandManager().sendUsage(sender, "leave"); return false;
return true;
} }
Player pSender = (Player) sender; Player pSender = (Player) sender;
Job job = Jobs.getJob(args[0]); Job job = Jobs.getJob(args[0]);
if (job == null) { if (job == null) {
pSender.sendMessage(Jobs.getLanguage().getMessage("general.error.job")); Language.sendMessage(sender, "general.error.job");
return true; return true;
} }
if (Jobs.getGCManager().UsePerPermissionForLeaving && !pSender.hasPermission("jobs.command.leave." + args[0].toLowerCase())) { if (Jobs.getGCManager().UsePerPermissionForLeaving && !pSender.hasPermission("jobs.command.leave." + args[0].toLowerCase())) {
CMIMessages.sendMessage(pSender, LC.info_NoPermission); CMIMessages.sendMessage(sender, LC.info_NoPermission);
return true; return true;
} }
@ -45,8 +47,8 @@ public class leave implements Cmd {
plugin.getServer().getScheduler().runTaskLater(plugin, () -> Util.LEAVECONFIRM.remove(uuid), plugin.getServer().getScheduler().runTaskLater(plugin, () -> Util.LEAVECONFIRM.remove(uuid),
20 * Jobs.getGCManager().ConfirmExpiryTime); 20 * Jobs.getGCManager().ConfirmExpiryTime);
pSender.sendMessage(Jobs.getLanguage().getMessage("command.leave.confirmationNeed", "[jobname]", Language.sendMessage(sender, "command.leave.confirmationNeed", "[jobname]",
job.getDisplayName(), "[time]", Jobs.getGCManager().ConfirmExpiryTime)); job.getDisplayName(), "[time]", Jobs.getGCManager().ConfirmExpiryTime);
return true; return true;
} }
@ -56,9 +58,9 @@ public class leave implements Cmd {
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(pSender); JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(pSender);
if (Jobs.getPlayerManager().leaveJob(jPlayer, job)) if (Jobs.getPlayerManager().leaveJob(jPlayer, job))
pSender.sendMessage(Jobs.getLanguage().getMessage("command.leave.success", "%jobname%", job.getDisplayName(), "[jobname]", job.getDisplayName())); Language.sendMessage(sender, "command.leave.success", "%jobname%", job.getDisplayName(), "[jobname]", job.getDisplayName());
else else
pSender.sendMessage(Jobs.getLanguage().getMessage("general.error.job")); Language.sendMessage(sender, "general.error.job");
return true; return true;
} }

View File

@ -9,6 +9,7 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.commands.Cmd;
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 com.gamingmesh.jobs.stuff.Util; import com.gamingmesh.jobs.stuff.Util;
import net.Zrips.CMILib.Locale.LC; import net.Zrips.CMILib.Locale.LC;
@ -20,7 +21,7 @@ public class leaveall implements Cmd {
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 null;
} }
Player pSender = (Player) sender; Player pSender = (Player) sender;
@ -28,7 +29,7 @@ public class leaveall implements Cmd {
List<JobProgression> jobs = jPlayer.getJobProgression(); List<JobProgression> jobs = jPlayer.getJobProgression();
if (jobs.isEmpty()) { if (jobs.isEmpty()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.leaveall.error.nojobs")); Language.sendMessage(sender, "command.leaveall.error.nojobs");
return true; return true;
} }
@ -41,8 +42,8 @@ public class leaveall implements Cmd {
plugin.getServer().getScheduler().runTaskLater(plugin, () -> Util.LEAVECONFIRM.remove(uuid), plugin.getServer().getScheduler().runTaskLater(plugin, () -> Util.LEAVECONFIRM.remove(uuid),
20 * Jobs.getGCManager().ConfirmExpiryTime); 20 * Jobs.getGCManager().ConfirmExpiryTime);
pSender.sendMessage(Jobs.getLanguage().getMessage("command.leaveall.confirmationNeed", "[time]", Language.sendMessage(pSender, "command.leaveall.confirmationNeed", "[time]",
Jobs.getGCManager().ConfirmExpiryTime)); Jobs.getGCManager().ConfirmExpiryTime);
return true; return true;
} }
@ -50,7 +51,7 @@ public class leaveall implements Cmd {
} }
Jobs.getPlayerManager().leaveAllJobs(jPlayer); Jobs.getPlayerManager().leaveAllJobs(jPlayer);
sender.sendMessage(Jobs.getLanguage().getMessage("command.leaveall.success")); Language.sendMessage(sender, "command.leaveall.success");
return true; return true;
} }
} }

View File

@ -9,6 +9,7 @@ import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.Job;
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;
public class level implements Cmd { public class level implements Cmd {
@ -19,8 +20,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"); return false;
return true;
} }
Action action = Action.Add; Action action = Action.Add;
@ -60,12 +60,12 @@ public class level implements Cmd {
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(playerName); JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(playerName);
if (jPlayer == null) { if (jPlayer == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0])); Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args[0]);
return true; return true;
} }
if (job == null) { if (job == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job")); Language.sendMessage(sender, "general.error.job");
return true; return true;
} }
@ -112,14 +112,14 @@ public class level implements Cmd {
Player player = jPlayer.getPlayer(); Player player = jPlayer.getPlayer();
if (player != null) if (player != null)
player.sendMessage(Jobs.getLanguage().getMessage("command.level.output.target", "%jobname%", job.getDisplayName(), "%level%", prog.getLevel(), Language.sendMessage(player, "command.level.output.target", "%jobname%", job.getDisplayName(), "%level%", prog.getLevel(),
"%exp%", String.format(Jobs.getGCManager().getDecimalPlacesExp(), prog.getExperience()))); "%exp%", String.format(Jobs.getGCManager().getDecimalPlacesExp(), prog.getExperience()));
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success")); Language.sendMessage(sender, "general.admin.success");
} else } else
sender.sendMessage(Jobs.getLanguage().getMessage("command.level.error.nojob")); Language.sendMessage(sender, "command.level.error.nojob");
} catch (Exception e) { } catch (Exception e) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error")); Language.sendMessage(sender, "general.admin.error");
} }
return true; return true;
} }

View File

@ -8,6 +8,7 @@ import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.CurrencyType; import com.gamingmesh.jobs.container.CurrencyType;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.economy.PaymentData; import com.gamingmesh.jobs.economy.PaymentData;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Locale.LC; import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Logs.CMIDebug; import net.Zrips.CMILib.Logs.CMIDebug;
@ -19,8 +20,7 @@ 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"); return false;
return true;
} }
JobsPlayer JPlayer = null; JobsPlayer JPlayer = null;
@ -38,7 +38,7 @@ public class limit implements Cmd {
} }
if (disabled) { if (disabled) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.limit.output.notenabled")); Language.sendMessage(sender,"command.limit.output.notenabled");
return true; return true;
} }
@ -63,10 +63,10 @@ public class limit implements Cmd {
if (limit.getLeftTime(type) > 0) { if (limit.getLeftTime(type) > 0) {
String typeName = type.getName().toLowerCase(); String typeName = type.getName().toLowerCase();
sender.sendMessage(Jobs.getLanguage().getMessage("command.limit.output." + typeName + "time", "%time%", CMITimeManager.to24hourShort(limit.getLeftTime(type)))); Language.sendMessage(sender, "command.limit.output." + typeName + "time", "%time%", CMITimeManager.to24hourShort(limit.getLeftTime(type)));
sender.sendMessage(Jobs.getLanguage().getMessage("command.limit.output." + typeName + "Limit", Language.sendMessage(sender, "command.limit.output." + typeName + "Limit",
"%current%", (int) (limit.getAmount(type) * 100) / 100D, "%current%", (int) (limit.getAmount(type) * 100) / 100D,
"%total%", JPlayer.getLimit(type))); "%total%", JPlayer.getLimit(type));
} }
} }
return true; return true;

View File

@ -15,6 +15,7 @@ import com.gamingmesh.jobs.container.CurrencyType;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.container.Log; import com.gamingmesh.jobs.container.Log;
import com.gamingmesh.jobs.container.LogAmounts; import com.gamingmesh.jobs.container.LogAmounts;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Container.CMISort; import net.Zrips.CMILib.Container.CMISort;
import net.Zrips.CMILib.Locale.LC; import net.Zrips.CMILib.Locale.LC;
@ -26,12 +27,11 @@ public class log implements Cmd {
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 null;
} }
if (args.length != 1 && args.length != 0) { if (args.length != 1 && args.length != 0) {
Jobs.getCommandManager().sendUsage(sender, "log"); return false;
return true;
} }
JobsPlayer JPlayer = null; JobsPlayer JPlayer = null;
@ -39,7 +39,7 @@ public class log implements Cmd {
JPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender); JPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
else if (args.length == 1) { else if (args.length == 1) {
if (!Jobs.hasPermission(sender, "jobs.command.log.others", true)) if (!Jobs.hasPermission(sender, "jobs.command.log.others", true))
return true; return null;
JPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]); JPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
} }
@ -51,9 +51,9 @@ public class log implements Cmd {
Map<String, Log> logList = JPlayer.getLog(); Map<String, Log> logList = JPlayer.getLog();
if (logList == null || logList.isEmpty()) { if (logList == null || logList.isEmpty()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.bottomline")); Language.sendMessage(sender, "command.log.output.bottomline");
sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.nodata")); Language.sendMessage(sender, "command.log.output.nodata");
sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.bottomline")); Language.sendMessage(sender, "command.log.output.bottomline");
return true; return true;
} }
@ -67,14 +67,14 @@ public class log implements Cmd {
unsortMap = CMISort.sortDoubleDESC(unsortMap); unsortMap = CMISort.sortDoubleDESC(unsortMap);
if (unsortMap.isEmpty()) { if (unsortMap.isEmpty()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.nodata")); Language.sendMessage(sender, "command.log.output.nodata");
return true; return true;
} }
int count = 0; int count = 0;
int max = 10; int max = 10;
sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.topline", "%playername%", JPlayer.getName(), "%playerdisplayname%", JPlayer.getDisplayName())); Language.sendMessage(sender, "command.log.output.topline", "%playername%", JPlayer.getName(), "%playerdisplayname%", JPlayer.getDisplayName());
for (Log one : logList.values()) { for (Log one : logList.values()) {
double totalMoney = 0, totalExp = 0, totalPoints = 0; double totalMoney = 0, totalExp = 0, totalPoints = 0;
@ -106,14 +106,14 @@ public class log implements Cmd {
if (points != 0D) if (points != 0D)
pointsS = Jobs.getLanguage().getMessage("command.log.output.points", "%amount%", points); pointsS = Jobs.getLanguage().getMessage("command.log.output.points", "%amount%", points);
sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.ls", Language.sendMessage(sender, "command.log.output.ls",
"%number%", count, "%number%", count,
"%action%", one.getActionType(), "%action%", one.getActionType(),
"%item%", amounts.getItemName().replace(":0", "").replace('_', ' ').toLowerCase(), "%item%", amounts.getItemName().replace(":0", "").replace('_', ' ').toLowerCase(),
"%qty%", amounts.getCount(), "%qty%", amounts.getCount(),
"%money%", moneyS, "%money%", moneyS,
"%exp%", expS, "%exp%", expS,
"%points%", pointsS)); "%points%", pointsS);
break; break;
} }
} }
@ -123,14 +123,14 @@ public class log implements Cmd {
} }
NumberFormat format = NumberFormat.getInstance(Locale.ENGLISH); NumberFormat format = NumberFormat.getInstance(Locale.ENGLISH);
sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.totalIncomes", "%money%", format.format(totalMoney), Language.sendMessage(sender, "command.log.output.totalIncomes", "%money%", format.format(totalMoney),
"%exp%", format.format(totalExp), "%points%", format.format(totalPoints))); "%exp%", format.format(totalExp), "%points%", format.format(totalPoints));
if (count > max) if (count > max)
break; break;
} }
sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.bottomline")); Language.sendMessage(sender, "command.log.output.bottomline");
return true; return true;
} }
} }

View File

@ -30,7 +30,7 @@ public class ownedblocks implements Cmd {
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))
return true; return null;
jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]); jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
} else if (sender instanceof Player) } else if (sender instanceof Player)
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender); jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
@ -39,8 +39,8 @@ public class ownedblocks implements Cmd {
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, "ownedblocks"); return false;
return true; return null;
} }
final JobsPlayer jp = jPlayer; final JobsPlayer jp = jPlayer;

View File

@ -8,6 +8,7 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.Placeholders.Placeholder.JobsPlaceHolders; import com.gamingmesh.jobs.Placeholders.Placeholder.JobsPlaceHolders;
import com.gamingmesh.jobs.Placeholders.Placeholder.JobsPlaceholderType; import com.gamingmesh.jobs.Placeholders.Placeholder.JobsPlaceholderType;
import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Container.PageInfo; import net.Zrips.CMILib.Container.PageInfo;
import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.Messages.CMIMessages;
@ -42,10 +43,10 @@ public class placeholders implements Cmd {
String placeholder = args[1]; String placeholder = args[1];
JobsPlaceholderType type = plugin.getPlaceholderAPIManager().getPlaceHolderType(player, placeholder); JobsPlaceholderType type = plugin.getPlaceholderAPIManager().getPlaceHolderType(player, placeholder);
sender.sendMessage(Jobs.getLanguage().getMessage("command.placeholders.output.parse", Language.sendMessage(sender, "command.placeholders.output.parse",
"[placeholder]", placeholder, "[placeholder]", placeholder,
"[source]", type == null ? "Unknown" : type.name(), "[source]", type == null ? "Unknown" : type.name(),
"[result]", plugin.getPlaceholderAPIManager().updatePlaceHolders(player, placeholder))); "[result]", plugin.getPlaceholderAPIManager().updatePlaceHolders(player, placeholder));
return true; return true;
} }
@ -72,17 +73,6 @@ public class placeholders implements Cmd {
if (plugin.isPlaceholderAPIEnabled()) { if (plugin.isPlaceholderAPIEnabled()) {
hover = place = one.getFull(); hover = place = one.getFull();
} }
// For MVdWPlaceholderAPI
// if (plugin.isMVdWPlaceholderAPIEnabled()) {
// if (!plugin.isPlaceholderAPIEnabled()) {
// place = one.getFull().substring(1, one.getFull().length() - 2);
// place = "{" + place + "}";
// }
// if (hover.isEmpty())
// hover = one.getFull();
// else
// hover += "\n" + "{" + one.getFull().substring(1, one.getFull().length() - 2) + "}";
// }
rm.addText(Jobs.getLanguage().getMessage("command.placeholders.output.list", "[place]", pi.getPositionForOutput(), "[placeholder]", place) + extra) rm.addText(Jobs.getLanguage().getMessage("command.placeholders.output.list", "[place]", pi.getPositionForOutput(), "[placeholder]", place) + extra)
.addHover(hover).addSuggestion(one.getFull()).show(sender); .addHover(hover).addSuggestion(one.getFull()).show(sender);
} }

View File

@ -6,26 +6,26 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.i18n.Language;
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().sendValidActions(sender); Jobs.getCommandManager().sendValidActions(sender);
return true; return false;
} }
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]); JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
if (jPlayer == null) { if (jPlayer == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0])); Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args[0]);
return true; return true;
} }
Job job = Jobs.getJob(args[1]); Job job = Jobs.getJob(args[1]);
if (job == null) { if (job == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job")); Language.sendMessage(sender, "general.error.job");
return true; return true;
} }

View File

@ -7,6 +7,7 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.container.PlayerPoints; import com.gamingmesh.jobs.container.PlayerPoints;
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;
@ -17,8 +18,7 @@ public class points implements Cmd {
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"); return false;
return true;
} }
JobsPlayer jPlayer = null; JobsPlayer jPlayer = null;
@ -41,10 +41,10 @@ public class points implements Cmd {
PlayerPoints pointInfo = jPlayer.getPointsData(); PlayerPoints pointInfo = jPlayer.getPointsData();
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());
sender.sendMessage(Jobs.getLanguage().getMessage("command.points.currentpoints", "%currentpoints%", (int) (pointInfo.getCurrentPoints() * 100) / 100D)); Language.sendMessage(sender, "command.points.currentpoints", "%currentpoints%", (int) (pointInfo.getCurrentPoints() * 100) / 100D);
sender.sendMessage(Jobs.getLanguage().getMessage("command.points.totalpoints", "%totalpoints%", (int) (pointInfo.getTotalPoints() * 100) / 100D)); Language.sendMessage(sender, "command.points.totalpoints", "%totalpoints%", (int) (pointInfo.getTotalPoints() * 100) / 100D);
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator")); Language.sendMessage(sender, "general.info.separator");
return true; return true;
} }
} }

View File

@ -7,25 +7,25 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.i18n.Language;
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"); return false;
return true;
} }
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]); JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
if (jPlayer == null) { if (jPlayer == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0])); Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args[0]);
return true; return true;
} }
Job job = Jobs.getJob(args[1]); Job job = Jobs.getJob(args[1]);
if (job == null) { if (job == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job")); Language.sendMessage(sender, "general.error.job");
return true; return true;
} }
@ -54,14 +54,14 @@ public class promote implements Cmd {
Player player = jPlayer.getPlayer(); Player player = jPlayer.getPlayer();
if (player != null) if (player != null)
player.sendMessage(Jobs.getLanguage().getMessage("command.promote.output.target", Language.sendMessage(player, "command.promote.output.target",
"%jobname%", job.getDisplayName(), "%jobname%", job.getDisplayName(),
"%levelsgained%", levelsGained)); "%levelsgained%", levelsGained);
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success")); Language.sendMessage(sender, "general.admin.success");
} catch (Throwable e) { } catch (Throwable e) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error")); Language.sendMessage(sender, "general.admin.error");
} }
return true; return true;
} }

View File

@ -14,6 +14,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.container.Quest; import com.gamingmesh.jobs.container.Quest;
import com.gamingmesh.jobs.container.QuestObjective; import com.gamingmesh.jobs.container.QuestObjective;
import com.gamingmesh.jobs.container.QuestProgression; import com.gamingmesh.jobs.container.QuestProgression;
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;
@ -27,7 +28,7 @@ public class quests implements Cmd {
if (!Jobs.getGCManager().DailyQuestsEnabled) { if (!Jobs.getGCManager().DailyQuestsEnabled) {
LC.info_FeatureNotEnabled.sendMessage(sender); LC.info_FeatureNotEnabled.sendMessage(sender);
return true; return null;
} }
JobsPlayer jPlayer = null; JobsPlayer jPlayer = null;
@ -35,7 +36,7 @@ public class quests implements Cmd {
if (args.length >= 1 && !args[0].equalsIgnoreCase("stop") && !args[0].equalsIgnoreCase("start")) { if (args.length >= 1 && !args[0].equalsIgnoreCase("stop") && !args[0].equalsIgnoreCase("start")) {
if (!Jobs.hasPermission(sender, "jobs.command.admin.quests", true)) if (!Jobs.hasPermission(sender, "jobs.command.admin.quests", true))
return true; return null;
jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]); jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
} else if (isPlayer) } else if (isPlayer)
@ -52,7 +53,7 @@ public class quests implements Cmd {
List<QuestProgression> questProgs = jPlayer.getQuestProgressions(); List<QuestProgression> questProgs = jPlayer.getQuestProgressions();
if (questProgs.isEmpty()) { if (questProgs.isEmpty()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.quests.error.noquests")); Language.sendMessage(sender, "command.quests.error.noquests");
return true; return true;
} }
@ -71,13 +72,13 @@ public class quests implements Cmd {
q.getQuest().setStopped(stopped); q.getQuest().setStopped(stopped);
} }
sender.sendMessage(Jobs.getLanguage().getMessage("command.quests.status.changed", "%status%", Language.sendMessage(sender, "command.quests.status.changed", "%status%",
stopped ? Jobs.getLanguage().getMessage("command.quests.status.stopped") : Jobs.getLanguage().getMessage("command.quests.status.started"))); stopped ? Jobs.getLanguage().getMessage("command.quests.status.stopped") : Jobs.getLanguage().getMessage("command.quests.status.started"));
return true; return true;
} }
} }
sender.sendMessage(Jobs.getLanguage().getMessage("command.quests.toplineseparator", "[playerName]", jPlayer.getName(), "[questsDone]", jPlayer.getDoneQuests())); Language.sendMessage(sender, "command.quests.toplineseparator", "[playerName]", jPlayer.getName(), "[questsDone]", jPlayer.getDoneQuests());
for (JobProgression jobProg : jPlayer.progression) { for (JobProgression jobProg : jPlayer.progression) {
List<QuestProgression> list = jPlayer.getQuestProgressions(jobProg.getJob()); List<QuestProgression> list = jPlayer.getQuestProgressions(jobProg.getJob());

View File

@ -4,13 +4,14 @@ import org.bukkit.command.CommandSender;
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.i18n.Language;
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")); Language.sendMessage(sender, "general.admin.success");
return true; return true;
} }
} }

View File

@ -7,37 +7,37 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.i18n.Language;
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"); return false;
return true;
} }
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]); JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
if (jPlayer == null) { if (jPlayer == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0])); Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args[0]);
return true; return true;
} }
Job job = Jobs.getJob(args[1]); Job job = Jobs.getJob(args[1]);
if (job == null) { if (job == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job")); Language.sendMessage(sender, "general.error.job");
return true; return null;
} }
double xpLost = 0D; double xpLost = 0D;
try { try {
xpLost = Double.parseDouble(args[2]); xpLost = Double.parseDouble(args[2]);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error")); Language.sendMessage(sender, "general.admin.error");
return true; return true;
} }
if (xpLost <= 0 || xpLost > Double.MAX_VALUE) { if (xpLost <= 0 || xpLost > Double.MAX_VALUE) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error")); Language.sendMessage(sender, "general.admin.error");
return true; return true;
} }
// check if player already has the job // check if player already has the job
@ -46,12 +46,12 @@ public class removexp implements Cmd {
Player player = jPlayer.getPlayer(); Player player = jPlayer.getPlayer();
if (player != null) { if (player != null) {
player.sendMessage(Jobs.getLanguage().getMessage("command.removexp.output.target", Language.sendMessage(player, "command.removexp.output.target",
"%jobname%", job.getDisplayName(), "%jobname%", job.getDisplayName(),
"%xplost%", xpLost)); "%xplost%", xpLost);
} }
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success")); Language.sendMessage(sender, "general.admin.success");
} }
return true; return true;
} }

View File

@ -4,6 +4,7 @@ import org.bukkit.command.CommandSender;
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.i18n.Language;
public class resetexploreregion implements Cmd { public class resetexploreregion implements Cmd {
@ -13,23 +14,22 @@ public class resetexploreregion 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 || !WORLD.equals(args[0])) { if (args.length != 2 || !WORLD.equals(args[0])) {
Jobs.getCommandManager().sendUsage(sender, "resetexploreregion"); return false;
return true;
} }
if (!Jobs.getGCManager().resetExploringData) { if (!Jobs.getGCManager().resetExploringData) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetexploreregion.output.notenabled")); Language.sendMessage(sender, "command.resetexploreregion.output.notenabled");
return true; return true;
} }
final String worldName = args[1]; final String worldName = args[1];
if (!worldName.matches(REGEX)) { if (!worldName.matches(REGEX)) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetexploreregion.output.invalidname")); Language.sendMessage(sender, "command.resetexploreregion.output.invalidname");
return true; return true;
} }
Jobs.getExploreManager().resetRegion(worldName); Jobs.getExploreManager().resetRegion(worldName);
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetexploreregion.output.reseted", "%worldname%", worldName)); Language.sendMessage(sender, "command.resetexploreregion.output.reseted", "%worldname%", worldName);
return true; return true;
} }
} }

View File

@ -4,14 +4,14 @@ import org.bukkit.command.CommandSender;
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.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.i18n.Language;
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"); return false;
return true;
} }
if (args[0].equalsIgnoreCase("all")) { if (args[0].equalsIgnoreCase("all")) {
@ -22,18 +22,18 @@ public class resetlimit implements Cmd {
} }
} }
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetlimit.output.reseted", "%playername%", "")); Language.sendMessage(sender, "command.resetlimit.output.reseted", "%playername%", "");
return true; return true;
} }
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]); JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
if (jPlayer == null) { if (jPlayer == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0])); Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args[0]);
return true; return true;
} }
jPlayer.resetPaymentLimit(); jPlayer.resetPaymentLimit();
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetlimit.output.reseted", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getDisplayName())); Language.sendMessage(sender, "command.resetlimit.output.reseted", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getDisplayName());
return true; return true;
} }
} }

View File

@ -10,6 +10,7 @@ import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.container.QuestProgression; import com.gamingmesh.jobs.container.QuestProgression;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Locale.LC; import net.Zrips.CMILib.Locale.LC;
@ -24,8 +25,7 @@ public class resetquest implements Cmd {
} }
if (args.length != 0 && args.length != 1 && args.length != 2) { if (args.length != 0 && args.length != 1 && args.length != 2) {
Jobs.getCommandManager().sendUsage(sender, "resetquest"); return false;
return true;
} }
JobsPlayer jPlayer = null; JobsPlayer jPlayer = null;
@ -44,7 +44,7 @@ public class resetquest implements Cmd {
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender); jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
if (jPlayer == null) { if (jPlayer == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args.length > 0 ? args[0] : "")); Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args.length > 0 ? args[0] : "");
return true; return true;
} }
@ -54,12 +54,12 @@ public class resetquest implements Cmd {
quests = jPlayer.getQuestProgressions(job); quests = jPlayer.getQuestProgressions(job);
if (quests.isEmpty()) { if (quests.isEmpty()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquest.output.noQuests")); Language.sendMessage(sender, "command.resetquest.output.noQuests");
return true; return true;
} }
jPlayer.resetQuests(quests); jPlayer.resetQuests(quests);
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquest.output.reseted", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getName())); Language.sendMessage(sender, "command.resetquest.output.reseted", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getName());
return true; return true;
} }
} }

View File

@ -10,6 +10,7 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.Job;
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;
@ -23,8 +24,7 @@ public class resetquesttotal implements Cmd {
} }
if (args.length != 0 && args.length != 1) { if (args.length != 0 && args.length != 1) {
Jobs.getCommandManager().sendUsage(sender, "resetquesttotal"); return false;
return true;
} }
if (args.length > 0 && args[0].equalsIgnoreCase("all")) { if (args.length > 0 && args[0].equalsIgnoreCase("all")) {
@ -32,7 +32,7 @@ public class resetquesttotal implements Cmd {
pl.getValue().setDoneQuests(0); pl.getValue().setDoneQuests(0);
} }
Jobs.getJobsDAO().resetDoneQuests(); Jobs.getJobsDAO().resetDoneQuests();
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquesttotal.output.reseted", "%playername%", Jobs.getPlayerManager().getPlayersCache().size())); Language.sendMessage(sender,"command.resetquesttotal.output.reseted", "%playername%", Jobs.getPlayerManager().getPlayersCache().size());
return true; return true;
} }
@ -52,14 +52,14 @@ public class resetquesttotal implements Cmd {
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender); jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
if (jPlayer == null) { if (jPlayer == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args.length > 0 ? args[0] : "")); Language.sendMessage(sender,"general.error.noinfoByPlayer", "%playername%", args.length > 0 ? args[0] : "");
return true; return true;
} }
jPlayer.setDoneQuests(0); jPlayer.setDoneQuests(0);
jPlayer.setSaved(false); jPlayer.setSaved(false);
jPlayer.save(); jPlayer.save();
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquesttotal.output.reseted", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getDisplayName())); Language.sendMessage(sender,"command.resetquesttotal.output.reseted", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getDisplayName());
return true; return true;
} }
} }

View File

@ -9,6 +9,7 @@ import org.bukkit.configuration.file.FileConfiguration;
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.i18n.Language;
public class schedule implements Cmd { public class schedule implements Cmd {
@ -16,7 +17,7 @@ public class schedule implements Cmd {
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 null;
} }
if (args[0].equalsIgnoreCase("enable")) { if (args[0].equalsIgnoreCase("enable")) {
@ -32,12 +33,12 @@ public class schedule implements Cmd {
ConfigurationSection path = c.getConfigurationSection("Boost." + name); ConfigurationSection path = c.getConfigurationSection("Boost." + name);
if (path == null) { if (path == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.schedule.output.noScheduleFound")); Language.sendMessage(sender,"command.schedule.output.noScheduleFound");
return false; return null;
} }
if (path.getBoolean("Enabled")) { if (path.getBoolean("Enabled")) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.schedule.output.alreadyEnabled")); Language.sendMessage(sender,"command.schedule.output.alreadyEnabled");
return true; return true;
} }
@ -63,7 +64,7 @@ public class schedule implements Cmd {
Jobs.getScheduleManager().load(); Jobs.getScheduleManager().load();
Jobs.getScheduleManager().start(); Jobs.getScheduleManager().start();
sender.sendMessage(Jobs.getLanguage().getMessage("command.schedule.output.enabled", "%until%", until, "%from%", from)); Language.sendMessage(sender,"command.schedule.output.enabled", "%until%", until, "%from%", from);
} }
return true; return true;

View File

@ -15,17 +15,16 @@ public class shop implements Cmd {
if (!Jobs.getGCManager().jobsshopenabled) { if (!Jobs.getGCManager().jobsshopenabled) {
LC.info_FeatureNotEnabled.sendMessage(sender); LC.info_FeatureNotEnabled.sendMessage(sender);
return true; return null;
} }
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
LC.info_Ingame.sendMessage(sender); LC.info_Ingame.sendMessage(sender);
return true; return null;
} }
if (args.length != 0 && args.length != 1) { if (args.length != 0 && args.length != 1) {
Jobs.getCommandManager().sendUsage(sender, "shop"); return false;
return true;
} }
int page = 1; int page = 1;

View File

@ -6,17 +6,21 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.Signs.SignTopType; import com.gamingmesh.jobs.Signs.SignTopType;
import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Locale.LC;
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; LC.info_FeatureNotEnabled.sendMessage(sender);
return null;
}
if (args.length != 1) { if (args.length != 1) {
Jobs.getCommandManager().sendUsage(sender, "signupdate"); return false;
return true;
} }
if (args[0].equalsIgnoreCase("all")) { if (args[0].equalsIgnoreCase("all")) {
@ -26,8 +30,8 @@ public class signupdate implements Cmd {
Job oldjob = Jobs.getJob(args[0]); Job oldjob = Jobs.getJob(args[0]);
if (oldjob == null) { if (oldjob == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job")); Language.sendMessage(sender, "general.error.job");
return true; return null;
} }
if (args.length == 2) { if (args.length == 2) {
@ -35,7 +39,6 @@ public class signupdate implements Cmd {
if (type != null) { if (type != null) {
Jobs.getSignUtil().signUpdate(oldjob, type); Jobs.getSignUtil().signUpdate(oldjob, type);
} }
return true; return true;
} }

View File

@ -12,6 +12,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.container.Quest; import com.gamingmesh.jobs.container.Quest;
import com.gamingmesh.jobs.container.QuestProgression; import com.gamingmesh.jobs.container.QuestProgression;
import com.gamingmesh.jobs.economy.BufferedEconomy; import com.gamingmesh.jobs.economy.BufferedEconomy;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Locale.LC; import net.Zrips.CMILib.Locale.LC;
@ -21,11 +22,11 @@ public class skipquest implements Cmd {
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 null;
} }
if (args.length != 2 && args.length != 3) { if (args.length != 2 && args.length != 3) {
Jobs.getCommandManager().sendUsage(sender, "skipquest"); return false;
return true;
} }
JobsPlayer jPlayer = null; JobsPlayer jPlayer = null;
@ -53,8 +54,8 @@ public class skipquest implements Cmd {
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender); jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
if (jPlayer == null) { if (jPlayer == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args.length > 0 ? args[0] : "")); Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args.length > 0 ? args[0] : "");
return true; return null;
} }
List<QuestProgression> quests = jPlayer.getQuestProgressions(); List<QuestProgression> quests = jPlayer.getQuestProgressions();
@ -63,8 +64,8 @@ public class skipquest implements Cmd {
quests = jPlayer.getQuestProgressions(job); quests = jPlayer.getQuestProgressions(job);
if (quests == null || quests.isEmpty()) { if (quests == null || quests.isEmpty()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquest.output.noQuests")); Language.sendMessage(sender, "command.resetquest.output.noQuests");
return true; return null;
} }
Quest old = null; Quest old = null;
@ -99,8 +100,8 @@ public class skipquest implements Cmd {
if (amount > 0 && player != null) { if (amount > 0 && player != null) {
if (!econ.getEconomy().hasMoney(player, amount)) { if (!econ.getEconomy().hasMoney(player, amount)) {
sender.sendMessage(Jobs.getLanguage().getMessage("economy.error.nomoney")); Language.sendMessage(sender, "economy.error.nomoney");
return false; return null;
} }
econ.getEconomy().withdrawPlayer(player, amount); econ.getEconomy().withdrawPlayer(player, amount);
@ -112,7 +113,7 @@ public class skipquest implements Cmd {
plugin.getServer().dispatchCommand(player, "jobs quests"); plugin.getServer().dispatchCommand(player, "jobs quests");
if (amount > 0) { if (amount > 0) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.skipquest.output.questSkipForCost", "%amount%", amount)); Language.sendMessage(sender, "command.skipquest.output.questSkipForCost", "%amount%", amount);
} }
return true; return true;

View File

@ -24,8 +24,8 @@ public class stats implements Cmd {
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 p) } else if (sender instanceof Player)
jPlayer = Jobs.getPlayerManager().getJobsPlayer(p); jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
if (jPlayer == null) { if (jPlayer == null) {
if (args.length >= 1) if (args.length >= 1)

View File

@ -7,6 +7,7 @@ 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.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.i18n.Language;
import com.gamingmesh.jobs.stuff.ToggleBarHandling; import com.gamingmesh.jobs.stuff.ToggleBarHandling;
import net.Zrips.CMILib.Locale.LC; import net.Zrips.CMILib.Locale.LC;
@ -18,13 +19,12 @@ public class toggle implements Cmd {
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 null;
} }
boolean isBossbar = false, isActionbar = false; boolean isBossbar = false, isActionbar = false;
if (args.length != 1 || (!(isBossbar = args[0].equalsIgnoreCase("bossbar")) && !(isActionbar = args[0].equalsIgnoreCase("actionbar")))) { if (args.length != 1 || (!(isBossbar = args[0].equalsIgnoreCase("bossbar")) && !(isActionbar = args[0].equalsIgnoreCase("actionbar")))) {
Jobs.getCommandManager().sendUsage(sender, "toggle"); return false;
return true;
} }
Player player = (Player) sender; Player player = (Player) sender;
@ -35,10 +35,10 @@ public class toggle implements Cmd {
if (ex == null || ex.booleanValue()) { if (ex == null || ex.booleanValue()) {
ToggleBarHandling.getActionBarToggle().put(playerUUID, false); ToggleBarHandling.getActionBarToggle().put(playerUUID, false);
sender.sendMessage(Jobs.getLanguage().getMessage("command.toggle.output.off")); Language.sendMessage(sender, "command.toggle.output.off");
} else { } else {
ToggleBarHandling.getActionBarToggle().put(playerUUID, true); ToggleBarHandling.getActionBarToggle().put(playerUUID, true);
sender.sendMessage(Jobs.getLanguage().getMessage("command.toggle.output.on")); Language.sendMessage(sender, "command.toggle.output.on");
} }
} }
@ -47,14 +47,14 @@ public class toggle implements Cmd {
if (ex == null || ex.booleanValue()) { if (ex == null || ex.booleanValue()) {
ToggleBarHandling.getBossBarToggle().put(playerUUID, false); ToggleBarHandling.getBossBarToggle().put(playerUUID, false);
sender.sendMessage(Jobs.getLanguage().getMessage("command.toggle.output.off")); Language.sendMessage(sender, "command.toggle.output.off");
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player.getUniqueId()); JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player.getUniqueId());
if (jPlayer != null) if (jPlayer != null)
jPlayer.hideBossBars(); jPlayer.hideBossBars();
} else { } else {
ToggleBarHandling.getBossBarToggle().put(playerUUID, true); ToggleBarHandling.getBossBarToggle().put(playerUUID, true);
sender.sendMessage(Jobs.getLanguage().getMessage("command.toggle.output.on")); Language.sendMessage(sender, "command.toggle.output.on");
} }
} }

View File

@ -24,11 +24,10 @@ public class top implements Cmd {
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");
return false; return false;
} }
Player player = sender instanceof Player p ? p : null; Player player = sender instanceof Player ? (Player) sender : null;
if (args[0].equalsIgnoreCase("clear")) { if (args[0].equalsIgnoreCase("clear")) {
if (player != null) { if (player != null) {
@ -43,7 +42,7 @@ public class top implements Cmd {
try { try {
page = Integer.parseInt(args[1]); page = Integer.parseInt(args[1]);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
return true; return false;
} }
} }
if (page < 1) if (page < 1)
@ -52,7 +51,7 @@ public class top implements Cmd {
Job job = Jobs.getJob(args[0]); Job job = Jobs.getJob(args[0]);
if (job == null) { if (job == null) {
Language.sendMessage(sender, "command.top.error.nojob"); Language.sendMessage(sender, "command.top.error.nojob");
return false; return null;
} }
int workingIn = Jobs.getUsedSlots(job); int workingIn = Jobs.getUsedSlots(job);

View File

@ -7,31 +7,31 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.i18n.Language;
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"); return false;
return true;
} }
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]); JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
if (jPlayer == null) { if (jPlayer == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0])); Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args[0]);
return true; return true;
} }
Job oldjob = Jobs.getJob(args[1]); Job oldjob = Jobs.getJob(args[1]);
if (oldjob == null) { if (oldjob == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job")); Language.sendMessage(sender, "general.error.job");
return true; return true;
} }
Job newjob = Jobs.getJob(args[2]); Job newjob = Jobs.getJob(args[2]);
if (newjob == null) { if (newjob == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job")); Language.sendMessage(sender, "general.error.job");
return true; return true;
} }
@ -41,15 +41,14 @@ public class transfer implements Cmd {
Player player = jPlayer.getPlayer(); Player player = jPlayer.getPlayer();
if (player != null) { if (player != null) {
player.sendMessage(Jobs.getLanguage().getMessage("command.transfer.output.target", Language.sendMessage(player, "command.transfer.output.target",
"%oldjobname%", oldjob.getDisplayName(), "%oldjobname%", oldjob.getDisplayName(),
"%newjobname%", newjob.getDisplayName())); "%newjobname%", newjob.getDisplayName());
} }
Language.sendMessage(sender, "general.admin.success");
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
} }
} catch (Exception e) { } catch (Exception e) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error")); Language.sendMessage(sender, "general.admin.error");
} }
return true; return true;