1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 05:55:27 +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.JobsPlayer;
import com.gamingmesh.jobs.container.Title;
import com.gamingmesh.jobs.i18n.Language;
import com.gamingmesh.jobs.stuff.Util;
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) {
if (job == null) {
// job doesn't exist
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
Language.sendMessage(sender, "general.error.job");
return;
}
@ -316,7 +317,7 @@ public class JobsCommands implements CommandExecutor {
PageInfo pi = new PageInfo(15, message.size(), page);
if (page > pi.getTotalPages()) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.invalidPage"));
Language.sendMessage(sender, "general.info.invalidPage");
return;
}

View File

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

View File

@ -21,12 +21,7 @@ public class blockinfo implements Cmd {
public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame);
return false;
}
if (args.length != 0) {
Jobs.getCommandManager().sendUsage(sender, "blockinfo");
return true;
return null;
}
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.JobsPlayer;
import com.gamingmesh.jobs.hooks.HookManager;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Locale.LC;
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) {
if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame);
return false;
return null;
}
if (args.length != 1) {
@ -35,7 +36,7 @@ public class bonus implements Cmd {
Player player = (Player) sender;
Job job = Jobs.getJob(args[0]);
if (job == null) {
player.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
Language.sendMessage(sender, "general.error.job");
return true;
}
@ -45,7 +46,7 @@ public class bonus implements Cmd {
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.Item);
@ -61,7 +62,7 @@ public class bonus implements Cmd {
HookManager.getMcMMOManager().mcMMOOverHaul && boost.get(BoostOf.McMMO, CurrencyType.EXP) != 0D)
printBoost(sender, boost, BoostOf.McMMO);
player.sendMessage(Jobs.getLanguage().getMessage("general.info.separator"));
Language.sendMessage(sender, "general.info.separator");
RawMessage rm = new RawMessage();
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.build();
rm.show(player);
@ -97,7 +96,7 @@ public class bonus implements Cmd {
if ((type == BoostOf.NearSpawner || type == BoostOf.PetPay) && msg.startsWith(" "))
msg = msg.substring(1, msg.length());
sender.sendMessage(prefix + msg);
CMIMessages.sendMessage(sender, prefix + msg);
}
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.container.CurrencyType;
import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Logs.CMIDebug;
@ -95,22 +96,22 @@ public class boost implements Cmd {
one.addBoost(curr, 1.0);
}
}
sender.sendMessage(Jobs.getLanguage().getMessage("command.boost.output.allreset"));
Language.sendMessage(sender, "command.boost.output.allreset");
} else {
for (Job one : Jobs.getJobs()) {
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) {
if (type == null) {
for (CurrencyType curr : CurrencyType.values()) {
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 {
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 {
return false;
@ -128,7 +129,7 @@ public class boost implements Cmd {
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 {
if (type == null) {
@ -138,14 +139,13 @@ public class boost implements Cmd {
} else {
job.addBoost(type, rate, timeDuration);
}
CMIDebug.d(timeDuration);
sender.sendMessage(Jobs.getLanguage().getMessage("command.boost.output.boostadded", "%boost%", rate, "%jobname%", job.getName()));
Language.sendMessage(sender, "command.boost.output.boostadded", "%boost%", rate, "%jobname%", job.getName());
}
return true;
}
private void showBoosts(CommandSender sender, Job job) {
private static void showBoosts(CommandSender sender, Job job) {
RawMessage rm = new RawMessage();
String msg = Jobs.getLanguage().getMessage("command.boost.output.boostStats", "%jobname%", job.getDisplayName());
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.container.BlockProtection;
import com.gamingmesh.jobs.container.DBAction;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Items.CMIMaterial;
import net.Zrips.CMILib.Locale.LC;
@ -73,9 +74,9 @@ public class bp implements Cmd {
}
if (changedBlocks.isEmpty())
sender.sendMessage(Jobs.getLanguage().getMessage("command.bp.output.notFound"));
Language.sendMessage(sender, "command.bp.output.notFound");
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() {
@Override

View File

@ -9,9 +9,11 @@ import org.bukkit.entity.Player;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Colors.CMIChatColor;
import net.Zrips.CMILib.Container.PageInfo;
import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.RawMessages.RawMessage;
public class browse implements Cmd {
@ -22,7 +24,7 @@ public class browse implements Cmd {
if (Jobs.getGCManager().BrowseUseNewLook) {
if (Jobs.getJobs().isEmpty()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.error.nojobs"));
Language.sendMessage(sender, "command.browse.error.nojobs");
return true;
}
@ -60,7 +62,7 @@ public class browse implements Cmd {
if (senderIsPlayer) {
if (j == null) {
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) {
if (!pi.isEntryOk())
continue;
@ -116,25 +118,25 @@ public class browse implements Cmd {
pi.autoPagination(sender, "jobs browse", "-p:");
} 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);
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)
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) {
int bonus = (int) (j.getBonus() * 100);
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
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()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.description", "[description]", one));
Language.sendMessage(sender, "command.browse.output.description", "[description]", one);
}
RawMessage rm = new RawMessage();
@ -148,7 +150,7 @@ public class browse implements Cmd {
}
} else {
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) {
String msg = "";
@ -177,14 +179,14 @@ public class browse implements Cmd {
msg += Jobs.getLanguage().getMessage("command.browse.output.console.list", "[jobname]", one.getName());
sender.sendMessage(msg);
CMIMessages.sendMessage(sender, msg);
}
} 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);
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)
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) {
int bonus = (int) (j.getBonus() * 100);
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
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()) {
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()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.error.nojobs"));
Language.sendMessage(sender, "command.browse.error.nojobs");
return true;
}
@ -260,9 +262,9 @@ public class browse implements Cmd {
}
if (Jobs.getGCManager().JobsGUIShowChatBrowse) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.header"));
Language.sendMessage(sender, "command.browse.output.header");
lines.forEach(sender::sendMessage);
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.footer"));
Language.sendMessage(sender, "command.browse.output.footer");
}
}
return true;

View File

@ -11,6 +11,7 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.container.blockOwnerShip.BlockTypes;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
@ -47,8 +48,8 @@ public class clearownership implements Cmd {
if (args.length >= 1)
CMIMessages.sendMessage(sender, LC.info_NoInformation);
else
Jobs.getCommandManager().sendUsage(sender, "clearownership");
return true;
return false;
return null;
}
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(
BlockTypes.BREWING_STAND, 0), "[smoker]", amounts.getOrDefault(BlockTypes.SMOKER, 0), "[blast]", amounts.getOrDefault(BlockTypes.BLAST_FURNACE, 0)));
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));
return true;
}
}

View File

@ -21,8 +21,7 @@ public class convert implements Cmd {
}
if (args.length > 0) {
Jobs.getCommandManager().sendUsage(sender, "convert");
return true;
return false;
}
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.container.Job;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Colors.CMIChatColor;
@ -15,19 +16,18 @@ public class demote implements Cmd {
@Override
public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
if (args.length < 3) {
Jobs.getCommandManager().sendUsage(sender, "demote");
return true;
return false;
}
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
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;
}
Job job = Jobs.getJob(args[1]);
if (job == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
Language.sendMessage(sender, "general.error.job");
return true;
}
@ -45,16 +45,15 @@ public class demote implements Cmd {
Player player = jPlayer.getPlayer();
if (player != null) {
String message = Jobs.getLanguage().getMessage("command.demote.output.target",
Language.sendMessage(sender, "command.demote.output.target",
"%jobname%", job.getDisplayName() + CMIChatColor.WHITE,
"%levelslost%", levelsLost);
player.sendMessage(message);
}
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
Language.sendMessage(sender, "general.admin.success");
}
} catch (Throwable e) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
Language.sendMessage(sender, "general.admin.error");
}
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.JobItems;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Colors.CMIChatColor;
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) {
if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame);
return false;
return null;
}
if (args.length < 1)
@ -94,7 +95,7 @@ public class edititembonus implements Cmd {
break;
}
sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.topline"));
Language.sendMessage(sender, "command.bonus.output.topline");
Object key = new CMINBT(iih).getString("JobsItemBoost");
if (key == null)
@ -106,17 +107,16 @@ public class edititembonus implements Cmd {
BoostMultiplier boost = item.getBoost();
String mc = CMIChatColor.DARK_GREEN.toString(),
pc = CMIChatColor.GOLD.toString(),
ec = CMIChatColor.YELLOW.toString();
String mc = CMIChatColor.DARK_GREEN.toString();
String pc = CMIChatColor.GOLD.toString();
String ec = CMIChatColor.YELLOW.toString();
for (Job one : item.getJobs()) {
String msg = Jobs.getLanguage().getMessage("command.itembonus.output.list",
Language.sendMessage(sender, "command.itembonus.output.list",
"[jobname]", one.getName(),
"%money%", mc + formatText((int) (boost.get(CurrencyType.MONEY) * 100)),
"%points%", pc + formatText((int) (boost.get(CurrencyType.POINTS) * 100)),
"%exp%", ec + formatText((int) (boost.get(CurrencyType.EXP) * 100)));
sender.sendMessage(msg);
}
return true;
}

View File

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

View File

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

View File

@ -28,7 +28,6 @@ import net.Zrips.CMILib.Container.CMIText;
import net.Zrips.CMILib.Container.PageInfo;
import net.Zrips.CMILib.FileHandler.ConfigReader;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Logs.CMIDebug;
import net.Zrips.CMILib.RawMessages.RawMessage;
import net.Zrips.CMILib.RawMessages.RawMessageCommand;
@ -56,6 +55,7 @@ public class editquests implements Cmd {
Action action = null;
// Only informing here and not canceling command
if (!Jobs.getGCManager().DailyQuestsEnabled) {
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.container.Job;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.i18n.Language;
public class employ implements Cmd {
@Override
public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
if (args.length < 2) {
Jobs.getCommandManager().sendUsage(sender, "employ");
return true;
return false;
}
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
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;
}
Job job = Jobs.getJob(args[1]);
if (job == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
Language.sendMessage(sender, "general.error.job");
return true;
}
if (jPlayer.isInJob(job)) {
// 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;
}
if (job.getMaxSlots() != null && Jobs.getUsedSlots(job) >= job.getMaxSlots()) {
String message = Jobs.getLanguage().getMessage("command.employ.error.fullslots");
message = message.replace("%jobname%", job.getDisplayName());
sender.sendMessage(message);
Language.sendMessage(sender, "command.employ.error.fullslots", "%jobname%", job.getDisplayName());
return true;
}
@ -47,11 +45,11 @@ public class employ implements Cmd {
Jobs.getPlayerManager().joinJob(jPlayer, job);
Player player = jPlayer.getPlayer();
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) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
Language.sendMessage(sender, "general.admin.error");
}
return true;
}

View File

@ -6,20 +6,18 @@ import org.bukkit.entity.EntityType;
import com.gamingmesh.jobs.Jobs;
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 {
@Override
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length != 0) {
Jobs.getCommandManager().sendUsage(sender, "entitylist");
return true;
}
String msg = "",
c1 = "&e",
c2 = "&6";
StringBuilder msg = new StringBuilder();
String c1 = "&e";
String c2 = "&6";
int i = 0;
for (EntityType type : EntityType.values()) {
@ -29,19 +27,19 @@ public class entitylist implements Cmd {
i++;
if (!msg.isEmpty())
msg += ", ";
msg.append(LC.info_ListSpliter.getLocale());
if (i > 1) {
msg += c1;
msg.append(c1);
i = 0;
} 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;
}

View File

@ -24,8 +24,7 @@ public class exp implements Cmd {
public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
if (args.length < 4) {
Jobs.getCommandManager().sendUsage(sender, "exp");
return true;
return false;
}
boolean silent = false;
@ -120,20 +119,20 @@ public class exp implements Cmd {
Player player = jPlayer.getPlayer();
if (player == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.give.output.notonline"));
Language.sendMessage(sender, "general.give.output.notonline");
return true;
}
if (!silent)
player.sendMessage(Jobs.getLanguage().getMessage("command.exp.output.target", "%jobname%", job.getDisplayName(), "%level%", prog.getLevelFormatted(), "%exp%", prog
.getExperience()));
Language.sendMessage(player, "command.exp.output.target", "%jobname%", job.getDisplayName(), "%level%", prog.getLevelFormatted(), "%exp%", prog
.getExperience());
if (!silentAdmin)
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
Language.sendMessage(sender, "general.admin.success");
} catch (Exception e) {
if (!silentAdmin)
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
Language.sendMessage(sender, "general.admin.error");
e.printStackTrace();
}
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.ExploreRegion;
import com.gamingmesh.jobs.container.PlayerInfo;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Locale.LC;
public class explored implements Cmd {
@Override
public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
if (!(sender instanceof Player))
return false;
if (!(sender instanceof Player)) {
LC.info_Ingame.sendMessage(sender);
return null;
}
Player player = (Player) sender;
Map<String, ExploreRegion> exploreRegion = Jobs.getExploreManager().getWorlds().get(player.getWorld().getName());
if (exploreRegion == null) {
player.sendMessage(Jobs.getLanguage().getMessage("command.explored.error.noexplore"));
Language.sendMessage(sender, "command.explored.error.noexplore");
return true;
}
@ -30,19 +35,19 @@ public class explored implements Cmd {
int RegionZ = (int) Math.floor(player.getLocation().getChunk().getZ() / 32D);
ExploreRegion region = exploreRegion.get(RegionX + ":" + RegionZ);
if (region == null) {
player.sendMessage(Jobs.getLanguage().getMessage("command.explored.error.noexplore"));
Language.sendMessage(sender, "command.explored.error.noexplore");
return true;
}
ExploreChunk chunk = region.getChunk(player.getLocation().getChunk());
if (chunk == null) {
player.sendMessage(Jobs.getLanguage().getMessage("command.explored.error.noexplore"));
Language.sendMessage(sender, "command.explored.error.noexplore");
return true;
}
if (Jobs.getGCManager().ExploreCompact && chunk.isFullyExplored()) {
player.sendMessage(Jobs.getLanguage().getMessage("command.explored.fullExplore"));
Language.sendMessage(sender, "command.explored.fullExplore");
return true;
}
@ -51,9 +56,9 @@ public class explored implements Cmd {
for (int i = 0; i < players.size(); i++) {
PlayerInfo ji = Jobs.getPlayerManager().getPlayerInfo(players.get(i));
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;
}

View File

@ -7,39 +7,39 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.i18n.Language;
public class fire implements Cmd {
@Override
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length < 2) {
Jobs.getCommandManager().sendUsage(sender, "fire");
return true;
return false;
}
Job job = Jobs.getJob(args[1]);
if (job == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
Language.sendMessage(sender, "general.error.job");
return true;
}
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
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;
}
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;
}
if (Jobs.getPlayerManager().leaveJob(jPlayer, job)) {
Player player = jPlayer.getPlayer();
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;

View File

@ -8,6 +8,7 @@ import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.JobProgression;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.dao.JobsDAO.DBTables;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
@ -17,8 +18,7 @@ public class fireall implements Cmd {
@Override
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length < 1) {
Jobs.getCommandManager().sendUsage(sender, "fireall");
return true;
return false;
}
if (args[0].equalsIgnoreCase("all")) {
@ -38,27 +38,27 @@ public class fireall implements Cmd {
one.setSaved(true);
}
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
Language.sendMessage(sender, "general.admin.success");
return true;
}
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
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;
}
if (jPlayer.progression.isEmpty()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.fireall.error.nojobs"));
Language.sendMessage(sender, "command.fireall.error.nojobs");
return true;
}
Jobs.getPlayerManager().leaveAllJobs(jPlayer);
Player player = jPlayer.getPlayer();
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;
}
}

View File

@ -11,12 +11,14 @@ import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobItems;
import com.gamingmesh.jobs.container.JobLimitedItems;
import com.gamingmesh.jobs.i18n.Language;
import com.gamingmesh.jobs.stuff.GiveItem;
public class give implements Cmd {
private enum actions {
items, limiteditems;
public static actions getByname(String name) {
for (actions one : actions.values()) {
if (one.name().equalsIgnoreCase(name))
@ -58,8 +60,8 @@ public class give implements Cmd {
player = (Player) sender;
if (player == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.give.output.notonline"));
return true;
Language.sendMessage(sender, "command.give.output.notonline");
return null;
}
if (name == null)
@ -76,7 +78,7 @@ public class give implements Cmd {
ItemStack item = jItem == null ? null : jItem.getItemStack(player);
if (item == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.give.output.noitem"));
Language.sendMessage(sender, "command.give.output.noitem");
return true;
}
@ -92,7 +94,7 @@ public class give implements Cmd {
ItemStack limItem = jLItem == null ? null : jLItem.getItemStack(player);
if (limItem == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.give.output.noitem"));
Language.sendMessage(sender, "command.give.output.noitem");
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.LogAmounts;
import com.gamingmesh.jobs.container.PlayerInfo;
import com.gamingmesh.jobs.i18n.Language;
import com.gamingmesh.jobs.stuff.Sorting;
import net.Zrips.CMILib.Time.CMITimeManager;
@ -24,8 +25,7 @@ public class glog implements Cmd {
@Override
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length != 0) {
Jobs.getCommandManager().sendUsage(sender, "glog");
return true;
return false;
}
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@ -62,7 +62,7 @@ public class glog implements Cmd {
unsortMap = Sorting.sortDoubleDESCByLog(unsortMap);
if (unsortMap.isEmpty()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.glog.output.nodata"));
Language.sendMessage(sender, "command.glog.output.nodata");
return;
}
@ -72,7 +72,7 @@ public class glog implements Cmd {
totalExp = 0,
totalPoints = 0;
sender.sendMessage(Jobs.getLanguage().getMessage("command.glog.output.topline"));
Language.sendMessage(sender, "command.glog.output.topline");
for (LogAmounts info : unsortMap.keySet()) {
double money = info.get(CurrencyType.MONEY);
totalMoney += money;
@ -95,14 +95,14 @@ public class glog implements Cmd {
if (points != 0D)
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,
"%action%", info.getAction(),
"%item%", info.getItemName().replace(":0", "").replace('_', ' ').toLowerCase(),
"%qty%", info.getCount(),
"%money%", moneyS,
"%exp%", expS,
"%points%", pointsS));
"%points%", pointsS);
count++;
@ -111,10 +111,10 @@ public class glog implements Cmd {
}
NumberFormat format = NumberFormat.getInstance(Locale.ENGLISH);
sender.sendMessage(Jobs.getLanguage().getMessage("command.glog.output.totalIncomes", "%money%", format.format(totalMoney),
"%exp%", format.format(totalExp), "%points%", format.format(totalPoints)));
Language.sendMessage(sender, "command.glog.output.totalIncomes", "%money%", format.format(totalMoney),
"%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;

View File

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

View File

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

View File

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

View File

@ -30,7 +30,7 @@ public class itembonus implements Cmd {
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame);
return false;
return null;
}
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) {
if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame);
return false;
return null;
}
if (args.length != 0) {
Jobs.getCommandManager().sendUsage(sender, "iteminfo");
return true;
return false;
}
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.JobProgression;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
@ -19,17 +20,16 @@ public class join implements Cmd {
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame);
return false;
return null;
}
if (args.length != 1 && args.length != 0 && args.length != 2) {
Jobs.getCommandManager().sendUsage(sender, "join");
return true;
return false;
}
if (args.length == 0) {
plugin.getServer().dispatchCommand(sender, "jobs browse");
return true;
return null;
}
Job job = Jobs.getJob(args[0]);
@ -58,17 +58,17 @@ public class join implements Cmd {
if (jPlayer.isInJob(job)) {
// 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;
}
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;
}
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;
}
@ -81,12 +81,12 @@ public class join implements Cmd {
JobProgression ajp = jPlayer.getArchivedJobProgression(job);
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;
}
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;
}
}

View File

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

View File

@ -9,6 +9,7 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.JobProgression;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.i18n.Language;
import com.gamingmesh.jobs.stuff.Util;
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) {
if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame);
return false;
return null;
}
Player pSender = (Player) sender;
@ -28,7 +29,7 @@ public class leaveall implements Cmd {
List<JobProgression> jobs = jPlayer.getJobProgression();
if (jobs.isEmpty()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.leaveall.error.nojobs"));
Language.sendMessage(sender, "command.leaveall.error.nojobs");
return true;
}
@ -41,8 +42,8 @@ public class leaveall implements Cmd {
plugin.getServer().getScheduler().runTaskLater(plugin, () -> Util.LEAVECONFIRM.remove(uuid),
20 * Jobs.getGCManager().ConfirmExpiryTime);
pSender.sendMessage(Jobs.getLanguage().getMessage("command.leaveall.confirmationNeed", "[time]",
Jobs.getGCManager().ConfirmExpiryTime));
Language.sendMessage(pSender, "command.leaveall.confirmationNeed", "[time]",
Jobs.getGCManager().ConfirmExpiryTime);
return true;
}
@ -50,7 +51,7 @@ public class leaveall implements Cmd {
}
Jobs.getPlayerManager().leaveAllJobs(jPlayer);
sender.sendMessage(Jobs.getLanguage().getMessage("command.leaveall.success"));
Language.sendMessage(sender, "command.leaveall.success");
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.JobProgression;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.i18n.Language;
public class level implements Cmd {
@ -19,8 +20,7 @@ public class level implements Cmd {
@Override
public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
if (args.length < 4) {
Jobs.getCommandManager().sendUsage(sender, "level");
return true;
return false;
}
Action action = Action.Add;
@ -60,12 +60,12 @@ public class level implements Cmd {
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(playerName);
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;
}
if (job == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
Language.sendMessage(sender, "general.error.job");
return true;
}
@ -112,14 +112,14 @@ public class level implements Cmd {
Player player = jPlayer.getPlayer();
if (player != null)
player.sendMessage(Jobs.getLanguage().getMessage("command.level.output.target", "%jobname%", job.getDisplayName(), "%level%", prog.getLevel(),
"%exp%", String.format(Jobs.getGCManager().getDecimalPlacesExp(), prog.getExperience())));
Language.sendMessage(player, "command.level.output.target", "%jobname%", job.getDisplayName(), "%level%", prog.getLevel(),
"%exp%", String.format(Jobs.getGCManager().getDecimalPlacesExp(), prog.getExperience()));
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
Language.sendMessage(sender, "general.admin.success");
} else
sender.sendMessage(Jobs.getLanguage().getMessage("command.level.error.nojob"));
Language.sendMessage(sender, "command.level.error.nojob");
} catch (Exception e) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
Language.sendMessage(sender, "general.admin.error");
}
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.JobsPlayer;
import com.gamingmesh.jobs.economy.PaymentData;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Logs.CMIDebug;
@ -19,8 +20,7 @@ public class limit implements Cmd {
@Override
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length != 0 && args.length != 1) {
Jobs.getCommandManager().sendUsage(sender, "limit");
return true;
return false;
}
JobsPlayer JPlayer = null;
@ -38,7 +38,7 @@ public class limit implements Cmd {
}
if (disabled) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.limit.output.notenabled"));
Language.sendMessage(sender,"command.limit.output.notenabled");
return true;
}
@ -63,10 +63,10 @@ public class limit implements Cmd {
if (limit.getLeftTime(type) > 0) {
String typeName = type.getName().toLowerCase();
sender.sendMessage(Jobs.getLanguage().getMessage("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 + "time", "%time%", CMITimeManager.to24hourShort(limit.getLeftTime(type)));
Language.sendMessage(sender, "command.limit.output." + typeName + "Limit",
"%current%", (int) (limit.getAmount(type) * 100) / 100D,
"%total%", JPlayer.getLimit(type)));
"%total%", JPlayer.getLimit(type));
}
}
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.Log;
import com.gamingmesh.jobs.container.LogAmounts;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Container.CMISort;
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) {
if (!(sender instanceof Player) && args.length != 1) {
CMIMessages.sendMessage(sender, LC.info_Ingame);
return false;
return null;
}
if (args.length != 1 && args.length != 0) {
Jobs.getCommandManager().sendUsage(sender, "log");
return true;
return false;
}
JobsPlayer JPlayer = null;
@ -39,7 +39,7 @@ public class log implements Cmd {
JPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
else if (args.length == 1) {
if (!Jobs.hasPermission(sender, "jobs.command.log.others", true))
return true;
return null;
JPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
}
@ -51,9 +51,9 @@ public class log implements Cmd {
Map<String, Log> logList = JPlayer.getLog();
if (logList == null || logList.isEmpty()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.bottomline"));
sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.nodata"));
sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.bottomline"));
Language.sendMessage(sender, "command.log.output.bottomline");
Language.sendMessage(sender, "command.log.output.nodata");
Language.sendMessage(sender, "command.log.output.bottomline");
return true;
}
@ -67,14 +67,14 @@ public class log implements Cmd {
unsortMap = CMISort.sortDoubleDESC(unsortMap);
if (unsortMap.isEmpty()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.nodata"));
Language.sendMessage(sender, "command.log.output.nodata");
return true;
}
int count = 0;
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()) {
double totalMoney = 0, totalExp = 0, totalPoints = 0;
@ -106,14 +106,14 @@ public class log implements Cmd {
if (points != 0D)
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,
"%action%", one.getActionType(),
"%item%", amounts.getItemName().replace(":0", "").replace('_', ' ').toLowerCase(),
"%qty%", amounts.getCount(),
"%money%", moneyS,
"%exp%", expS,
"%points%", pointsS));
"%points%", pointsS);
break;
}
}
@ -123,14 +123,14 @@ public class log implements Cmd {
}
NumberFormat format = NumberFormat.getInstance(Locale.ENGLISH);
sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.totalIncomes", "%money%", format.format(totalMoney),
"%exp%", format.format(totalExp), "%points%", format.format(totalPoints)));
Language.sendMessage(sender, "command.log.output.totalIncomes", "%money%", format.format(totalMoney),
"%exp%", format.format(totalExp), "%points%", format.format(totalPoints));
if (count > max)
break;
}
sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.bottomline"));
Language.sendMessage(sender, "command.log.output.bottomline");
return true;
}
}

