1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-18 22:21:26 +01:00

Merge branch 'Zrips:master' into bucket-entity-action

This commit is contained in:
FireML 2023-07-21 05:52:43 +01:00 committed by GitHub
commit 2fab19974c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
130 changed files with 4855 additions and 4778 deletions

Binary file not shown.

BIN
libs/CMILib1.4.0.0.jar Normal file

Binary file not shown.

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>Jobs</groupId> <groupId>Jobs</groupId>
<artifactId>jobs</artifactId> <artifactId>jobs</artifactId>
<version>5.1.2.2</version> <version>5.2.1.0</version>
<name>Jobs</name> <name>Jobs</name>
<url>http://maven.apache.org</url> <url>http://maven.apache.org</url>
@ -197,7 +197,7 @@
<artifactId>CMILib</artifactId> <artifactId>CMILib</artifactId>
<version>latest</version> <version>latest</version>
<scope>system</scope> <scope>system</scope>
<systemPath>${basedir}/libs/CMILib1.2.4.5.jar</systemPath> <systemPath>${basedir}/libs/CMILib1.4.0.0.jar</systemPath>
</dependency> </dependency>
<!-- WildStacker --> <!-- WildStacker -->
<dependency> <dependency>
@ -286,7 +286,7 @@
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version> <version>2.3.1</version>
<configuration> <configuration>
<outputDirectory>D:\MC\Server 1.19\plugins\</outputDirectory> <outputDirectory>D:\MC\Server 1.20\plugins\</outputDirectory>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>

View File

@ -27,6 +27,7 @@ import net.Zrips.CMILib.GUI.CMIGuiButton;
import net.Zrips.CMILib.GUI.GUIManager.GUIClickType; import net.Zrips.CMILib.GUI.GUIManager.GUIClickType;
import net.Zrips.CMILib.Items.CMIItemStack; import net.Zrips.CMILib.Items.CMIItemStack;
import net.Zrips.CMILib.Locale.LC; import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Logs.CMIDebug;
import net.Zrips.CMILib.Version.Version; import net.Zrips.CMILib.Version.Version;
public class GuiManager { public class GuiManager {
@ -285,6 +286,7 @@ public class GuiManager {
} }
double income = jInfo.getIncome(level, numjobs, jPlayer.maxJobsEquation); double income = jInfo.getIncome(level, numjobs, jPlayer.maxJobsEquation);
income = boost.getFinalAmount(CurrencyType.MONEY, income); income = boost.getFinalAmount(CurrencyType.MONEY, income);
String incomeColor = income >= 0 ? "" : ChatColor.DARK_RED.toString(); String incomeColor = income >= 0 ? "" : ChatColor.DARK_RED.toString();

View File

@ -18,13 +18,14 @@
package com.gamingmesh.jobs; package com.gamingmesh.jobs;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.plugin.RegisteredServiceProvider; import org.bukkit.plugin.RegisteredServiceProvider;
import com.gamingmesh.jobs.economy.BlackholeEconomy; import com.gamingmesh.jobs.economy.BlackholeEconomy;
import com.gamingmesh.jobs.economy.VaultEconomy; import com.gamingmesh.jobs.economy.VaultEconomy;
import net.Zrips.CMILib.Messages.CMIMessages;
import net.milkbowl.vault.economy.Economy;
public class HookEconomyTask implements Runnable { public class HookEconomyTask implements Runnable {
private Jobs plugin; private Jobs plugin;
@ -72,7 +73,7 @@ public class HookEconomyTask implements Runnable {
} }
Jobs.setEconomy(new VaultEconomy(provider.getProvider())); Jobs.setEconomy(new VaultEconomy(provider.getProvider()));
Jobs.consoleMsg("&e[" + plugin.getDescription().getName() + "] Successfully linked with Vault. (" + provider.getProvider().getName() + ")"); CMIMessages.consoleMessage("&e[" + plugin.getDescription().getName() + "] Successfully linked with Vault. (" + provider.getProvider().getName() + ")");
return hookResult.pass; return hookResult.pass;
} }

View File