View File

@ -30,7 +30,7 @@ public class ownedblocks implements Cmd {
JobsPlayer jPlayer = null;
if (args.length >= 1) {
if (!Jobs.hasPermission(sender, "jobs.command.admin.ownedblocks", true))
return true;
return null;
jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
} else if (sender instanceof Player)
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
@ -39,8 +39,8 @@ public class ownedblocks implements Cmd {
if (args.length >= 1)
CMIMessages.sendMessage(sender, LC.info_NoInformation);
else
Jobs.getCommandManager().sendUsage(sender, "ownedblocks");
return true;
return false;
return null;
}
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.JobsPlaceholderType;
import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Container.PageInfo;
import net.Zrips.CMILib.Messages.CMIMessages;
@ -42,10 +43,10 @@ public class placeholders implements Cmd {
String placeholder = args[1];
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,
"[source]", type == null ? "Unknown" : type.name(),
"[result]", plugin.getPlaceholderAPIManager().updatePlaceHolders(player, placeholder)));
"[result]", plugin.getPlaceholderAPIManager().updatePlaceHolders(player, placeholder));
return true;
}
@ -72,17 +73,6 @@ public class placeholders implements Cmd {
if (plugin.isPlaceholderAPIEnabled()) {
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)
.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.container.Job;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.i18n.Language;
public class playerinfo implements Cmd {
@Override
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length < 2) {
Jobs.getCommandManager().sendUsage(sender, "playerinfo");
Jobs.getCommandManager().sendValidActions(sender);
return true;
return false;
}
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
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;
}
Job job = Jobs.getJob(args[1]);
if (job == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
Language.sendMessage(sender, "general.error.job");
return true;
}

View File

@ -7,6 +7,7 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.container.PlayerPoints;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Locale.LC;
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) {
if (args.length != 0 && args.length != 1) {
Jobs.getCommandManager().sendUsage(sender, "points");
return true;
return false;
}
JobsPlayer jPlayer = null;
@ -41,10 +41,10 @@ public class points implements Cmd {
PlayerPoints pointInfo = jPlayer.getPointsData();
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.toplineseparator", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getDisplayName()));
sender.sendMessage(Jobs.getLanguage().getMessage("command.points.currentpoints", "%currentpoints%", (int) (pointInfo.getCurrentPoints() * 100) / 100D));
sender.sendMessage(Jobs.getLanguage().getMessage("command.points.totalpoints", "%totalpoints%", (int) (pointInfo.getTotalPoints() * 100) / 100D));
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator"));
Language.sendMessage(sender, "general.info.toplineseparator", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getDisplayName());
Language.sendMessage(sender, "command.points.currentpoints", "%currentpoints%", (int) (pointInfo.getCurrentPoints() * 100) / 100D);
Language.sendMessage(sender, "command.points.totalpoints", "%totalpoints%", (int) (pointInfo.getTotalPoints() * 100) / 100D);
Language.sendMessage(sender, "general.info.separator");
return true;
}
}