@ -22,6 +22,7 @@ import com.gamingmesh.jobs.container.JobItems;
import net.Zrips.CMILib.Colors.CMIChatColor; import net.Zrips.CMILib.Colors.CMIChatColor;
import net.Zrips.CMILib.FileHandler.ConfigReader; import net.Zrips.CMILib.FileHandler.ConfigReader;
import net.Zrips.CMILib.Items.CMIMaterial; import net.Zrips.CMILib.Items.CMIMaterial;
import net.Zrips.CMILib.Messages.CMIMessages;
public final class ItemBoostManager { public final class ItemBoostManager {
@ -228,7 +229,7 @@ public final class ItemBoostManager {
} }
cfg.save(); cfg.save();
Jobs.consoleMsg("&eLoaded &6" + ITEMS.size() + " &eboosted items"); CMIMessages.consoleMessage("&eLoaded &6" + ITEMS.size() + " &eboosted items");
} }
/** /**

View File

@ -34,7 +34,6 @@ import java.util.logging.Logger;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -112,14 +111,12 @@ import com.gamingmesh.jobs.tasks.BufferedPaymentThread;
import com.gamingmesh.jobs.tasks.DatabaseSaveThread; import com.gamingmesh.jobs.tasks.DatabaseSaveThread;
import net.Zrips.CMILib.ActionBar.CMIActionBar; import net.Zrips.CMILib.ActionBar.CMIActionBar;
import net.Zrips.CMILib.Colors.CMIChatColor;
import net.Zrips.CMILib.Container.PageInfo;
import net.Zrips.CMILib.Items.CMIMaterial; import net.Zrips.CMILib.Items.CMIMaterial;
import net.Zrips.CMILib.Locale.LC; import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Logs.CMIDebug;
import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.RawMessages.RawMessage; import net.Zrips.CMILib.RawMessages.RawMessage;
import net.Zrips.CMILib.Version.Version; import net.Zrips.CMILib.Version.Version;
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
public final class Jobs extends JavaPlugin { public final class Jobs extends JavaPlugin {
@ -168,7 +165,7 @@ public final class Jobs extends JavaPlugin {
private static boolean hasLimitedItems = false; private static boolean hasLimitedItems = false;
private static final int MAX_ENTRIES = 5; private static final int MAX_ENTRIES = 20;
public static final LinkedHashMap<UUID, FastPayment> FASTPAYMENT = new LinkedHashMap<UUID, FastPayment>(MAX_ENTRIES + 1, .75F, false) { public static final LinkedHashMap<UUID, FastPayment> FASTPAYMENT = new LinkedHashMap<UUID, FastPayment>(MAX_ENTRIES + 1, .75F, false) {
protected boolean removeEldestEntry(Map.Entry<UUID, FastPayment> eldest) { protected boolean removeEldestEntry(Map.Entry<UUID, FastPayment> eldest) {
return size() > MAX_ENTRIES; return size() > MAX_ENTRIES;
@ -268,7 +265,7 @@ public final class Jobs extends JavaPlugin {
try { try {
if (Integer.parseInt(papi if (Integer.parseInt(papi
.getDescription().getVersion().replaceAll("[^\\d]", "")) >= 2100 && new PlaceholderAPIHook(this).register()) { .getDescription().getVersion().replaceAll("[^\\d]", "")) >= 2100 && new PlaceholderAPIHook(this).register()) {
consoleMsg("&6PlaceholderAPI &ehooked."); CMIMessages.consoleMessage("&6PlaceholderAPI &ehooked.");
} }
} catch (NumberFormatException ex) { } catch (NumberFormatException ex) {
return false; return false;
@ -567,7 +564,7 @@ public final class Jobs extends JavaPlugin {
getPlayerManager().addPlayerToCache(jPlayer); getPlayerManager().addPlayerToCache(jPlayer);
} }
if (!getPlayerManager().getPlayersCache().isEmpty()) if (!getPlayerManager().getPlayersCache().isEmpty())
consoleMsg("&ePreloaded &6" + getPlayerManager().getPlayersCache().size() + " &eplayers data in &6" + ((int) ((System.currentTimeMillis() - time) / 1000.0D * 100.0D) / 100.0D)); CMIMessages.consoleMessage("&ePreloaded &6" + getPlayerManager().getPlayersCache().size() + " &eplayers data in &6" + ((int) ((System.currentTimeMillis() - time) / 1000.0D * 100.0D) / 100.0D));
} }
public static void convertDatabase() { public static void convertDatabase() {
@ -597,7 +594,7 @@ public final class Jobs extends JavaPlugin {
// Jobs.getJobsDAO().saveBlockProtection(); // Jobs.getJobsDAO().saveBlockProtection();
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
Jobs.consoleMsg("&cCan't write data to data base, please send error log to dev's."); CMIMessages.consoleMessage("&cCan't write data to data base, please send error log to dev's.");
return; return;
} }
@ -767,14 +764,14 @@ public final class Jobs extends JavaPlugin {
} }
// register economy // register economy
getServer().getScheduler().runTask(this, new HookEconomyTask(this)); CMIScheduler.get().runTask(new HookEconomyTask(this));
dao.loadBlockProtection(); dao.loadBlockProtection();
getExploreManager().load(); getExploreManager().load();
getCommandManager().fillCommands(); getCommandManager().fillCommands();
getDBManager().getDB().triggerTableIdUpdate(); getDBManager().getDB().triggerTableIdUpdate();
consoleMsg("&ePlugin has been enabled successfully."); CMIMessages.consoleMessage("&ePlugin has been enabled successfully.");
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); e.printStackTrace();
System.out.println("There was some issues when starting plugin. Please contact dev about this. Plugin will be disabled."); System.out.println("There was some issues when starting plugin. Please contact dev about this. Plugin will be disabled.");
@ -916,6 +913,9 @@ public final class Jobs extends JavaPlugin {
} }
private static void checkDailyQuests(JobsPlayer jPlayer, Job job, ActionInfo info) { private static void checkDailyQuests(JobsPlayer jPlayer, Job job, ActionInfo info) {
if (!Jobs.getGCManager().DailyQuestsEnabled) {
return;
}
if (!job.getQuests().isEmpty()) { if (!job.getQuests().isEmpty()) {
for (QuestProgression one : jPlayer.getQuestProgressions(job, info.getType())) { for (QuestProgression one : jPlayer.getQuestProgressions(job, info.getType())) {
one.processQuest(jPlayer, info); one.processQuest(jPlayer, info);
@ -1258,7 +1258,7 @@ public final class Jobs extends JavaPlugin {
jPlayer.getUpdateBossBarFor().add(prog.getJob().getName()); jPlayer.getUpdateBossBarFor().add(prog.getJob().getName());
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); e.printStackTrace();
consoleMsg("&c[Jobs] Some issues with boss bar feature accured, try disabling it to avoid it."); CMIMessages.consoleMessage("&c[Jobs] Some issues with boss bar feature accured, try disabling it to avoid it.");
} }
Map<CurrencyType, Double> payments = new HashMap<>(); Map<CurrencyType, Double> payments = new HashMap<>();
@ -1416,15 +1416,27 @@ public final class Jobs extends JavaPlugin {
return 9 * level - 158; return 9 * level - 158;
} }
public static void perform(JobsPlayer jPlayer, ActionInfo info, BufferedPayment payment, Job job) { public static void perform(JobsPlayer jPlayer, ActionInfo info, BufferedPayment payment, Job job, Block block, Entity ent, LivingEntity victim) {
double expPayment = payment.get(CurrencyType.EXP); double expPayment = payment.get(CurrencyType.EXP);
JobsPrePaymentEvent jobsPrePaymentEvent = new JobsPrePaymentEvent(jPlayer.getPlayer(), noneJob, payment.get(CurrencyType.MONEY),
payment.get(CurrencyType.POINTS), block, ent, victim, info);
Bukkit.getServer().getPluginManager().callEvent(jobsPrePaymentEvent);
// If event is canceled, don't do anything
if (jobsPrePaymentEvent.isCancelled())
return;
payment.set(CurrencyType.MONEY, jobsPrePaymentEvent.getAmount());
payment.set(CurrencyType.POINTS, jobsPrePaymentEvent.getPoints());
JobsExpGainEvent jobsExpGainEvent = new JobsExpGainEvent(payment.getOfflinePlayer(), job, expPayment); JobsExpGainEvent jobsExpGainEvent = new JobsExpGainEvent(payment.getOfflinePlayer(), job, expPayment);
Bukkit.getServer().getPluginManager().callEvent(jobsExpGainEvent); Bukkit.getServer().getPluginManager().callEvent(jobsExpGainEvent);
// If event is canceled, don't do anything // If event is canceled, don't do anything
if (jobsExpGainEvent.isCancelled()) if (jobsExpGainEvent.isCancelled())
return; return;
payment.set(CurrencyType.EXP, jobsExpGainEvent.getExp());
boolean limited = true; boolean limited = true;
for (CurrencyType one : CurrencyType.values()) { for (CurrencyType one : CurrencyType.values()) {
if (jPlayer.isUnderLimit(one, payment.get(one))) { if (jPlayer.isUnderLimit(one, payment.get(one))) {
@ -1449,12 +1461,6 @@ public final class Jobs extends JavaPlugin {
getPlayerManager().performLevelUp(jPlayer, prog.getJob(), oldLevel); getPlayerManager().performLevelUp(jPlayer, prog.getJob(), oldLevel);
} }
public static void consoleMsg(String msg) {
if (msg != null) {
Bukkit.getServer().getConsoleSender().sendMessage(CMIChatColor.translate(msg));
}
}
public static SelectionManager getSelectionManager() { public static SelectionManager getSelectionManager() {
return smanager; return smanager;
} }
@ -1472,50 +1478,6 @@ public final class Jobs extends JavaPlugin {
} }
public void showPagination(CommandSender sender, PageInfo pi, String cmd) {
showPagination(sender, pi.getTotalPages(), pi.getCurrentPage(), pi.getTotalEntries(), cmd, null);
}
public void showPagination(CommandSender sender, PageInfo pi, String cmd, String pagePref) {
showPagination(sender, pi.getTotalPages(), pi.getCurrentPage(), pi.getTotalEntries(), cmd, pagePref);
}
public void showPagination(CommandSender sender, int pageCount, int currentPage, int totalEntries, String cmd, String pagePref) {
if (!(sender instanceof Player))
return;
if (!cmd.startsWith("/"))
cmd = "/" + cmd;
if (pageCount == 1)
return;
String pagePrefix = pagePref == null ? "" : pagePref;
int nextPage = currentPage + 1;
nextPage = currentPage < pageCount ? nextPage : currentPage;
int prevpage = currentPage - 1;
if (currentPage <= 1) {
prevpage = currentPage;
}
RawMessage rm = new RawMessage()
.addText((currentPage > 1 ? LC.info_prevPage.getLocale() : LC.info_prevPageOff.getLocale()))
.addHover(currentPage > 1 ? LC.info_prevPageHover.getLocale() : LC.info_lastPageHover.getLocale())
.addCommand(currentPage > 1 ? cmd + " " + pagePrefix + prevpage : cmd + " " + pagePrefix + pageCount);
rm.addText(LC.info_pageCount.getLocale("[current]", currentPage, "[total]", pageCount))
.addHover(LC.info_pageCountHover.getLocale("[totalEntries]", totalEntries));
rm.addText(pageCount > currentPage ? LC.info_nextPage.getLocale() : LC.info_nextPageOff.getLocale())
.addHover(pageCount > currentPage ? LC.info_nextPageHover.getLocale() : LC.info_firstPageHover.getLocale())
.addCommand(pageCount > currentPage ? cmd + " " + pagePrefix + nextPage : cmd + " " + pagePrefix + 1);
if (pageCount != 0)
rm.show(sender);
}
public static boolean hasLimitedItems() { public static boolean hasLimitedItems() {
return hasLimitedItems; return hasLimitedItems;
} }

View File

@ -53,7 +53,9 @@ public class PermissionManager {
jobs_maxblastfurnaces_AMOUNT(remade("jobs.maxblastfurnaces.%AMOUNT%"), 30), jobs_maxblastfurnaces_AMOUNT(remade("jobs.maxblastfurnaces.%AMOUNT%"), 30),
jobs_maxsmokers_AMOUNT(remade("jobs.maxsmokers.%AMOUNT%"), 30), jobs_maxsmokers_AMOUNT(remade("jobs.maxsmokers.%AMOUNT%"), 30),
jobs_maxbrewingstands_AMOUNT(remade("jobs.maxbrewingstands.%AMOUNT%"), 30), jobs_maxbrewingstands_AMOUNT(remade("jobs.maxbrewingstands.%AMOUNT%"), 30),
jobs_world_WORLDNAME(remade("jobs.world.%WORLDNAME%"), 2); jobs_world_WORLDNAME(remade("jobs.world.%WORLDNAME%"), 2),
jobs_maxquest_JOBNAME_AMOUNT(remade("jobs.maxquest.%JOBNAME%.%AMOUNT%"), 30),
jobs_maxquest_all_AMOUNT(remade("jobs.maxquest.all.%AMOUNT%"), 30);
private int reload; private int reload;
private List<String> perms; private List<String> perms;
@ -93,7 +95,7 @@ public class PermissionManager {
} }
private int getDelay(String perm) { private int getDelay(String perm) {
return permDelay.getOrDefault(perm, 1); return permDelay.getOrDefault(perm, 1000);
} }
public PermissionManager() { public PermissionManager() {
@ -165,7 +167,9 @@ public class PermissionManager {
double amount = Double.NEGATIVE_INFINITY; double amount = Double.NEGATIVE_INFINITY;
permissionInfo permInfo = jPlayer.getPermissionsCache(perm); permissionInfo permInfo = jPlayer.getPermissionsCache(perm);
if (force || getDelay(perm) + permInfo.getTime() < System.currentTimeMillis()) { if (force || getDelay(perm) + permInfo.getTime() < System.currentTimeMillis()) {
Map<String, Boolean> perms = getAll(player, perm); Map<String, Boolean> perms = getAll(player, perm);
for (Map.Entry<String, Boolean> permission : perms.entrySet()) { for (Map.Entry<String, Boolean> permission : perms.entrySet()) {
if (!permission.getKey().startsWith(perm) || !permission.getValue()) if (!permission.getKey().startsWith(perm) || !permission.getValue())

View File

@ -88,6 +88,7 @@ public class Placeholder {
user_archived_jobs_exp_$1("jname/number"), user_archived_jobs_exp_$1("jname/number"),
jtop_name_$1_$2("jname/number", "[1-15]"), jtop_name_$1_$2("jname/number", "[1-15]"),
jtop_displayname_$1_$2("jname/number", "[1-15]"),
jtop_level_$1_$2("jname/number", "[1-15]"), jtop_level_$1_$2("jname/number", "[1-15]"),
maxjobs, maxjobs,
@ -616,6 +617,26 @@ public class Placeholder {
List<TopList> list = Jobs.getJobsDAO().getTopListByJob(jo, 15); List<TopList> list = Jobs.getJobsDAO().getTopListByJob(jo, 15);
if (list.size() < place)
return "";
return list.get(place - 1).getPlayerInfo().getName();
case jtop_displayname_$1_$2:
if (values.size() < 2)
return "";
place = 0;
try {
place = Integer.parseInt(values.get(1));
} catch (NumberFormatException e) {
return "";
}
if (place < 1)
return "";
list = Jobs.getJobsDAO().getTopListByJob(jo, 15);
if (list.size() < place) if (list.size() < place)
return ""; return "";

View File

@ -31,8 +31,8 @@ import java.util.concurrent.ThreadLocalRandom;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Color; import org.bukkit.Color;
import org.bukkit.FireworkEffect; import org.bukkit.FireworkEffect;
import org.bukkit.Material;
import org.bukkit.FireworkEffect.Type; import org.bukkit.FireworkEffect.Type;
import org.bukkit.Material;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Firework; import org.bukkit.entity.Firework;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
@ -40,8 +40,6 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Tameable; import org.bukkit.entity.Tameable;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.FireworkMeta; import org.bukkit.inventory.meta.FireworkMeta;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import com.gamingmesh.jobs.api.JobsJoinEvent; import com.gamingmesh.jobs.api.JobsJoinEvent;
import com.gamingmesh.jobs.api.JobsLeaveEvent; import com.gamingmesh.jobs.api.JobsLeaveEvent;
@ -62,7 +60,6 @@ import com.gamingmesh.jobs.dao.JobsDAO;
import com.gamingmesh.jobs.dao.JobsDAOData; import com.gamingmesh.jobs.dao.JobsDAOData;
import com.gamingmesh.jobs.economy.PaymentData; import com.gamingmesh.jobs.economy.PaymentData;
import com.gamingmesh.jobs.hooks.HookManager; import com.gamingmesh.jobs.hooks.HookManager;
import com.gamingmesh.jobs.stuff.PerformCommands;
import com.gamingmesh.jobs.stuff.Util; import com.gamingmesh.jobs.stuff.Util;
import net.Zrips.CMILib.ActionBar.CMIActionBar; import net.Zrips.CMILib.ActionBar.CMIActionBar;
@ -72,6 +69,7 @@ import net.Zrips.CMILib.Logs.CMIDebug;
import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.NBT.CMINBT; import net.Zrips.CMILib.NBT.CMINBT;
import net.Zrips.CMILib.Version.Version; import net.Zrips.CMILib.Version.Version;
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
public class PlayerManager { public class PlayerManager {
@ -336,7 +334,7 @@ public class PlayerManager {
i++; i++;
if (y++ >= 1000) { if (y++ >= 1000) {
Jobs.consoleMsg("&e[Jobs] Saved " + i + "/" + total + " players data"); CMIMessages.consoleMessage("&e[Jobs] Saved " + i + "/" + total + " players data");
y = 0; y = 0;
} }
} }
@ -452,6 +450,14 @@ public class PlayerManager {
return jPlayer; return jPlayer;
} }
private static void performCommandsOnJoin(JobsPlayer jPlayer, Job job) {
String pName = jPlayer.getName();
for (String one : job.getCmdOnJoin()) {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), one.replace("[name]", pName).replace("[jobname]", job.getName()));
}
}
/** /**
* Causes player to join to the given job. * Causes player to join to the given job.
* *
@ -476,13 +482,23 @@ public class PlayerManager {
Jobs.getJobsDAO().joinJob(jPlayer, jPlayer.getJobProgression(job)); Jobs.getJobsDAO().joinJob(jPlayer, jPlayer.getJobProgression(job));
jPlayer.setLeftTime(job); jPlayer.setLeftTime(job);
PerformCommands.performCommandsOnJoin(jPlayer, job); performCommandsOnJoin(jPlayer, job);
Jobs.takeSlot(job); Jobs.takeSlot(job);
Jobs.getSignUtil().updateAllSign(job); Jobs.getSignUtil().updateAllSign(job);
job.updateTotalPlayers(); job.updateTotalPlayers();
jPlayer.maxJobsEquation = getMaxJobs(jPlayer); jPlayer.maxJobsEquation = getMaxJobs(jPlayer);
// Removing from cached item boost for recalculation
cache.remove(jPlayer.getUniqueId());
}
private static void performCommandsOnLeave(JobsPlayer jPlayer, Job job) {
String pName = jPlayer.getName();
for (String one : job.getCmdOnLeave()) {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), one.replace("[name]", pName).replace("[jobname]", job.getName()));
}
} }
/** /**
@ -510,13 +526,17 @@ public class PlayerManager {
if (!Jobs.getJobsDAO().quitJob(jPlayer, job)) if (!Jobs.getJobsDAO().quitJob(jPlayer, job))
return false; return false;
PerformCommands.performCommandsOnLeave(jPlayer, job); performCommandsOnLeave(jPlayer, job);
Jobs.leaveSlot(job); Jobs.leaveSlot(job);
jPlayer.getLeftTimes().remove(jPlayer.getUniqueId()); jPlayer.getLeftTimes().remove(jPlayer.getUniqueId());
Jobs.getSignUtil().updateAllSign(job); Jobs.getSignUtil().updateAllSign(job);
job.updateTotalPlayers(); job.updateTotalPlayers();
// Removing from cached item boost for recalculation
cache.remove(jPlayer.getUniqueId());
return true; return true;
} }
@ -712,7 +732,7 @@ public class PlayerManager {
} }
if (Jobs.getGCManager().FireworkLevelupUse && player != null) { if (Jobs.getGCManager().FireworkLevelupUse && player != null) {
plugin.getServer().getScheduler().runTaskLater(plugin, new Runnable() { CMIScheduler.get().runTaskLater(new Runnable() {
@Override @Override
public void run() { public void run() {
if (!player.isOnline()) if (!player.isOnline())
@ -1044,6 +1064,7 @@ public class PlayerManager {
continue; continue;
} }
} }
jitems.add(getJobsItemByNbt(item)); jitems.add(getJobsItemByNbt(item));
} }
} }
@ -1180,7 +1201,7 @@ public class PlayerManager {
if (!Jobs.getGCManager().AutoJobJoinUse || player == null || player.isOp()) if (!Jobs.getGCManager().AutoJobJoinUse || player == null || player.isOp())
return; return;
plugin.getServer().getScheduler().runTaskLater(plugin, new Runnable() { CMIScheduler.get().runTaskLater(new Runnable() {
@Override @Override
public void run() { public void run() {
if (!player.isOnline()) if (!player.isOnline())

View File

@ -21,8 +21,9 @@ import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.TopList; import com.gamingmesh.jobs.container.TopList;
import net.Zrips.CMILib.FileHandler.ConfigReader; import net.Zrips.CMILib.FileHandler.ConfigReader;
import net.Zrips.CMILib.Items.CMIMaterial; import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.Version.Version; import net.Zrips.CMILib.Version.Version;
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
public class SignUtil { public class SignUtil {
@ -130,7 +131,7 @@ public class SignUtil {
} }
if (!signsByLocation.isEmpty()) { if (!signsByLocation.isEmpty()) {
Jobs.consoleMsg("&e[Jobs] Loaded " + signsByLocation.size() + " top list signs"); CMIMessages.consoleMessage("&e[Jobs] Loaded " + signsByLocation.size() + " top list signs");
} }
} }
@ -342,13 +343,10 @@ public class SignUtil {
org.bukkit.material.Sign signMat = (org.bukkit.material.Sign) sign.getData(); org.bukkit.material.Sign signMat = (org.bukkit.material.Sign) sign.getData();
directionFacing = signMat.getFacing(); directionFacing = signMat.getFacing();
} else { } else {
if (CMIMaterial.isWallSign(sign.getType())) { if (sign.getBlockData() instanceof org.bukkit.block.data.type.WallSign)
org.bukkit.block.data.type.WallSign data = (org.bukkit.block.data.type.WallSign) sign.getBlockData(); directionFacing = ((org.bukkit.block.data.type.WallSign) sign.getBlockData()).getFacing();
directionFacing = data.getFacing(); else if (sign.getBlockData() instanceof org.bukkit.block.data.type.Sign)
} else { directionFacing = ((org.bukkit.block.data.type.Sign) sign.getBlockData()).getRotation();
org.bukkit.block.data.type.Sign data = (org.bukkit.block.data.type.Sign) sign.getBlockData();
directionFacing = data.getRotation();
}
} }
final Location loc = sign.getLocation().clone(); final Location loc = sign.getLocation().clone();
@ -357,7 +355,7 @@ public class SignUtil {
if (directionFacing != null && !(loc.getBlock().getState() instanceof Skull)) if (directionFacing != null && !(loc.getBlock().getState() instanceof Skull))
loc.add(directionFacing.getOppositeFace().getModX(), 0, directionFacing.getOppositeFace().getModZ()); loc.add(directionFacing.getOppositeFace().getModX(), 0, directionFacing.getOppositeFace().getModZ());
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { CMIScheduler.get().runTaskLater(new Runnable() {
@Override @Override
public void run() { public void run() {
if (!(loc.getBlock().getState() instanceof Skull)) if (!(loc.getBlock().getState() instanceof Skull))

View File

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

View File

@ -14,6 +14,8 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.list.info;
import com.gamingmesh.jobs.commands.list.playerinfo;
import com.gamingmesh.jobs.container.ActionType; import com.gamingmesh.jobs.container.ActionType;
import com.gamingmesh.jobs.container.Boost; import com.gamingmesh.jobs.container.Boost;
import com.gamingmesh.jobs.container.CurrencyType; import com.gamingmesh.jobs.container.CurrencyType;
@ -22,13 +24,13 @@ 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;
import net.Zrips.CMILib.Container.CMIArray; import net.Zrips.CMILib.Container.CMIArray;
import net.Zrips.CMILib.Container.PageInfo; import net.Zrips.CMILib.Container.PageInfo;
import net.Zrips.CMILib.Locale.LC; import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Logs.CMIDebug;
import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.RawMessages.RawMessage; import net.Zrips.CMILib.RawMessages.RawMessage;
@ -113,7 +115,12 @@ public class JobsCommands implements CommandExecutor {
return true; return true;
} }
return cmdClass.perform(plugin, sender, myArgs) || help(sender, 1); Boolean result = cmdClass.perform(plugin, sender, myArgs);
if (result != null && !result)
sendUsage(sender, cmd);
return result == null || !result ? false : true;
} }
private static String[] reduceArgs(String[] args) { private static String[] reduceArgs(String[] args) {
@ -162,18 +169,12 @@ public class JobsCommands implements CommandExecutor {
boolean pl = sender instanceof Player; boolean pl = sender instanceof Player;
// Old format
// sender.sendMessage(Jobs.getLanguage().getMessage("command.help.output.title"));
for (String one : commands) { for (String one : commands) {
if (!pi.isEntryOk()) if (!pi.isEntryOk())
continue; continue;
if (pi.isBreak()) if (pi.isBreak())
break; break;
// Old format
// sender.sendMessage(Jobs.getLanguage().getMessage("command.help.output.cmdInfoFormat", "[command]", getUsage(one), "[description]", Jobs.getLanguage().getMessage("command." + one
// + ".help.info")));
if (pl) { if (pl) {
rm.addText("\n" + getUsage(one)); rm.addText("\n" + getUsage(one));
rm.addHover(Jobs.getLanguage().getMessage("command." + one + ".help.info")); rm.addHover(Jobs.getLanguage().getMessage("command." + one + ".help.info"));
@ -182,12 +183,10 @@ public class JobsCommands implements CommandExecutor {
rm.addText("\n" + Jobs.getLanguage().getMessage("command.help.output.cmdInfoFormat", "[command]", getUsage(one), "[description]", Jobs.getLanguage().getMessage("command." + one rm.addText("\n" + Jobs.getLanguage().getMessage("command.help.output.cmdInfoFormat", "[command]", getUsage(one), "[description]", Jobs.getLanguage().getMessage("command." + one
+ ".help.info"))); + ".help.info")));
} }
} }
rm.show(sender); rm.show(sender);
plugin.showPagination(sender, pi, LABEL + " ?"); pi.autoPagination(sender, LABEL + " ?");
return true; return true;
} }
@ -269,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;
} }
@ -277,21 +276,24 @@ public class JobsCommands implements CommandExecutor {
List<String> message = new ArrayList<>(); List<String> message = new ArrayList<>();
if (job.getBoost().get(CurrencyType.EXP) != 0D) for (CurrencyType one : CurrencyType.values()) {
message.add(Jobs.getLanguage().getMessage("command.expboost.output.infostats", "%boost%", (job.getBoost().get(CurrencyType.EXP)) + 1)); double boost = job.getBoost().get(one);
if (boost != 0D) {
if (job.getBoost().get(CurrencyType.MONEY) != 0D) String boostAmount = String.valueOf(boost + 1);
message.add(Jobs.getLanguage().getMessage("command.moneyboost.output.infostats", "%boost%", (job.getBoost().get(CurrencyType.MONEY)) + 1)); if (boost % 1 == 0)
boostAmount = String.valueOf((int) boost + 1);
if (job.getBoost().get(CurrencyType.POINTS) != 0D) message.add(Jobs.getLanguage().getMessage("command.boost.output.infostats", "%boost%", boostAmount, "%type%", one.getDisplayName()));
message.add(Jobs.getLanguage().getMessage("command.pointboost.output.infostats", "%boost%", (job.getBoost().get(CurrencyType.POINTS)) + 1)); }
}
if (Jobs.getGCManager().useDynamicPayment) { if (Jobs.getGCManager().useDynamicPayment) {
int bonus = (int) ((job.getBonus() * 100) / 100.0); int bonus = (int) (job.getBonus() * 100);
if (bonus != 0) { if (bonus != 0) {
if (bonus < 0) if (bonus < 0)
message.add(Jobs.getLanguage().getMessage("command.info.help.penalty", "[penalty]", (int) (job.getBonus() * 100) / 100.0 * -1)); message.add(Jobs.getLanguage().getMessage("command.info.help.penalty", "[penalty]", bonus * -1));
else else
message.add(Jobs.getLanguage().getMessage("command.info.help.bonus", "[bonus]", bonus)); message.add(Jobs.getLanguage().getMessage("command.info.help.bonus", "[bonus]", bonus));
} }
@ -315,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;
} }
@ -333,9 +335,9 @@ public class JobsCommands implements CommandExecutor {
String pName = player.getName(); String pName = player.getName();
if (sender.getName().equalsIgnoreCase(pName)) if (sender.getName().equalsIgnoreCase(pName))
plugin.showPagination(sender, pi, "jobs info " + job.getName() + t); pi.autoPagination(sender, LABEL + " " + info.class.getSimpleName() + " " + job.getName() + t);
else else
plugin.showPagination(sender, pi, "jobs playerinfo " + pName + " " + job.getName() + t); pi.autoPagination(sender, LABEL + " " + playerinfo.class.getSimpleName() + " " + job.getName() + t);
} }
} }
@ -421,6 +423,10 @@ public class JobsCommands implements CommandExecutor {
* @return the message * @return the message
*/ */
public String jobStatsMessage(JobProgression jobProg) { public String jobStatsMessage(JobProgression jobProg) {
return jobStatsMessage(jobProg, true);
}
public String jobStatsMessage(JobProgression jobProg, boolean progressBar) {
boolean isMaxLevelReached = jobProg.getLevel() == jobProg.getJob().getMaxLevel(); boolean isMaxLevelReached = jobProg.getLevel() == jobProg.getJob().getMaxLevel();
String path = "command.stats.output." + (isMaxLevelReached ? "max-level" String path = "command.stats.output." + (isMaxLevelReached ? "max-level"
: "message"); : "message");
@ -432,7 +438,7 @@ public class JobsCommands implements CommandExecutor {
"%jobxp%", Math.round(jobProg.getExperience() * 100.0) / 100.0, "%jobxp%", Math.round(jobProg.getExperience() * 100.0) / 100.0,
"%jobmaxxp%", jobProg.getMaxExperience(), "%jobmaxxp%", jobProg.getMaxExperience(),
"%titlename%", title == null ? "Unknown" : title.getName()); "%titlename%", title == null ? "Unknown" : title.getName());
return " " + (isMaxLevelReached ? "" : jobProgressMessage(jobProg.getMaxExperience(), jobProg.getExperience())) + " " + message; return " " + (isMaxLevelReached ? "" : progressBar ? jobProgressMessage(jobProg.getMaxExperience(), jobProg.getExperience()) : "") + " " + message;
} }
public String jobProgressMessage(double max, double current) { public String jobProgressMessage(double max, double current) {

View File

@ -10,17 +10,18 @@ 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;
public class archive implements Cmd { public class archive implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
JobsPlayer jPlayer = null; JobsPlayer jPlayer = null;
if (args.length >= 1) { if (args.length >= 1) {
if (!Jobs.hasPermission(sender, "jobs.command.admin.archive", true)) { if (!Jobs.hasPermission(sender, "jobs.command.admin.archive", true)) {
return true; return null;
} }
jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]); jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
@ -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 true; return null;
} }
Set<JobProgression> allJobs = jPlayer.getArchivedJobs().getArchivedJobs(); Set<JobProgression> allJobs = jPlayer.getArchivedJobs().getArchivedJobs();
if (allJobs.isEmpty()) { if (allJobs.isEmpty()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.archive.error.nojob")); Language.sendMessage(sender, "command.archive.error.nojob");
return true; 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;
@ -20,7 +21,7 @@ import net.Zrips.CMILib.Messages.CMIMessages;
public class area implements Cmd { public class area implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return false;
@ -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

@ -18,15 +18,10 @@ public class blockinfo implements Cmd {
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public boolean perform(Jobs plugin, CommandSender sender, String[] args) { public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return 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;
@ -21,10 +22,10 @@ import net.Zrips.CMILib.RawMessages.RawMessage;
public class bonus implements Cmd { public class bonus implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return 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

@ -0,0 +1,174 @@
package com.gamingmesh.jobs.commands.list;
import org.bukkit.command.CommandSender;
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;
import net.Zrips.CMILib.RawMessages.RawMessage;
import net.Zrips.CMILib.Time.CMITimeManager;
import net.Zrips.CMILib.Time.timeModifier;
public class boost implements Cmd {
@Override
public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
Double rate = null;
Long timeDuration = null;
Job job = null;
boolean allJobs = false;
boolean reset = false;
CurrencyType type = null;
for (String one : args) {
if (type == null) {
type = CurrencyType.getByName(one);
if (type != null)
continue;
}
if (one.equalsIgnoreCase("all")) {
allJobs = true;
continue;
}
if (one.equalsIgnoreCase("reset")) {
reset = true;
continue;
}
if (job == null) {
job = Jobs.getJob(one);
if (job != null)
continue;
}
if (rate == null) {
try {
rate = Double.parseDouble(one);
continue;
} catch (NumberFormatException e) {
}
}
try {
Long t = timeModifier.getTimeRangeFromString(one);
if (timeDuration == null && t != null) {
timeDuration = t;
continue;
}
} catch (Exception e) {
}
}
if (job == null && rate == null && !reset) {
LC.info_Spliter.sendMessage(sender);
for (Job one : Jobs.getJobs()) {
showBoosts(sender, one);
}
return true;
}
if (job != null && rate == null) {
LC.info_Spliter.sendMessage(sender);
showBoosts(sender, job);
return true;
}
if (rate == null)
rate = 1D;
if (timeDuration == null)
timeDuration = 0L;
if (reset) {
if (job == null) {
if (type == null) {
for (Job one : Jobs.getJobs()) {
for (CurrencyType curr : CurrencyType.values()) {
one.addBoost(curr, 0);
}
}
Language.sendMessage(sender, "command.boost.output.allreset");
} else {
for (Job one : Jobs.getJobs()) {
one.addBoost(type, 0);
}
Language.sendMessage(sender, "command.boost.output.alltypereset", "%type%", type.getDisplayName());
}
} else {
if (type == null) {
for (CurrencyType curr : CurrencyType.values()) {
job.addBoost(curr, 0);
}
Language.sendMessage(sender, "command.moneyboost.output.jobsboostreset", "%jobname%", job.getName());
} else {
job.addBoost(type, 0);
Language.sendMessage(sender, "command.moneyboost.output.jobstypeboostreset", "%jobname%", job.getName(), "%type%", type.getDisplayName());
}
}
return true;
}
if (job == null || allJobs) {
for (Job one : Jobs.getJobs()) {
if (type == null) {
for (CurrencyType curr : CurrencyType.values()) {
one.addBoost(curr, rate, timeDuration);
}
} else {
one.addBoost(type, rate, timeDuration);
}
Language.sendMessage(sender, "command.boost.output.boostadded", "%boost%", rate, "%jobname%", one.getName());
}
} else {
if (type == null) {
for (CurrencyType curr : CurrencyType.values()) {
job.addBoost(curr, rate, timeDuration);
}
} else {
job.addBoost(type, rate, timeDuration);
}
Language.sendMessage(sender, "command.boost.output.boostadded", "%boost%", rate, "%jobname%", job.getName());
}
return true;
}
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%");
rm.addText(split[0]);
// String msg = Jobs.getLanguage().getMessage("command.boost.output.boostStats", "%jobname%", job.getDisplayName());
for (CurrencyType curr : CurrencyType.values()) {
double boost = job.getBoost().get(curr);
String boostAmount = String.valueOf(boost);
if (boost % 1 == 0)
boostAmount = String.valueOf((int) boost);
if (curr.isEnabled()) {
rm.addText(Jobs.getLanguage().getMessage("general.info.paymentTypeValued." + curr.toString(), "%amount%", boostAmount) + " ");
}
if (job.getBoost().getTime(curr) != null && job.getBoost().isValid(curr)) {
rm.addHover(CMITimeManager.to24hourShort(job.getBoost().getTime(curr) - System.currentTimeMillis()));
}
}
if (split.length > 1)
rm.addText(split[1]);
rm.show(sender);
}
}

View File

@ -13,17 +13,19 @@ 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;
import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.Version.Version; import net.Zrips.CMILib.Version.Version;
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
public class bp implements Cmd { public class bp implements Cmd {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame); CMIMessages.sendMessage(sender, LC.info_Ingame);
@ -73,23 +75,24 @@ 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() { if (!changedBlocks.isEmpty()) {
@Override Location bloc = changedBlocks.get(0).getLocation();
public void run() { CMIScheduler.get().runAtLocationLater(bloc, () -> {
if (Version.isCurrentEqualOrHigher(Version.v1_15_R1)) if (Version.isCurrentEqualOrHigher(Version.v1_15_R1)) {
for (Block one : changedBlocks) { for (Block one : changedBlocks) {
player.sendBlockChange(one.getLocation(), one.getBlockData()); player.sendBlockChange(one.getLocation(), one.getBlockData());
} }
else } else {
for (Block one : changedBlocks) { for (Block one : changedBlocks) {
player.sendBlockChange(one.getLocation(), one.getType(), one.getData()); player.sendBlockChange(one.getLocation(), one.getType(), one.getData());
} }
} }
}, 120L); }, 120L);
}
return true; return true;
} }

View File

@ -9,20 +9,22 @@ 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 {
@Override @Override
public boolean perform(Jobs plugin, CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, CommandSender sender, final String[] args) {
boolean senderIsPlayer = sender instanceof Player; boolean senderIsPlayer = sender instanceof Player;
if (Jobs.getGCManager().BrowseUseNewLook) { if (Jobs.getGCManager().BrowseUseNewLook) {
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;
@ -113,28 +115,28 @@ public class browse implements Cmd {
rm.show(sender); rm.show(sender);
} }
plugin.showPagination(sender, pi, "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;
@ -18,7 +19,7 @@ import net.Zrips.CMILib.Messages.CMIMessages;
public class clearownership implements Cmd { public class clearownership implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
JobsPlayer jPlayer = null; JobsPlayer jPlayer = null;
String location = null; String location = null;
@ -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

@ -1,6 +1,5 @@
package com.gamingmesh.jobs.commands.list; package com.gamingmesh.jobs.commands.list;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -10,27 +9,27 @@ import com.gamingmesh.jobs.dao.JobsManager.DataBaseType;
import net.Zrips.CMILib.Locale.LC; import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
public class convert implements Cmd { public class convert implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, CommandSender sender, String[] args) { public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
if (sender instanceof Player) { if (sender instanceof Player) {
CMIMessages.sendMessage(sender, LC.info_FromConsole); CMIMessages.sendMessage(sender, LC.info_FromConsole);
return true; return true;
} }
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";
String to = Jobs.getDBManager().getDbType() == DataBaseType.SqLite ? "MySQL" : "SQLite"; String to = Jobs.getDBManager().getDbType() == DataBaseType.SqLite ? "MySQL" : "SQLite";
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { CMIScheduler.get().runTaskAsynchronously(() -> {
Jobs.convertDatabase(); Jobs.convertDatabase();
Jobs.consoleMsg("&eDatabase was converted from &2" + from + " &eto &2" + to + "&e!"); CMIMessages.consoleMessage("&eDatabase was converted from &2" + from + " &eto &2" + to + "&e!");
}); });
return true; return true;

View File

@ -7,27 +7,27 @@ 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;
public class demote implements Cmd { public class demote implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, CommandSender sender, String[] args) { public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
if (args.length < 3) { if (args.length < 3) {
Jobs.getCommandManager().sendUsage(sender, "demote"); 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;
@ -35,10 +36,10 @@ public class edititembonus implements Cmd {
} }
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return 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;
@ -27,10 +28,12 @@ public class editjobs implements Cmd {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@Override @Override
public boolean perform(Jobs plugin, CommandSender sender, String[] args) { public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
if (!(sender instanceof Player)) if (!(sender instanceof Player)) {
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);
} }
@ -117,7 +123,7 @@ public class editjobs implements Cmd {
rm.show(sender); rm.show(sender);
Util.getJobsEditorMap().remove(player.getUniqueId()); Util.getJobsEditorMap().remove(player.getUniqueId());
plugin.showPagination(sender, pi, "jobs editjobs list " + job.getName() + " " + actionT.getName()); pi.autoPagination(sender, "jobs editjobs list " + job.getName() + " " + actionT.getName());
return true; return true;
} }

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;
@ -12,15 +13,14 @@ import net.Zrips.CMILib.Messages.CMIMessages;
public class editpoints implements Cmd { public class editpoints implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, CommandSender sender, String[] args) { public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
if (args.length != 3) { if (args.length != 3) {
Jobs.getCommandManager().sendUsage(sender, "editpoints"); 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;
@ -50,12 +49,17 @@ public class editquests implements Cmd {
static HashMap<String, List<String>> tempObjectives = new HashMap<String, List<String>>(); static HashMap<String, List<String>> tempObjectives = new HashMap<String, List<String>>();
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, String[] args) {
int page = 0; int page = 0;
Action action = null; Action action = null;
// Only informing here and not canceling command
if (!Jobs.getGCManager().DailyQuestsEnabled) {
LC.info_FeatureNotEnabled.sendMessage(sender);
}
for (String one : args) { for (String one : args) {
if (page == 0) { if (page == 0) {
try { try {

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.everyFirstToUpperCase(type.name()));
} }
sender.sendMessage(CMIChatColor.translate(msg)); CMIMessages.sendMessage(sender, msg.toString());
return true; return true;
} }

View File

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

@ -1,106 +0,0 @@
package com.gamingmesh.jobs.commands.list;
import org.bukkit.command.CommandSender;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.CurrencyType;
import com.gamingmesh.jobs.container.Job;
import net.Zrips.CMILib.Time.timeModifier;
public class expboost implements Cmd {
@Override
public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
if (args.length > 3 || args.length <= 1) {
Jobs.getCommandManager().sendUsage(sender, "expboost");
return true;
}
Double rate = null;
Long timeDuration = null;
String jobName = null;
boolean reset = false;
for (String one : args) {
if (one.equalsIgnoreCase("reset")) {
reset = true;
continue;
}
if (jobName == null) {
jobName = one;
continue;
}
if (rate == null) {
try {
rate = Double.parseDouble(one);
continue;
} catch (NumberFormatException e) {
}
}
try {
Long t = timeModifier.getTimeRangeFromString(one);
if (t != null)
timeDuration = t;
continue;
} catch (Exception e) {
}
}
if (!reset && rate == null || jobName == null) {
Jobs.getCommandManager().sendUsage(sender, "expboost");
return false;
}
if (rate == null)
rate = 1D;
if (timeDuration == null)
timeDuration = 0L;
if (!reset && jobName.equalsIgnoreCase("all")) {
for (Job job : Jobs.getJobs()) {
job.addBoost(CurrencyType.EXP, rate, timeDuration);
}
sender.sendMessage(Jobs.getLanguage().getMessage("command.expboost.output.boostalladded", "%boost%", rate));
return true;
}
if (reset) {
if (jobName.equalsIgnoreCase("all")) {
for (Job one : Jobs.getJobs()) {
one.addBoost(CurrencyType.EXP, 1.0);
}
sender.sendMessage(Jobs.getLanguage().getMessage("command.expboost.output.allreset"));
} else if (args.length > 1) {
Job job = Jobs.getJob(jobName);
if (job == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
}
job.addBoost(CurrencyType.EXP, 1.0);
sender.sendMessage(Jobs.getLanguage().getMessage("command.expboost.output.jobsboostreset", "%jobname%", job.getName()));
}
return true;
}
Job job = Jobs.getJob(jobName);
if (job == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
}
job.addBoost(CurrencyType.EXP, rate, timeDuration);
sender.sendMessage(Jobs.getLanguage().getMessage("command.expboost.output.boostadded", "%boost%", rate,
"%jobname%", job.getName()));
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;
@ -15,10 +16,9 @@ import net.Zrips.CMILib.Messages.CMIMessages;
public class fireall implements Cmd { public class fireall implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length < 1) { if (args.length < 1) {
Jobs.getCommandManager().sendUsage(sender, "fireall"); 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))
@ -27,7 +29,7 @@ public class give implements Cmd {
} }
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
Player player = null; Player player = null;
Job job = null; Job job = null;
actions name = null; actions name = null;
@ -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,23 +15,25 @@ 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 com.gamingmesh.jobs.stuff.TimeManage;
import net.Zrips.CMILib.Time.CMITimeManager;
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
public class glog implements Cmd { public class glog implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length != 0) { if (args.length != 0) {
Jobs.getCommandManager().sendUsage(sender, "glog"); return false;
return true;
} }
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { CMIScheduler.get().runTaskAsynchronously(new Runnable() {
@Override @Override
public void run() { public void run() {
Map<LogAmounts, Double> unsortMap = new HashMap<>(); Map<LogAmounts, Double> unsortMap = new HashMap<>();
int time = TimeManage.timeInInt(); int time = CMITimeManager.timeInInt();
for (Integer oneP : Jobs.getJobsDAO().getLognameList(time, time)) { for (Integer oneP : Jobs.getJobsDAO().getLognameList(time, time)) {
PlayerInfo info = Jobs.getPlayerManager().getPlayerInfo(oneP); PlayerInfo info = Jobs.getPlayerManager().getPlayerInfo(oneP);
@ -61,7 +63,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;
} }
@ -71,7 +73,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;
@ -94,14 +96,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++;
@ -110,10 +112,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;
@ -19,15 +20,14 @@ import net.Zrips.CMILib.Scoreboards.CMIScoreboard;
public class gtop implements Cmd { public class gtop implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return 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 {
@ -92,7 +92,7 @@ public class gtop implements Cmd {
CMIScoreboard.show(player, Jobs.getLanguage().getMessage("scoreboard.gtopline"), ls, Jobs.getGCManager().ToplistInScoreboardInterval); CMIScoreboard.show(player, Jobs.getLanguage().getMessage("scoreboard.gtopline"), ls, Jobs.getGCManager().ToplistInScoreboardInterval);
} }
plugin.showPagination(sender, pi, "jobs gtop"); pi.autoPagination(sender, "jobs gtop");
return true; return true;
} }
} }

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

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

View File

@ -19,15 +19,14 @@ public class iteminfo implements Cmd {
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return 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;
@ -16,20 +17,19 @@ import net.Zrips.CMILib.RawMessages.RawMessage;
public class join implements Cmd { public class join implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return 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,32 +7,35 @@ 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;
import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
public class leave implements Cmd { public class leave implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) if (!(sender instanceof Player)) {
return false; 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;
} }
@ -42,11 +45,11 @@ public class leave implements Cmd {
if (!Util.LEAVECONFIRM.contains(uuid)) { if (!Util.LEAVECONFIRM.contains(uuid)) {
Util.LEAVECONFIRM.add(uuid); Util.LEAVECONFIRM.add(uuid);
plugin.getServer().getScheduler().runTaskLater(plugin, () -> Util.LEAVECONFIRM.remove(uuid), CMIScheduler.get().runTaskLater(() -> 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 +59,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,18 +9,20 @@ 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;
import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
public class leaveall implements Cmd { public class leaveall implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return null;
} }
Player pSender = (Player) sender; Player pSender = (Player) sender;
@ -28,7 +30,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;
} }
@ -38,11 +40,11 @@ public class leaveall implements Cmd {
if (!Util.LEAVECONFIRM.contains(uuid)) { if (!Util.LEAVECONFIRM.contains(uuid)) {
Util.LEAVECONFIRM.add(uuid); Util.LEAVECONFIRM.add(uuid);
plugin.getServer().getScheduler().runTaskLater(plugin, () -> Util.LEAVECONFIRM.remove(uuid), CMIScheduler.get().runTaskLater(() -> 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 +52,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 {
@ -17,10 +18,9 @@ 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,18 +8,19 @@ 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.Messages.CMIMessages; import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.Time.CMITimeManager; import net.Zrips.CMILib.Time.CMITimeManager;
public class limit implements Cmd { public class limit implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length != 0 && args.length != 1) { if (args.length != 0 && args.length != 1) {
Jobs.getCommandManager().sendUsage(sender, "limit"); return false;
return true;
} }
JobsPlayer JPlayer = null; JobsPlayer JPlayer = null;
@ -37,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;
} }
@ -54,16 +55,17 @@ public class limit implements Cmd {
continue; continue;
PaymentData limit = JPlayer.getPaymentLimit(); PaymentData limit = JPlayer.getPaymentLimit();
if (limit.getLeftTime(type) <= 0) if (limit.getLeftTime(type) <= 0) {
limit.resetLimits(type); limit.resetLimits(type);
}
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,23 +15,23 @@ 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.stuff.Sorting; import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Container.CMISort;
import net.Zrips.CMILib.Locale.LC; import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.Messages.CMIMessages;
public class log implements Cmd { public class log implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player) && args.length != 1) { if (!(sender instanceof Player) && args.length != 1) {
CMIMessages.sendMessage(sender, LC.info_Ingame); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return 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;
} }
@ -65,16 +65,16 @@ public class log implements Cmd {
} }
} }
unsortMap = Sorting.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

@ -1,106 +0,0 @@
package com.gamingmesh.jobs.commands.list;
import org.bukkit.command.CommandSender;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.CurrencyType;
import com.gamingmesh.jobs.container.Job;
import net.Zrips.CMILib.Time.timeModifier;
public class moneyboost implements Cmd {
@Override
public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
if (args.length > 3 || args.length <= 1) {
Jobs.getCommandManager().sendUsage(sender, "moneyboost");
return true;
}
Double rate = null;
Long timeDuration = null;
String jobName = null;
boolean reset = false;
for (String one : args) {
if (one.equalsIgnoreCase("reset")) {
reset = true;
continue;
}
if (jobName == null) {
jobName = one;
continue;
}
if (rate == null) {
try {
rate = Double.parseDouble(one);
continue;
} catch (NumberFormatException e) {
}
}
try {
Long t = timeModifier.getTimeRangeFromString(one);
if (t != null)
timeDuration = t;
continue;
} catch (Exception e) {
}
}
if (!reset && rate == null || jobName == null) {
Jobs.getCommandManager().sendUsage(sender, "moneyboost");
return false;
}
if (rate == null)
rate = 1D;
if (timeDuration == null)
timeDuration = 0L;
if (!reset && jobName.equalsIgnoreCase("all")) {
for (Job job : Jobs.getJobs()) {
job.addBoost(CurrencyType.MONEY, rate, timeDuration);
}
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.boostalladded", "%boost%", rate));
return true;
}
if (reset) {
if (jobName.equalsIgnoreCase("all")) {
for (Job one : Jobs.getJobs()) {
one.addBoost(CurrencyType.MONEY, 1.0);
}
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.allreset"));
} else if (args.length > 1) {
Job job = Jobs.getJob(jobName);
if (job == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
}
job.addBoost(CurrencyType.MONEY, 1.0);
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.jobsboostreset", "%jobname%", job.getName()));
}
return true;
}
Job job = Jobs.getJob(jobName);
if (job == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
}
job.addBoost(CurrencyType.MONEY, rate, timeDuration);
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.boostadded", "%boost%", rate,
"%jobname%", job.getName()));
return true;
}
}

View File

@ -26,11 +26,11 @@ import net.Zrips.CMILib.RawMessages.RawMessage;
public class ownedblocks implements Cmd { public class ownedblocks implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
JobsPlayer jPlayer = null; JobsPlayer jPlayer = null;
if (args.length >= 1) { if (args.length >= 1) {
if (!Jobs.hasPermission(sender, "jobs.command.admin.ownedblocks", true)) if (!Jobs.hasPermission(sender, "jobs.command.admin.ownedblocks", true))
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,14 +8,16 @@ 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.RawMessages.RawMessage; import net.Zrips.CMILib.RawMessages.RawMessage;
public class placeholders implements Cmd { public class placeholders implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
boolean isPlayer = sender instanceof Player; boolean isPlayer = sender instanceof Player;
Player player = isPlayer ? (Player) sender : null; Player player = isPlayer ? (Player) sender : null;
@ -31,7 +33,7 @@ public class placeholders implements Cmd {
} else { } else {
player = Bukkit.getPlayer(args[0]); player = Bukkit.getPlayer(args[0]);
if (player == null) { if (player == null) {
Jobs.consoleMsg("&cPlayer cannot be null!"); CMIMessages.consoleMessage("&cPlayer cannot be null!");
return false; return false;
} }
} }
@ -41,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;
} }
@ -71,23 +73,12 @@ 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);
} }
if (player != null) if (player != null)
plugin.showPagination(sender, pi, "jobs placeholders", "-p:"); pi.autoPagination(sender, "jobs placeholders", "-p:");
return true; return true;
} }
} }

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

@ -1,106 +0,0 @@
package com.gamingmesh.jobs.commands.list;
import org.bukkit.command.CommandSender;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.CurrencyType;
import com.gamingmesh.jobs.container.Job;
import net.Zrips.CMILib.Time.timeModifier;
public class pointboost implements Cmd {
@Override
public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
if (args.length > 3 || args.length <= 1) {
Jobs.getCommandManager().sendUsage(sender, "pointboost");
return true;
}
Double rate = null;
Long timeDuration = null;
String jobName = null;
boolean reset = false;
for (String one : args) {
if (one.equalsIgnoreCase("reset")) {
reset = true;
continue;
}
if (jobName == null) {
jobName = one;
continue;
}
if (rate == null) {
try {
rate = Double.parseDouble(one);
continue;
} catch (NumberFormatException e) {
}
}
try {
Long t = timeModifier.getTimeRangeFromString(one);
if (t != null)
timeDuration = t;
continue;
} catch (Exception e) {
}
}
if (!reset && rate == null || jobName == null) {
Jobs.getCommandManager().sendUsage(sender, "moneyboost");
return false;
}
if (rate == null)
rate = 1D;
if (timeDuration == null)
timeDuration = 0L;
if (!reset && jobName.equalsIgnoreCase("all")) {
for (Job job : Jobs.getJobs()) {
job.addBoost(CurrencyType.POINTS, rate, timeDuration);
}
sender.sendMessage(Jobs.getLanguage().getMessage("command.pointboost.output.boostalladded", "%boost%", rate));
return true;
}
if (reset) {
if (jobName.equalsIgnoreCase("all")) {
for (Job one : Jobs.getJobs()) {
one.addBoost(CurrencyType.POINTS, 1.0);
}
sender.sendMessage(Jobs.getLanguage().getMessage("command.pointboost.output.allreset"));
} else if (args.length > 1) {
Job job = Jobs.getJob(jobName);
if (job == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
}
job.addBoost(CurrencyType.POINTS, 1.0);
sender.sendMessage(Jobs.getLanguage().getMessage("command.pointboost.output.jobsboostreset", "%jobname%", job.getName()));
}
return true;
}
Job job = Jobs.getJob(jobName);
if (job == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
}
job.addBoost(CurrencyType.POINTS, rate, timeDuration);
sender.sendMessage(Jobs.getLanguage().getMessage("command.pointboost.output.boostadded", "%boost%", rate,
"%jobname%", job.getName()));
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;
@ -14,11 +15,10 @@ import net.Zrips.CMILib.Messages.CMIMessages;
public class points implements Cmd { public class points implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length != 0 && args.length != 1) { if (args.length != 0 && args.length != 1) {
Jobs.getCommandManager().sendUsage(sender, "points"); 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,7 +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.stuff.TimeManage; 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,13 +24,19 @@ import net.Zrips.CMILib.Time.CMITimeManager;
public class quests implements Cmd { public class quests implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, String[] args) {
if (!Jobs.getGCManager().DailyQuestsEnabled) {
LC.info_FeatureNotEnabled.sendMessage(sender);
return null;
}
JobsPlayer jPlayer = null; JobsPlayer jPlayer = null;
boolean isPlayer = sender instanceof Player; boolean isPlayer = sender instanceof Player;
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)
@ -47,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;
} }
@ -66,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 {
@ -11,25 +12,24 @@ public class resetexploreregion implements Cmd {
private static String REGEX = "^[0-9a-zA-Z_-]+$"; private static String REGEX = "^[0-9a-zA-Z_-]+$";
@Override @Override
public boolean perform(Jobs plugin, CommandSender sender, String[] args) { public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
if (args.length != 2 || !WORLD.equals(args[0])) { if (args.length != 2 || !WORLD.equals(args[0])) {
Jobs.getCommandManager().sendUsage(sender, "resetexploreregion"); 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,16 +10,24 @@ 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;
public class resetquest implements Cmd { public class resetquest implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length != 0 && args.length != 1 && args.length != 2) {
Jobs.getCommandManager().sendUsage(sender, "resetquest"); if (!Jobs.getGCManager().DailyQuestsEnabled) {
LC.info_FeatureNotEnabled.sendMessage(sender);
return true; return true;
} }
if (args.length != 0 && args.length != 1 && args.length != 2) {
return false;
}
JobsPlayer jPlayer = null; JobsPlayer jPlayer = null;
Job job = null; Job job = null;
@ -36,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;
} }
@ -46,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,22 +10,29 @@ 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;
public class resetquesttotal implements Cmd { public class resetquesttotal implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length != 0 && args.length != 1) { if (!Jobs.getGCManager().DailyQuestsEnabled) {
Jobs.getCommandManager().sendUsage(sender, "resetquesttotal"); LC.info_FeatureNotEnabled.sendMessage(sender);
return true; return true;
} }
if (args.length != 0 && args.length != 1) {
return false;
}
if (args.length > 0 && args[0].equalsIgnoreCase("all")) { if (args.length > 0 && args[0].equalsIgnoreCase("all")) {
for (Entry<UUID, JobsPlayer> pl : Jobs.getPlayerManager().getPlayersCache().entrySet()) { for (Entry<UUID, JobsPlayer> pl : Jobs.getPlayerManager().getPlayersCache().entrySet()) {
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;
} }
@ -45,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,14 +9,15 @@ 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 {
@Override @Override
public boolean perform(final Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(final Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length < 2) { if (args.length < 2) {
Jobs.getCommandManager().sendUsage(sender, "schedule"); Jobs.getCommandManager().sendUsage(sender, "schedule");
return true; return 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

@ -2,25 +2,29 @@ package com.gamingmesh.jobs.commands.list;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; 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 net.Zrips.CMILib.Locale.LC; import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
public class shop implements Cmd { public class shop implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!Jobs.getGCManager().jobsshopenabled) {
LC.info_FeatureNotEnabled.sendMessage(sender);
return null;
}
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame); 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

@ -2,6 +2,7 @@ package com.gamingmesh.jobs.commands.list;
import java.util.List; import java.util.List;
import com.gamingmesh.jobs.stuff.Util;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -12,14 +13,22 @@ 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.Version.Schedulers.CMIScheduler;
public class skipquest implements Cmd { public class skipquest implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (args.length != 2 && args.length != 3) { if (!Jobs.getGCManager().DailyQuestsEnabled) {
Jobs.getCommandManager().sendUsage(sender, "skipquest"); LC.info_FeatureNotEnabled.sendMessage(sender);
return true; return null;
}
// Needs to allow longer so multiword quest names work
if (args.length < 2) {
return false;
} }
JobsPlayer jPlayer = null; JobsPlayer jPlayer = null;
@ -47,8 +56,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();
@ -57,8 +66,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;
@ -93,12 +102,29 @@ 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);
} }
// Add confirmation if configured
if (Jobs.getGCManager().EnableConfirmation) {
java.util.UUID uuid = jPlayer.getUniqueId();
if (!Util.SKIPCONFIRM.contains(uuid)) {
Util.SKIPCONFIRM.add(uuid);
CMIScheduler.get().runTaskLater(() -> Util.SKIPCONFIRM.remove(uuid),
20 * Jobs.getGCManager().ConfirmExpiryTime);
Language.sendMessage(sender, "command.skipquest.confirmationNeed", "[questName]",
old.getQuestName(), "[time]", Jobs.getGCManager().ConfirmExpiryTime);
return true;
}
Util.SKIPCONFIRM.remove(uuid);
}
jPlayer.replaceQuest(old); jPlayer.replaceQuest(old);
@ -106,7 +132,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

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

View File

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

@ -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.Job; import com.gamingmesh.jobs.container.Job;
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;
@ -20,21 +21,19 @@ import net.Zrips.CMILib.Scoreboards.CMIScoreboard;
public class top implements Cmd { public class top implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) {
CMIMessages.sendMessage(sender, LC.info_Ingame);
return false;
}
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 = (Player) sender; Player player = sender instanceof Player ? (Player) sender : null;
if (args[0].equalsIgnoreCase("clear")) { if (args[0].equalsIgnoreCase("clear")) {
if (player != null) {
player.getScoreboard().clearSlot(DisplaySlot.SIDEBAR); player.getScoreboard().clearSlot(DisplaySlot.SIDEBAR);
CMIScoreboard.removeScoreBoard(player); CMIScoreboard.removeScoreBoard(player);
}
return true; return true;
} }
@ -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)
@ -51,8 +50,8 @@ public class top implements Cmd {
Job job = Jobs.getJob(args[0]); Job job = Jobs.getJob(args[0]);
if (job == null) { if (job == null) {
player.sendMessage(Jobs.getLanguage().getMessage("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);
@ -64,25 +63,24 @@ public class top implements Cmd {
return true; return true;
} }
player.sendMessage(Jobs.getLanguage().getMessage("command.top.help.info"));
int place = 1; int place = 1;
if (!Jobs.getGCManager().ShowToplistInScoreboard) { if (!Jobs.getGCManager().ShowToplistInScoreboard || player == null) {
player.sendMessage(Jobs.getLanguage().getMessage("command.top.output.topline", "%jobname%", job.getName(), "%amount%", Jobs.getGCManager().JobsTopAmount)); Language.sendMessage(sender, "command.top.output.topline", "%jobname%", job.getName(), "%amount%", Jobs.getGCManager().JobsTopAmount);
for (TopList one : fullList) { for (TopList one : fullList) {
if (place > Jobs.getGCManager().JobsTopAmount) if (place > Jobs.getGCManager().JobsTopAmount)
break; break;
player.sendMessage(Jobs.getLanguage().getMessage("command.top.output.list", Language.sendMessage(sender, "command.top.output.list",
"%number%", ((page - 1) * Jobs.getGCManager().JobsTopAmount) + place, "%number%", ((page - 1) * Jobs.getGCManager().JobsTopAmount) + place,
"%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());
place++; place++;
} }
plugin.showPagination(sender, pi, "jobs top " + job.getName()); pi.autoPagination(sender, "jobs top " + job.getName());
} else { } else {
List<String> ls = new ArrayList<>(); List<String> ls = new ArrayList<>();
@ -96,7 +94,7 @@ public class top implements Cmd {
CMIScoreboard.show(player, Jobs.getLanguage().getMessage("scoreboard.topline", "%jobname%", job.getName()), ls, Jobs.getGCManager().ToplistInScoreboardInterval); CMIScoreboard.show(player, Jobs.getLanguage().getMessage("scoreboard.topline", "%jobname%", job.getName()), ls, Jobs.getGCManager().ToplistInScoreboardInterval);
plugin.showPagination(sender, pi, "jobs top " + job.getName()); pi.autoPagination(sender, "jobs top " + job.getName());
} }
return true; return true;
} }

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;

View File

@ -13,14 +13,15 @@ import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.RawMessages.RawMessage; import net.Zrips.CMILib.RawMessages.RawMessage;
import net.Zrips.CMILib.Util.CMIVersionChecker; import net.Zrips.CMILib.Util.CMIVersionChecker;
import net.Zrips.CMILib.Version.Version; import net.Zrips.CMILib.Version.Version;
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
import net.milkbowl.vault.economy.Economy; import net.milkbowl.vault.economy.Economy;
public class version implements Cmd { public class version implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { CMIScheduler.get().runTaskAsynchronously(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -62,7 +63,7 @@ public class version implements Cmd {
final String vault = preVault; final String vault = preVault;
final String vaultProvider = vProvider; final String vaultProvider = vProvider;
Bukkit.getScheduler().runTask(plugin, new Runnable() { CMIScheduler.get().runTask(new Runnable() {
@Override @Override
public void run() { public void run() {

View File

@ -16,7 +16,7 @@ import com.gamingmesh.jobs.container.DBAction;
import net.Zrips.CMILib.Container.CMIBlock; import net.Zrips.CMILib.Container.CMIBlock;
import net.Zrips.CMILib.Container.CMIBlock.Bisect; import net.Zrips.CMILib.Container.CMIBlock.Bisect;
import net.Zrips.CMILib.Items.CMIMaterial; import net.Zrips.CMILib.Items.CMIMaterial;
import net.Zrips.CMILib.Logs.CMIDebug; import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
public class BlockProtectionManager { public class BlockProtectionManager {
@ -80,7 +80,7 @@ public class BlockProtectionManager {
public BlockProtection addP(Location loc, Long time, boolean paid, boolean cache) { public BlockProtection addP(Location loc, Long time, boolean paid, boolean cache) {
if (time == 0) if (time == null || time == 0)
return null; return null;
String v = loc.getBlockX() + ":" + loc.getBlockY() + ":" + loc.getBlockZ(); String v = loc.getBlockX() + ":" + loc.getBlockY() + ":" + loc.getBlockZ();
@ -98,8 +98,8 @@ public class BlockProtectionManager {
Bp = new BlockProtection(DBAction.INSERT, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); Bp = new BlockProtection(DBAction.INSERT, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
else { else {
Bp.setAction(DBAction.UPDATE); Bp.setAction(DBAction.UPDATE);
if (Bp.getSchedId() > -1) if (Bp.getScheduler() != null)
Bukkit.getServer().getScheduler().cancelTask(Bp.getSchedId()); Bp.getScheduler().cancel();
} }
Bp.setPaid(paid); Bp.setPaid(paid);
@ -107,7 +107,7 @@ public class BlockProtectionManager {
// If timer is under 2 hours, we can run scheduler to remove it when time comes // If timer is under 2 hours, we can run scheduler to remove it when time comes
if (time > -1 && (time - System.currentTimeMillis()) / 1000 < 60 * 60 * 2) if (time > -1 && (time - System.currentTimeMillis()) / 1000 < 60 * 60 * 2)
Bp.setSchedId(Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Jobs.getInstance(), () -> { Bp.setScheduler(CMIScheduler.get().runTaskLater(() -> {
remove(loc); remove(loc);
}, (time - System.currentTimeMillis()) / 50)); }, (time - System.currentTimeMillis()) / 50));

View File

@ -13,6 +13,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.stuff.ToggleBarHandling; import com.gamingmesh.jobs.stuff.ToggleBarHandling;
import net.Zrips.CMILib.Version.Version; import net.Zrips.CMILib.Version.Version;
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
public class BossBarManager { public class BossBarManager {
@ -36,7 +37,7 @@ public class BossBarManager {
public void ShowJobProgression(final JobsPlayer player, final JobProgression jobProg, double expGain) { public void ShowJobProgression(final JobsPlayer player, final JobProgression jobProg, double expGain) {
if (Jobs.getGCManager().isBossBarAsync()) { if (Jobs.getGCManager().isBossBarAsync()) {
Bukkit.getScheduler().runTaskAsynchronously(Jobs.getInstance(), () -> ShowJobProgressionInTask(player, jobProg, expGain)); CMIScheduler.get().runTaskAsynchronously(() -> ShowJobProgressionInTask(player, jobProg, expGain));
} else { } else {
ShowJobProgressionInTask(player, jobProg, expGain); ShowJobProgressionInTask(player, jobProg, expGain);
} }
@ -139,7 +140,7 @@ public class BossBarManager {
bar.setVisible(true); bar.setVisible(true);
if (oldOne != null) if (oldOne != null)
oldOne.setId(Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { oldOne.setScheduler(CMIScheduler.get().runTaskLater(new Runnable() {
@Override @Override
public void run() { public void run() {
for (BossBarInfo one : player.getBossBarInfo()) { for (BossBarInfo one : player.getBossBarInfo()) {

View File

@ -60,7 +60,7 @@ import net.Zrips.CMILib.Equations.ParseError;
import net.Zrips.CMILib.Equations.Parser; import net.Zrips.CMILib.Equations.Parser;
import net.Zrips.CMILib.FileHandler.ConfigReader; import net.Zrips.CMILib.FileHandler.ConfigReader;
import net.Zrips.CMILib.Items.CMIMaterial; import net.Zrips.CMILib.Items.CMIMaterial;
import net.Zrips.CMILib.Logs.CMIDebug; import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.Version.Version; import net.Zrips.CMILib.Version.Version;
public class ConfigManager { public class ConfigManager {
@ -965,7 +965,7 @@ public class ConfigManager {
Jobs.setJobs(jobs); Jobs.setJobs(jobs);
if (!jobs.isEmpty()) { if (!jobs.isEmpty()) {
Jobs.consoleMsg("&eLoaded &6" + jobs.size() + " &ejobs"); CMIMessages.consoleMessage("&eLoaded &6" + jobs.size() + " &ejobs");
} }
ItemBoostManager.load(); ItemBoostManager.load();
@ -1315,7 +1315,7 @@ public class ConfigManager {
jobItems.put(node.toLowerCase(), new JobItems(node, CMIMaterial.get(id), 1, name, lore, enchants, b, new ArrayList<Job>())); jobItems.put(node.toLowerCase(), new JobItems(node, CMIMaterial.get(id), 1, name, lore, enchants, b, new ArrayList<Job>()));
} }
Jobs.consoleMsg("&cRemove Items section from " + jobKey + " job, as of Jobs 4.10.0 version this was moved to boostedItems.yml file!"); CMIMessages.consoleMessage("&cRemove Items section from " + jobKey + " job, as of Jobs 4.10.0 version this was moved to boostedItems.yml file!");
} }
// Limited Items // Limited Items
@ -1435,13 +1435,13 @@ public class ConfigManager {
quests.add(quest); quests.add(quest);
} catch (Exception e) { } catch (Exception e) {
Jobs.consoleMsg("&cCan't load &6" + one + " &cquest for &6" + jobFullName); CMIMessages.consoleMessage("&cCan't load &6" + one + " &cquest for &6" + jobFullName);
e.printStackTrace(); e.printStackTrace();
} }
} }
job.setQuests(quests); job.setQuests(quests);
Jobs.consoleMsg("&eLoaded &6" + quests.size() + " &equests for &6" + jobFullName); CMIMessages.consoleMessage("&eLoaded &6" + quests.size() + " &equests for &6" + jobFullName);
} }
job.setMaxDailyQuests(jobSection.getInt("maxDailyQuests", 1)); job.setMaxDailyQuests(jobSection.getInt("maxDailyQuests", 1));

View File

@ -17,7 +17,7 @@ import com.gamingmesh.jobs.container.JobsWorld;
import com.gamingmesh.jobs.dao.JobsDAO.ExploreDataTableFields; import com.gamingmesh.jobs.dao.JobsDAO.ExploreDataTableFields;
import com.gamingmesh.jobs.stuff.Util; import com.gamingmesh.jobs.stuff.Util;
import net.Zrips.CMILib.Logs.CMIDebug; import net.Zrips.CMILib.Messages.CMIMessages;
public class ExploreManager { public class ExploreManager {
@ -48,11 +48,11 @@ public class ExploreManager {
if (!exploreEnabled) if (!exploreEnabled)
return; return;
Jobs.consoleMsg("&eLoading explorer data"); CMIMessages.consoleMessage("&eLoading explorer data");
Long time = System.currentTimeMillis(); Long time = System.currentTimeMillis();
Jobs.getJobsDAO().loadExplore(); Jobs.getJobsDAO().loadExplore();
int size = getSize(); int size = getSize();
Jobs.consoleMsg("&eLoaded explorer data" + (size != 0 ? " (&6" + size + "&e)" : " ") + " in " + (System.currentTimeMillis() - time) + " ms"); CMIMessages.consoleMessage("&eLoaded explorer data" + (size != 0 ? " (&6" + size + "&e)" : " ") + " in " + (System.currentTimeMillis() - time) + " ms");
} }
public Map<String, Map<String, ExploreRegion>> getWorlds() { public Map<String, Map<String, ExploreRegion>> getWorlds() {
@ -149,17 +149,17 @@ public class ExploreManager {
} }
public void resetRegion(String worldname) { public void resetRegion(String worldname) {
Jobs.consoleMsg("&eReseting explorer data. World: " + worldname); CMIMessages.consoleMessage("&eReseting explorer data. World: " + worldname);
Map<String, Map<String, ExploreRegion>> worlds = getWorlds(); Map<String, Map<String, ExploreRegion>> worlds = getWorlds();
worlds.put(worldname, new HashMap<String, ExploreRegion>()); worlds.put(worldname, new HashMap<String, ExploreRegion>());
boolean r = Jobs.getJobsDAO().deleteExploredWorld(worldname); boolean r = Jobs.getJobsDAO().deleteExploredWorld(worldname);
if (!r) { if (!r) {
Jobs.consoleMsg("&eFailed in DAO."); CMIMessages.consoleMessage("&eFailed in DAO.");
return; return;
} }
Jobs.consoleMsg("&eCompleted to reset explorer data."); CMIMessages.consoleMessage("&eCompleted to reset explorer data.");
} }
} }

View File

@ -40,12 +40,12 @@ import com.gamingmesh.jobs.container.CurrencyLimit;
import com.gamingmesh.jobs.container.CurrencyType; import com.gamingmesh.jobs.container.CurrencyType;
import net.Zrips.CMILib.CMILib; import net.Zrips.CMILib.CMILib;
import net.Zrips.CMILib.Container.CMIArray;
import net.Zrips.CMILib.Container.CMIList; import net.Zrips.CMILib.Container.CMIList;
import net.Zrips.CMILib.Equations.Parser; import net.Zrips.CMILib.Equations.Parser;
import net.Zrips.CMILib.FileHandler.ConfigReader; import net.Zrips.CMILib.FileHandler.ConfigReader;
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.Messages.CMIMessages;
import net.Zrips.CMILib.Version.Version; import net.Zrips.CMILib.Version.Version;
public class GeneralConfigManager { public class GeneralConfigManager {
@ -95,7 +95,8 @@ public class GeneralConfigManager {
SignsColorizeJobName, ShowToplistInScoreboard, useGlobalTimer, useSilkTouchProtection, UseCustomNames, SignsColorizeJobName, ShowToplistInScoreboard, useGlobalTimer, useSilkTouchProtection, UseCustomNames,
PreventSlimeSplit, PreventMagmaCubeSplit, PreventHopperFillUps, PreventBrewingStandFillUps, informOnPaymentDisable, PreventSlimeSplit, PreventMagmaCubeSplit, PreventHopperFillUps, PreventBrewingStandFillUps, informOnPaymentDisable,
BrowseUseNewLook, payExploringWhenGliding = false, resetExploringData = false, disablePaymentIfMaxLevelReached, disablePaymentIfRiding, BrowseUseNewLook, payExploringWhenGliding = false, resetExploringData = false, disablePaymentIfMaxLevelReached, disablePaymentIfRiding,
boostedItemsInOffHand = false, boostedItemsInMainHand, boostedArmorItems, boostedItemsSlotSpecific, multiplyBoostedExtraValues, addPermissionBoost, highestPermissionBoost /*, preventCropResizePayment*/, boostedItemsInOffHand = false, boostedItemsInMainHand, boostedArmorItems, boostedItemsSlotSpecific, multiplyBoostedExtraValues, addPermissionBoost,
highestPermissionBoost,
payItemDurabilityLoss, payItemDurabilityLoss,
applyToNegativeIncome, useMinimumOveralPayment, useMinimumOveralPoints, useMinimumOveralExp, useBreederFinder, applyToNegativeIncome, useMinimumOveralPayment, useMinimumOveralPoints, useMinimumOveralExp, useBreederFinder,
CancelCowMilking, fixAtMaxLevel, TitleChangeChat, TitleChangeActionBar, LevelChangeChat, CancelCowMilking, fixAtMaxLevel, TitleChangeChat, TitleChangeActionBar, LevelChangeChat,
@ -106,10 +107,13 @@ public class GeneralConfigManager {
EnableConfirmation, jobsInfoOpensBrowse, MonsterDamageUse, useMaxPaymentCurve, blockOwnershipTakeOver, EnableConfirmation, jobsInfoOpensBrowse, MonsterDamageUse, useMaxPaymentCurve, blockOwnershipTakeOver,
hideJobsInfoWithoutPermission, UseTaxes, TransferToServerAccount, TakeFromPlayersPayment, AutoJobJoinUse, AllowDelevel, RomanNumbers, hideJobsInfoWithoutPermission, UseTaxes, TransferToServerAccount, TakeFromPlayersPayment, AutoJobJoinUse, AllowDelevel, RomanNumbers,
BossBarEnabled = false, BossBarShowOnEachAction = false, BossBarsMessageByDefault = false, ExploreCompact, DBCleaningJobsUse, DBCleaningUsersUse, BossBarEnabled = false, BossBarShowOnEachAction = false, BossBarsMessageByDefault = false, ExploreCompact, DBCleaningJobsUse, DBCleaningUsersUse,
DisabledWorldsUse, UseAsWhiteListWorldList, PaymentMethodsMoney, PaymentMethodsPoints, PaymentMethodsExp, MythicMobsEnabled, DisabledWorldsUse, UseAsWhiteListWorldList, MythicMobsEnabled,
LoggingUse, payForCombiningItems, BlastFurnacesReassign = false, SmokerReassign = false, payForStackedEntities, payForAbove = false, LoggingUse, payForCombiningItems, BlastFurnacesReassign = false, SmokerReassign = false, payForStackedEntities, payForAbove = false,
payForEachVTradeItem, allowEnchantingBoostedItems, bossBarAsync = false, preventShopItemEnchanting; payForEachVTradeItem, allowEnchantingBoostedItems, bossBarAsync = false, preventShopItemEnchanting;
public boolean jobsshopenabled;
public boolean DailyQuestsEnabled;
public ItemStack guiInfoButton; public ItemStack guiInfoButton;
public int InfoButtonSlot = 9; public int InfoButtonSlot = 9;
public List<String> InfoButtonCommands = new ArrayList<String>(); public List<String> InfoButtonCommands = new ArrayList<String>();
@ -419,6 +423,9 @@ public class GeneralConfigManager {
c.addComment("broadcast.on-level-up.levels", "For what levels you want to broadcast message? Keep it at 0 if you want for all of them"); c.addComment("broadcast.on-level-up.levels", "For what levels you want to broadcast message? Keep it at 0 if you want for all of them");
BroadcastingLevelUpLevels = c.getIntList("broadcast.on-level-up.levels", Arrays.asList(0)); BroadcastingLevelUpLevels = c.getIntList("broadcast.on-level-up.levels", Arrays.asList(0));
c.addComment("DailyQuests.Enabled", "Enables or disables daily quests");
DailyQuestsEnabled = c.get("DailyQuests.Enabled", true);
c.addComment("DailyQuests.ResetTime", "Defines time in 24hour format when we want to give out new daily quests", c.addComment("DailyQuests.ResetTime", "Defines time in 24hour format when we want to give out new daily quests",
"Any daily quests given before reset will be invalid and new ones will be given out"); "Any daily quests given before reset will be invalid and new ones will be given out");
ResetTimeHour = c.get("DailyQuests.ResetTime.Hour", 4); ResetTimeHour = c.get("DailyQuests.ResetTime.Hour", 4);
@ -450,6 +457,9 @@ public class GeneralConfigManager {
c.addComment("prevent-shop-item-enchanting", "Prevent players to enchant items from the shop in the anvil with enchanted books"); c.addComment("prevent-shop-item-enchanting", "Prevent players to enchant items from the shop in the anvil with enchanted books");
preventShopItemEnchanting = c.get("prevent-shop-item-enchanting", true); preventShopItemEnchanting = c.get("prevent-shop-item-enchanting", true);
c.addComment("jobs-shop-enabled", "Enables or disables jobs shop");
jobsshopenabled = c.get("jobs-shop-enabled", true);
c.addComment("enable-pay-near-spawner", c.addComment("enable-pay-near-spawner",
"Option to allow payment to be made when killing mobs from a spawner.", "Option to allow payment to be made when killing mobs from a spawner.",
"Use jobs.nearspawner.[amount] to define multiplayer. Example jobs.nearspawner.-0.5 will pay half of payment, jobs.nearspawner.-1 will not pay at all"); "Use jobs.nearspawner.[amount] to define multiplayer. Example jobs.nearspawner.-0.5 will pay half of payment, jobs.nearspawner.-1 will not pay at all");
@ -543,7 +553,7 @@ public class GeneralConfigManager {
CMIMaterial mat = CMIMaterial.get(mName); CMIMaterial mat = CMIMaterial.get(mName);
if (mat == CMIMaterial.NONE) { if (mat == CMIMaterial.NONE) {
Jobs.consoleMsg("Failed to recognize " + one + " entry from config file"); CMIMessages.consoleMessage("Failed to recognize " + one + " entry from config file");
continue; continue;
} }
@ -585,9 +595,10 @@ public class GeneralConfigManager {
c.addComment("Economy.PaymentMethods", c.addComment("Economy.PaymentMethods",
"By disabling one of these, players no longer will get particular payment.", "By disabling one of these, players no longer will get particular payment.",
"Useful for removing particular payment method without editing whole jobConfig file"); "Useful for removing particular payment method without editing whole jobConfig file");
PaymentMethodsMoney = c.get("Economy.PaymentMethods.Money", true);
PaymentMethodsPoints = c.get("Economy.PaymentMethods.Points", true); for (CurrencyType one : CurrencyType.values()) {
PaymentMethodsExp = c.get("Economy.PaymentMethods.Exp", true); one.setEnabled(c.get("Economy.PaymentMethods." + one.getName(), true));
}
c.addComment("Economy.GeneralMulti", c.addComment("Economy.GeneralMulti",
"Can be used to change payment amounts for all jobs and all actions if you want to readjust them", "Can be used to change payment amounts for all jobs and all actions if you want to readjust them",
@ -644,7 +655,7 @@ public class GeneralConfigManager {
DynamicPaymentEquation.setVariable("totaljobs", 10); DynamicPaymentEquation.setVariable("totaljobs", 10);
DynamicPaymentEquation.setVariable("jobstotalplayers", 10); DynamicPaymentEquation.setVariable("jobstotalplayers", 10);
} catch (Throwable e) { } catch (Throwable e) {
Jobs.consoleMsg("&cDynamic payment equation has an invalid property. Disabling feature!"); CMIMessages.consoleMessage("&cDynamic payment equation has an invalid property. Disabling feature!");
useDynamicPayment = false; useDynamicPayment = false;
} }
@ -702,8 +713,14 @@ public class GeneralConfigManager {
Jobs.getPluginLogger().warning("MoneyLimit has an invalid value. Disabling money limit!"); Jobs.getPluginLogger().warning("MoneyLimit has an invalid value. Disabling money limit!");
limit.setEnabled(false); limit.setEnabled(false);
} }
c.addComment("Economy.Limit.Money.TimeLimit", "Time in seconds: 60 = 1 min, 3600 = 1 hour, 86400 = 24 hours"); c.addComment("Economy.Limit.Money.TimeLimit", "Time in seconds: 60 = 1 min, 3600 = 1 hour, 86400 = 24 hours");
limit.setTimeLimit(c.get("Economy.Limit.Money.TimeLimit", 3600)); limit.setTimeLimit(c.get("Economy.Limit.Money.TimeLimit", 3600));
c.addComment("Economy.Limit.Money.ResetTime", "Time in 24 hour format when limit should reset. This will override TimeLimit if defined",
"Example: '00:00:00' will reset timer at midnight, '04:30:00' will reset at 4:30 in the morning", "Set to empty field if you want to use TimeLimit");
limit.setResetsAt(c.get("Economy.Limit.Money.ResetTime", ""));
c.addComment("Economy.Limit.Money.AnnouncementDelay", "Delay between announcements about reached money limit", c.addComment("Economy.Limit.Money.AnnouncementDelay", "Delay between announcements about reached money limit",
"Keep this from 30 to 5 min (300), as players can get annoyed of constant message displaying"); "Keep this from 30 to 5 min (300), as players can get annoyed of constant message displaying");
limit.setAnnouncementDelay(c.get("Economy.Limit.Money.AnnouncementDelay", 30)); limit.setAnnouncementDelay(c.get("Economy.Limit.Money.AnnouncementDelay", 30));
@ -736,6 +753,11 @@ public class GeneralConfigManager {
} }
c.addComment("Economy.Limit.Point.TimeLimit", "Time in seconds: 60 = 1 min, 3600 = 1 hour, 86400 = 24 hours"); c.addComment("Economy.Limit.Point.TimeLimit", "Time in seconds: 60 = 1 min, 3600 = 1 hour, 86400 = 24 hours");
limit.setTimeLimit(c.get("Economy.Limit.Point.TimeLimit", 3600)); limit.setTimeLimit(c.get("Economy.Limit.Point.TimeLimit", 3600));
c.addComment("Economy.Limit.Point.ResetTime", "Time in 24 hour format when limit should reset. This will override TimeLimit if defined",
"Example: '00:00:00' will reset timer at midnight, '04:30:00' will reset at 4:30 in the morning", "Set to empty field if you want to use TimeLimit");
limit.setResetsAt(c.get("Economy.Limit.Point.ResetTime", ""));
c.addComment("Economy.Limit.Point.AnnouncementDelay", "Delay between announcements about reached limit", c.addComment("Economy.Limit.Point.AnnouncementDelay", "Delay between announcements about reached limit",
"Keep this from 30 to 5 min (300), as players can get annoyed of constant message displaying"); "Keep this from 30 to 5 min (300), as players can get annoyed of constant message displaying");
limit.setAnnouncementDelay(c.get("Economy.Limit.Point.AnnouncementDelay", 30)); limit.setAnnouncementDelay(c.get("Economy.Limit.Point.AnnouncementDelay", 30));
@ -768,6 +790,11 @@ public class GeneralConfigManager {
} }
c.addComment("Economy.Limit.Exp.TimeLimit", "Time in seconds: 60 = 1 min, 3600 = 1 hour, 86400 = 24 hours"); c.addComment("Economy.Limit.Exp.TimeLimit", "Time in seconds: 60 = 1 min, 3600 = 1 hour, 86400 = 24 hours");
limit.setTimeLimit(c.get("Economy.Limit.Exp.TimeLimit", 3600)); limit.setTimeLimit(c.get("Economy.Limit.Exp.TimeLimit", 3600));
c.addComment("Economy.Limit.Exp.ResetTime", "Time in 24 hour format when limit should reset. This will override TimeLimit if defined",
"Example: '00:00:00' will reset timer at midnight, '04:30:00' will reset at 4:30 in the morning", "Set to empty field if you want to use TimeLimit");
limit.setResetsAt(c.get("Economy.Limit.Exp.ResetTime", ""));
c.addComment("Economy.Limit.Exp.AnnouncementDelay", "Delay between announcements about reached Exp limit", c.addComment("Economy.Limit.Exp.AnnouncementDelay", "Delay between announcements about reached Exp limit",
"Keep this from 30 to 5 min (300), as players can get annoyed of constant message displaying"); "Keep this from 30 to 5 min (300), as players can get annoyed of constant message displaying");
limit.setAnnouncementDelay(c.get("Economy.Limit.Exp.AnnouncementDelay", 30)); limit.setAnnouncementDelay(c.get("Economy.Limit.Exp.AnnouncementDelay", 30));

View File

@ -7,6 +7,7 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.container.CurrencyType;
import com.gamingmesh.jobs.stuff.Util; import com.gamingmesh.jobs.stuff.Util;
import net.Zrips.CMILib.FileHandler.ConfigReader; import net.Zrips.CMILib.FileHandler.ConfigReader;
@ -79,6 +80,19 @@ public class LanguageManager {
c.get("limitedItem.error.levelup", "&cYou need to level up in [jobname] to use this item!"); c.get("limitedItem.error.levelup", "&cYou need to level up in [jobname] to use this item!");
c.get("general.info.toplineseparator", "&7*********************** &6%playerdisplayname% &7***********************"); c.get("general.info.toplineseparator", "&7*********************** &6%playerdisplayname% &7***********************");
c.get("general.info.separator", "&7*******************************************************"); c.get("general.info.separator", "&7*******************************************************");
for (CurrencyType curr : CurrencyType.values()) {
c.get("general.info.paymentType." + curr.toString(), curr.getName());
String color = "&2";
if (curr.equals(CurrencyType.POINTS))
color = "&6";
else if (curr.equals(CurrencyType.EXP))
color = "&e";
c.get("general.info.paymentTypeValued." + curr.toString(), color + curr.getName() + ": %amount%");
}
c.get("general.info.invalidPage", "&cInvalid page"); c.get("general.info.invalidPage", "&cInvalid page");
c.get("general.info.blocks.furnace", "Furnace"); c.get("general.info.blocks.furnace", "Furnace");
c.get("general.info.blocks.smoker", "Smoker"); c.get("general.info.blocks.smoker", "Smoker");
@ -107,35 +121,17 @@ public class LanguageManager {
c.get("command.help.output.title", "&e-------&e ======= &6Jobs &e======= &e-------"); c.get("command.help.output.title", "&e-------&e ======= &6Jobs &e======= &e-------");
c.get("command.moneyboost.help.info", "Boosts money gain for all players"); c.get("command.boost.help.info", "Boosts jobs gains for all players");
c.get("command.moneyboost.help.args", "[jobname]/all/reset [time]/[rate]"); c.get("command.boost.help.args", "exp/money/points [jobname]/all/reset [rate] [time]");
Jobs.getGCManager().getCommandArgs().put("moneyboost", Arrays.asList("[jobname]%%all%%reset", "[time]%%2", "%%2")); Jobs.getGCManager().getCommandArgs().put("boost", Arrays.asList("[jobname]", "reset%%exp%%money%%points", "[time]%%2", "%%2"));
c.get("command.moneyboost.output.allreset", "All money boosts turned off"); c.get("command.boost.output.allreset", "&aAll boosts turned off");
c.get("command.moneyboost.output.jobsboostreset", "Money boost has been turned off for %jobname%"); c.get("command.boost.output.alltypereset", "&aAll &e%type% &aboosts turned off");
c.get("command.moneyboost.output.nothingtoreset", "Nothing to reset"); c.get("command.boost.output.jobsboostreset", "&aBoost has been turned off for &e%jobname%");
c.get("command.moneyboost.output.boostalladded", "Money boost of %boost% added for all jobs!"); c.get("command.boost.output.jobstypeboostreset", "&e%type% &aboost has been turned off for &e%jobname%");
c.get("command.moneyboost.output.boostadded", "Money boost of &e%boost% &aadded for &e%jobname%!"); c.get("command.boost.output.nothingtoreset", "Nothing to reset");
c.get("command.moneyboost.output.infostats", "&c-----> &aMoney rate x%boost% enabled&c <-------"); c.get("command.boost.output.boostadded", "&aBoost of &e%boost% &aadded for &e%jobname%!");
c.get("command.boost.output.infostats", "&c-----> &a%type% rate x%boost% enabled&c <-------");
c.get("command.pointboost.help.info", "Boosts point gain for all players"); c.get("command.boost.output.boostStats", "&6%payments% &e%jobname%");
c.get("command.pointboost.help.args", "[jobname]/all/reset [time]/[rate]");
Jobs.getGCManager().getCommandArgs().put("pointboost", Arrays.asList("[jobname]%%all%%reset", "[time]%%2", "%%2"));
c.get("command.pointboost.output.allreset", "All point boosts turned off");
c.get("command.pointboost.output.jobsboostreset", "Point boost has been turned off for %jobname%");
c.get("command.pointboost.output.nothingtoreset", "Nothing to reset");
c.get("command.pointboost.output.boostalladded", "Points boost of %boost% added for all jobs!");
c.get("command.pointboost.output.boostadded", "Points boost of &e%boost% &aadded for &e%jobname%!");
c.get("command.pointboost.output.infostats", "&c-----> &aPoints rate x%boost% enabled&c <-------");
c.get("command.expboost.help.info", "Boosts exp gain for all players");
c.get("command.expboost.help.args", "[jobname]/all/reset [time]/[rate]");
Jobs.getGCManager().getCommandArgs().put("expboost", Arrays.asList("[jobname]%%all%%reset", "[time]%%2", "%%2"));
c.get("command.expboost.output.allreset", "All exp boosts turned off");
c.get("command.expboost.output.jobsboostreset", "Exp boost has been turned off for %jobname%");
c.get("command.expboost.output.nothingtoreset", "Nothing to reset");
c.get("command.expboost.output.boostalladded", "Exp boost of %boost% added for all jobs!");
c.get("command.expboost.output.boostadded", "Exp boost of &e%boost% &aadded for &e%jobname%!");
c.get("command.expboost.output.infostats", "&c-----> &aExp rate x%boost% enabled&c <-------");
c.get("command.schedule.help.info", "Enables the given scheduler"); c.get("command.schedule.help.info", "Enables the given scheduler");
c.get("command.schedule.help.args", "enable [scheduleName] [untilTime]"); c.get("command.schedule.help.args", "enable [scheduleName] [untilTime]");
@ -486,6 +482,7 @@ public class LanguageManager {
c.get("command.skipquest.help.info", "Skip defined quest and get new one"); c.get("command.skipquest.help.info", "Skip defined quest and get new one");
c.get("command.skipquest.help.args", "[jobname] [questname] (playerName)"); c.get("command.skipquest.help.args", "[jobname] [questname] (playerName)");
c.get("command.skipquest.output.questSkipForCost", "&2You skipped the quest and paid:&e %amount%$"); c.get("command.skipquest.output.questSkipForCost", "&2You skipped the quest and paid:&e %amount%$");
c.get("command.skipquest.confirmationNeed", "&cAre you sure you want to skip&e [questName]&c quest? Type the command again within&6 [time] seconds &cto confirm!");
Jobs.getGCManager().getCommandArgs().put("skipquest", Arrays.asList("[jobname]", "[questname]", "[playername]")); Jobs.getGCManager().getCommandArgs().put("skipquest", Arrays.asList("[jobname]", "[questname]", "[playername]"));
c.get("command.quests.help.info", "List available quests"); c.get("command.quests.help.info", "List available quests");

View File

@ -26,7 +26,7 @@ import net.Zrips.CMILib.Container.CMIText;
import net.Zrips.CMILib.Entities.CMIEntityType; import net.Zrips.CMILib.Entities.CMIEntityType;
import net.Zrips.CMILib.FileHandler.ConfigReader; import net.Zrips.CMILib.FileHandler.ConfigReader;
import net.Zrips.CMILib.Items.CMIMaterial; import net.Zrips.CMILib.Items.CMIMaterial;
import net.Zrips.CMILib.Logs.CMIDebug; import net.Zrips.CMILib.Messages.CMIMessages;
public class NameTranslatorManager { public class NameTranslatorManager {
@ -231,9 +231,9 @@ public class NameTranslatorManager {
} }
if (listOfNames.size() > 0) if (listOfNames.size() > 0)
Jobs.consoleMsg("&eLoaded &6" + listOfNames.size() + " &ecustom item names"); CMIMessages.consoleMessage("&eLoaded &6" + listOfNames.size() + " &ecustom item names");
} else } else
Jobs.consoleMsg("&cThe ItemList section not found in &6" + itemFile.fileName + " &cfile."); CMIMessages.consoleMessage("&cThe ItemList section not found in &6" + itemFile.fileName + " &cfile.");
if ((section = itemFile.getConfig().getConfigurationSection("EntityList")) != null) { if ((section = itemFile.getConfig().getConfigurationSection("EntityList")) != null) {
listOfEntities.clear(); listOfEntities.clear();
@ -252,9 +252,9 @@ public class NameTranslatorManager {
} }
if (!listOfEntities.isEmpty()) if (!listOfEntities.isEmpty())
Jobs.consoleMsg("&eLoaded &6" + listOfEntities.size() + " &ecustom entity names"); CMIMessages.consoleMessage("&eLoaded &6" + listOfEntities.size() + " &ecustom entity names");
} else } else
Jobs.consoleMsg("&cThe EntityList section not found in &6" + itemFile.fileName + " &cfile."); CMIMessages.consoleMessage("&cThe EntityList section not found in &6" + itemFile.fileName + " &cfile.");
if ((section = itemFile.getConfig().getConfigurationSection("MythicEntityList")) != null) { if ((section = itemFile.getConfig().getConfigurationSection("MythicEntityList")) != null) {
listOfMMEntities.clear(); listOfMMEntities.clear();
@ -265,9 +265,9 @@ public class NameTranslatorManager {
} }
if (listOfMMEntities.size() > 0) if (listOfMMEntities.size() > 0)
Jobs.consoleMsg("&eLoaded &6" + listOfMMEntities.size() + " &ecustom MythicMobs names"); CMIMessages.consoleMessage("&eLoaded &6" + listOfMMEntities.size() + " &ecustom MythicMobs names");
} else } else
Jobs.consoleMsg("&cThe MythicEntityList section not found in &6" + itemFile.fileName + " &cfile."); CMIMessages.consoleMessage("&cThe MythicEntityList section not found in &6" + itemFile.fileName + " &cfile.");
if ((section = itemFile.getConfig().getConfigurationSection("EnchantList")) != null) { if ((section = itemFile.getConfig().getConfigurationSection("EnchantList")) != null) {
listOfEnchants.clear(); listOfEnchants.clear();
@ -277,9 +277,9 @@ public class NameTranslatorManager {
} }
if (listOfEnchants.size() > 0) if (listOfEnchants.size() > 0)
Jobs.consoleMsg("&eLoaded &6" + listOfEnchants.size() + " &ecustom enchant names"); CMIMessages.consoleMessage("&eLoaded &6" + listOfEnchants.size() + " &ecustom enchant names");
} else } else
Jobs.consoleMsg("&cThe EnchantList section not found in &6" + itemFile.fileName + " &cfile."); CMIMessages.consoleMessage("&cThe EnchantList section not found in &6" + itemFile.fileName + " &cfile.");
if ((section = itemFile.getConfig().getConfigurationSection("PotionEffects")) != null) { if ((section = itemFile.getConfig().getConfigurationSection("PotionEffects")) != null) {
listOfPotionEffects.clear(); listOfPotionEffects.clear();
@ -289,9 +289,9 @@ public class NameTranslatorManager {
} }
if (listOfPotionEffects.size() > 0) if (listOfPotionEffects.size() > 0)
Jobs.consoleMsg("&eLoaded &6" + listOfPotionEffects.size() + " &ecustom enchant names"); CMIMessages.consoleMessage("&eLoaded &6" + listOfPotionEffects.size() + " &ecustom enchant names");
} else } else
Jobs.consoleMsg("&cThe PotionEffects section not found in &6" + itemFile.fileName + " &cfile."); CMIMessages.consoleMessage("&cThe PotionEffects section not found in &6" + itemFile.fileName + " &cfile.");
if ((section = itemFile.getConfig().getConfigurationSection("ColorList")) != null) { if ((section = itemFile.getConfig().getConfigurationSection("ColorList")) != null) {
listOfColors.clear(); listOfColors.clear();
@ -304,9 +304,9 @@ public class NameTranslatorManager {
} }
if (!listOfColors.isEmpty()) if (!listOfColors.isEmpty())
Jobs.consoleMsg("&eLoaded &6" + listOfColors.size() + " &ecustom color names"); CMIMessages.consoleMessage("&eLoaded &6" + listOfColors.size() + " &ecustom color names");
} else } else
Jobs.consoleMsg("&cThe ColorList section not found in &6" + itemFile.fileName + " &cfile."); CMIMessages.consoleMessage("&cThe ColorList section not found in &6" + itemFile.fileName + " &cfile.");
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")

View File

@ -20,6 +20,8 @@ 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 net.Zrips.CMILib.Messages.CMIMessages;
public class RestrictedAreaManager { public class RestrictedAreaManager {
protected final Map<String, RestrictedArea> restrictedAreas = new HashMap<>(); protected final Map<String, RestrictedArea> restrictedAreas = new HashMap<>();
@ -231,7 +233,7 @@ public class RestrictedAreaManager {
int size = restrictedAreas.size(); int size = restrictedAreas.size();
if (size > 0) if (size > 0)
Jobs.consoleMsg("&e[Jobs] Loaded " + size + " restricted areas!"); CMIMessages.consoleMessage("&e[Jobs] Loaded " + size + " restricted areas!");
try { try {
conf.save(f); conf.save(f);

View File

@ -8,6 +8,7 @@ import com.gamingmesh.jobs.Jobs;
import net.Zrips.CMILib.FileHandler.ConfigReader; import net.Zrips.CMILib.FileHandler.ConfigReader;
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.Messages.CMIMessages;
public class RestrictedBlockManager { public class RestrictedBlockManager {
@ -46,7 +47,7 @@ public class RestrictedBlockManager {
CMIMaterial mat = cm == null ? null : cm.getCMIType(); CMIMaterial mat = cm == null ? null : cm.getCMIType();
if (mat == null || !mat.isBlock()) { if (mat == null || !mat.isBlock()) {
Jobs.consoleMsg("&eYour defined (&6" + one + "&e) protected block id/name is not correct!"); CMIMessages.consoleMessage("&eYour defined (&6" + one + "&e) protected block id/name is not correct!");
continue; continue;
} }
@ -68,7 +69,7 @@ public class RestrictedBlockManager {
cfg.get("blocksTimer." + mat.name(), timer); cfg.get("blocksTimer." + mat.name(), timer);
if (!mat.isBlock()) { if (!mat.isBlock()) {
Jobs.consoleMsg("&e[Jobs] Your defined (" + one + ") protected block id/name is not correct!"); CMIMessages.consoleMessage("&e[Jobs] Your defined (" + one + ") protected block id/name is not correct!");
continue; continue;
} }
@ -79,7 +80,7 @@ public class RestrictedBlockManager {
int size = restrictedBlocksTimer.size(); int size = restrictedBlocksTimer.size();
if (size > 0) if (size > 0)
Jobs.consoleMsg("&eLoaded &6" + size + " &eprotected blocks timers"); CMIMessages.consoleMessage("&eLoaded &6" + size + " &eprotected blocks timers");
cfg.save(); cfg.save();
} }

View File

@ -7,26 +7,27 @@ import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import com.gamingmesh.jobs.api.JobsScheduleStartEvent;
import com.gamingmesh.jobs.api.JobsScheduleStopEvent;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.scheduler.BukkitTask;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.api.JobsScheduleStartEvent;
import com.gamingmesh.jobs.api.JobsScheduleStopEvent;
import com.gamingmesh.jobs.container.BoostMultiplier; import com.gamingmesh.jobs.container.BoostMultiplier;
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.container.Schedule; import com.gamingmesh.jobs.container.Schedule;
import net.Zrips.CMILib.Logs.CMIDebug; import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
import net.Zrips.CMILib.Version.Schedulers.CMITask;
public class ScheduleManager { public class ScheduleManager {
private Jobs plugin; private Jobs plugin;
private BukkitTask timer; private CMITask timer;
private YmlMaker jobSchedule; private YmlMaker jobSchedule;
public static final List<Schedule> BOOSTSCHEDULE = new ArrayList<>(); public static final List<Schedule> BOOSTSCHEDULE = new ArrayList<>();
@ -44,7 +45,7 @@ public class ScheduleManager {
return; return;
cancel(); cancel();
timer = Bukkit.getScheduler().runTaskTimer(plugin, this::scheduler, 20, 30 * 20L); timer = CMIScheduler.get().scheduleSyncRepeatingTask(this::scheduler, 20, 30 * 20L);
} }
public void cancel() { public void cancel() {
@ -180,7 +181,7 @@ public class ScheduleManager {
!path.isList("Days") && !path.isString("Days") || !path.isList("Days") && !path.isString("Days") ||
!path.isList("Jobs") && !path.isString("Jobs")) { !path.isList("Jobs") && !path.isString("Jobs")) {
Jobs.consoleMsg("&cIncorect scheduler format detected for " + oneSection + " scheduler!"); CMIMessages.consoleMessage("&cIncorect scheduler format detected for " + oneSection + " scheduler!");
continue; continue;
} }
@ -228,6 +229,6 @@ public class ScheduleManager {
} }
if (!BOOSTSCHEDULE.isEmpty()) if (!BOOSTSCHEDULE.isEmpty())
Jobs.consoleMsg("&eLoaded " + BOOSTSCHEDULE.size() + " schedulers!"); CMIMessages.consoleMessage("&eLoaded " + BOOSTSCHEDULE.size() + " schedulers!");
} }
} }

View File

@ -113,11 +113,14 @@ public class ShopManager {
List<String> lore = new ArrayList<>(); List<String> lore = new ArrayList<>();
CMIMaterial mat = CMIMaterial.get(item.getIconMaterial()); CMIMaterial mat = CMIMaterial.get(item.getIconMaterial());
boolean hiddenLore = false;
if (item.isHideWithoutPerm()) { if (item.isHideWithoutPerm()) {
for (String onePerm : item.getRequiredPerm()) { for (String onePerm : item.getRequiredPerm()) {
if (!player.hasPermission(onePerm)) { if (!player.hasPermission(onePerm)) {
mat = CMIMaterial.STONE_BUTTON; mat = CMIMaterial.STONE_BUTTON;
lore.add(Jobs.getLanguage().getMessage("command.shop.info.NoPermToBuy")); lore.add(Jobs.getLanguage().getMessage("command.shop.info.NoPermToBuy"));
hiddenLore = true;
break; break;
} }
} }
@ -127,6 +130,7 @@ public class ShopManager {
jPlayer.getTotalLevels() < item.getRequiredTotalLevels()) { jPlayer.getTotalLevels() < item.getRequiredTotalLevels()) {
mat = CMIMaterial.STONE_BUTTON; mat = CMIMaterial.STONE_BUTTON;
lore.add(Jobs.getLanguage().getMessage("command.shop.info.NoPoints")); lore.add(Jobs.getLanguage().getMessage("command.shop.info.NoPoints"));
hiddenLore = true;
} }
if (mat == CMIMaterial.NONE) if (mat == CMIMaterial.NONE)
@ -142,6 +146,7 @@ public class ShopManager {
if (item.getIconName() != null) if (item.getIconName() != null)
meta.setDisplayName(item.getIconName()); meta.setDisplayName(item.getIconName());
if (!hiddenLore) {
lore.addAll(item.getIconLore()); lore.addAll(item.getIconLore());
if (item.getPointPrice() > 0) { if (item.getPointPrice() > 0) {
@ -185,6 +190,7 @@ public class ShopManager {
"%totalLevel%", (jPlayer.getTotalLevels() < item.getRequiredTotalLevels() "%totalLevel%", (jPlayer.getTotalLevels() < item.getRequiredTotalLevels()
? Jobs.getLanguage().getMessage("command.shop.info.reqTotalLevelColor") : "") + item.getRequiredTotalLevels())); ? Jobs.getLanguage().getMessage("command.shop.info.reqTotalLevelColor") : "") + item.getRequiredTotalLevels()));
} }
}
meta.setLore(lore); meta.setLore(lore);
@ -497,6 +503,6 @@ public class ShopManager {
} }
if (!list.isEmpty()) if (!list.isEmpty())
Jobs.consoleMsg("&eLoaded &6" + list.size() + " &eshop items"); CMIMessages.consoleMessage("&eLoaded &6" + list.size() + " &eshop items");
} }
} }

View File

@ -11,6 +11,7 @@ import com.gamingmesh.jobs.container.Title;
import net.Zrips.CMILib.Colors.CMIChatColor; import net.Zrips.CMILib.Colors.CMIChatColor;
import net.Zrips.CMILib.FileHandler.ConfigReader; import net.Zrips.CMILib.FileHandler.ConfigReader;
import net.Zrips.CMILib.Messages.CMIMessages;
public class TitleManager { public class TitleManager {
@ -157,6 +158,6 @@ public class TitleManager {
int size = titles.size(); int size = titles.size();
if (size > 0) if (size > 0)
Jobs.consoleMsg("&eLoaded &6" + size + " &etitles"); CMIMessages.consoleMessage("&eLoaded &6" + size + " &etitles");
} }
} }

View File

@ -2,12 +2,14 @@ package com.gamingmesh.jobs.container;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import net.Zrips.CMILib.Version.Schedulers.CMITask;
public class BlockProtection { public class BlockProtection {
private static long pre = (int) (System.currentTimeMillis() / 10000000000L) * 10000000000L; private static long pre = (int) (System.currentTimeMillis() / 10000000000L) * 10000000000L;
private int id = -1; private int id = -1;
private int schedId = - 1; private CMITask scheduler = null;
private int time = -1; private int time = -1;
private int recorded = -1; private int recorded = -1;
private DBAction action; private DBAction action;
@ -115,11 +117,11 @@ public class BlockProtection {
return z; return z;
} }
public int getSchedId() { public CMITask getScheduler() {
return schedId; return scheduler;
} }
public void setSchedId(int schedId) { public void setScheduler(CMITask cmiTask) {
this.schedId = schedId; this.scheduler = cmiTask;
} }
} }

View File

@ -68,9 +68,10 @@ public class Boost {
if (one == BoostOf.NearSpawner || one == BoostOf.PetPay) if (one == BoostOf.NearSpawner || one == BoostOf.PetPay)
continue; continue;
if (bm.isValid(type)) if (bm.isValid(type)) {
r += bm.get(type); r += bm.get(type);
} }
}
if (!excludeExtra) { if (!excludeExtra) {
if (Jobs.getGCManager().multiplyBoostedExtraValues) { if (Jobs.getGCManager().multiplyBoostedExtraValues) {

View File

@ -23,17 +23,20 @@ public class BoostMultiplier implements Cloneable {
} }
public BoostMultiplier add(CurrencyType type, double amount) { public BoostMultiplier add(CurrencyType type, double amount) {
if (!Double.isNaN(amount))
map.put(type, amount); map.put(type, amount);
timers.remove(type);
return this; return this;
} }
public BoostMultiplier add(CurrencyType type, double amount, long time) { public BoostMultiplier add(CurrencyType type, double amount, long time) {
add(type, amount);
timers.put(type, time); timers.put(type, time);
return add(type, amount); return this;
} }
public BoostMultiplier add(double amount) { public BoostMultiplier add(double amount) {
if (amount != 0) { if (amount != 0 && !Double.isNaN(amount)) {
for (CurrencyType one : CurrencyType.values()) { for (CurrencyType one : CurrencyType.values()) {
map.put(one, amount); map.put(one, amount);
} }

View File

@ -1,13 +1,14 @@
package com.gamingmesh.jobs.container; package com.gamingmesh.jobs.container;
import org.bukkit.Bukkit;
import org.bukkit.boss.BossBar; import org.bukkit.boss.BossBar;
import net.Zrips.CMILib.Version.Schedulers.CMITask;
public class BossBarInfo { public class BossBarInfo {
private String jobName; private String jobName;
private String PlayerName; private String PlayerName;
private BossBar bar; private BossBar bar;
private int id = -1; private CMITask scheduler = null;
public BossBarInfo(String PlayerName, String jobName, BossBar bar) { public BossBarInfo(String PlayerName, String jobName, BossBar bar) {
this.PlayerName = PlayerName; this.PlayerName = PlayerName;
@ -15,14 +16,14 @@ public class BossBarInfo {
this.bar = bar; this.bar = bar;
} }
public void setId(int id) { public void setScheduler(CMITask cmiTask) {
cancel(); cancel();
this.id = id; this.scheduler = cmiTask;
} }
public void cancel() { public void cancel() {
if (id != -1) if (scheduler != null)
Bukkit.getScheduler().cancelTask(this.id); scheduler.cancel();
} }
public String getPlayerName() { public String getPlayerName() {

View File

@ -4,12 +4,14 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.Zrips.CMILib.Equations.Parser; import net.Zrips.CMILib.Equations.Parser;
import net.Zrips.CMILib.Messages.CMIMessages;
public class CurrencyLimit { public class CurrencyLimit {
private boolean enabled; private boolean enabled;
private List<CurrencyType> stopWith; private List<CurrencyType> stopWith;
private int timeLimit; private int timeLimit = 0;
private resetTime resetsAt = null;
private int announcementDelay; private int announcementDelay;
private Parser maxEquation; private Parser maxEquation;
@ -66,4 +68,40 @@ public class CurrencyLimit {
this.maxEquation = maxEquation; this.maxEquation = maxEquation;
} }
public resetTime getResetsAt() {
return resetsAt;
}
public void setResetsAt(int hour, int minute, int second) {
this.resetsAt = new resetTime(hour, minute, second);
}
public void setResetsAt(String resetsAt) {
if (resetsAt.isEmpty())
return;
int hour = 0;
int minute = 0;
int second = 0;
String[] split = resetsAt.split(":");
try {
hour = Integer.parseInt(split[0]);
if (split.length >= 2) {
minute = Integer.parseInt(split[1]);
}
if (split.length >= 3) {
second = Integer.parseInt(split[2]);
}
} catch (Throwable e) {
CMIMessages.consoleMessage("Failed to recognize reset time as " + resetsAt);
return;
}
setResetsAt(hour, minute, second);
}
} }

View File

@ -18,6 +18,8 @@
package com.gamingmesh.jobs.container; package com.gamingmesh.jobs.container;
import com.gamingmesh.jobs.Jobs;
public enum CurrencyType { public enum CurrencyType {
MONEY("Money", 1), MONEY("Money", 1),
EXP("Exp", 2), EXP("Exp", 2),
@ -25,6 +27,7 @@ public enum CurrencyType {
private String name; private String name;
private int id = 0; private int id = 0;
private boolean enabled = true;
CurrencyType(String name, int id) { CurrencyType(String name, int id) {
this.name = name; this.name = name;
@ -54,4 +57,16 @@ public enum CurrencyType {
public int getId() { public int getId() {
return id; return id;
} }
public String getDisplayName() {
return Jobs.getLanguage().getMessage("general.info.paymentType." + this.toString());
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
} }

View File

@ -225,13 +225,22 @@ public class Job {
eq.setVariable("totaljobs", Jobs.getJobs().size()); eq.setVariable("totaljobs", Jobs.getJobs().size());
eq.setVariable("jobstotalplayers", getTotalPlayers()); eq.setVariable("jobstotalplayers", getTotalPlayers());
double now = eq.getValue(); double now = 0D;
try {
now = eq.getValue();
} catch (Throwable e) {
e.printStackTrace();
}
if (now > Jobs.getGCManager().DynamicPaymentMaxBonus) if (now > Jobs.getGCManager().DynamicPaymentMaxBonus)
now = Jobs.getGCManager().DynamicPaymentMaxBonus; now = Jobs.getGCManager().DynamicPaymentMaxBonus;
if (now < Jobs.getGCManager().DynamicPaymentMaxPenalty) if (now < Jobs.getGCManager().DynamicPaymentMaxPenalty)
now = Jobs.getGCManager().DynamicPaymentMaxPenalty; now = Jobs.getGCManager().DynamicPaymentMaxPenalty;
if (Double.isNaN(now))
now = 0;
this.bonus = now; this.bonus = now;
} }
@ -301,6 +310,7 @@ public class Job {
}; };
String shortActionName = CMIMaterial.getGeneralMaterialName(action.getName()); String shortActionName = CMIMaterial.getGeneralMaterialName(action.getName());
for (JobInfo info : getJobInfo(action.getType())) { for (JobInfo info : getJobInfo(action.getType())) {
if (condition.test(info, action)) { if (condition.test(info, action)) {
if (!info.isInLevelRange(level)) { if (!info.isInLevelRange(level)) {

View File

@ -113,7 +113,7 @@ public class JobInfo {
public double getIncome(double level, int numjobs, int maxJobs) { public double getIncome(double level, int numjobs, int maxJobs) {
if (softIncomeLevelLimit != null && level > softIncomeLevelLimit) if (softIncomeLevelLimit != null && level > softIncomeLevelLimit)
level = softIncomeLevelLimit; level = softIncomeLevelLimit;
if (baseIncome == 0 || !Jobs.getGCManager().PaymentMethodsMoney) if (baseIncome == 0 || !CurrencyType.MONEY.isEnabled())
return 0; return 0;
moneyEquation.setVariable("joblevel", level); moneyEquation.setVariable("joblevel", level);
moneyEquation.setVariable("numjobs", numjobs); moneyEquation.setVariable("numjobs", numjobs);
@ -125,7 +125,7 @@ public class JobInfo {
public double getExperience(double level, int numjobs, int maxJobs) { public double getExperience(double level, int numjobs, int maxJobs) {
if (softExpLevelLimit != null && level > softExpLevelLimit) if (softExpLevelLimit != null && level > softExpLevelLimit)
level = softExpLevelLimit; level = softExpLevelLimit;
if (baseXp == 0 || !Jobs.getGCManager().PaymentMethodsExp) if (baseXp == 0 || !CurrencyType.EXP.isEnabled())
return 0; return 0;
xpEquation.setVariable("joblevel", level); xpEquation.setVariable("joblevel", level);
xpEquation.setVariable("numjobs", numjobs); xpEquation.setVariable("numjobs", numjobs);
@ -137,7 +137,7 @@ public class JobInfo {
public double getPoints(double level, int numjobs, int maxJobs) { public double getPoints(double level, int numjobs, int maxJobs) {
if (softPointsLevelLimit != null && level > softPointsLevelLimit) if (softPointsLevelLimit != null && level > softPointsLevelLimit)
level = softPointsLevelLimit; level = softPointsLevelLimit;
if (basePoints == 0 || !Jobs.getGCManager().PaymentMethodsPoints) if (basePoints == 0 || !CurrencyType.POINTS.isEnabled())
return 0; return 0;
pointsEquation.setVariable("joblevel", level); pointsEquation.setVariable("joblevel", level);
pointsEquation.setVariable("numjobs", numjobs); pointsEquation.setVariable("numjobs", numjobs);

View File

@ -22,9 +22,9 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.stuff.TimeManage;
import com.gamingmesh.jobs.stuff.Util; import com.gamingmesh.jobs.stuff.Util;
import net.Zrips.CMILib.Container.CMINumber;
import net.Zrips.CMILib.Time.CMITimeManager; import net.Zrips.CMILib.Time.CMITimeManager;
public class JobProgression { public class JobProgression {
@ -146,7 +146,7 @@ public class JobProgression {
*/ */
public String getLevelFormatted() { public String getLevelFormatted() {
if (Jobs.getGCManager().RomanNumbers) if (Jobs.getGCManager().RomanNumbers)
return Util.toRoman(level); return CMINumber.toRoman(level);
return String.valueOf(level); return String.valueOf(level);
} }

View File

@ -47,6 +47,8 @@ import net.Zrips.CMILib.Equations.Parser;
import net.Zrips.CMILib.Items.CMIMaterial; import net.Zrips.CMILib.Items.CMIMaterial;
import net.Zrips.CMILib.Logs.CMIDebug; import net.Zrips.CMILib.Logs.CMIDebug;
import net.Zrips.CMILib.Time.CMITimeManager; import net.Zrips.CMILib.Time.CMITimeManager;
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
import net.Zrips.CMILib.Version.Schedulers.CMITask;
public class JobsPlayer { public class JobsPlayer {
@ -1347,14 +1349,14 @@ public class JobsPlayer {
this.doneQuests = doneQuests; this.doneQuests = doneQuests;
} }
private Integer questSignUpdateShed; private CMITask questSignUpdateShed;
public void addDoneQuest(final Job job) { public void addDoneQuest(final Job job) {
doneQuests++; doneQuests++;
setSaved(false); setSaved(false);
if (questSignUpdateShed == null) { if (questSignUpdateShed == null) {
questSignUpdateShed = plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> { questSignUpdateShed = CMIScheduler.get().runTaskLater(() -> {
Jobs.getSignUtil().signUpdate(job, SignTopType.questtoplist); Jobs.getSignUtil().signUpdate(job, SignTopType.questtoplist);
questSignUpdateShed = null; questSignUpdateShed = null;
}, Jobs.getGCManager().getSavePeriod() * 60 * 20L); }, Jobs.getGCManager().getSavePeriod() * 60 * 20L);

View File

@ -3,7 +3,7 @@ package com.gamingmesh.jobs.container;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import com.gamingmesh.jobs.stuff.TimeManage; import net.Zrips.CMILib.Time.CMITimeManager;
public final class Log { public final class Log {
@ -36,7 +36,7 @@ public final class Log {
} }
public void setDate() { public void setDate() {
this.day = TimeManage.timeInInt(); this.day = CMITimeManager.timeInInt();
} }
public int getDate() { public int getDate() {

View File

@ -26,6 +26,7 @@ public class PlayerPoints {
public void takePoints(double points) { public void takePoints(double points) {
current -= points; current -= points;
total -= points;
} }
public boolean havePoints(double points) { public boolean havePoints(double points) {

View File

@ -4,15 +4,12 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import com.gamingmesh.jobs.actions.EnchantActionInfo;
import com.gamingmesh.jobs.stuff.Util;
import net.Zrips.CMILib.Logs.CMIDebug;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.event.server.ServerCommandEvent; import org.bukkit.event.server.ServerCommandEvent;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.actions.EnchantActionInfo;
import com.gamingmesh.jobs.stuff.Util;
public class QuestProgression { public class QuestProgression {
@ -160,22 +157,24 @@ public class QuestProgression {
} }
} }
boolean completed = isCompleted();
Job questJob = quest.getJob(); Job questJob = quest.getJob();
if (questJob != null) { if (questJob != null && completed) {
int maxQuest = jPlayer.getPlayerMaxQuest(questJob.getName()); int maxQuest = jPlayer.getPlayerMaxQuest(questJob.getName());
if (maxQuest > 0 && jPlayer.getDoneQuests() >= maxQuest) { if (maxQuest > 0 && jPlayer.getDoneQuests() >= maxQuest) {
return; return;
} }
} }
if (!isCompleted() && if (!completed && objective != null) {
objective != null) {
Integer old = done.getOrDefault(objective, 0); Integer old = done.getOrDefault(objective, 0);
done.put(objective, old < objective.getAmount() ? old + 1 : objective.getAmount()); done.put(objective, old < objective.getAmount() ? old + 1 : objective.getAmount());
} }
jPlayer.setSaved(false); jPlayer.setSaved(false);
//needs to re-call isCompleted() because it might have changed above.
if (!isCompleted() || !player.isOnline() || givenReward) if (!isCompleted() || !player.isOnline() || givenReward)
return; return;

View File

@ -24,6 +24,7 @@ import com.gamingmesh.jobs.stuff.blockLoc;
import net.Zrips.CMILib.Container.CMILocation; import net.Zrips.CMILib.Container.CMILocation;
import net.Zrips.CMILib.Items.CMIMaterial; import net.Zrips.CMILib.Items.CMIMaterial;
import net.Zrips.CMILib.Messages.CMIMessages;
public class BlockOwnerShip { public class BlockOwnerShip {
@ -380,7 +381,7 @@ public class BlockOwnerShip {
} }
if (total > 0) { if (total > 0) {
Jobs.consoleMsg("&eLoaded &6" + total + " " + path.toLowerCase() + " &efor reassigning."); CMIMessages.consoleMessage("&eLoaded &6" + total + " " + path.toLowerCase() + " &efor reassigning.");
} }
} }

View File

@ -0,0 +1,58 @@
package com.gamingmesh.jobs.container;
import java.util.Calendar;
import java.util.Date;
public class resetTime {
private int hour = 0;
private int minute = 0;
private int second = 0;
public resetTime(int hour, int minute, int second) {
this.hour = hour % 24;
this.minute = minute % 60;
this.second = second % 60;
}
public int getHour() {
return hour;
}
public void setHour(int hour) {
this.hour = hour;
}
public int getMinute() {
return minute;
}
public void setMinute(int minute) {
this.minute = minute;
}
public int getSecond() {
return second;
}
public void setSecond(int second) {
this.second = second;
}
public long toMili() {
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.set(Calendar.HOUR_OF_DAY, hour);
calendar.set(Calendar.MINUTE, minute);
calendar.set(Calendar.SECOND, second);
if (calendar.getTimeInMillis() < System.currentTimeMillis()) {
calendar.add(Calendar.DAY_OF_YEAR, 1);
}
return calendar.getTimeInMillis();
}
}

View File

@ -41,10 +41,11 @@ import com.gamingmesh.jobs.container.PlayerPoints;
import com.gamingmesh.jobs.container.TopList; import com.gamingmesh.jobs.container.TopList;
import com.gamingmesh.jobs.dao.JobsManager.DataBaseType; import com.gamingmesh.jobs.dao.JobsManager.DataBaseType;
import com.gamingmesh.jobs.economy.PaymentData; import com.gamingmesh.jobs.economy.PaymentData;
import com.gamingmesh.jobs.stuff.TimeManage;
import com.gamingmesh.jobs.stuff.Util; import com.gamingmesh.jobs.stuff.Util;
import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.Time.CMITimeManager;
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
public abstract class JobsDAO { public abstract class JobsDAO {
@ -819,7 +820,7 @@ public abstract class JobsDAO {
PreparedStatement prest = null; PreparedStatement prest = null;
ResultSet res = null; ResultSet res = null;
try { try {
int time = TimeManage.timeInInt(); int time = CMITimeManager.timeInInt();
prest = conn.prepareStatement("SELECT * FROM `" + DBTables.LogTable.getTableName() + "` WHERE `" + LogTableFields.time.getCollumn() + "` = ? ;"); prest = conn.prepareStatement("SELECT * FROM `" + DBTables.LogTable.getTableName() + "` WHERE `" + LogTableFields.time.getCollumn() + "` = ? ;");
prest.setInt(1, time); prest.setInt(1, time);
res = prest.executeQuery(); res = prest.executeQuery();
@ -1016,10 +1017,10 @@ public abstract class JobsDAO {
public void triggerTableIdUpdate() { public void triggerTableIdUpdate() {
// Lets convert old fields // Lets convert old fields
if (!converted) { if (!converted) {
Bukkit.getServer().getScheduler().runTaskLater(plugin, () -> { CMIScheduler.get().runTaskLater(() -> {
Jobs.consoleMsg("&6[Jobs] Converting to new database format"); CMIMessages.consoleMessage("&6[Jobs] Converting to new database format");
convertID(); convertID();
Jobs.consoleMsg("&6[Jobs] Converted to new database format"); CMIMessages.consoleMessage("&6[Jobs] Converted to new database format");
converted = true; converted = true;
}, 60L); }, 60L);
} }
@ -2311,7 +2312,7 @@ public abstract class JobsDAO {
PreparedStatement prest = null; PreparedStatement prest = null;
ResultSet res = null; ResultSet res = null;
try { try {
int time = TimeManage.timeInInt(); int time = CMITimeManager.timeInInt();
prest = conn.prepareStatement("SELECT * FROM `" + DBTables.LogTable.getTableName() prest = conn.prepareStatement("SELECT * FROM `" + DBTables.LogTable.getTableName()
+ "` WHERE `" + LogTableFields.userid.getCollumn() + "` = ? AND `" + LogTableFields.time.getCollumn() + "` = ? ;"); + "` WHERE `" + LogTableFields.userid.getCollumn() + "` = ? AND `" + LogTableFields.time.getCollumn() + "` = ? ;");
prest.setInt(1, player.getUserId()); prest.setInt(1, player.getUserId());
@ -2508,12 +2509,12 @@ public abstract class JobsDAO {
i++; i++;
if (ii++ >= 100000) { if (ii++ >= 100000) {
Jobs.consoleMsg("&6[Jobs] Loading (" + i + ") BP"); CMIMessages.consoleMessage("&6[Jobs] Loading (" + i + ") BP");
ii = 0; ii = 0;
} }
} }
if (i > 0) { if (i > 0) {
Jobs.consoleMsg("&e[Jobs] Loaded " + i + " block protection entries. " + (System.currentTimeMillis() - timer) + "ms"); CMIMessages.consoleMessage("&e[Jobs] Loaded " + i + " block protection entries. " + (System.currentTimeMillis() - timer) + "ms");
} }
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
@ -2577,7 +2578,7 @@ public abstract class JobsDAO {
conn.setAutoCommit(true); conn.setAutoCommit(true);
if (i > 0) if (i > 0)
Jobs.consoleMsg("&e[Jobs] Saved " + i + " new explorer entries."); CMIMessages.consoleMessage("&e[Jobs] Saved " + i + " new explorer entries.");
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
@ -2624,7 +2625,7 @@ public abstract class JobsDAO {
conn.setAutoCommit(true); conn.setAutoCommit(true);
if (i > 0) if (i > 0)
Jobs.consoleMsg("&e[Jobs] Updated " + i + " explorer entries."); CMIMessages.consoleMessage("&e[Jobs] Updated " + i + " explorer entries.");
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();

View File

@ -6,7 +6,7 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.container.LoadStatus; import com.gamingmesh.jobs.container.LoadStatus;
import net.Zrips.CMILib.FileHandler.ConfigReader; import net.Zrips.CMILib.FileHandler.ConfigReader;
import net.Zrips.CMILib.Logs.CMIDebug; import net.Zrips.CMILib.Messages.CMIMessages;
public class JobsManager { public class JobsManager {
private JobsDAO dao; private JobsDAO dao;
@ -70,9 +70,9 @@ public class JobsManager {
public void start() { public void start() {
if (Jobs.getJobsDAO() != null) { if (Jobs.getJobsDAO() != null) {
Jobs.consoleMsg("&eClosing existing database connection..."); CMIMessages.consoleMessage("&eClosing existing database connection...");
Jobs.getJobsDAO().closeConnections(); Jobs.getJobsDAO().closeConnections();
Jobs.consoleMsg("&eClosed"); CMIMessages.consoleMessage("&eClosed");
} }
ConfigReader c = Jobs.getGCManager().getConfig(); ConfigReader c = Jobs.getGCManager().getConfig();
@ -100,7 +100,7 @@ public class JobsManager {
} }
} else { } else {
if (!storageMethod.equalsIgnoreCase("sqlite")) { if (!storageMethod.equalsIgnoreCase("sqlite")) {
Jobs.consoleMsg("&cInvalid storage method! Changing method to sqlite!"); CMIMessages.consoleMessage("&cInvalid storage method! Changing method to sqlite!");
c.set("storage.method", "sqlite"); c.set("storage.method", "sqlite");
} }

View File

@ -8,7 +8,7 @@ import java.sql.Statement;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.dao.JobsManager.DataBaseType; import com.gamingmesh.jobs.dao.JobsManager.DataBaseType;
import net.Zrips.CMILib.Logs.CMIDebug; import net.Zrips.CMILib.Messages.CMIMessages;
public class JobsMySQL extends JobsDAO { public class JobsMySQL extends JobsDAO {
@ -52,7 +52,7 @@ public class JobsMySQL extends JobsDAO {
protected void checkUpdate() throws SQLException { protected void checkUpdate() throws SQLException {
JobsConnection conn = getConnection(); JobsConnection conn = getConnection();
if (conn == null) { if (conn == null) {
Jobs.consoleMsg("&cCould not run database updates! Could not connect to MySQL!"); CMIMessages.consoleMessage("&cCould not run database updates! Could not connect to MySQL!");
return; return;
} }
@ -77,7 +77,7 @@ public class JobsMySQL extends JobsDAO {
@Override @Override
public boolean createTable(String query) { public boolean createTable(String query) {
if (query == null || query.isEmpty()) { if (query == null || query.isEmpty()) {
Jobs.consoleMsg("&cCould not create table: query is empty or null."); CMIMessages.consoleMessage("&cCould not create table: query is empty or null.");
return false; return false;
} }
JobsConnection conn = getConnection(); JobsConnection conn = getConnection();
@ -88,7 +88,7 @@ public class JobsMySQL extends JobsDAO {
statement = conn.createStatement(); statement = conn.createStatement();
statement.execute(query); statement.execute(query);
} catch (SQLException e) { } catch (SQLException e) {
Jobs.consoleMsg("&cCould not create table, SQLException: " + e.getMessage()); CMIMessages.consoleMessage("&cCould not create table, SQLException: " + e.getMessage());
return false; return false;
} finally { } finally {
close(statement); close(statement);
@ -111,7 +111,7 @@ public class JobsMySQL extends JobsDAO {
tables.close(); tables.close();
return false; return false;
} catch (SQLException e) { } catch (SQLException e) {
Jobs.consoleMsg("Not a table |" + "SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME ='" + table + "';" + "|"); CMIMessages.consoleMessage("Not a table |" + "SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME ='" + table + "';" + "|");
} }
PreparedStatement insert = null; PreparedStatement insert = null;
@ -125,7 +125,7 @@ public class JobsMySQL extends JobsDAO {
return true; return true;
} }
} catch (SQLException e) { } catch (SQLException e) {
Jobs.consoleMsg("Not a table |" + "SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME ='" + table + "';" + "|"); CMIMessages.consoleMessage("Not a table |" + "SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME ='" + table + "';" + "|");
} finally { } finally {
close(res); close(res);
close(insert); close(insert);
@ -140,14 +140,14 @@ public class JobsMySQL extends JobsDAO {
try { try {
statement = getConnection().createStatement(); statement = getConnection().createStatement();
} catch (SQLException e) { } catch (SQLException e) {
Jobs.consoleMsg("&cCould not check if its collumn, SQLException: " + e.getMessage()); CMIMessages.consoleMessage("&cCould not check if its collumn, SQLException: " + e.getMessage());
return false; return false;
} }
try { try {
statement.executeQuery("SELECT `" + collumn + "` FROM `" + table + "`;"); statement.executeQuery("SELECT `" + collumn + "` FROM `" + table + "`;");
return true; return true;
} catch (SQLException e) { } catch (SQLException e) {
Jobs.consoleMsg("Not a collumn |" + "SELECT " + collumn + " FROM " + table + "|"); CMIMessages.consoleMessage("Not a collumn |" + "SELECT " + collumn + " FROM " + table + "|");
return false; return false;
} finally { } finally {
close(statement); close(statement);
@ -160,11 +160,11 @@ public class JobsMySQL extends JobsDAO {
try { try {
statement = getConnection().createStatement(); statement = getConnection().createStatement();
} catch (SQLException e) { } catch (SQLException e) {
Jobs.consoleMsg("&cCould not add new collumn, SQLException: " + e.getMessage()); CMIMessages.consoleMessage("&cCould not add new collumn, SQLException: " + e.getMessage());
return false; return false;
} }
try { try {
Jobs.consoleMsg("Creating collumn |" + "ALTER TABLE `" + table + "` ADD COLUMN `" + collumn + "` " + type + ";" + "|"); CMIMessages.consoleMessage("Creating collumn |" + "ALTER TABLE `" + table + "` ADD COLUMN `" + collumn + "` " + type + ";" + "|");
statement.executeUpdate("ALTER TABLE `" + table + "` ADD COLUMN `" + collumn + "` " + type + ";"); statement.executeUpdate("ALTER TABLE `" + table + "` ADD COLUMN `" + collumn + "` " + type + ";");
return true; return true;
} catch (SQLException e) { } catch (SQLException e) {
@ -179,14 +179,14 @@ public class JobsMySQL extends JobsDAO {
Statement statement = null; Statement statement = null;
try { try {
if (!isTable(table)) { if (!isTable(table)) {
Jobs.consoleMsg("&cTable \"" + table + "\" does not exist."); CMIMessages.consoleMessage("&cTable \"" + table + "\" does not exist.");
return false; return false;
} }
statement = getConnection().createStatement(); statement = getConnection().createStatement();
statement.executeUpdate("DELETE FROM " + table + ";"); statement.executeUpdate("DELETE FROM " + table + ";");
return true; return true;
} catch (SQLException e) { } catch (SQLException e) {
Jobs.consoleMsg("&cCould not wipe table, SQLException: " + e.getMessage()); CMIMessages.consoleMessage("&cCould not wipe table, SQLException: " + e.getMessage());
e.printStackTrace(); e.printStackTrace();
return false; return false;
} finally { } finally {
@ -199,14 +199,14 @@ public class JobsMySQL extends JobsDAO {
Statement statement = null; Statement statement = null;
try { try {
if (!isTable(table)) { if (!isTable(table)) {
Jobs.consoleMsg("&cTable \"" + table + "\" does not exist."); CMIMessages.consoleMessage("&cTable \"" + table + "\" does not exist.");
return false; return false;
} }
statement = getConnection().createStatement(); statement = getConnection().createStatement();
statement.executeUpdate("DROP TABLE IF EXISTS `" + table + "`;"); statement.executeUpdate("DROP TABLE IF EXISTS `" + table + "`;");
return true; return true;
} catch (SQLException e) { } catch (SQLException e) {
Jobs.consoleMsg("&cCould not wipe table, SQLException: " + e.getMessage()); CMIMessages.consoleMessage("&cCould not wipe table, SQLException: " + e.getMessage());
e.printStackTrace(); e.printStackTrace();
return false; return false;
} finally { } finally {

Some files were not shown because too many files have changed in this diff Show More