View File

@ -7,25 +7,25 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.i18n.Language;
public class promote implements Cmd {
@Override
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length < 3) {
Jobs.getCommandManager().sendUsage(sender, "promote");
return true;
return false;
}
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
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;
}
Job job = Jobs.getJob(args[1]);
if (job == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
Language.sendMessage(sender, "general.error.job");
return true;
}
@ -54,14 +54,14 @@ public class promote implements Cmd {
Player player = jPlayer.getPlayer();
if (player != null)
player.sendMessage(Jobs.getLanguage().getMessage("command.promote.output.target",
Language.sendMessage(player, "command.promote.output.target",
"%jobname%", job.getDisplayName(),
"%levelsgained%", levelsGained));
"%levelsgained%", levelsGained);
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
Language.sendMessage(sender, "general.admin.success");
} catch (Throwable e) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
Language.sendMessage(sender, "general.admin.error");
}
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.QuestObjective;
import com.gamingmesh.jobs.container.QuestProgression;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
@ -27,7 +28,7 @@ public class quests implements Cmd {
if (!Jobs.getGCManager().DailyQuestsEnabled) {
LC.info_FeatureNotEnabled.sendMessage(sender);
return true;
return 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 (!Jobs.hasPermission(sender, "jobs.command.admin.quests", true))
return true;
return null;
jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
} else if (isPlayer)
@ -52,7 +53,7 @@ public class quests implements Cmd {
List<QuestProgression> questProgs = jPlayer.getQuestProgressions();
if (questProgs.isEmpty()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.quests.error.noquests"));
Language.sendMessage(sender, "command.quests.error.noquests");
return true;
}
@ -71,13 +72,13 @@ public class quests implements Cmd {
q.getQuest().setStopped(stopped);
}
sender.sendMessage(Jobs.getLanguage().getMessage("command.quests.status.changed", "%status%",
stopped ? Jobs.getLanguage().getMessage("command.quests.status.stopped") : Jobs.getLanguage().getMessage("command.quests.status.started")));
Language.sendMessage(sender, "command.quests.status.changed", "%status%",
stopped ? Jobs.getLanguage().getMessage("command.quests.status.stopped") : Jobs.getLanguage().getMessage("command.quests.status.started"));
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) {
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.commands.Cmd;
import com.gamingmesh.jobs.i18n.Language;
public class reload implements Cmd {
@Override
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
Jobs.reload();
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
Language.sendMessage(sender, "general.admin.success");
return true;
}
}

View File

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

View File

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

View File

@ -4,14 +4,14 @@ import org.bukkit.command.CommandSender;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.i18n.Language;
public class resetlimit implements Cmd {
@Override
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length != 1) {
Jobs.getCommandManager().sendUsage(sender, "resetlimit");
return true;
return false;
}
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;
}
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
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;
}
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;
}
}

View File

@ -10,6 +10,7 @@ import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.container.QuestProgression;
import com.gamingmesh.jobs.i18n.Language;
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) {
Jobs.getCommandManager().sendUsage(sender, "resetquest");
return true;
return false;
}
JobsPlayer jPlayer = null;
@ -44,7 +44,7 @@ public class resetquest implements Cmd {
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
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;
}
@ -54,12 +54,12 @@ public class resetquest implements Cmd {
quests = jPlayer.getQuestProgressions(job);
if (quests.isEmpty()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquest.output.noQuests"));
Language.sendMessage(sender, "command.resetquest.output.noQuests");
return true;
}
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;
}
}

View File

@ -10,6 +10,7 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Locale.LC;
@ -23,8 +24,7 @@ public class resetquesttotal implements Cmd {
}
if (args.length != 0 && args.length != 1) {
Jobs.getCommandManager().sendUsage(sender, "resetquesttotal");
return true;
return false;
}
if (args.length > 0 && args[0].equalsIgnoreCase("all")) {
@ -32,7 +32,7 @@ public class resetquesttotal implements Cmd {
pl.getValue().setDoneQuests(0);
}
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;
}
@ -52,14 +52,14 @@ public class resetquesttotal implements Cmd {
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
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;
}
jPlayer.setDoneQuests(0);
jPlayer.setSaved(false);
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;
}
}

View File

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

View File

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

View File

@ -6,17 +6,21 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.Signs.SignTopType;
import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Locale.LC;
public class signupdate implements Cmd {
@Override
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!Jobs.getGCManager().SignsEnabled)
return true;
if (!Jobs.getGCManager().SignsEnabled) {
LC.info_FeatureNotEnabled.sendMessage(sender);
return null;
}
if (args.length != 1) {
Jobs.getCommandManager().sendUsage(sender, "signupdate");
return true;
return false;
}
if (args[0].equalsIgnoreCase("all")) {
@ -26,8 +30,8 @@ public class signupdate implements Cmd {
Job oldjob = Jobs.getJob(args[0]);
if (oldjob == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
Language.sendMessage(sender, "general.error.job");
return null;
}
if (args.length == 2) {
@ -35,7 +39,6 @@ public class signupdate implements Cmd {
if (type != null) {
Jobs.getSignUtil().signUpdate(oldjob, type);
}
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.QuestProgression;
import com.gamingmesh.jobs.economy.BufferedEconomy;
import com.gamingmesh.jobs.i18n.Language;
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) {
if (!Jobs.getGCManager().DailyQuestsEnabled) {
LC.info_FeatureNotEnabled.sendMessage(sender);
return true;
return null;
}
if (args.length != 2 && args.length != 3) {
Jobs.getCommandManager().sendUsage(sender, "skipquest");
return true;
return false;
}
JobsPlayer jPlayer = null;
@ -53,8 +54,8 @@ public class skipquest implements Cmd {
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
if (jPlayer == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args.length > 0 ? args[0] : ""));
return true;
Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args.length > 0 ? args[0] : "");
return null;
}
List<QuestProgression> quests = jPlayer.getQuestProgressions();
@ -63,8 +64,8 @@ public class skipquest implements Cmd {
quests = jPlayer.getQuestProgressions(job);
if (quests == null || quests.isEmpty()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquest.output.noQuests"));
return true;
Language.sendMessage(sender, "command.resetquest.output.noQuests");
return null;
}
Quest old = null;
@ -99,8 +100,8 @@ public class skipquest implements Cmd {
if (amount > 0 && player != null) {
if (!econ.getEconomy().hasMoney(player, amount)) {
sender.sendMessage(Jobs.getLanguage().getMessage("economy.error.nomoney"));
return false;
Language.sendMessage(sender, "economy.error.nomoney");
return null;
}
econ.getEconomy().withdrawPlayer(player, amount);
@ -112,7 +113,7 @@ public class skipquest implements Cmd {
plugin.getServer().dispatchCommand(player, "jobs quests");
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;

View File

@ -24,8 +24,8 @@ public class stats implements Cmd {
if (!Jobs.hasPermission(sender, "jobs.command.admin.stats", true))
return true;
jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
} else if (sender instanceof Player p)
jPlayer = Jobs.getPlayerManager().getJobsPlayer(p);
} else if (sender instanceof Player)
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
if (jPlayer == null) {
if (args.length >= 1)

View File

@ -7,6 +7,7 @@ import org.bukkit.entity.Player;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.i18n.Language;
import com.gamingmesh.jobs.stuff.ToggleBarHandling;
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) {
if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame);
return false;
return null;
}
boolean isBossbar = false, isActionbar = false;
if (args.length != 1 || (!(isBossbar = args[0].equalsIgnoreCase("bossbar")) && !(isActionbar = args[0].equalsIgnoreCase("actionbar")))) {
Jobs.getCommandManager().sendUsage(sender, "toggle");
return true;
return false;
}
Player player = (Player) sender;
@ -35,10 +35,10 @@ public class toggle implements Cmd {
if (ex == null || ex.booleanValue()) {
ToggleBarHandling.getActionBarToggle().put(playerUUID, false);
sender.sendMessage(Jobs.getLanguage().getMessage("command.toggle.output.off"));
Language.sendMessage(sender, "command.toggle.output.off");
} else {
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()) {
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());
if (jPlayer != null)
jPlayer.hideBossBars();
} else {
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) {
if (args.length != 1 && args.length != 2) {
Jobs.getCommandManager().sendUsage(sender, "top");
return false;
}
Player player = sender instanceof Player p ? p : null;
Player player = sender instanceof Player ? (Player) sender : null;
if (args[0].equalsIgnoreCase("clear")) {
if (player != null) {
@ -43,7 +42,7 @@ public class top implements Cmd {
try {
page = Integer.parseInt(args[1]);
} catch (NumberFormatException e) {
return true;
return false;
}
}
if (page < 1)
@ -52,7 +51,7 @@ public class top implements Cmd {
Job job = Jobs.getJob(args[0]);
if (job == null) {
Language.sendMessage(sender, "command.top.error.nojob");
return false;
return null;
}
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.container.Job;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.i18n.Language;
public class transfer implements Cmd {
@Override
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length < 3) {
Jobs.getCommandManager().sendUsage(sender, "transfer");
return true;
return false;
}
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
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;
}
Job oldjob = Jobs.getJob(args[1]);
if (oldjob == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
Language.sendMessage(sender, "general.error.job");
return true;
}
Job newjob = Jobs.getJob(args[2]);
if (newjob == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
Language.sendMessage(sender, "general.error.job");
return true;
}
@ -41,15 +41,14 @@ public class transfer implements Cmd {
Player player = jPlayer.getPlayer();
if (player != null) {
player.sendMessage(Jobs.getLanguage().getMessage("command.transfer.output.target",
Language.sendMessage(player, "command.transfer.output.target",
"%oldjobname%", oldjob.getDisplayName(),
"%newjobname%", newjob.getDisplayName()));
"%newjobname%", newjob.getDisplayName());
}
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
Language.sendMessage(sender, "general.admin.success");
}
} catch (Exception e) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
Language.sendMessage(sender, "general.admin.error");
}
return true;