mirror of
https://github.com/Zrips/Jobs.git
synced 2024-12-31 21:37:57 +01:00
Merge branch 'Zrips:master' into bucket-entity-action
This commit is contained in:
commit
2fab19974c
Binary file not shown.
BIN
libs/CMILib1.4.0.0.jar
Normal file
BIN
libs/CMILib1.4.0.0.jar
Normal file
Binary file not shown.
6
pom.xml
6
pom.xml
@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>Jobs</groupId>
|
||||
<artifactId>jobs</artifactId>
|
||||
<version>5.1.2.2</version>
|
||||
<version>5.2.1.0</version>
|
||||
<name>Jobs</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
@ -197,7 +197,7 @@
|
||||
<artifactId>CMILib</artifactId>
|
||||
<version>latest</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/libs/CMILib1.2.4.5.jar</systemPath>
|
||||
<systemPath>${basedir}/libs/CMILib1.4.0.0.jar</systemPath>
|
||||
</dependency>
|
||||
<!-- WildStacker -->
|
||||
<dependency>
|
||||
@ -286,7 +286,7 @@
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.3.1</version>
|
||||
<configuration>
|
||||
<outputDirectory>D:\MC\Server 1.19\plugins\</outputDirectory>
|
||||
<outputDirectory>D:\MC\Server 1.20\plugins\</outputDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
@ -27,6 +27,7 @@ import net.Zrips.CMILib.GUI.CMIGuiButton;
|
||||
import net.Zrips.CMILib.GUI.GUIManager.GUIClickType;
|
||||
import net.Zrips.CMILib.Items.CMIItemStack;
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||
import net.Zrips.CMILib.Version.Version;
|
||||
|
||||
public class GuiManager {
|
||||
@ -285,6 +286,7 @@ public class GuiManager {
|
||||
}
|
||||
|
||||
double income = jInfo.getIncome(level, numjobs, jPlayer.maxJobsEquation);
|
||||
|
||||
income = boost.getFinalAmount(CurrencyType.MONEY, income);
|
||||
String incomeColor = income >= 0 ? "" : ChatColor.DARK_RED.toString();
|
||||
|
||||
|
@ -18,13 +18,14 @@
|
||||
|
||||
package com.gamingmesh.jobs;
|
||||
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
import com.gamingmesh.jobs.economy.BlackholeEconomy;
|
||||
import com.gamingmesh.jobs.economy.VaultEconomy;
|
||||
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
|
||||
public class HookEconomyTask implements Runnable {
|
||||
|
||||
private Jobs plugin;
|
||||
@ -72,7 +73,7 @@ public class HookEconomyTask implements Runnable {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@ import com.gamingmesh.jobs.container.JobItems;
|
||||
import net.Zrips.CMILib.Colors.CMIChatColor;
|
||||
import net.Zrips.CMILib.FileHandler.ConfigReader;
|
||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
|
||||
public final class ItemBoostManager {
|
||||
|
||||
@ -228,7 +229,7 @@ public final class ItemBoostManager {
|
||||
}
|
||||
|
||||
cfg.save();
|
||||
Jobs.consoleMsg("&eLoaded &6" + ITEMS.size() + " &eboosted items");
|
||||
CMIMessages.consoleMessage("&eLoaded &6" + ITEMS.size() + " &eboosted items");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -34,7 +34,6 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -112,14 +111,12 @@ import com.gamingmesh.jobs.tasks.BufferedPaymentThread;
|
||||
import com.gamingmesh.jobs.tasks.DatabaseSaveThread;
|
||||
|
||||
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.Locale.LC;
|
||||
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
import net.Zrips.CMILib.RawMessages.RawMessage;
|
||||
import net.Zrips.CMILib.Version.Version;
|
||||
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
|
||||
|
||||
public final class Jobs extends JavaPlugin {
|
||||
|
||||
@ -168,7 +165,7 @@ public final class Jobs extends JavaPlugin {
|
||||
|
||||
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) {
|
||||
protected boolean removeEldestEntry(Map.Entry<UUID, FastPayment> eldest) {
|
||||
return size() > MAX_ENTRIES;
|
||||
@ -268,7 +265,7 @@ public final class Jobs extends JavaPlugin {
|
||||
try {
|
||||
if (Integer.parseInt(papi
|
||||
.getDescription().getVersion().replaceAll("[^\\d]", "")) >= 2100 && new PlaceholderAPIHook(this).register()) {
|
||||
consoleMsg("&6PlaceholderAPI &ehooked.");
|
||||
CMIMessages.consoleMessage("&6PlaceholderAPI &ehooked.");
|
||||
}
|
||||
} catch (NumberFormatException ex) {
|
||||
return false;
|
||||
@ -567,7 +564,7 @@ public final class Jobs extends JavaPlugin {
|
||||
getPlayerManager().addPlayerToCache(jPlayer);
|
||||
}
|
||||
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() {
|
||||
@ -597,7 +594,7 @@ public final class Jobs extends JavaPlugin {
|
||||
// Jobs.getJobsDAO().saveBlockProtection();
|
||||
} catch (SQLException e) {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -767,14 +764,14 @@ public final class Jobs extends JavaPlugin {
|
||||
}
|
||||
|
||||
// register economy
|
||||
getServer().getScheduler().runTask(this, new HookEconomyTask(this));
|
||||
CMIScheduler.get().runTask(new HookEconomyTask(this));
|
||||
|
||||
dao.loadBlockProtection();
|
||||
getExploreManager().load();
|
||||
getCommandManager().fillCommands();
|
||||
getDBManager().getDB().triggerTableIdUpdate();
|
||||
|
||||
consoleMsg("&ePlugin has been enabled successfully.");
|
||||
CMIMessages.consoleMessage("&ePlugin has been enabled successfully.");
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
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) {
|
||||
if (!Jobs.getGCManager().DailyQuestsEnabled) {
|
||||
return;
|
||||
}
|
||||
if (!job.getQuests().isEmpty()) {
|
||||
for (QuestProgression one : jPlayer.getQuestProgressions(job, info.getType())) {
|
||||
one.processQuest(jPlayer, info);
|
||||
@ -1258,7 +1258,7 @@ public final class Jobs extends JavaPlugin {
|
||||
jPlayer.getUpdateBossBarFor().add(prog.getJob().getName());
|
||||
} catch (Throwable e) {
|
||||
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<>();
|
||||
@ -1416,15 +1416,27 @@ public final class Jobs extends JavaPlugin {
|
||||
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);
|
||||
|
||||
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);
|
||||
Bukkit.getServer().getPluginManager().callEvent(jobsExpGainEvent);
|
||||
// If event is canceled, don't do anything
|
||||
if (jobsExpGainEvent.isCancelled())
|
||||
return;
|
||||
|
||||
payment.set(CurrencyType.EXP, jobsExpGainEvent.getExp());
|
||||
|
||||
boolean limited = true;
|
||||
for (CurrencyType one : CurrencyType.values()) {
|
||||
if (jPlayer.isUnderLimit(one, payment.get(one))) {
|
||||
@ -1449,12 +1461,6 @@ public final class Jobs extends JavaPlugin {
|
||||
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() {
|
||||
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() {
|
||||
return hasLimitedItems;
|
||||
}
|
||||
|
@ -53,7 +53,9 @@ public class PermissionManager {
|
||||
jobs_maxblastfurnaces_AMOUNT(remade("jobs.maxblastfurnaces.%AMOUNT%"), 30),
|
||||
jobs_maxsmokers_AMOUNT(remade("jobs.maxsmokers.%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 List<String> perms;
|
||||
@ -93,7 +95,7 @@ public class PermissionManager {
|
||||
}
|
||||
|
||||
private int getDelay(String perm) {
|
||||
return permDelay.getOrDefault(perm, 1);
|
||||
return permDelay.getOrDefault(perm, 1000);
|
||||
}
|
||||
|
||||
public PermissionManager() {
|
||||
@ -165,7 +167,9 @@ public class PermissionManager {
|
||||
double amount = Double.NEGATIVE_INFINITY;
|
||||
|
||||
permissionInfo permInfo = jPlayer.getPermissionsCache(perm);
|
||||
|
||||
if (force || getDelay(perm) + permInfo.getTime() < System.currentTimeMillis()) {
|
||||
|
||||
Map<String, Boolean> perms = getAll(player, perm);
|
||||
for (Map.Entry<String, Boolean> permission : perms.entrySet()) {
|
||||
if (!permission.getKey().startsWith(perm) || !permission.getValue())
|
||||
@ -176,7 +180,7 @@ public class PermissionManager {
|
||||
if (amount == Double.NEGATIVE_INFINITY)
|
||||
amount = 0D;
|
||||
amount += temp;
|
||||
}else if (temp > amount)
|
||||
} else if (temp > amount)
|
||||
amount = temp;
|
||||
} catch (NumberFormatException ex) {
|
||||
Jobs.getPluginLogger().log(java.util.logging.Level.WARNING, ex.getLocalizedMessage());
|
||||
|
@ -88,6 +88,7 @@ public class Placeholder {
|
||||
user_archived_jobs_exp_$1("jname/number"),
|
||||
|
||||
jtop_name_$1_$2("jname/number", "[1-15]"),
|
||||
jtop_displayname_$1_$2("jname/number", "[1-15]"),
|
||||
jtop_level_$1_$2("jname/number", "[1-15]"),
|
||||
|
||||
maxjobs,
|
||||
@ -616,6 +617,26 @@ public class Placeholder {
|
||||
|
||||
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)
|
||||
return "";
|
||||
|
||||
|
@ -31,8 +31,8 @@ import java.util.concurrent.ThreadLocalRandom;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Firework;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -40,8 +40,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
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.JobsLeaveEvent;
|
||||
@ -62,7 +60,6 @@ import com.gamingmesh.jobs.dao.JobsDAO;
|
||||
import com.gamingmesh.jobs.dao.JobsDAOData;
|
||||
import com.gamingmesh.jobs.economy.PaymentData;
|
||||
import com.gamingmesh.jobs.hooks.HookManager;
|
||||
import com.gamingmesh.jobs.stuff.PerformCommands;
|
||||
import com.gamingmesh.jobs.stuff.Util;
|
||||
|
||||
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.NBT.CMINBT;
|
||||
import net.Zrips.CMILib.Version.Version;
|
||||
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
|
||||
|
||||
public class PlayerManager {
|
||||
|
||||
@ -336,7 +334,7 @@ public class PlayerManager {
|
||||
i++;
|
||||
|
||||
if (y++ >= 1000) {
|
||||
Jobs.consoleMsg("&e[Jobs] Saved " + i + "/" + total + " players data");
|
||||
CMIMessages.consoleMessage("&e[Jobs] Saved " + i + "/" + total + " players data");
|
||||
y = 0;
|
||||
}
|
||||
}
|
||||
@ -452,6 +450,14 @@ public class PlayerManager {
|
||||
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.
|
||||
*
|
||||
@ -476,13 +482,23 @@ public class PlayerManager {
|
||||
Jobs.getJobsDAO().joinJob(jPlayer, jPlayer.getJobProgression(job));
|
||||
jPlayer.setLeftTime(job);
|
||||
|
||||
PerformCommands.performCommandsOnJoin(jPlayer, job);
|
||||
performCommandsOnJoin(jPlayer, job);
|
||||
|
||||
Jobs.takeSlot(job);
|
||||
Jobs.getSignUtil().updateAllSign(job);
|
||||
|
||||
job.updateTotalPlayers();
|
||||
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))
|
||||
return false;
|
||||
|
||||
PerformCommands.performCommandsOnLeave(jPlayer, job);
|
||||
performCommandsOnLeave(jPlayer, job);
|
||||
Jobs.leaveSlot(job);
|
||||
|
||||
jPlayer.getLeftTimes().remove(jPlayer.getUniqueId());
|
||||
|
||||
Jobs.getSignUtil().updateAllSign(job);
|
||||
job.updateTotalPlayers();
|
||||
|
||||
// Removing from cached item boost for recalculation
|
||||
cache.remove(jPlayer.getUniqueId());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -712,7 +732,7 @@ public class PlayerManager {
|
||||
}
|
||||
|
||||
if (Jobs.getGCManager().FireworkLevelupUse && player != null) {
|
||||
plugin.getServer().getScheduler().runTaskLater(plugin, new Runnable() {
|
||||
CMIScheduler.get().runTaskLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!player.isOnline())
|
||||
@ -1044,6 +1064,7 @@ public class PlayerManager {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
jitems.add(getJobsItemByNbt(item));
|
||||
}
|
||||
}
|
||||
@ -1180,7 +1201,7 @@ public class PlayerManager {
|
||||
if (!Jobs.getGCManager().AutoJobJoinUse || player == null || player.isOp())
|
||||
return;
|
||||
|
||||
plugin.getServer().getScheduler().runTaskLater(plugin, new Runnable() {
|
||||
CMIScheduler.get().runTaskLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!player.isOnline())
|
||||
|
@ -21,8 +21,9 @@ import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.TopList;
|
||||
|
||||
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.Schedulers.CMIScheduler;
|
||||
|
||||
public class SignUtil {
|
||||
|
||||
@ -130,7 +131,7 @@ public class SignUtil {
|
||||
}
|
||||
|
||||
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();
|
||||
directionFacing = signMat.getFacing();
|
||||
} else {
|
||||
if (CMIMaterial.isWallSign(sign.getType())) {
|
||||
org.bukkit.block.data.type.WallSign data = (org.bukkit.block.data.type.WallSign) sign.getBlockData();
|
||||
directionFacing = data.getFacing();
|
||||
} else {
|
||||
org.bukkit.block.data.type.Sign data = (org.bukkit.block.data.type.Sign) sign.getBlockData();
|
||||
directionFacing = data.getRotation();
|
||||
}
|
||||
if (sign.getBlockData() instanceof org.bukkit.block.data.type.WallSign)
|
||||
directionFacing = ((org.bukkit.block.data.type.WallSign) sign.getBlockData()).getFacing();
|
||||
else if (sign.getBlockData() instanceof org.bukkit.block.data.type.Sign)
|
||||
directionFacing = ((org.bukkit.block.data.type.Sign) sign.getBlockData()).getRotation();
|
||||
}
|
||||
|
||||
final Location loc = sign.getLocation().clone();
|
||||
@ -357,7 +355,7 @@ public class SignUtil {
|
||||
if (directionFacing != null && !(loc.getBlock().getState() instanceof Skull))
|
||||
loc.add(directionFacing.getOppositeFace().getModX(), 0, directionFacing.getOppositeFace().getModZ());
|
||||
|
||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
CMIScheduler.get().runTaskLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!(loc.getBlock().getState() instanceof Skull))
|
||||
|
@ -5,5 +5,5 @@ import org.bukkit.command.CommandSender;
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
|
||||
public interface Cmd {
|
||||
boolean perform(Jobs plugin, CommandSender sender, String[] args);
|
||||
Boolean perform(Jobs plugin, CommandSender sender, String[] args);
|
||||
}
|
||||
|
@ -14,6 +14,8 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
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.Boost;
|
||||
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.JobsPlayer;
|
||||
import com.gamingmesh.jobs.container.Title;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
import com.gamingmesh.jobs.stuff.Util;
|
||||
|
||||
import net.Zrips.CMILib.ActionBar.CMIActionBar;
|
||||
import net.Zrips.CMILib.Container.CMIArray;
|
||||
import net.Zrips.CMILib.Container.PageInfo;
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
import net.Zrips.CMILib.RawMessages.RawMessage;
|
||||
|
||||
@ -113,7 +115,12 @@ public class JobsCommands implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
return cmdClass.perform(plugin, sender, myArgs) || help(sender, 1);
|
||||
Boolean result = cmdClass.perform(plugin, sender, myArgs);
|
||||
|
||||
if (result != null && !result)
|
||||
sendUsage(sender, cmd);
|
||||
|
||||
return result == null || !result ? false : true;
|
||||
}
|
||||
|
||||
private static String[] reduceArgs(String[] args) {
|
||||
@ -162,18 +169,12 @@ public class JobsCommands implements CommandExecutor {
|
||||
|
||||
boolean pl = sender instanceof Player;
|
||||
|
||||
// Old format
|
||||
// sender.sendMessage(Jobs.getLanguage().getMessage("command.help.output.title"));
|
||||
for (String one : commands) {
|
||||
if (!pi.isEntryOk())
|
||||
continue;
|
||||
if (pi.isBreak())
|
||||
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) {
|
||||
rm.addText("\n" + getUsage(one));
|
||||
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
|
||||
+ ".help.info")));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
rm.show(sender);
|
||||
|
||||
plugin.showPagination(sender, pi, LABEL + " ?");
|
||||
pi.autoPagination(sender, LABEL + " ?");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -269,7 +268,7 @@ public class JobsCommands implements CommandExecutor {
|
||||
public void jobInfoMessage(CommandSender sender, JobsPlayer player, Job job, String type, int page) {
|
||||
if (job == null) {
|
||||
// job doesn't exist
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||
Language.sendMessage(sender, "general.error.job");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -277,21 +276,24 @@ public class JobsCommands implements CommandExecutor {
|
||||
|
||||
List<String> message = new ArrayList<>();
|
||||
|
||||
if (job.getBoost().get(CurrencyType.EXP) != 0D)
|
||||
message.add(Jobs.getLanguage().getMessage("command.expboost.output.infostats", "%boost%", (job.getBoost().get(CurrencyType.EXP)) + 1));
|
||||
for (CurrencyType one : CurrencyType.values()) {
|
||||
double boost = job.getBoost().get(one);
|
||||
if (boost != 0D) {
|
||||
|
||||
if (job.getBoost().get(CurrencyType.MONEY) != 0D)
|
||||
message.add(Jobs.getLanguage().getMessage("command.moneyboost.output.infostats", "%boost%", (job.getBoost().get(CurrencyType.MONEY)) + 1));
|
||||
String boostAmount = String.valueOf(boost + 1);
|
||||
if (boost % 1 == 0)
|
||||
boostAmount = String.valueOf((int) boost + 1);
|
||||
|
||||
if (job.getBoost().get(CurrencyType.POINTS) != 0D)
|
||||
message.add(Jobs.getLanguage().getMessage("command.pointboost.output.infostats", "%boost%", (job.getBoost().get(CurrencyType.POINTS)) + 1));
|
||||
message.add(Jobs.getLanguage().getMessage("command.boost.output.infostats", "%boost%", boostAmount, "%type%", one.getDisplayName()));
|
||||
}
|
||||
}
|
||||
|
||||
if (Jobs.getGCManager().useDynamicPayment) {
|
||||
int bonus = (int) ((job.getBonus() * 100) / 100.0);
|
||||
int bonus = (int) (job.getBonus() * 100);
|
||||
|
||||
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
|
||||
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);
|
||||
|
||||
if (page > pi.getTotalPages()) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.invalidPage"));
|
||||
Language.sendMessage(sender, "general.info.invalidPage");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -333,9 +335,9 @@ public class JobsCommands implements CommandExecutor {
|
||||
String pName = player.getName();
|
||||
|
||||
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
|
||||
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
|
||||
*/
|
||||
public String jobStatsMessage(JobProgression jobProg) {
|
||||
return jobStatsMessage(jobProg, true);
|
||||
}
|
||||
|
||||
public String jobStatsMessage(JobProgression jobProg, boolean progressBar) {
|
||||
boolean isMaxLevelReached = jobProg.getLevel() == jobProg.getJob().getMaxLevel();
|
||||
String path = "command.stats.output." + (isMaxLevelReached ? "max-level"
|
||||
: "message");
|
||||
@ -432,7 +438,7 @@ public class JobsCommands implements CommandExecutor {
|
||||
"%jobxp%", Math.round(jobProg.getExperience() * 100.0) / 100.0,
|
||||
"%jobmaxxp%", jobProg.getMaxExperience(),
|
||||
"%titlename%", title == null ? "Unknown" : title.getName());
|
||||
return " " + (isMaxLevelReached ? "" : jobProgressMessage(jobProg.getMaxExperience(), jobProg.getExperience())) + " " + message;
|
||||
return " " + (isMaxLevelReached ? "" : progressBar ? jobProgressMessage(jobProg.getMaxExperience(), jobProg.getExperience()) : "") + " " + message;
|
||||
}
|
||||
|
||||
public String jobProgressMessage(double max, double current) {
|
||||
|
@ -10,17 +10,18 @@ import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.JobProgression;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
import net.Zrips.CMILib.RawMessages.RawMessage;
|
||||
|
||||
public class archive implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
JobsPlayer jPlayer = null;
|
||||
if (args.length >= 1) {
|
||||
if (!Jobs.hasPermission(sender, "jobs.command.admin.archive", true)) {
|
||||
return true;
|
||||
return null;
|
||||
}
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
|
||||
|
||||
@ -30,17 +31,17 @@ public class archive implements Cmd {
|
||||
|
||||
if (jPlayer == null) {
|
||||
if (args.length >= 1)
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0]));
|
||||
return true;
|
||||
Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args[0]);
|
||||
return null;
|
||||
}
|
||||
|
||||
Set<JobProgression> allJobs = jPlayer.getArchivedJobs().getArchivedJobs();
|
||||
if (allJobs.isEmpty()) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.archive.error.nojob"));
|
||||
return true;
|
||||
Language.sendMessage(sender, "command.archive.error.nojob");
|
||||
return null;
|
||||
}
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.toplineseparator", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getDisplayName()));
|
||||
Language.sendMessage(sender, "general.info.toplineseparator", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getDisplayName());
|
||||
for (JobProgression jobInfo : allJobs) {
|
||||
RawMessage rm = new RawMessage();
|
||||
if (jobInfo.canRejoin())
|
||||
@ -53,7 +54,7 @@ public class archive implements Cmd {
|
||||
rm.show(sender);
|
||||
}
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator"));
|
||||
Language.sendMessage(sender, "general.info.separator");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import com.gamingmesh.jobs.config.RestrictedAreaManager;
|
||||
import com.gamingmesh.jobs.container.CuboidArea;
|
||||
import com.gamingmesh.jobs.container.RestrictedArea;
|
||||
import com.gamingmesh.jobs.hooks.HookManager;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
@ -20,7 +21,7 @@ import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
public class area implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
return false;
|
||||
@ -51,20 +52,20 @@ public class area implements Cmd {
|
||||
RestrictedAreaManager ra = Jobs.getRestrictedAreaManager();
|
||||
|
||||
if (ra.isExist(name)) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.exist"));
|
||||
Language.sendMessage(sender, "command.area.output.exist");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!wg && !Jobs.getSelectionManager().hasPlacedBoth(player)) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.select",
|
||||
"%tool%", CMIMaterial.get(Jobs.getGCManager().getSelectionTool()).getName()));
|
||||
Language.sendMessage(sender, "command.area.output.select",
|
||||
"%tool%", CMIMaterial.get(Jobs.getGCManager().getSelectionTool()).getName());
|
||||
return true;
|
||||
}
|
||||
if (wg && HookManager.getWorldGuardManager() != null) {
|
||||
com.sk89q.worldguard.protection.regions.ProtectedRegion protectedRegion = HookManager.getWorldGuardManager().getProtectedRegionByName(name);
|
||||
|
||||
if (protectedRegion == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.wgDontExist"));
|
||||
Language.sendMessage(sender, "command.area.output.wgDontExist");
|
||||
return true;
|
||||
}
|
||||
name = protectedRegion.getId();
|
||||
@ -74,7 +75,7 @@ public class area implements Cmd {
|
||||
ra.addNew(new RestrictedArea(name, Jobs.getSelectionManager().getSelectionCuboid(player), bonus), true);
|
||||
else
|
||||
ra.addNew(new RestrictedArea(name, name, bonus), true);
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.addedNew", "%bonus%", bonus));
|
||||
Language.sendMessage(sender, "command.area.output.addedNew", "%bonus%", bonus);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -88,12 +89,12 @@ public class area implements Cmd {
|
||||
String name = args[1];
|
||||
|
||||
if (!ra.isExist(name)) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.dontExist"));
|
||||
Language.sendMessage(sender, "command.area.output.dontExist");
|
||||
return true;
|
||||
}
|
||||
|
||||
ra.remove(name);
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.removed", "%name%", name));
|
||||
Language.sendMessage(sender, "command.area.output.removed", "%name%", name);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -111,10 +112,10 @@ public class area implements Cmd {
|
||||
}
|
||||
|
||||
if (msg.isEmpty()) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.noAreasByLoc"));
|
||||
Language.sendMessage(sender, "command.area.output.noAreasByLoc");
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.areaList", "%list%", msg));
|
||||
Language.sendMessage(sender, "command.area.output.areaList", "%list%", msg);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -132,7 +133,7 @@ public class area implements Cmd {
|
||||
i++;
|
||||
CuboidArea cuboid = area.getValue().getCuboidArea();
|
||||
if (area.getValue().getWgName() == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.list", "%number%", i,
|
||||
Language.sendMessage(sender, "command.area.output.list", "%number%", i,
|
||||
"%areaname%", area.getKey(),
|
||||
"%worldname%", cuboid.getWorld().getName(),
|
||||
"%x1%", cuboid.getLowLoc().getBlockX(),
|
||||
@ -141,25 +142,25 @@ public class area implements Cmd {
|
||||
"%x2%", cuboid.getHighLoc().getBlockX(),
|
||||
"%y2%", cuboid.getHighLoc().getBlockY(),
|
||||
"%z2%", cuboid.getHighLoc().getBlockZ(),
|
||||
"%bonus%", area.getValue().getMultiplier()));
|
||||
"%bonus%", area.getValue().getMultiplier());
|
||||
} else {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.wgList", "%number%", i,
|
||||
Language.sendMessage(sender, "command.area.output.wgList", "%number%", i,
|
||||
"%areaname%", area.getKey(),
|
||||
"%bonus%", area.getValue().getMultiplier()));
|
||||
"%bonus%", area.getValue().getMultiplier());
|
||||
}
|
||||
}
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator"));
|
||||
Language.sendMessage(sender, "general.info.separator");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length > 0) {
|
||||
if (args[0].equalsIgnoreCase("add")) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.help.addUsage"));
|
||||
Language.sendMessage(sender, "command.area.help.addUsage");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("remove")) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.help.removeUsage"));
|
||||
Language.sendMessage(sender, "command.area.help.removeUsage");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -18,15 +18,10 @@ public class blockinfo implements Cmd {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.length != 0) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "blockinfo");
|
||||
return true;
|
||||
return null;
|
||||
}
|
||||
|
||||
Block block = Util.getTargetBlock((Player) sender, 15);
|
||||
|
@ -13,6 +13,7 @@ import com.gamingmesh.jobs.container.CurrencyType;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.hooks.HookManager;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
@ -21,10 +22,10 @@ import net.Zrips.CMILib.RawMessages.RawMessage;
|
||||
public class bonus implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
if (args.length != 1) {
|
||||
@ -35,7 +36,7 @@ public class bonus implements Cmd {
|
||||
Player player = (Player) sender;
|
||||
Job job = Jobs.getJob(args[0]);
|
||||
if (job == null) {
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||
Language.sendMessage(sender, "general.error.job");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -45,7 +46,7 @@ public class bonus implements Cmd {
|
||||
|
||||
Boost boost = Jobs.getPlayerManager().getFinalBonus(jPlayer, job, true, true);
|
||||
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.topline"));
|
||||
Language.sendMessage(sender, "command.bonus.output.topline");
|
||||
|
||||
printBoost(sender, boost, BoostOf.Permission);
|
||||
printBoost(sender, boost, BoostOf.Item);
|
||||
@ -61,7 +62,7 @@ public class bonus implements Cmd {
|
||||
HookManager.getMcMMOManager().mcMMOOverHaul && boost.get(BoostOf.McMMO, CurrencyType.EXP) != 0D)
|
||||
printBoost(sender, boost, BoostOf.McMMO);
|
||||
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("general.info.separator"));
|
||||
Language.sendMessage(sender, "general.info.separator");
|
||||
|
||||
RawMessage rm = new RawMessage();
|
||||
String msg = Jobs.getLanguage().getMessage("command.bonus.output.final",
|
||||
@ -76,8 +77,6 @@ public class bonus implements Cmd {
|
||||
|
||||
rm.addText(msg).addHover(Arrays.asList(Jobs.getLanguage().getMessage("command.bonus.output.finalExplanation"), msg2));
|
||||
|
||||
|
||||
|
||||
rm.build();
|
||||
rm.show(player);
|
||||
|
||||
@ -97,7 +96,7 @@ public class bonus implements Cmd {
|
||||
if ((type == BoostOf.NearSpawner || type == BoostOf.PetPay) && msg.startsWith(" "))
|
||||
msg = msg.substring(1, msg.length());
|
||||
|
||||
sender.sendMessage(prefix + msg);
|
||||
CMIMessages.sendMessage(sender, prefix + msg);
|
||||
}
|
||||
|
||||
private static String formatText(double amount) {
|
||||
|
174
src/main/java/com/gamingmesh/jobs/commands/list/boost.java
Normal file
174
src/main/java/com/gamingmesh/jobs/commands/list/boost.java
Normal 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);
|
||||
}
|
||||
}
|
@ -13,17 +13,19 @@ import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.BlockProtection;
|
||||
import com.gamingmesh.jobs.container.DBAction;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
import net.Zrips.CMILib.Version.Version;
|
||||
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
|
||||
|
||||
public class bp implements Cmd {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
@ -73,23 +75,24 @@ public class bp implements Cmd {
|
||||
}
|
||||
|
||||
if (changedBlocks.isEmpty())
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.bp.output.notFound"));
|
||||
Language.sendMessage(sender, "command.bp.output.notFound");
|
||||
else
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.bp.output.found", "%amount%", changedBlocks.size()));
|
||||
Language.sendMessage(sender, "command.bp.output.found", "%amount%", changedBlocks.size());
|
||||
|
||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (Version.isCurrentEqualOrHigher(Version.v1_15_R1))
|
||||
if (!changedBlocks.isEmpty()) {
|
||||
Location bloc = changedBlocks.get(0).getLocation();
|
||||
CMIScheduler.get().runAtLocationLater(bloc, () -> {
|
||||
if (Version.isCurrentEqualOrHigher(Version.v1_15_R1)) {
|
||||
for (Block one : changedBlocks) {
|
||||
player.sendBlockChange(one.getLocation(), one.getBlockData());
|
||||
}
|
||||
else
|
||||
} else {
|
||||
for (Block one : changedBlocks) {
|
||||
player.sendBlockChange(one.getLocation(), one.getType(), one.getData());
|
||||
}
|
||||
}
|
||||
}, 120L);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -9,20 +9,22 @@ import org.bukkit.entity.Player;
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
import net.Zrips.CMILib.Colors.CMIChatColor;
|
||||
import net.Zrips.CMILib.Container.PageInfo;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
import net.Zrips.CMILib.RawMessages.RawMessage;
|
||||
|
||||
public class browse implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, CommandSender sender, final String[] args) {
|
||||
boolean senderIsPlayer = sender instanceof Player;
|
||||
|
||||
if (Jobs.getGCManager().BrowseUseNewLook) {
|
||||
if (Jobs.getJobs().isEmpty()) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.error.nojobs"));
|
||||
Language.sendMessage(sender, "command.browse.error.nojobs");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -60,7 +62,7 @@ public class browse implements Cmd {
|
||||
if (senderIsPlayer) {
|
||||
if (j == null) {
|
||||
PageInfo pi = new PageInfo(Jobs.getGCManager().getBrowseAmountToShow(), jobList.size(), page);
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.newHeader", "[amount]", jobList.size()));
|
||||
Language.sendMessage(sender, "command.browse.output.newHeader", "[amount]", jobList.size());
|
||||
for (Job one : jobList) {
|
||||
if (!pi.isEntryOk())
|
||||
continue;
|
||||
@ -113,28 +115,28 @@ public class browse implements Cmd {
|
||||
|
||||
rm.show(sender);
|
||||
}
|
||||
plugin.showPagination(sender, pi, "jobs browse", "-p:");
|
||||
pi.autoPagination(sender, "jobs browse", "-p:");
|
||||
} else {
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.jobHeader", "[jobname]", j.getName()));
|
||||
Language.sendMessage(sender, "command.browse.output.jobHeader", "[jobname]", j.getName());
|
||||
|
||||
int maxLevel = j.getMaxLevel(sender);
|
||||
if (maxLevel > 0)
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.info.help.newMax", "[max]", maxLevel));
|
||||
Language.sendMessage(sender, "command.info.help.newMax", "[max]", maxLevel);
|
||||
|
||||
if (Jobs.getGCManager().ShowTotalWorkers)
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", j.getTotalPlayers()));
|
||||
Language.sendMessage(sender, "command.browse.output.totalWorkers", "[amount]", j.getTotalPlayers());
|
||||
|
||||
if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) {
|
||||
int bonus = (int) (j.getBonus() * 100);
|
||||
if (bonus < 0)
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.penalty", "[amount]", bonus * -1));
|
||||
Language.sendMessage(sender, "command.browse.output.penalty", "[amount]", bonus * -1);
|
||||
else
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", bonus));
|
||||
Language.sendMessage(sender, "command.browse.output.bonus", "[amount]", bonus);
|
||||
}
|
||||
|
||||
for (String one : j.getFullDescription()) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.description", "[description]", one));
|
||||
Language.sendMessage(sender, "command.browse.output.description", "[description]", one);
|
||||
}
|
||||
|
||||
RawMessage rm = new RawMessage();
|
||||
@ -148,7 +150,7 @@ public class browse implements Cmd {
|
||||
}
|
||||
} else {
|
||||
if (j == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.console.newHeader", "[amount]", jobList.size(), "\\n", "\n"));
|
||||
Language.sendMessage(sender, "command.browse.output.console.newHeader", "[amount]", jobList.size(), "\\n", "\n");
|
||||
for (Job one : jobList) {
|
||||
String msg = "";
|
||||
|
||||
@ -177,14 +179,14 @@ public class browse implements Cmd {
|
||||
|
||||
msg += Jobs.getLanguage().getMessage("command.browse.output.console.list", "[jobname]", one.getName());
|
||||
|
||||
sender.sendMessage(msg);
|
||||
CMIMessages.sendMessage(sender, msg);
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.jobHeader", "[jobname]", j.getName()));
|
||||
Language.sendMessage(sender, "command.browse.output.jobHeader", "[jobname]", j.getName());
|
||||
|
||||
int maxLevel = j.getMaxLevel(sender);
|
||||
if (maxLevel > 0)
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.info.help.newMax", "[max]", maxLevel));
|
||||
Language.sendMessage(sender, "command.info.help.newMax", "[max]", maxLevel);
|
||||
|
||||
if (Jobs.getGCManager().ShowTotalWorkers)
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", j.getTotalPlayers()));
|
||||
@ -192,13 +194,13 @@ public class browse implements Cmd {
|
||||
if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) {
|
||||
int bonus = (int) (j.getBonus() * 100);
|
||||
if (bonus < 0)
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.penalty", "[amount]", bonus * -1));
|
||||
Language.sendMessage(sender, "command.browse.output.penalty", "[amount]", bonus * -1);
|
||||
else
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", bonus));
|
||||
Language.sendMessage(sender, "command.browse.output.bonus", "[amount]", bonus);
|
||||
}
|
||||
|
||||
for (String one : j.getFullDescription()) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.description", "[description]", one));
|
||||
Language.sendMessage(sender, "command.browse.output.description", "[description]", one);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -245,7 +247,7 @@ public class browse implements Cmd {
|
||||
}
|
||||
|
||||
if (lines.isEmpty()) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.error.nojobs"));
|
||||
Language.sendMessage(sender, "command.browse.error.nojobs");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -260,9 +262,9 @@ public class browse implements Cmd {
|
||||
}
|
||||
|
||||
if (Jobs.getGCManager().JobsGUIShowChatBrowse) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.header"));
|
||||
Language.sendMessage(sender, "command.browse.output.header");
|
||||
lines.forEach(sender::sendMessage);
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.footer"));
|
||||
Language.sendMessage(sender, "command.browse.output.footer");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -11,6 +11,7 @@ import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.container.blockOwnerShip.BlockTypes;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
@ -18,7 +19,7 @@ import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
public class clearownership implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
JobsPlayer jPlayer = null;
|
||||
String location = null;
|
||||
|
||||
@ -47,8 +48,8 @@ public class clearownership implements Cmd {
|
||||
if (args.length >= 1)
|
||||
CMIMessages.sendMessage(sender, LC.info_NoInformation);
|
||||
else
|
||||
Jobs.getCommandManager().sendUsage(sender, "clearownership");
|
||||
return true;
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
final UUID uuid = jPlayer.getUniqueId();
|
||||
@ -64,8 +65,8 @@ public class clearownership implements Cmd {
|
||||
}
|
||||
}
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.clearownership.output.cleared", "[furnaces]", amounts.getOrDefault(BlockTypes.FURNACE, 0), "[brewing]", amounts.getOrDefault(
|
||||
BlockTypes.BREWING_STAND, 0), "[smoker]", amounts.getOrDefault(BlockTypes.SMOKER, 0), "[blast]", amounts.getOrDefault(BlockTypes.BLAST_FURNACE, 0)));
|
||||
Language.sendMessage(sender,"command.clearownership.output.cleared", "[furnaces]", amounts.getOrDefault(BlockTypes.FURNACE, 0), "[brewing]", amounts.getOrDefault(
|
||||
BlockTypes.BREWING_STAND, 0), "[smoker]", amounts.getOrDefault(BlockTypes.SMOKER, 0), "[blast]", amounts.getOrDefault(BlockTypes.BLAST_FURNACE, 0));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.gamingmesh.jobs.commands.list;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
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.Messages.CMIMessages;
|
||||
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
|
||||
|
||||
public class convert implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
CMIMessages.sendMessage(sender, LC.info_FromConsole);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length > 0) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "convert");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
String from = Jobs.getDBManager().getDbType() == DataBaseType.SqLite ? "SQLite" : "MySQL";
|
||||
String to = Jobs.getDBManager().getDbType() == DataBaseType.SqLite ? "MySQL" : "SQLite";
|
||||
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
CMIScheduler.get().runTaskAsynchronously(() -> {
|
||||
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;
|
||||
|
@ -7,27 +7,27 @@ import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
import net.Zrips.CMILib.Colors.CMIChatColor;
|
||||
|
||||
public class demote implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
if (args.length < 3) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "demote");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
|
||||
if (jPlayer == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0]));
|
||||
Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
Job job = Jobs.getJob(args[1]);
|
||||
if (job == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||
Language.sendMessage(sender, "general.error.job");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -45,16 +45,15 @@ public class demote implements Cmd {
|
||||
|
||||
Player player = jPlayer.getPlayer();
|
||||
if (player != null) {
|
||||
String message = Jobs.getLanguage().getMessage("command.demote.output.target",
|
||||
Language.sendMessage(sender, "command.demote.output.target",
|
||||
"%jobname%", job.getDisplayName() + CMIChatColor.WHITE,
|
||||
"%levelslost%", levelsLost);
|
||||
player.sendMessage(message);
|
||||
}
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
|
||||
Language.sendMessage(sender, "general.admin.success");
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
|
||||
Language.sendMessage(sender, "general.admin.error");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import com.gamingmesh.jobs.container.CurrencyType;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobItems;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
import net.Zrips.CMILib.Colors.CMIChatColor;
|
||||
import net.Zrips.CMILib.Items.CMIItemStack;
|
||||
@ -35,10 +36,10 @@ public class edititembonus implements Cmd {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
if (args.length < 1)
|
||||
@ -94,7 +95,7 @@ public class edititembonus implements Cmd {
|
||||
break;
|
||||
}
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.topline"));
|
||||
Language.sendMessage(sender, "command.bonus.output.topline");
|
||||
|
||||
Object key = new CMINBT(iih).getString("JobsItemBoost");
|
||||
if (key == null)
|
||||
@ -106,17 +107,16 @@ public class edititembonus implements Cmd {
|
||||
|
||||
BoostMultiplier boost = item.getBoost();
|
||||
|
||||
String mc = CMIChatColor.DARK_GREEN.toString(),
|
||||
pc = CMIChatColor.GOLD.toString(),
|
||||
ec = CMIChatColor.YELLOW.toString();
|
||||
String mc = CMIChatColor.DARK_GREEN.toString();
|
||||
String pc = CMIChatColor.GOLD.toString();
|
||||
String ec = CMIChatColor.YELLOW.toString();
|
||||
|
||||
for (Job one : item.getJobs()) {
|
||||
String msg = Jobs.getLanguage().getMessage("command.itembonus.output.list",
|
||||
Language.sendMessage(sender, "command.itembonus.output.list",
|
||||
"[jobname]", one.getName(),
|
||||
"%money%", mc + formatText((int) (boost.get(CurrencyType.MONEY) * 100)),
|
||||
"%points%", pc + formatText((int) (boost.get(CurrencyType.POINTS) * 100)),
|
||||
"%exp%", ec + formatText((int) (boost.get(CurrencyType.EXP) * 100)));
|
||||
sender.sendMessage(msg);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import net.Zrips.CMILib.Colors.CMIChatColor;
|
||||
import net.Zrips.CMILib.Container.PageInfo;
|
||||
import net.Zrips.CMILib.Items.CMIItemStack;
|
||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.RawMessages.RawMessage;
|
||||
import net.Zrips.CMILib.Version.Version;
|
||||
|
||||
@ -27,10 +28,12 @@ public class editjobs implements Cmd {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
|
||||
if (!(sender instanceof Player))
|
||||
if (!(sender instanceof Player)) {
|
||||
LC.info_Ingame.sendMessage(sender);
|
||||
return false;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
|
||||
@ -44,7 +47,9 @@ public class editjobs implements Cmd {
|
||||
|
||||
for (Job one : Jobs.getJobs()) {
|
||||
RawMessage rm = new RawMessage();
|
||||
rm.add(Jobs.getLanguage().getMessage("command.editjobs.help.list.jobs", "%jobname%", one.getJobDisplayName()), one.getName(), "jobs editjobs list " + one.getName());
|
||||
rm.addText(Jobs.getLanguage().getMessage("command.editjobs.help.list.jobs", "%jobname%", one.getDisplayName()))
|
||||
.addHover(one.getName())
|
||||
.addCommand("jobs editjobs list " + one.getName());
|
||||
rm.show(sender);
|
||||
}
|
||||
|
||||
@ -65,8 +70,9 @@ public class editjobs implements Cmd {
|
||||
continue;
|
||||
|
||||
RawMessage rm = new RawMessage();
|
||||
rm.add(Jobs.getLanguage().getMessage("command.editjobs.help.list.actions", "%actionname%", oneI.getName()), oneI.getName(), "jobs editjobs list " + job.getName() + " " + oneI.getName()
|
||||
+ " 1");
|
||||
rm.addText(Jobs.getLanguage().getMessage("command.editjobs.help.list.actions", "%actionname%", oneI.getName()))
|
||||
.addHover(oneI.getName())
|
||||
.addCommand("jobs editjobs list " + job.getName() + " " + oneI.getName() + " 1");
|
||||
rm.show(sender);
|
||||
}
|
||||
|
||||
@ -117,7 +123,7 @@ public class editjobs implements Cmd {
|
||||
rm.show(sender);
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.container.PlayerPoints;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
@ -12,15 +13,14 @@ import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
public class editpoints implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
if (args.length != 3) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "editpoints");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[1]);
|
||||
if (jPlayer == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[1]));
|
||||
Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -29,33 +29,33 @@ public class editpoints implements Cmd {
|
||||
amount = Double.parseDouble(args[2]);
|
||||
} catch (NumberFormatException e) {
|
||||
CMIMessages.sendMessage(sender, LC.info_UseInteger);
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayerPoints pointInfo = jPlayer.getPointsData();
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "take":
|
||||
pointInfo.takePoints(amount);
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.editpoints.output.take",
|
||||
Language.sendMessage(sender, "command.editpoints.output.take",
|
||||
"%playername%", jPlayer.getName(),
|
||||
"%playerdisplayname%", jPlayer.getDisplayName(),
|
||||
"%amount%", amount,
|
||||
"%total%", (int) (pointInfo.getCurrentPoints() * 100) / 100D));
|
||||
"%total%", (int) (pointInfo.getCurrentPoints() * 100) / 100D);
|
||||
break;
|
||||
case "add":
|
||||
pointInfo.addPoints(amount);
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.editpoints.output.add",
|
||||
Language.sendMessage(sender, "command.editpoints.output.add",
|
||||
"%playername%", jPlayer.getName(),
|
||||
"%playerdisplayname%", jPlayer.getDisplayName(),
|
||||
"%amount%", amount,
|
||||
"%total%", (int) (pointInfo.getCurrentPoints() * 100) / 100D));
|
||||
"%total%", (int) (pointInfo.getCurrentPoints() * 100) / 100D);
|
||||
break;
|
||||
case "set":
|
||||
pointInfo.setPoints(amount);
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.editpoints.output.set",
|
||||
Language.sendMessage(sender, "command.editpoints.output.set",
|
||||
"%playername%", jPlayer.getName(),
|
||||
"%playerdisplayname%", jPlayer.getDisplayName(),
|
||||
"%amount%", amount));
|
||||
"%amount%", amount);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -28,7 +28,6 @@ import net.Zrips.CMILib.Container.CMIText;
|
||||
import net.Zrips.CMILib.Container.PageInfo;
|
||||
import net.Zrips.CMILib.FileHandler.ConfigReader;
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||
import net.Zrips.CMILib.RawMessages.RawMessage;
|
||||
import net.Zrips.CMILib.RawMessages.RawMessageCommand;
|
||||
|
||||
@ -50,12 +49,17 @@ public class editquests implements Cmd {
|
||||
static HashMap<String, List<String>> tempObjectives = new HashMap<String, List<String>>();
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, String[] args) {
|
||||
|
||||
int page = 0;
|
||||
|
||||
Action action = null;
|
||||
|
||||
// Only informing here and not canceling command
|
||||
if (!Jobs.getGCManager().DailyQuestsEnabled) {
|
||||
LC.info_FeatureNotEnabled.sendMessage(sender);
|
||||
}
|
||||
|
||||
for (String one : args) {
|
||||
if (page == 0) {
|
||||
try {
|
||||
|
@ -7,38 +7,36 @@ import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
public class employ implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
if (args.length < 2) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "employ");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
|
||||
if (jPlayer == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0]));
|
||||
Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
Job job = Jobs.getJob(args[1]);
|
||||
if (job == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||
Language.sendMessage(sender, "general.error.job");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (jPlayer.isInJob(job)) {
|
||||
// already in job message
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.employ.error.alreadyin", "%jobname%", job.getDisplayName()));
|
||||
Language.sendMessage(sender, "command.employ.error.alreadyin", "%jobname%", job.getDisplayName());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (job.getMaxSlots() != null && Jobs.getUsedSlots(job) >= job.getMaxSlots()) {
|
||||
String message = Jobs.getLanguage().getMessage("command.employ.error.fullslots");
|
||||
message = message.replace("%jobname%", job.getDisplayName());
|
||||
sender.sendMessage(message);
|
||||
Language.sendMessage(sender, "command.employ.error.fullslots", "%jobname%", job.getDisplayName());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -47,11 +45,11 @@ public class employ implements Cmd {
|
||||
Jobs.getPlayerManager().joinJob(jPlayer, job);
|
||||
Player player = jPlayer.getPlayer();
|
||||
if (player != null)
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.employ.output.target", "%jobname%", job.getDisplayName()));
|
||||
Language.sendMessage(player, "command.employ.output.target", "%jobname%", job.getDisplayName());
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
|
||||
Language.sendMessage(sender, "general.admin.success");
|
||||
} catch (Throwable e) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
|
||||
Language.sendMessage(sender, "general.admin.error");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -6,20 +6,18 @@ import org.bukkit.entity.EntityType;
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
|
||||
import net.Zrips.CMILib.Colors.CMIChatColor;
|
||||
import net.Zrips.CMILib.Container.CMIText;
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
|
||||
public class entitylist implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (args.length != 0) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "entitylist");
|
||||
return true;
|
||||
}
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
|
||||
String msg = "",
|
||||
c1 = "&e",
|
||||
c2 = "&6";
|
||||
StringBuilder msg = new StringBuilder();
|
||||
String c1 = "&e";
|
||||
String c2 = "&6";
|
||||
|
||||
int i = 0;
|
||||
for (EntityType type : EntityType.values()) {
|
||||
@ -29,19 +27,19 @@ public class entitylist implements Cmd {
|
||||
i++;
|
||||
|
||||
if (!msg.isEmpty())
|
||||
msg += ", ";
|
||||
msg.append(LC.info_ListSpliter.getLocale());
|
||||
|
||||
if (i > 1) {
|
||||
msg += c1;
|
||||
msg.append(c1);
|
||||
i = 0;
|
||||
} else {
|
||||
msg += c2;
|
||||
msg.append(c2);
|
||||
}
|
||||
|
||||
msg += type.name().toLowerCase();
|
||||
msg.append(CMIText.everyFirstToUpperCase(type.name()));
|
||||
}
|
||||
|
||||
sender.sendMessage(CMIChatColor.translate(msg));
|
||||
CMIMessages.sendMessage(sender, msg.toString());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -21,11 +21,10 @@ public class exp implements Cmd {
|
||||
Random rand = new Random();
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
|
||||
if (args.length < 4) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "exp");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean silent = false;
|
||||
@ -120,20 +119,20 @@ public class exp implements Cmd {
|
||||
|
||||
Player player = jPlayer.getPlayer();
|
||||
if (player == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.give.output.notonline"));
|
||||
Language.sendMessage(sender, "general.give.output.notonline");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!silent)
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.exp.output.target", "%jobname%", job.getDisplayName(), "%level%", prog.getLevelFormatted(), "%exp%", prog
|
||||
.getExperience()));
|
||||
Language.sendMessage(player, "command.exp.output.target", "%jobname%", job.getDisplayName(), "%level%", prog.getLevelFormatted(), "%exp%", prog
|
||||
.getExperience());
|
||||
|
||||
if (!silentAdmin)
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
|
||||
Language.sendMessage(sender, "general.admin.success");
|
||||
|
||||
} catch (Exception e) {
|
||||
if (!silentAdmin)
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
|
||||
Language.sendMessage(sender, "general.admin.error");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -10,19 +10,24 @@ import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.ExploreChunk;
|
||||
import com.gamingmesh.jobs.container.ExploreRegion;
|
||||
import com.gamingmesh.jobs.container.PlayerInfo;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
|
||||
public class explored implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
if (!(sender instanceof Player))
|
||||
return false;
|
||||
public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
LC.info_Ingame.sendMessage(sender);
|
||||
return null;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
Map<String, ExploreRegion> exploreRegion = Jobs.getExploreManager().getWorlds().get(player.getWorld().getName());
|
||||
|
||||
if (exploreRegion == null) {
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.explored.error.noexplore"));
|
||||
Language.sendMessage(sender, "command.explored.error.noexplore");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -30,19 +35,19 @@ public class explored implements Cmd {
|
||||
int RegionZ = (int) Math.floor(player.getLocation().getChunk().getZ() / 32D);
|
||||
ExploreRegion region = exploreRegion.get(RegionX + ":" + RegionZ);
|
||||
if (region == null) {
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.explored.error.noexplore"));
|
||||
Language.sendMessage(sender, "command.explored.error.noexplore");
|
||||
return true;
|
||||
}
|
||||
|
||||
ExploreChunk chunk = region.getChunk(player.getLocation().getChunk());
|
||||
|
||||
if (chunk == null) {
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.explored.error.noexplore"));
|
||||
Language.sendMessage(sender, "command.explored.error.noexplore");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Jobs.getGCManager().ExploreCompact && chunk.isFullyExplored()) {
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.explored.fullExplore"));
|
||||
Language.sendMessage(sender, "command.explored.fullExplore");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -51,9 +56,9 @@ public class explored implements Cmd {
|
||||
for (int i = 0; i < players.size(); i++) {
|
||||
PlayerInfo ji = Jobs.getPlayerManager().getPlayerInfo(players.get(i));
|
||||
if (ji != null)
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.explored.list", "%place%", i + 1, "%playername%", ji.getName()));
|
||||
Language.sendMessage(sender, "command.explored.list", "%place%", i + 1, "%playername%", ji.getName());
|
||||
}
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("general.info.separator"));
|
||||
Language.sendMessage(sender, "general.info.separator");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -7,39 +7,39 @@ import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
public class fire implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (args.length < 2) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "fire");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
Job job = Jobs.getJob(args[1]);
|
||||
if (job == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||
Language.sendMessage(sender, "general.error.job");
|
||||
return true;
|
||||
}
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
|
||||
if (jPlayer == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0]));
|
||||
Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!jPlayer.isInJob(job)) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.fire.error.nojob", "%jobname%", job.getDisplayName()));
|
||||
Language.sendMessage(sender, "command.fire.error.nojob", "%jobname%", job.getDisplayName());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Jobs.getPlayerManager().leaveJob(jPlayer, job)) {
|
||||
Player player = jPlayer.getPlayer();
|
||||
if (player != null)
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.fire.output.target", "%jobname%", job.getDisplayName()));
|
||||
Language.sendMessage(player, "command.fire.output.target", "%jobname%", job.getDisplayName());
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
|
||||
Language.sendMessage(sender, "general.admin.success");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -8,6 +8,7 @@ import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.JobProgression;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.dao.JobsDAO.DBTables;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
@ -15,10 +16,9 @@ import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
public class fireall implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (args.length < 1) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "fireall");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("all")) {
|
||||
@ -38,27 +38,27 @@ public class fireall implements Cmd {
|
||||
one.setSaved(true);
|
||||
}
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
|
||||
Language.sendMessage(sender, "general.admin.success");
|
||||
return true;
|
||||
}
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
|
||||
if (jPlayer == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0]));
|
||||
Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (jPlayer.progression.isEmpty()) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.fireall.error.nojobs"));
|
||||
Language.sendMessage(sender, "command.fireall.error.nojobs");
|
||||
return true;
|
||||
}
|
||||
|
||||
Jobs.getPlayerManager().leaveAllJobs(jPlayer);
|
||||
Player player = jPlayer.getPlayer();
|
||||
if (player != null)
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.fireall.output.target"));
|
||||
Language.sendMessage(player, "command.fireall.output.target");
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
|
||||
Language.sendMessage(sender, "general.admin.success");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -11,12 +11,14 @@ import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobItems;
|
||||
import com.gamingmesh.jobs.container.JobLimitedItems;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
import com.gamingmesh.jobs.stuff.GiveItem;
|
||||
|
||||
public class give implements Cmd {
|
||||
|
||||
private enum actions {
|
||||
items, limiteditems;
|
||||
|
||||
public static actions getByname(String name) {
|
||||
for (actions one : actions.values()) {
|
||||
if (one.name().equalsIgnoreCase(name))
|
||||
@ -27,7 +29,7 @@ public class give implements Cmd {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
Player player = null;
|
||||
Job job = null;
|
||||
actions name = null;
|
||||
@ -58,8 +60,8 @@ public class give implements Cmd {
|
||||
player = (Player) sender;
|
||||
|
||||
if (player == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.give.output.notonline"));
|
||||
return true;
|
||||
Language.sendMessage(sender, "command.give.output.notonline");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (name == null)
|
||||
@ -76,7 +78,7 @@ public class give implements Cmd {
|
||||
ItemStack item = jItem == null ? null : jItem.getItemStack(player);
|
||||
|
||||
if (item == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.give.output.noitem"));
|
||||
Language.sendMessage(sender, "command.give.output.noitem");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -92,7 +94,7 @@ public class give implements Cmd {
|
||||
ItemStack limItem = jLItem == null ? null : jLItem.getItemStack(player);
|
||||
|
||||
if (limItem == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.give.output.noitem"));
|
||||
Language.sendMessage(sender, "command.give.output.noitem");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -15,23 +15,25 @@ import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.container.Log;
|
||||
import com.gamingmesh.jobs.container.LogAmounts;
|
||||
import com.gamingmesh.jobs.container.PlayerInfo;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
import com.gamingmesh.jobs.stuff.Sorting;
|
||||
import com.gamingmesh.jobs.stuff.TimeManage;
|
||||
|
||||
import net.Zrips.CMILib.Time.CMITimeManager;
|
||||
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
|
||||
|
||||
public class glog implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (args.length != 0) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "glog");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
CMIScheduler.get().runTaskAsynchronously(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Map<LogAmounts, Double> unsortMap = new HashMap<>();
|
||||
int time = TimeManage.timeInInt();
|
||||
int time = CMITimeManager.timeInInt();
|
||||
|
||||
for (Integer oneP : Jobs.getJobsDAO().getLognameList(time, time)) {
|
||||
PlayerInfo info = Jobs.getPlayerManager().getPlayerInfo(oneP);
|
||||
@ -61,7 +63,7 @@ public class glog implements Cmd {
|
||||
|
||||
unsortMap = Sorting.sortDoubleDESCByLog(unsortMap);
|
||||
if (unsortMap.isEmpty()) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.glog.output.nodata"));
|
||||
Language.sendMessage(sender, "command.glog.output.nodata");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -71,7 +73,7 @@ public class glog implements Cmd {
|
||||
totalExp = 0,
|
||||
totalPoints = 0;
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.glog.output.topline"));
|
||||
Language.sendMessage(sender, "command.glog.output.topline");
|
||||
for (LogAmounts info : unsortMap.keySet()) {
|
||||
double money = info.get(CurrencyType.MONEY);
|
||||
totalMoney += money;
|
||||
@ -94,14 +96,14 @@ public class glog implements Cmd {
|
||||
if (points != 0D)
|
||||
pointsS = Jobs.getLanguage().getMessage("command.glog.output.points", "%amount%", points);
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.glog.output.ls",
|
||||
Language.sendMessage(sender, "command.glog.output.ls",
|
||||
"%number%", count,
|
||||
"%action%", info.getAction(),
|
||||
"%item%", info.getItemName().replace(":0", "").replace('_', ' ').toLowerCase(),
|
||||
"%qty%", info.getCount(),
|
||||
"%money%", moneyS,
|
||||
"%exp%", expS,
|
||||
"%points%", pointsS));
|
||||
"%points%", pointsS);
|
||||
|
||||
count++;
|
||||
|
||||
@ -110,10 +112,10 @@ public class glog implements Cmd {
|
||||
}
|
||||
|
||||
NumberFormat format = NumberFormat.getInstance(Locale.ENGLISH);
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.glog.output.totalIncomes", "%money%", format.format(totalMoney),
|
||||
"%exp%", format.format(totalExp), "%points%", format.format(totalPoints)));
|
||||
Language.sendMessage(sender, "command.glog.output.totalIncomes", "%money%", format.format(totalMoney),
|
||||
"%exp%", format.format(totalExp), "%points%", format.format(totalPoints));
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.glog.output.bottomline"));
|
||||
Language.sendMessage(sender, "command.glog.output.bottomline");
|
||||
}
|
||||
});
|
||||
return true;
|
||||
|
@ -8,36 +8,36 @@ import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
public class grantxp implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (args.length < 3) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "grantxp");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
|
||||
if (jPlayer == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0]));
|
||||
Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
Job job = Jobs.getJob(args[1]);
|
||||
if (job == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||
Language.sendMessage(sender, "general.error.job");
|
||||
return true;
|
||||
}
|
||||
double xpGained;
|
||||
try {
|
||||
xpGained = Double.parseDouble(args[2]);
|
||||
} catch (NumberFormatException e) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
|
||||
Language.sendMessage(sender, "general.admin.error");
|
||||
return true;
|
||||
}
|
||||
if (xpGained <= 0) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
|
||||
Language.sendMessage(sender, "general.admin.error");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ public class grantxp implements Cmd {
|
||||
player.sendMessage(message);
|
||||
}
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
|
||||
Language.sendMessage(sender, "general.admin.success");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import org.bukkit.scoreboard.DisplaySlot;
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.TopList;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
import net.Zrips.CMILib.Container.PageInfo;
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
@ -19,15 +20,14 @@ import net.Zrips.CMILib.Scoreboards.CMIScoreboard;
|
||||
public class gtop implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
if (args.length > 1) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "gtop");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
@ -54,24 +54,24 @@ public class gtop implements Cmd {
|
||||
|
||||
List<TopList> FullList = Jobs.getJobsDAO().getGlobalTopList(pi.getStart());
|
||||
if (FullList.isEmpty()) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.gtop.error.nojob"));
|
||||
Language.sendMessage(sender, "command.gtop.error.nojob");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!Jobs.getGCManager().ShowToplistInScoreboard) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.gtop.output.topline", "%amount%", amount));
|
||||
Language.sendMessage(sender, "command.gtop.output.topline", "%amount%", amount);
|
||||
|
||||
int i = 0;
|
||||
for (TopList One : FullList) {
|
||||
if (i >= amount)
|
||||
break;
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.gtop.output.list",
|
||||
Language.sendMessage(sender, "command.gtop.output.list",
|
||||
"%number%", pi.getPositionForOutput(i),
|
||||
"%playername%", One.getPlayerInfo().getName(),
|
||||
"%playerdisplayname%", One.getPlayerInfo().getDisplayName(),
|
||||
"%level%", One.getLevel(),
|
||||
"%exp%", One.getExp()));
|
||||
"%exp%", One.getExp());
|
||||
++i;
|
||||
}
|
||||
} else {
|
||||
@ -92,7 +92,7 @@ public class gtop implements Cmd {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.ActionType;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
@ -15,29 +16,28 @@ import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
public class info implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
if (args.length < 1) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "info");
|
||||
Jobs.getCommandManager().sendValidActions(sender);
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
Player pSender = (Player) sender;
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(pSender);
|
||||
if (jPlayer == null) {
|
||||
pSender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", pSender.getName()));
|
||||
Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", pSender.getName());
|
||||
return true;
|
||||
}
|
||||
|
||||
Job job = Jobs.getJob(args[0]);
|
||||
if (job == null) {
|
||||
pSender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||
Language.sendMessage(sender, "general.error.job");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -27,10 +27,10 @@ import net.Zrips.CMILib.RawMessages.RawMessage;
|
||||
public class itembonus implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
|
@ -19,15 +19,14 @@ public class iteminfo implements Cmd {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
if (args.length != 0) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "iteminfo");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack iih = CMIItemStack.getItemInMainHand((Player) sender);
|
||||
|
@ -8,6 +8,7 @@ import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobProgression;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
@ -16,20 +17,19 @@ import net.Zrips.CMILib.RawMessages.RawMessage;
|
||||
public class join implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
if (args.length != 1 && args.length != 0 && args.length != 2) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "join");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.length == 0) {
|
||||
plugin.getServer().dispatchCommand(sender, "jobs browse");
|
||||
return true;
|
||||
return null;
|
||||
}
|
||||
|
||||
Job job = Jobs.getJob(args[0]);
|
||||
@ -58,17 +58,17 @@ public class join implements Cmd {
|
||||
|
||||
if (jPlayer.isInJob(job)) {
|
||||
// already in job message
|
||||
pSender.sendMessage(Jobs.getLanguage().getMessage("command.join.error.alreadyin", "%jobname%", job.getDisplayName()));
|
||||
Language.sendMessage(sender, "command.join.error.alreadyin", "%jobname%", job.getDisplayName());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (job.getMaxSlots() != null && Jobs.getUsedSlots(job) >= job.getMaxSlots()) {
|
||||
pSender.sendMessage(Jobs.getLanguage().getMessage("command.join.error.fullslots", "%jobname%", job.getDisplayName()));
|
||||
Language.sendMessage(sender, "command.join.error.fullslots", "%jobname%", job.getDisplayName());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!job.isIgnoreMaxJobs() && !Jobs.getPlayerManager().getJobsLimit(jPlayer, (short) jPlayer.progression.size())) {
|
||||
pSender.sendMessage(Jobs.getLanguage().getMessage("command.join.error.maxjobs"));
|
||||
Language.sendMessage(sender, "command.join.error.maxjobs");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -81,12 +81,12 @@ public class join implements Cmd {
|
||||
|
||||
JobProgression ajp = jPlayer.getArchivedJobProgression(job);
|
||||
if (ajp != null && !ajp.canRejoin()) {
|
||||
pSender.sendMessage(Jobs.getLanguage().getMessage("command.join.error.rejoin", "[time]", ajp.getRejoinTimeMessage()));
|
||||
Language.sendMessage(sender, "command.join.error.rejoin", "[time]", ajp.getRejoinTimeMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
Jobs.getPlayerManager().joinJob(jPlayer, job);
|
||||
pSender.sendMessage(Jobs.getLanguage().getMessage("command.join.success", "%jobname%", job.getDisplayName()));
|
||||
Language.sendMessage(sender, "command.join.success", "%jobname%", job.getDisplayName());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -7,32 +7,35 @@ import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
import com.gamingmesh.jobs.stuff.Util;
|
||||
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
|
||||
|
||||
public class leave implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (!(sender instanceof Player))
|
||||
return false;
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
LC.info_Ingame.sendMessage(sender);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (args.length < 1) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "leave");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
Player pSender = (Player) sender;
|
||||
Job job = Jobs.getJob(args[0]);
|
||||
if (job == null) {
|
||||
pSender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||
Language.sendMessage(sender, "general.error.job");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Jobs.getGCManager().UsePerPermissionForLeaving && !pSender.hasPermission("jobs.command.leave." + args[0].toLowerCase())) {
|
||||
CMIMessages.sendMessage(pSender, LC.info_NoPermission);
|
||||
CMIMessages.sendMessage(sender, LC.info_NoPermission);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -42,11 +45,11 @@ public class leave implements Cmd {
|
||||
if (!Util.LEAVECONFIRM.contains(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);
|
||||
|
||||
pSender.sendMessage(Jobs.getLanguage().getMessage("command.leave.confirmationNeed", "[jobname]",
|
||||
job.getDisplayName(), "[time]", Jobs.getGCManager().ConfirmExpiryTime));
|
||||
Language.sendMessage(sender, "command.leave.confirmationNeed", "[jobname]",
|
||||
job.getDisplayName(), "[time]", Jobs.getGCManager().ConfirmExpiryTime);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -56,9 +59,9 @@ public class leave implements Cmd {
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(pSender);
|
||||
|
||||
if (Jobs.getPlayerManager().leaveJob(jPlayer, job))
|
||||
pSender.sendMessage(Jobs.getLanguage().getMessage("command.leave.success", "%jobname%", job.getDisplayName(), "[jobname]", job.getDisplayName()));
|
||||
Language.sendMessage(sender, "command.leave.success", "%jobname%", job.getDisplayName(), "[jobname]", job.getDisplayName());
|
||||
else
|
||||
pSender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||
Language.sendMessage(sender, "general.error.job");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -9,18 +9,20 @@ import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.JobProgression;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
import com.gamingmesh.jobs.stuff.Util;
|
||||
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
|
||||
|
||||
public class leaveall implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
Player pSender = (Player) sender;
|
||||
@ -28,7 +30,7 @@ public class leaveall implements Cmd {
|
||||
|
||||
List<JobProgression> jobs = jPlayer.getJobProgression();
|
||||
if (jobs.isEmpty()) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.leaveall.error.nojobs"));
|
||||
Language.sendMessage(sender, "command.leaveall.error.nojobs");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -38,11 +40,11 @@ public class leaveall implements Cmd {
|
||||
if (!Util.LEAVECONFIRM.contains(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);
|
||||
|
||||
pSender.sendMessage(Jobs.getLanguage().getMessage("command.leaveall.confirmationNeed", "[time]",
|
||||
Jobs.getGCManager().ConfirmExpiryTime));
|
||||
Language.sendMessage(pSender, "command.leaveall.confirmationNeed", "[time]",
|
||||
Jobs.getGCManager().ConfirmExpiryTime);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -50,7 +52,7 @@ public class leaveall implements Cmd {
|
||||
}
|
||||
|
||||
Jobs.getPlayerManager().leaveAllJobs(jPlayer);
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.leaveall.success"));
|
||||
Language.sendMessage(sender, "command.leaveall.success");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobProgression;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
public class level implements Cmd {
|
||||
|
||||
@ -17,10 +18,9 @@ public class level implements Cmd {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
if (args.length < 4) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "level");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
Action action = Action.Add;
|
||||
@ -60,12 +60,12 @@ public class level implements Cmd {
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(playerName);
|
||||
if (jPlayer == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0]));
|
||||
Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (job == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||
Language.sendMessage(sender, "general.error.job");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -112,14 +112,14 @@ public class level implements Cmd {
|
||||
|
||||
Player player = jPlayer.getPlayer();
|
||||
if (player != null)
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.level.output.target", "%jobname%", job.getDisplayName(), "%level%", prog.getLevel(),
|
||||
"%exp%", String.format(Jobs.getGCManager().getDecimalPlacesExp(), prog.getExperience())));
|
||||
Language.sendMessage(player, "command.level.output.target", "%jobname%", job.getDisplayName(), "%level%", prog.getLevel(),
|
||||
"%exp%", String.format(Jobs.getGCManager().getDecimalPlacesExp(), prog.getExperience()));
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
|
||||
Language.sendMessage(sender, "general.admin.success");
|
||||
} else
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.level.error.nojob"));
|
||||
Language.sendMessage(sender, "command.level.error.nojob");
|
||||
} catch (Exception e) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
|
||||
Language.sendMessage(sender, "general.admin.error");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -8,18 +8,19 @@ import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.CurrencyType;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.economy.PaymentData;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
import net.Zrips.CMILib.Time.CMITimeManager;
|
||||
|
||||
public class limit implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (args.length != 0 && args.length != 1) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "limit");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
JobsPlayer JPlayer = null;
|
||||
@ -37,7 +38,7 @@ public class limit implements Cmd {
|
||||
}
|
||||
|
||||
if (disabled) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.limit.output.notenabled"));
|
||||
Language.sendMessage(sender,"command.limit.output.notenabled");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -54,16 +55,17 @@ public class limit implements Cmd {
|
||||
continue;
|
||||
PaymentData limit = JPlayer.getPaymentLimit();
|
||||
|
||||
if (limit.getLeftTime(type) <= 0)
|
||||
if (limit.getLeftTime(type) <= 0) {
|
||||
limit.resetLimits(type);
|
||||
}
|
||||
|
||||
if (limit.getLeftTime(type) > 0) {
|
||||
String typeName = type.getName().toLowerCase();
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.limit.output." + typeName + "time", "%time%", CMITimeManager.to24hourShort(limit.getLeftTime(type))));
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.limit.output." + typeName + "Limit",
|
||||
Language.sendMessage(sender, "command.limit.output." + typeName + "time", "%time%", CMITimeManager.to24hourShort(limit.getLeftTime(type)));
|
||||
Language.sendMessage(sender, "command.limit.output." + typeName + "Limit",
|
||||
"%current%", (int) (limit.getAmount(type) * 100) / 100D,
|
||||
"%total%", JPlayer.getLimit(type)));
|
||||
"%total%", JPlayer.getLimit(type));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -15,23 +15,23 @@ import com.gamingmesh.jobs.container.CurrencyType;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.container.Log;
|
||||
import com.gamingmesh.jobs.container.LogAmounts;
|
||||
import com.gamingmesh.jobs.stuff.Sorting;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
import net.Zrips.CMILib.Container.CMISort;
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
|
||||
public class log implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (!(sender instanceof Player) && args.length != 1) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
if (args.length != 1 && args.length != 0) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "log");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
JobsPlayer JPlayer = null;
|
||||
@ -39,7 +39,7 @@ public class log implements Cmd {
|
||||
JPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
||||
else if (args.length == 1) {
|
||||
if (!Jobs.hasPermission(sender, "jobs.command.log.others", true))
|
||||
return true;
|
||||
return null;
|
||||
|
||||
JPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
|
||||
}
|
||||
@ -51,9 +51,9 @@ public class log implements Cmd {
|
||||
|
||||
Map<String, Log> logList = JPlayer.getLog();
|
||||
if (logList == null || logList.isEmpty()) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.bottomline"));
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.nodata"));
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.bottomline"));
|
||||
Language.sendMessage(sender, "command.log.output.bottomline");
|
||||
Language.sendMessage(sender, "command.log.output.nodata");
|
||||
Language.sendMessage(sender, "command.log.output.bottomline");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -65,16 +65,16 @@ public class log implements Cmd {
|
||||
}
|
||||
}
|
||||
|
||||
unsortMap = Sorting.sortDoubleDESC(unsortMap);
|
||||
unsortMap = CMISort.sortDoubleDESC(unsortMap);
|
||||
if (unsortMap.isEmpty()) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.nodata"));
|
||||
Language.sendMessage(sender, "command.log.output.nodata");
|
||||
return true;
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
int max = 10;
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.topline", "%playername%", JPlayer.getName(), "%playerdisplayname%", JPlayer.getDisplayName()));
|
||||
Language.sendMessage(sender, "command.log.output.topline", "%playername%", JPlayer.getName(), "%playerdisplayname%", JPlayer.getDisplayName());
|
||||
for (Log one : logList.values()) {
|
||||
double totalMoney = 0, totalExp = 0, totalPoints = 0;
|
||||
|
||||
@ -106,14 +106,14 @@ public class log implements Cmd {
|
||||
if (points != 0D)
|
||||
pointsS = Jobs.getLanguage().getMessage("command.log.output.points", "%amount%", points);
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.ls",
|
||||
Language.sendMessage(sender, "command.log.output.ls",
|
||||
"%number%", count,
|
||||
"%action%", one.getActionType(),
|
||||
"%item%", amounts.getItemName().replace(":0", "").replace('_', ' ').toLowerCase(),
|
||||
"%qty%", amounts.getCount(),
|
||||
"%money%", moneyS,
|
||||
"%exp%", expS,
|
||||
"%points%", pointsS));
|
||||
"%points%", pointsS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -123,14 +123,14 @@ public class log implements Cmd {
|
||||
}
|
||||
|
||||
NumberFormat format = NumberFormat.getInstance(Locale.ENGLISH);
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.totalIncomes", "%money%", format.format(totalMoney),
|
||||
"%exp%", format.format(totalExp), "%points%", format.format(totalPoints)));
|
||||
Language.sendMessage(sender, "command.log.output.totalIncomes", "%money%", format.format(totalMoney),
|
||||
"%exp%", format.format(totalExp), "%points%", format.format(totalPoints));
|
||||
|
||||
if (count > max)
|
||||
break;
|
||||
}
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.bottomline"));
|
||||
Language.sendMessage(sender, "command.log.output.bottomline");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -26,11 +26,11 @@ import net.Zrips.CMILib.RawMessages.RawMessage;
|
||||
public class ownedblocks implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
JobsPlayer jPlayer = null;
|
||||
if (args.length >= 1) {
|
||||
if (!Jobs.hasPermission(sender, "jobs.command.admin.ownedblocks", true))
|
||||
return true;
|
||||
return null;
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
|
||||
} else if (sender instanceof Player)
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
||||
@ -39,8 +39,8 @@ public class ownedblocks implements Cmd {
|
||||
if (args.length >= 1)
|
||||
CMIMessages.sendMessage(sender, LC.info_NoInformation);
|
||||
else
|
||||
Jobs.getCommandManager().sendUsage(sender, "ownedblocks");
|
||||
return true;
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
final JobsPlayer jp = jPlayer;
|
||||
|
@ -8,14 +8,16 @@ import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.Placeholders.Placeholder.JobsPlaceHolders;
|
||||
import com.gamingmesh.jobs.Placeholders.Placeholder.JobsPlaceholderType;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
import net.Zrips.CMILib.Container.PageInfo;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
import net.Zrips.CMILib.RawMessages.RawMessage;
|
||||
|
||||
public class placeholders implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
boolean isPlayer = sender instanceof Player;
|
||||
Player player = isPlayer ? (Player) sender : null;
|
||||
|
||||
@ -31,7 +33,7 @@ public class placeholders implements Cmd {
|
||||
} else {
|
||||
player = Bukkit.getPlayer(args[0]);
|
||||
if (player == null) {
|
||||
Jobs.consoleMsg("&cPlayer cannot be null!");
|
||||
CMIMessages.consoleMessage("&cPlayer cannot be null!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -41,10 +43,10 @@ public class placeholders implements Cmd {
|
||||
String placeholder = args[1];
|
||||
JobsPlaceholderType type = plugin.getPlaceholderAPIManager().getPlaceHolderType(player, placeholder);
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.placeholders.output.parse",
|
||||
Language.sendMessage(sender, "command.placeholders.output.parse",
|
||||
"[placeholder]", placeholder,
|
||||
"[source]", type == null ? "Unknown" : type.name(),
|
||||
"[result]", plugin.getPlaceholderAPIManager().updatePlaceHolders(player, placeholder)));
|
||||
"[result]", plugin.getPlaceholderAPIManager().updatePlaceHolders(player, placeholder));
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -71,23 +73,12 @@ public class placeholders implements Cmd {
|
||||
if (plugin.isPlaceholderAPIEnabled()) {
|
||||
hover = place = one.getFull();
|
||||
}
|
||||
// For MVdWPlaceholderAPI
|
||||
// if (plugin.isMVdWPlaceholderAPIEnabled()) {
|
||||
// if (!plugin.isPlaceholderAPIEnabled()) {
|
||||
// place = one.getFull().substring(1, one.getFull().length() - 2);
|
||||
// place = "{" + place + "}";
|
||||
// }
|
||||
// if (hover.isEmpty())
|
||||
// hover = one.getFull();
|
||||
// else
|
||||
// hover += "\n" + "{" + one.getFull().substring(1, one.getFull().length() - 2) + "}";
|
||||
// }
|
||||
rm.addText(Jobs.getLanguage().getMessage("command.placeholders.output.list", "[place]", pi.getPositionForOutput(), "[placeholder]", place) + extra)
|
||||
.addHover(hover).addSuggestion(one.getFull()).show(sender);
|
||||
}
|
||||
|
||||
if (player != null)
|
||||
plugin.showPagination(sender, pi, "jobs placeholders", "-p:");
|
||||
pi.autoPagination(sender, "jobs placeholders", "-p:");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -6,26 +6,26 @@ import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
public class playerinfo implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (args.length < 2) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "playerinfo");
|
||||
Jobs.getCommandManager().sendValidActions(sender);
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
|
||||
if (jPlayer == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0]));
|
||||
Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
Job job = Jobs.getJob(args[1]);
|
||||
if (job == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||
Language.sendMessage(sender, "general.error.job");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.container.PlayerPoints;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
@ -14,11 +15,10 @@ import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
public class points implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
|
||||
if (args.length != 0 && args.length != 1) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "points");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
JobsPlayer jPlayer = null;
|
||||
@ -41,10 +41,10 @@ public class points implements Cmd {
|
||||
|
||||
PlayerPoints pointInfo = jPlayer.getPointsData();
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.toplineseparator", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getDisplayName()));
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.points.currentpoints", "%currentpoints%", (int) (pointInfo.getCurrentPoints() * 100) / 100D));
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.points.totalpoints", "%totalpoints%", (int) (pointInfo.getTotalPoints() * 100) / 100D));
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator"));
|
||||
Language.sendMessage(sender, "general.info.toplineseparator", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getDisplayName());
|
||||
Language.sendMessage(sender, "command.points.currentpoints", "%currentpoints%", (int) (pointInfo.getCurrentPoints() * 100) / 100D);
|
||||
Language.sendMessage(sender, "command.points.totalpoints", "%totalpoints%", (int) (pointInfo.getTotalPoints() * 100) / 100D);
|
||||
Language.sendMessage(sender, "general.info.separator");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -7,25 +7,25 @@ import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
public class promote implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (args.length < 3) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "promote");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
|
||||
if (jPlayer == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0]));
|
||||
Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
Job job = Jobs.getJob(args[1]);
|
||||
if (job == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||
Language.sendMessage(sender, "general.error.job");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -54,14 +54,14 @@ public class promote implements Cmd {
|
||||
|
||||
Player player = jPlayer.getPlayer();
|
||||
if (player != null)
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.promote.output.target",
|
||||
Language.sendMessage(player, "command.promote.output.target",
|
||||
"%jobname%", job.getDisplayName(),
|
||||
"%levelsgained%", levelsGained));
|
||||
"%levelsgained%", levelsGained);
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
|
||||
Language.sendMessage(sender, "general.admin.success");
|
||||
|
||||
} catch (Throwable e) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
|
||||
Language.sendMessage(sender, "general.admin.error");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.container.Quest;
|
||||
import com.gamingmesh.jobs.container.QuestObjective;
|
||||
import com.gamingmesh.jobs.container.QuestProgression;
|
||||
import com.gamingmesh.jobs.stuff.TimeManage;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
@ -24,13 +24,19 @@ import net.Zrips.CMILib.Time.CMITimeManager;
|
||||
public class quests implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, String[] args) {
|
||||
|
||||
if (!Jobs.getGCManager().DailyQuestsEnabled) {
|
||||
LC.info_FeatureNotEnabled.sendMessage(sender);
|
||||
return null;
|
||||
}
|
||||
|
||||
JobsPlayer jPlayer = null;
|
||||
boolean isPlayer = sender instanceof Player;
|
||||
|
||||
if (args.length >= 1 && !args[0].equalsIgnoreCase("stop") && !args[0].equalsIgnoreCase("start")) {
|
||||
if (!Jobs.hasPermission(sender, "jobs.command.admin.quests", true))
|
||||
return true;
|
||||
return null;
|
||||
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
|
||||
} else if (isPlayer)
|
||||
@ -47,7 +53,7 @@ public class quests implements Cmd {
|
||||
List<QuestProgression> questProgs = jPlayer.getQuestProgressions();
|
||||
|
||||
if (questProgs.isEmpty()) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.quests.error.noquests"));
|
||||
Language.sendMessage(sender, "command.quests.error.noquests");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -66,13 +72,13 @@ public class quests implements Cmd {
|
||||
q.getQuest().setStopped(stopped);
|
||||
}
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.quests.status.changed", "%status%",
|
||||
stopped ? Jobs.getLanguage().getMessage("command.quests.status.stopped") : Jobs.getLanguage().getMessage("command.quests.status.started")));
|
||||
Language.sendMessage(sender, "command.quests.status.changed", "%status%",
|
||||
stopped ? Jobs.getLanguage().getMessage("command.quests.status.stopped") : Jobs.getLanguage().getMessage("command.quests.status.started"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.quests.toplineseparator", "[playerName]", jPlayer.getName(), "[questsDone]", jPlayer.getDoneQuests()));
|
||||
Language.sendMessage(sender, "command.quests.toplineseparator", "[playerName]", jPlayer.getName(), "[questsDone]", jPlayer.getDoneQuests());
|
||||
|
||||
for (JobProgression jobProg : jPlayer.progression) {
|
||||
List<QuestProgression> list = jPlayer.getQuestProgressions(jobProg.getJob());
|
||||
|
@ -4,13 +4,14 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
public class reload implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
Jobs.reload();
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
|
||||
Language.sendMessage(sender, "general.admin.success");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -7,37 +7,37 @@ import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
public class removexp implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (args.length < 3) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "removexp");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
|
||||
|
||||
if (jPlayer == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0]));
|
||||
Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
Job job = Jobs.getJob(args[1]);
|
||||
if (job == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||
return true;
|
||||
Language.sendMessage(sender, "general.error.job");
|
||||
return null;
|
||||
}
|
||||
double xpLost = 0D;
|
||||
try {
|
||||
xpLost = Double.parseDouble(args[2]);
|
||||
} catch (NumberFormatException e) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
|
||||
Language.sendMessage(sender, "general.admin.error");
|
||||
return true;
|
||||
}
|
||||
if (xpLost <= 0 || xpLost > Double.MAX_VALUE) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
|
||||
Language.sendMessage(sender, "general.admin.error");
|
||||
return true;
|
||||
}
|
||||
// check if player already has the job
|
||||
@ -46,12 +46,12 @@ public class removexp implements Cmd {
|
||||
|
||||
Player player = jPlayer.getPlayer();
|
||||
if (player != null) {
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.removexp.output.target",
|
||||
Language.sendMessage(player, "command.removexp.output.target",
|
||||
"%jobname%", job.getDisplayName(),
|
||||
"%xplost%", xpLost));
|
||||
"%xplost%", xpLost);
|
||||
}
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
|
||||
Language.sendMessage(sender, "general.admin.success");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
public class resetexploreregion implements Cmd {
|
||||
|
||||
@ -11,25 +12,24 @@ public class resetexploreregion implements Cmd {
|
||||
private static String REGEX = "^[0-9a-zA-Z_-]+$";
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
if (args.length != 2 || !WORLD.equals(args[0])) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "resetexploreregion");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Jobs.getGCManager().resetExploringData) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetexploreregion.output.notenabled"));
|
||||
Language.sendMessage(sender, "command.resetexploreregion.output.notenabled");
|
||||
return true;
|
||||
}
|
||||
|
||||
final String worldName = args[1];
|
||||
if (!worldName.matches(REGEX)) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetexploreregion.output.invalidname"));
|
||||
Language.sendMessage(sender, "command.resetexploreregion.output.invalidname");
|
||||
return true;
|
||||
}
|
||||
|
||||
Jobs.getExploreManager().resetRegion(worldName);
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetexploreregion.output.reseted", "%worldname%", worldName));
|
||||
Language.sendMessage(sender, "command.resetexploreregion.output.reseted", "%worldname%", worldName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -4,14 +4,14 @@ import org.bukkit.command.CommandSender;
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
public class resetlimit implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (args.length != 1) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "resetlimit");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("all")) {
|
||||
@ -22,18 +22,18 @@ public class resetlimit implements Cmd {
|
||||
}
|
||||
}
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetlimit.output.reseted", "%playername%", ""));
|
||||
Language.sendMessage(sender, "command.resetlimit.output.reseted", "%playername%", "");
|
||||
return true;
|
||||
}
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
|
||||
if (jPlayer == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0]));
|
||||
Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
jPlayer.resetPaymentLimit();
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetlimit.output.reseted", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getDisplayName()));
|
||||
Language.sendMessage(sender, "command.resetlimit.output.reseted", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getDisplayName());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -10,16 +10,24 @@ import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.container.QuestProgression;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
|
||||
public class resetquest implements Cmd {
|
||||
|
||||
@Override
|
||||
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");
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
|
||||
if (!Jobs.getGCManager().DailyQuestsEnabled) {
|
||||
LC.info_FeatureNotEnabled.sendMessage(sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length != 0 && args.length != 1 && args.length != 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
JobsPlayer jPlayer = null;
|
||||
Job job = null;
|
||||
|
||||
@ -36,7 +44,7 @@ public class resetquest implements Cmd {
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
||||
|
||||
if (jPlayer == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args.length > 0 ? args[0] : ""));
|
||||
Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args.length > 0 ? args[0] : "");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -46,12 +54,12 @@ public class resetquest implements Cmd {
|
||||
quests = jPlayer.getQuestProgressions(job);
|
||||
|
||||
if (quests.isEmpty()) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquest.output.noQuests"));
|
||||
Language.sendMessage(sender, "command.resetquest.output.noQuests");
|
||||
return true;
|
||||
}
|
||||
|
||||
jPlayer.resetQuests(quests);
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquest.output.reseted", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getName()));
|
||||
Language.sendMessage(sender, "command.resetquest.output.reseted", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getName());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -10,22 +10,29 @@ import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
|
||||
public class resetquesttotal implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (args.length != 0 && args.length != 1) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "resetquesttotal");
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (!Jobs.getGCManager().DailyQuestsEnabled) {
|
||||
LC.info_FeatureNotEnabled.sendMessage(sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length != 0 && args.length != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.length > 0 && args[0].equalsIgnoreCase("all")) {
|
||||
for (Entry<UUID, JobsPlayer> pl : Jobs.getPlayerManager().getPlayersCache().entrySet()) {
|
||||
pl.getValue().setDoneQuests(0);
|
||||
}
|
||||
Jobs.getJobsDAO().resetDoneQuests();
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquesttotal.output.reseted", "%playername%", Jobs.getPlayerManager().getPlayersCache().size()));
|
||||
Language.sendMessage(sender,"command.resetquesttotal.output.reseted", "%playername%", Jobs.getPlayerManager().getPlayersCache().size());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -45,14 +52,14 @@ public class resetquesttotal implements Cmd {
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
||||
|
||||
if (jPlayer == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args.length > 0 ? args[0] : ""));
|
||||
Language.sendMessage(sender,"general.error.noinfoByPlayer", "%playername%", args.length > 0 ? args[0] : "");
|
||||
return true;
|
||||
}
|
||||
|
||||
jPlayer.setDoneQuests(0);
|
||||
jPlayer.setSaved(false);
|
||||
jPlayer.save();
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquesttotal.output.reseted", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getDisplayName()));
|
||||
Language.sendMessage(sender,"command.resetquesttotal.output.reseted", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getDisplayName());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -9,14 +9,15 @@ import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
public class schedule implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(final Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(final Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (args.length < 2) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "schedule");
|
||||
return true;
|
||||
return null;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("enable")) {
|
||||
@ -32,12 +33,12 @@ public class schedule implements Cmd {
|
||||
|
||||
ConfigurationSection path = c.getConfigurationSection("Boost." + name);
|
||||
if (path == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.schedule.output.noScheduleFound"));
|
||||
return false;
|
||||
Language.sendMessage(sender,"command.schedule.output.noScheduleFound");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (path.getBoolean("Enabled")) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.schedule.output.alreadyEnabled"));
|
||||
Language.sendMessage(sender,"command.schedule.output.alreadyEnabled");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -63,7 +64,7 @@ public class schedule implements Cmd {
|
||||
|
||||
Jobs.getScheduleManager().load();
|
||||
Jobs.getScheduleManager().start();
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.schedule.output.enabled", "%until%", until, "%from%", from));
|
||||
Language.sendMessage(sender,"command.schedule.output.enabled", "%until%", until, "%from%", from);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -2,25 +2,29 @@ package com.gamingmesh.jobs.commands.list;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
|
||||
public class shop implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
|
||||
if (!Jobs.getGCManager().jobsshopenabled) {
|
||||
LC.info_FeatureNotEnabled.sendMessage(sender);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
return true;
|
||||
LC.info_Ingame.sendMessage(sender);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (args.length != 0 && args.length != 1) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "shop");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
int page = 1;
|
||||
|
@ -6,17 +6,21 @@ import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.Signs.SignTopType;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
|
||||
public class signupdate implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (!Jobs.getGCManager().SignsEnabled)
|
||||
return true;
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (!Jobs.getGCManager().SignsEnabled) {
|
||||
LC.info_FeatureNotEnabled.sendMessage(sender);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (args.length != 1) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "signupdate");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("all")) {
|
||||
@ -26,8 +30,8 @@ public class signupdate implements Cmd {
|
||||
|
||||
Job oldjob = Jobs.getJob(args[0]);
|
||||
if (oldjob == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||
return true;
|
||||
Language.sendMessage(sender, "general.error.job");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (args.length == 2) {
|
||||
@ -35,7 +39,6 @@ public class signupdate implements Cmd {
|
||||
if (type != null) {
|
||||
Jobs.getSignUtil().signUpdate(oldjob, type);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ package com.gamingmesh.jobs.commands.list;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.gamingmesh.jobs.stuff.Util;
|
||||
import org.bukkit.command.CommandSender;
|
||||
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.QuestProgression;
|
||||
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 {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (args.length != 2 && args.length != 3) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "skipquest");
|
||||
return true;
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (!Jobs.getGCManager().DailyQuestsEnabled) {
|
||||
LC.info_FeatureNotEnabled.sendMessage(sender);
|
||||
return null;
|
||||
}
|
||||
// Needs to allow longer so multiword quest names work
|
||||
if (args.length < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
JobsPlayer jPlayer = null;
|
||||
@ -47,8 +56,8 @@ public class skipquest implements Cmd {
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
||||
|
||||
if (jPlayer == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args.length > 0 ? args[0] : ""));
|
||||
return true;
|
||||
Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args.length > 0 ? args[0] : "");
|
||||
return null;
|
||||
}
|
||||
|
||||
List<QuestProgression> quests = jPlayer.getQuestProgressions();
|
||||
@ -57,8 +66,8 @@ public class skipquest implements Cmd {
|
||||
quests = jPlayer.getQuestProgressions(job);
|
||||
|
||||
if (quests == null || quests.isEmpty()) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquest.output.noQuests"));
|
||||
return true;
|
||||
Language.sendMessage(sender, "command.resetquest.output.noQuests");
|
||||
return null;
|
||||
}
|
||||
|
||||
Quest old = null;
|
||||
@ -93,12 +102,29 @@ public class skipquest implements Cmd {
|
||||
|
||||
if (amount > 0 && player != null) {
|
||||
if (!econ.getEconomy().hasMoney(player, amount)) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("economy.error.nomoney"));
|
||||
return false;
|
||||
Language.sendMessage(sender, "economy.error.nomoney");
|
||||
return null;
|
||||
}
|
||||
|
||||
econ.getEconomy().withdrawPlayer(player, amount);
|
||||
}
|
||||
// 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);
|
||||
|
||||
@ -106,7 +132,7 @@ public class skipquest implements Cmd {
|
||||
plugin.getServer().dispatchCommand(player, "jobs quests");
|
||||
|
||||
if (amount > 0) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.skipquest.output.questSkipForCost", "%amount%", amount));
|
||||
Language.sendMessage(sender, "command.skipquest.output.questSkipForCost", "%amount%", amount);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -8,6 +8,7 @@ import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.commands.JobsCommands;
|
||||
import com.gamingmesh.jobs.container.JobProgression;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
@ -16,7 +17,7 @@ import net.Zrips.CMILib.RawMessages.RawMessage;
|
||||
public class stats implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
|
||||
JobsPlayer jPlayer = null;
|
||||
if (args.length >= 1) {
|
||||
@ -35,23 +36,23 @@ public class stats implements Cmd {
|
||||
}
|
||||
|
||||
if (jPlayer.progression.isEmpty()) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.stats.error.nojob"));
|
||||
Language.sendMessage(sender, "command.stats.error.nojob");
|
||||
return true;
|
||||
}
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.toplineseparator", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getDisplayName()));
|
||||
Language.sendMessage(sender, "general.info.toplineseparator", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getDisplayName());
|
||||
|
||||
String leftClick = Jobs.getLanguage().getMessage("command.info.gui.leftClick");
|
||||
|
||||
String pref = JobsCommands.LABEL + " " + info.class.getSimpleName() + " ";
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator"));
|
||||
Language.sendMessage(sender, "general.info.separator");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import org.bukkit.entity.Player;
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
import com.gamingmesh.jobs.stuff.ToggleBarHandling;
|
||||
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
@ -15,16 +16,15 @@ import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
public class toggle implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
boolean isBossbar = false, isActionbar = false;
|
||||
if (args.length != 1 || (!(isBossbar = args[0].equalsIgnoreCase("bossbar")) && !(isActionbar = args[0].equalsIgnoreCase("actionbar")))) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "toggle");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
@ -35,10 +35,10 @@ public class toggle implements Cmd {
|
||||
|
||||
if (ex == null || ex.booleanValue()) {
|
||||
ToggleBarHandling.getActionBarToggle().put(playerUUID, false);
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.toggle.output.off"));
|
||||
Language.sendMessage(sender, "command.toggle.output.off");
|
||||
} else {
|
||||
ToggleBarHandling.getActionBarToggle().put(playerUUID, true);
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.toggle.output.on"));
|
||||
Language.sendMessage(sender, "command.toggle.output.on");
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,14 +47,14 @@ public class toggle implements Cmd {
|
||||
|
||||
if (ex == null || ex.booleanValue()) {
|
||||
ToggleBarHandling.getBossBarToggle().put(playerUUID, false);
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.toggle.output.off"));
|
||||
Language.sendMessage(sender, "command.toggle.output.off");
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player.getUniqueId());
|
||||
if (jPlayer != null)
|
||||
jPlayer.hideBossBars();
|
||||
} else {
|
||||
ToggleBarHandling.getBossBarToggle().put(playerUUID, true);
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.toggle.output.on"));
|
||||
Language.sendMessage(sender, "command.toggle.output.on");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.TopList;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
import net.Zrips.CMILib.Container.PageInfo;
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
@ -20,21 +21,19 @@ import net.Zrips.CMILib.Scoreboards.CMIScoreboard;
|
||||
public class top implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
return false;
|
||||
}
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
|
||||
if (args.length != 1 && args.length != 2) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "top");
|
||||
return false;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
Player player = sender instanceof Player ? (Player) sender : null;
|
||||
|
||||
if (args[0].equalsIgnoreCase("clear")) {
|
||||
if (player != null) {
|
||||
player.getScoreboard().clearSlot(DisplaySlot.SIDEBAR);
|
||||
CMIScoreboard.removeScoreBoard(player);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -43,7 +42,7 @@ public class top implements Cmd {
|
||||
try {
|
||||
page = Integer.parseInt(args[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (page < 1)
|
||||
@ -51,8 +50,8 @@ public class top implements Cmd {
|
||||
|
||||
Job job = Jobs.getJob(args[0]);
|
||||
if (job == null) {
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.top.error.nojob"));
|
||||
return false;
|
||||
Language.sendMessage(sender, "command.top.error.nojob");
|
||||
return null;
|
||||
}
|
||||
|
||||
int workingIn = Jobs.getUsedSlots(job);
|
||||
@ -64,25 +63,24 @@ public class top implements Cmd {
|
||||
return true;
|
||||
}
|
||||
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.top.help.info"));
|
||||
|
||||
int place = 1;
|
||||
|
||||
if (!Jobs.getGCManager().ShowToplistInScoreboard) {
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.top.output.topline", "%jobname%", job.getName(), "%amount%", Jobs.getGCManager().JobsTopAmount));
|
||||
if (!Jobs.getGCManager().ShowToplistInScoreboard || player == null) {
|
||||
Language.sendMessage(sender, "command.top.output.topline", "%jobname%", job.getName(), "%amount%", Jobs.getGCManager().JobsTopAmount);
|
||||
|
||||
for (TopList one : fullList) {
|
||||
if (place > Jobs.getGCManager().JobsTopAmount)
|
||||
break;
|
||||
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.top.output.list",
|
||||
Language.sendMessage(sender, "command.top.output.list",
|
||||
"%number%", ((page - 1) * Jobs.getGCManager().JobsTopAmount) + place,
|
||||
"%playername%", one.getPlayerInfo().getName(),
|
||||
"%playerdisplayname%", one.getPlayerInfo().getDisplayName(),
|
||||
"%level%", one.getLevel(),
|
||||
"%exp%", one.getExp()));
|
||||
"%exp%", one.getExp());
|
||||
place++;
|
||||
}
|
||||
plugin.showPagination(sender, pi, "jobs top " + job.getName());
|
||||
pi.autoPagination(sender, "jobs top " + job.getName());
|
||||
} else {
|
||||
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);
|
||||
|
||||
plugin.showPagination(sender, pi, "jobs top " + job.getName());
|
||||
pi.autoPagination(sender, "jobs top " + job.getName());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -7,31 +7,31 @@ import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
public class transfer implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (args.length < 3) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "transfer");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
|
||||
if (jPlayer == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0]));
|
||||
Language.sendMessage(sender, "general.error.noinfoByPlayer", "%playername%", args[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
Job oldjob = Jobs.getJob(args[1]);
|
||||
if (oldjob == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||
Language.sendMessage(sender, "general.error.job");
|
||||
return true;
|
||||
}
|
||||
|
||||
Job newjob = Jobs.getJob(args[2]);
|
||||
if (newjob == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||
Language.sendMessage(sender, "general.error.job");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -41,15 +41,14 @@ public class transfer implements Cmd {
|
||||
|
||||
Player player = jPlayer.getPlayer();
|
||||
if (player != null) {
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.transfer.output.target",
|
||||
Language.sendMessage(player, "command.transfer.output.target",
|
||||
"%oldjobname%", oldjob.getDisplayName(),
|
||||
"%newjobname%", newjob.getDisplayName()));
|
||||
"%newjobname%", newjob.getDisplayName());
|
||||
}
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
|
||||
Language.sendMessage(sender, "general.admin.success");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
|
||||
Language.sendMessage(sender, "general.admin.error");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -13,14 +13,15 @@ import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
import net.Zrips.CMILib.RawMessages.RawMessage;
|
||||
import net.Zrips.CMILib.Util.CMIVersionChecker;
|
||||
import net.Zrips.CMILib.Version.Version;
|
||||
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
|
||||
public class version implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
CMIScheduler.get().runTaskAsynchronously(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@ -62,7 +63,7 @@ public class version implements Cmd {
|
||||
final String vault = preVault;
|
||||
final String vaultProvider = vProvider;
|
||||
|
||||
Bukkit.getScheduler().runTask(plugin, new Runnable() {
|
||||
CMIScheduler.get().runTask(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
|
@ -16,7 +16,7 @@ import com.gamingmesh.jobs.container.DBAction;
|
||||
import net.Zrips.CMILib.Container.CMIBlock;
|
||||
import net.Zrips.CMILib.Container.CMIBlock.Bisect;
|
||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
|
||||
|
||||
public class BlockProtectionManager {
|
||||
|
||||
@ -80,7 +80,7 @@ public class BlockProtectionManager {
|
||||
|
||||
public BlockProtection addP(Location loc, Long time, boolean paid, boolean cache) {
|
||||
|
||||
if (time == 0)
|
||||
if (time == null || time == 0)
|
||||
return null;
|
||||
|
||||
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());
|
||||
else {
|
||||
Bp.setAction(DBAction.UPDATE);
|
||||
if (Bp.getSchedId() > -1)
|
||||
Bukkit.getServer().getScheduler().cancelTask(Bp.getSchedId());
|
||||
if (Bp.getScheduler() != null)
|
||||
Bp.getScheduler().cancel();
|
||||
}
|
||||
|
||||
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 (time > -1 && (time - System.currentTimeMillis()) / 1000 < 60 * 60 * 2)
|
||||
Bp.setSchedId(Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Jobs.getInstance(), () -> {
|
||||
Bp.setScheduler(CMIScheduler.get().runTaskLater(() -> {
|
||||
remove(loc);
|
||||
}, (time - System.currentTimeMillis()) / 50));
|
||||
|
||||
@ -117,7 +117,7 @@ public class BlockProtectionManager {
|
||||
map.put(loc.getWorld(), regions);
|
||||
|
||||
// Only saving into save cache if timer is higher than 5 minutes
|
||||
if (cache && ((time - System.currentTimeMillis()) / 1000 > 60 * 5 || time < 0) )
|
||||
if (cache && ((time - System.currentTimeMillis()) / 1000 > 60 * 5 || time < 0))
|
||||
addToCache(loc, Bp);
|
||||
return Bp;
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.stuff.ToggleBarHandling;
|
||||
|
||||
import net.Zrips.CMILib.Version.Version;
|
||||
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
|
||||
|
||||
public class BossBarManager {
|
||||
|
||||
@ -36,7 +37,7 @@ public class BossBarManager {
|
||||
|
||||
public void ShowJobProgression(final JobsPlayer player, final JobProgression jobProg, double expGain) {
|
||||
if (Jobs.getGCManager().isBossBarAsync()) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(Jobs.getInstance(), () -> ShowJobProgressionInTask(player, jobProg, expGain));
|
||||
CMIScheduler.get().runTaskAsynchronously(() -> ShowJobProgressionInTask(player, jobProg, expGain));
|
||||
} else {
|
||||
ShowJobProgressionInTask(player, jobProg, expGain);
|
||||
}
|
||||
@ -139,7 +140,7 @@ public class BossBarManager {
|
||||
bar.setVisible(true);
|
||||
|
||||
if (oldOne != null)
|
||||
oldOne.setId(Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
oldOne.setScheduler(CMIScheduler.get().runTaskLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (BossBarInfo one : player.getBossBarInfo()) {
|
||||
|
@ -60,7 +60,7 @@ import net.Zrips.CMILib.Equations.ParseError;
|
||||
import net.Zrips.CMILib.Equations.Parser;
|
||||
import net.Zrips.CMILib.FileHandler.ConfigReader;
|
||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
import net.Zrips.CMILib.Version.Version;
|
||||
|
||||
public class ConfigManager {
|
||||
@ -965,7 +965,7 @@ public class ConfigManager {
|
||||
Jobs.setJobs(jobs);
|
||||
|
||||
if (!jobs.isEmpty()) {
|
||||
Jobs.consoleMsg("&eLoaded &6" + jobs.size() + " &ejobs");
|
||||
CMIMessages.consoleMessage("&eLoaded &6" + jobs.size() + " &ejobs");
|
||||
}
|
||||
|
||||
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>()));
|
||||
}
|
||||
|
||||
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
|
||||
@ -1435,13 +1435,13 @@ public class ConfigManager {
|
||||
|
||||
quests.add(quest);
|
||||
} 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();
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
|
@ -17,7 +17,7 @@ import com.gamingmesh.jobs.container.JobsWorld;
|
||||
import com.gamingmesh.jobs.dao.JobsDAO.ExploreDataTableFields;
|
||||
import com.gamingmesh.jobs.stuff.Util;
|
||||
|
||||
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
|
||||
public class ExploreManager {
|
||||
|
||||
@ -48,11 +48,11 @@ public class ExploreManager {
|
||||
if (!exploreEnabled)
|
||||
return;
|
||||
|
||||
Jobs.consoleMsg("&eLoading explorer data");
|
||||
CMIMessages.consoleMessage("&eLoading explorer data");
|
||||
Long time = System.currentTimeMillis();
|
||||
Jobs.getJobsDAO().loadExplore();
|
||||
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() {
|
||||
@ -149,17 +149,17 @@ public class ExploreManager {
|
||||
}
|
||||
|
||||
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();
|
||||
worlds.put(worldname, new HashMap<String, ExploreRegion>());
|
||||
|
||||
boolean r = Jobs.getJobsDAO().deleteExploredWorld(worldname);
|
||||
if (!r) {
|
||||
Jobs.consoleMsg("&eFailed in DAO.");
|
||||
CMIMessages.consoleMessage("&eFailed in DAO.");
|
||||
return;
|
||||
}
|
||||
|
||||
Jobs.consoleMsg("&eCompleted to reset explorer data.");
|
||||
CMIMessages.consoleMessage("&eCompleted to reset explorer data.");
|
||||
}
|
||||
}
|
||||
|
@ -40,12 +40,12 @@ import com.gamingmesh.jobs.container.CurrencyLimit;
|
||||
import com.gamingmesh.jobs.container.CurrencyType;
|
||||
|
||||
import net.Zrips.CMILib.CMILib;
|
||||
import net.Zrips.CMILib.Container.CMIArray;
|
||||
import net.Zrips.CMILib.Container.CMIList;
|
||||
import net.Zrips.CMILib.Equations.Parser;
|
||||
import net.Zrips.CMILib.FileHandler.ConfigReader;
|
||||
import net.Zrips.CMILib.Items.CMIItemStack;
|
||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
import net.Zrips.CMILib.Version.Version;
|
||||
|
||||
public class GeneralConfigManager {
|
||||
@ -95,7 +95,8 @@ public class GeneralConfigManager {
|
||||
SignsColorizeJobName, ShowToplistInScoreboard, useGlobalTimer, useSilkTouchProtection, UseCustomNames,
|
||||
PreventSlimeSplit, PreventMagmaCubeSplit, PreventHopperFillUps, PreventBrewingStandFillUps, informOnPaymentDisable,
|
||||
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,
|
||||
applyToNegativeIncome, useMinimumOveralPayment, useMinimumOveralPoints, useMinimumOveralExp, useBreederFinder,
|
||||
CancelCowMilking, fixAtMaxLevel, TitleChangeChat, TitleChangeActionBar, LevelChangeChat,
|
||||
@ -106,10 +107,13 @@ public class GeneralConfigManager {
|
||||
EnableConfirmation, jobsInfoOpensBrowse, MonsterDamageUse, useMaxPaymentCurve, blockOwnershipTakeOver,
|
||||
hideJobsInfoWithoutPermission, UseTaxes, TransferToServerAccount, TakeFromPlayersPayment, AutoJobJoinUse, AllowDelevel, RomanNumbers,
|
||||
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,
|
||||
payForEachVTradeItem, allowEnchantingBoostedItems, bossBarAsync = false, preventShopItemEnchanting;
|
||||
|
||||
public boolean jobsshopenabled;
|
||||
public boolean DailyQuestsEnabled;
|
||||
|
||||
public ItemStack guiInfoButton;
|
||||
public int InfoButtonSlot = 9;
|
||||
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");
|
||||
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",
|
||||
"Any daily quests given before reset will be invalid and new ones will be given out");
|
||||
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");
|
||||
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",
|
||||
"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");
|
||||
@ -543,7 +553,7 @@ public class GeneralConfigManager {
|
||||
|
||||
CMIMaterial mat = CMIMaterial.get(mName);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -585,9 +595,10 @@ public class GeneralConfigManager {
|
||||
c.addComment("Economy.PaymentMethods",
|
||||
"By disabling one of these, players no longer will get particular payment.",
|
||||
"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);
|
||||
PaymentMethodsExp = c.get("Economy.PaymentMethods.Exp", true);
|
||||
|
||||
for (CurrencyType one : CurrencyType.values()) {
|
||||
one.setEnabled(c.get("Economy.PaymentMethods." + one.getName(), true));
|
||||
}
|
||||
|
||||
c.addComment("Economy.GeneralMulti",
|
||||
"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("jobstotalplayers", 10);
|
||||
} 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;
|
||||
}
|
||||
|
||||
@ -702,8 +713,14 @@ public class GeneralConfigManager {
|
||||
Jobs.getPluginLogger().warning("MoneyLimit has an invalid value. Disabling money limit!");
|
||||
limit.setEnabled(false);
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
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",
|
||||
"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));
|
||||
@ -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");
|
||||
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",
|
||||
"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));
|
||||
@ -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");
|
||||
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",
|
||||
"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));
|
||||
|
@ -7,6 +7,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.container.CurrencyType;
|
||||
import com.gamingmesh.jobs.stuff.Util;
|
||||
|
||||
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("general.info.toplineseparator", "&7*********************** &6%playerdisplayname% &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.blocks.furnace", "Furnace");
|
||||
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.moneyboost.help.info", "Boosts money gain for all players");
|
||||
c.get("command.moneyboost.help.args", "[jobname]/all/reset [time]/[rate]");
|
||||
Jobs.getGCManager().getCommandArgs().put("moneyboost", Arrays.asList("[jobname]%%all%%reset", "[time]%%2", "%%2"));
|
||||
c.get("command.moneyboost.output.allreset", "All money boosts turned off");
|
||||
c.get("command.moneyboost.output.jobsboostreset", "Money boost has been turned off for %jobname%");
|
||||
c.get("command.moneyboost.output.nothingtoreset", "Nothing to reset");
|
||||
c.get("command.moneyboost.output.boostalladded", "Money boost of %boost% added for all jobs!");
|
||||
c.get("command.moneyboost.output.boostadded", "Money boost of &e%boost% &aadded for &e%jobname%!");
|
||||
c.get("command.moneyboost.output.infostats", "&c-----> &aMoney rate x%boost% enabled&c <-------");
|
||||
|
||||
c.get("command.pointboost.help.info", "Boosts point gain for all players");
|
||||
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.boost.help.info", "Boosts jobs gains for all players");
|
||||
c.get("command.boost.help.args", "exp/money/points [jobname]/all/reset [rate] [time]");
|
||||
Jobs.getGCManager().getCommandArgs().put("boost", Arrays.asList("[jobname]", "reset%%exp%%money%%points", "[time]%%2", "%%2"));
|
||||
c.get("command.boost.output.allreset", "&aAll boosts turned off");
|
||||
c.get("command.boost.output.alltypereset", "&aAll &e%type% &aboosts turned off");
|
||||
c.get("command.boost.output.jobsboostreset", "&aBoost has been turned off for &e%jobname%");
|
||||
c.get("command.boost.output.jobstypeboostreset", "&e%type% &aboost has been turned off for &e%jobname%");
|
||||
c.get("command.boost.output.nothingtoreset", "Nothing to reset");
|
||||
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.boost.output.boostStats", "&6%payments% &e%jobname%");
|
||||
|
||||
c.get("command.schedule.help.info", "Enables the given scheduler");
|
||||
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.args", "[jobname] [questname] (playerName)");
|
||||
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]"));
|
||||
|
||||
c.get("command.quests.help.info", "List available quests");
|
||||
|
@ -26,7 +26,7 @@ import net.Zrips.CMILib.Container.CMIText;
|
||||
import net.Zrips.CMILib.Entities.CMIEntityType;
|
||||
import net.Zrips.CMILib.FileHandler.ConfigReader;
|
||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
|
||||
public class NameTranslatorManager {
|
||||
|
||||
@ -231,9 +231,9 @@ public class NameTranslatorManager {
|
||||
}
|
||||
|
||||
if (listOfNames.size() > 0)
|
||||
Jobs.consoleMsg("&eLoaded &6" + listOfNames.size() + " &ecustom item names");
|
||||
CMIMessages.consoleMessage("&eLoaded &6" + listOfNames.size() + " &ecustom item names");
|
||||
} 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) {
|
||||
listOfEntities.clear();
|
||||
@ -252,9 +252,9 @@ public class NameTranslatorManager {
|
||||
}
|
||||
|
||||
if (!listOfEntities.isEmpty())
|
||||
Jobs.consoleMsg("&eLoaded &6" + listOfEntities.size() + " &ecustom entity names");
|
||||
CMIMessages.consoleMessage("&eLoaded &6" + listOfEntities.size() + " &ecustom entity names");
|
||||
} 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) {
|
||||
listOfMMEntities.clear();
|
||||
@ -265,9 +265,9 @@ public class NameTranslatorManager {
|
||||
}
|
||||
|
||||
if (listOfMMEntities.size() > 0)
|
||||
Jobs.consoleMsg("&eLoaded &6" + listOfMMEntities.size() + " &ecustom MythicMobs names");
|
||||
CMIMessages.consoleMessage("&eLoaded &6" + listOfMMEntities.size() + " &ecustom MythicMobs names");
|
||||
} 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) {
|
||||
listOfEnchants.clear();
|
||||
@ -277,9 +277,9 @@ public class NameTranslatorManager {
|
||||
}
|
||||
|
||||
if (listOfEnchants.size() > 0)
|
||||
Jobs.consoleMsg("&eLoaded &6" + listOfEnchants.size() + " &ecustom enchant names");
|
||||
CMIMessages.consoleMessage("&eLoaded &6" + listOfEnchants.size() + " &ecustom enchant names");
|
||||
} 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) {
|
||||
listOfPotionEffects.clear();
|
||||
@ -289,9 +289,9 @@ public class NameTranslatorManager {
|
||||
}
|
||||
|
||||
if (listOfPotionEffects.size() > 0)
|
||||
Jobs.consoleMsg("&eLoaded &6" + listOfPotionEffects.size() + " &ecustom enchant names");
|
||||
CMIMessages.consoleMessage("&eLoaded &6" + listOfPotionEffects.size() + " &ecustom enchant names");
|
||||
} 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) {
|
||||
listOfColors.clear();
|
||||
@ -304,9 +304,9 @@ public class NameTranslatorManager {
|
||||
}
|
||||
|
||||
if (!listOfColors.isEmpty())
|
||||
Jobs.consoleMsg("&eLoaded &6" + listOfColors.size() + " &ecustom color names");
|
||||
CMIMessages.consoleMessage("&eLoaded &6" + listOfColors.size() + " &ecustom color names");
|
||||
} 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")
|
||||
|
@ -20,6 +20,8 @@ import com.gamingmesh.jobs.container.CuboidArea;
|
||||
import com.gamingmesh.jobs.container.RestrictedArea;
|
||||
import com.gamingmesh.jobs.hooks.HookManager;
|
||||
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
|
||||
public class RestrictedAreaManager {
|
||||
|
||||
protected final Map<String, RestrictedArea> restrictedAreas = new HashMap<>();
|
||||
@ -231,7 +233,7 @@ public class RestrictedAreaManager {
|
||||
|
||||
int size = restrictedAreas.size();
|
||||
if (size > 0)
|
||||
Jobs.consoleMsg("&e[Jobs] Loaded " + size + " restricted areas!");
|
||||
CMIMessages.consoleMessage("&e[Jobs] Loaded " + size + " restricted areas!");
|
||||
|
||||
try {
|
||||
conf.save(f);
|
||||
|
@ -8,6 +8,7 @@ import com.gamingmesh.jobs.Jobs;
|
||||
import net.Zrips.CMILib.FileHandler.ConfigReader;
|
||||
import net.Zrips.CMILib.Items.CMIItemStack;
|
||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
|
||||
public class RestrictedBlockManager {
|
||||
|
||||
@ -46,7 +47,7 @@ public class RestrictedBlockManager {
|
||||
CMIMaterial mat = cm == null ? null : cm.getCMIType();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -68,7 +69,7 @@ public class RestrictedBlockManager {
|
||||
cfg.get("blocksTimer." + mat.name(), timer);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -79,7 +80,7 @@ public class RestrictedBlockManager {
|
||||
|
||||
int size = restrictedBlocksTimer.size();
|
||||
if (size > 0)
|
||||
Jobs.consoleMsg("&eLoaded &6" + size + " &eprotected blocks timers");
|
||||
CMIMessages.consoleMessage("&eLoaded &6" + size + " &eprotected blocks timers");
|
||||
|
||||
cfg.save();
|
||||
}
|
||||
|
@ -7,26 +7,27 @@ import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.gamingmesh.jobs.api.JobsScheduleStartEvent;
|
||||
import com.gamingmesh.jobs.api.JobsScheduleStopEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
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.CurrencyType;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
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 {
|
||||
|
||||
private Jobs plugin;
|
||||
|
||||
private BukkitTask timer;
|
||||
private CMITask timer;
|
||||
private YmlMaker jobSchedule;
|
||||
|
||||
public static final List<Schedule> BOOSTSCHEDULE = new ArrayList<>();
|
||||
@ -44,7 +45,7 @@ public class ScheduleManager {
|
||||
return;
|
||||
|
||||
cancel();
|
||||
timer = Bukkit.getScheduler().runTaskTimer(plugin, this::scheduler, 20, 30 * 20L);
|
||||
timer = CMIScheduler.get().scheduleSyncRepeatingTask(this::scheduler, 20, 30 * 20L);
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
@ -180,7 +181,7 @@ public class ScheduleManager {
|
||||
!path.isList("Days") && !path.isString("Days") ||
|
||||
!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;
|
||||
}
|
||||
|
||||
@ -228,6 +229,6 @@ public class ScheduleManager {
|
||||
}
|
||||
|
||||
if (!BOOSTSCHEDULE.isEmpty())
|
||||
Jobs.consoleMsg("&eLoaded " + BOOSTSCHEDULE.size() + " schedulers!");
|
||||
CMIMessages.consoleMessage("&eLoaded " + BOOSTSCHEDULE.size() + " schedulers!");
|
||||
}
|
||||
}
|
||||
|
@ -113,11 +113,14 @@ public class ShopManager {
|
||||
List<String> lore = new ArrayList<>();
|
||||
CMIMaterial mat = CMIMaterial.get(item.getIconMaterial());
|
||||
|
||||
boolean hiddenLore = false;
|
||||
|
||||
if (item.isHideWithoutPerm()) {
|
||||
for (String onePerm : item.getRequiredPerm()) {
|
||||
if (!player.hasPermission(onePerm)) {
|
||||
mat = CMIMaterial.STONE_BUTTON;
|
||||
lore.add(Jobs.getLanguage().getMessage("command.shop.info.NoPermToBuy"));
|
||||
hiddenLore = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -127,6 +130,7 @@ public class ShopManager {
|
||||
jPlayer.getTotalLevels() < item.getRequiredTotalLevels()) {
|
||||
mat = CMIMaterial.STONE_BUTTON;
|
||||
lore.add(Jobs.getLanguage().getMessage("command.shop.info.NoPoints"));
|
||||
hiddenLore = true;
|
||||
}
|
||||
|
||||
if (mat == CMIMaterial.NONE)
|
||||
@ -142,6 +146,7 @@ public class ShopManager {
|
||||
if (item.getIconName() != null)
|
||||
meta.setDisplayName(item.getIconName());
|
||||
|
||||
if (!hiddenLore) {
|
||||
lore.addAll(item.getIconLore());
|
||||
|
||||
if (item.getPointPrice() > 0) {
|
||||
@ -185,6 +190,7 @@ public class ShopManager {
|
||||
"%totalLevel%", (jPlayer.getTotalLevels() < item.getRequiredTotalLevels()
|
||||
? Jobs.getLanguage().getMessage("command.shop.info.reqTotalLevelColor") : "") + item.getRequiredTotalLevels()));
|
||||
}
|
||||
}
|
||||
|
||||
meta.setLore(lore);
|
||||
|
||||
@ -497,6 +503,6 @@ public class ShopManager {
|
||||
}
|
||||
|
||||
if (!list.isEmpty())
|
||||
Jobs.consoleMsg("&eLoaded &6" + list.size() + " &eshop items");
|
||||
CMIMessages.consoleMessage("&eLoaded &6" + list.size() + " &eshop items");
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import com.gamingmesh.jobs.container.Title;
|
||||
|
||||
import net.Zrips.CMILib.Colors.CMIChatColor;
|
||||
import net.Zrips.CMILib.FileHandler.ConfigReader;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
|
||||
public class TitleManager {
|
||||
|
||||
@ -157,6 +158,6 @@ public class TitleManager {
|
||||
|
||||
int size = titles.size();
|
||||
if (size > 0)
|
||||
Jobs.consoleMsg("&eLoaded &6" + size + " &etitles");
|
||||
CMIMessages.consoleMessage("&eLoaded &6" + size + " &etitles");
|
||||
}
|
||||
}
|
||||
|
@ -2,12 +2,14 @@ package com.gamingmesh.jobs.container;
|
||||
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Zrips.CMILib.Version.Schedulers.CMITask;
|
||||
|
||||
public class BlockProtection {
|
||||
|
||||
private static long pre = (int) (System.currentTimeMillis() / 10000000000L) * 10000000000L;
|
||||
|
||||
private int id = -1;
|
||||
private int schedId = - 1;
|
||||
private CMITask scheduler = null;
|
||||
private int time = -1;
|
||||
private int recorded = -1;
|
||||
private DBAction action;
|
||||
@ -115,11 +117,11 @@ public class BlockProtection {
|
||||
return z;
|
||||
}
|
||||
|
||||
public int getSchedId() {
|
||||
return schedId;
|
||||
public CMITask getScheduler() {
|
||||
return scheduler;
|
||||
}
|
||||
|
||||
public void setSchedId(int schedId) {
|
||||
this.schedId = schedId;
|
||||
public void setScheduler(CMITask cmiTask) {
|
||||
this.scheduler = cmiTask;
|
||||
}
|
||||
}
|
||||
|
@ -68,9 +68,10 @@ public class Boost {
|
||||
if (one == BoostOf.NearSpawner || one == BoostOf.PetPay)
|
||||
continue;
|
||||
|
||||
if (bm.isValid(type))
|
||||
if (bm.isValid(type)) {
|
||||
r += bm.get(type);
|
||||
}
|
||||
}
|
||||
|
||||
if (!excludeExtra) {
|
||||
if (Jobs.getGCManager().multiplyBoostedExtraValues) {
|
||||
|
@ -23,17 +23,20 @@ public class BoostMultiplier implements Cloneable {
|
||||
}
|
||||
|
||||
public BoostMultiplier add(CurrencyType type, double amount) {
|
||||
if (!Double.isNaN(amount))
|
||||
map.put(type, amount);
|
||||
timers.remove(type);
|
||||
return this;
|
||||
}
|
||||
|
||||
public BoostMultiplier add(CurrencyType type, double amount, long time) {
|
||||
add(type, amount);
|
||||
timers.put(type, time);
|
||||
return add(type, amount);
|
||||
return this;
|
||||
}
|
||||
|
||||
public BoostMultiplier add(double amount) {
|
||||
if (amount != 0) {
|
||||
if (amount != 0 && !Double.isNaN(amount)) {
|
||||
for (CurrencyType one : CurrencyType.values()) {
|
||||
map.put(one, amount);
|
||||
}
|
||||
|
@ -1,13 +1,14 @@
|
||||
package com.gamingmesh.jobs.container;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.boss.BossBar;
|
||||
|
||||
import net.Zrips.CMILib.Version.Schedulers.CMITask;
|
||||
|
||||
public class BossBarInfo {
|
||||
private String jobName;
|
||||
private String PlayerName;
|
||||
private BossBar bar;
|
||||
private int id = -1;
|
||||
private CMITask scheduler = null;
|
||||
|
||||
public BossBarInfo(String PlayerName, String jobName, BossBar bar) {
|
||||
this.PlayerName = PlayerName;
|
||||
@ -15,14 +16,14 @@ public class BossBarInfo {
|
||||
this.bar = bar;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
public void setScheduler(CMITask cmiTask) {
|
||||
cancel();
|
||||
this.id = id;
|
||||
this.scheduler = cmiTask;
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
if (id != -1)
|
||||
Bukkit.getScheduler().cancelTask(this.id);
|
||||
if (scheduler != null)
|
||||
scheduler.cancel();
|
||||
}
|
||||
|
||||
public String getPlayerName() {
|
||||
|
@ -4,12 +4,14 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.Zrips.CMILib.Equations.Parser;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
|
||||
public class CurrencyLimit {
|
||||
|
||||
private boolean enabled;
|
||||
private List<CurrencyType> stopWith;
|
||||
private int timeLimit;
|
||||
private int timeLimit = 0;
|
||||
private resetTime resetsAt = null;
|
||||
private int announcementDelay;
|
||||
private Parser maxEquation;
|
||||
|
||||
@ -66,4 +68,40 @@ public class CurrencyLimit {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
package com.gamingmesh.jobs.container;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
|
||||
public enum CurrencyType {
|
||||
MONEY("Money", 1),
|
||||
EXP("Exp", 2),
|
||||
@ -25,6 +27,7 @@ public enum CurrencyType {
|
||||
|
||||
private String name;
|
||||
private int id = 0;
|
||||
private boolean enabled = true;
|
||||
|
||||
CurrencyType(String name, int id) {
|
||||
this.name = name;
|
||||
@ -54,4 +57,16 @@ public enum CurrencyType {
|
||||
public int getId() {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -225,13 +225,22 @@ public class Job {
|
||||
eq.setVariable("totaljobs", Jobs.getJobs().size());
|
||||
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)
|
||||
now = Jobs.getGCManager().DynamicPaymentMaxBonus;
|
||||
|
||||
if (now < Jobs.getGCManager().DynamicPaymentMaxPenalty)
|
||||
now = Jobs.getGCManager().DynamicPaymentMaxPenalty;
|
||||
|
||||
if (Double.isNaN(now))
|
||||
now = 0;
|
||||
|
||||
this.bonus = now;
|
||||
}
|
||||
|
||||
@ -301,6 +310,7 @@ public class Job {
|
||||
};
|
||||
|
||||
String shortActionName = CMIMaterial.getGeneralMaterialName(action.getName());
|
||||
|
||||
for (JobInfo info : getJobInfo(action.getType())) {
|
||||
if (condition.test(info, action)) {
|
||||
if (!info.isInLevelRange(level)) {
|
||||
|
@ -113,7 +113,7 @@ public class JobInfo {
|
||||
public double getIncome(double level, int numjobs, int maxJobs) {
|
||||
if (softIncomeLevelLimit != null && level > softIncomeLevelLimit)
|
||||
level = softIncomeLevelLimit;
|
||||
if (baseIncome == 0 || !Jobs.getGCManager().PaymentMethodsMoney)
|
||||
if (baseIncome == 0 || !CurrencyType.MONEY.isEnabled())
|
||||
return 0;
|
||||
moneyEquation.setVariable("joblevel", level);
|
||||
moneyEquation.setVariable("numjobs", numjobs);
|
||||
@ -125,7 +125,7 @@ public class JobInfo {
|
||||
public double getExperience(double level, int numjobs, int maxJobs) {
|
||||
if (softExpLevelLimit != null && level > softExpLevelLimit)
|
||||
level = softExpLevelLimit;
|
||||
if (baseXp == 0 || !Jobs.getGCManager().PaymentMethodsExp)
|
||||
if (baseXp == 0 || !CurrencyType.EXP.isEnabled())
|
||||
return 0;
|
||||
xpEquation.setVariable("joblevel", level);
|
||||
xpEquation.setVariable("numjobs", numjobs);
|
||||
@ -137,7 +137,7 @@ public class JobInfo {
|
||||
public double getPoints(double level, int numjobs, int maxJobs) {
|
||||
if (softPointsLevelLimit != null && level > softPointsLevelLimit)
|
||||
level = softPointsLevelLimit;
|
||||
if (basePoints == 0 || !Jobs.getGCManager().PaymentMethodsPoints)
|
||||
if (basePoints == 0 || !CurrencyType.POINTS.isEnabled())
|
||||
return 0;
|
||||
pointsEquation.setVariable("joblevel", level);
|
||||
pointsEquation.setVariable("numjobs", numjobs);
|
||||
|
@ -22,9 +22,9 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.stuff.TimeManage;
|
||||
import com.gamingmesh.jobs.stuff.Util;
|
||||
|
||||
import net.Zrips.CMILib.Container.CMINumber;
|
||||
import net.Zrips.CMILib.Time.CMITimeManager;
|
||||
|
||||
public class JobProgression {
|
||||
@ -146,7 +146,7 @@ public class JobProgression {
|
||||
*/
|
||||
public String getLevelFormatted() {
|
||||
if (Jobs.getGCManager().RomanNumbers)
|
||||
return Util.toRoman(level);
|
||||
return CMINumber.toRoman(level);
|
||||
return String.valueOf(level);
|
||||
}
|
||||
|
||||
|
@ -47,6 +47,8 @@ import net.Zrips.CMILib.Equations.Parser;
|
||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||
import net.Zrips.CMILib.Time.CMITimeManager;
|
||||
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
|
||||
import net.Zrips.CMILib.Version.Schedulers.CMITask;
|
||||
|
||||
public class JobsPlayer {
|
||||
|
||||
@ -1347,14 +1349,14 @@ public class JobsPlayer {
|
||||
this.doneQuests = doneQuests;
|
||||
}
|
||||
|
||||
private Integer questSignUpdateShed;
|
||||
private CMITask questSignUpdateShed;
|
||||
|
||||
public void addDoneQuest(final Job job) {
|
||||
doneQuests++;
|
||||
setSaved(false);
|
||||
|
||||
if (questSignUpdateShed == null) {
|
||||
questSignUpdateShed = plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> {
|
||||
questSignUpdateShed = CMIScheduler.get().runTaskLater(() -> {
|
||||
Jobs.getSignUtil().signUpdate(job, SignTopType.questtoplist);
|
||||
questSignUpdateShed = null;
|
||||
}, Jobs.getGCManager().getSavePeriod() * 60 * 20L);
|
||||
|
@ -3,7 +3,7 @@ package com.gamingmesh.jobs.container;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.gamingmesh.jobs.stuff.TimeManage;
|
||||
import net.Zrips.CMILib.Time.CMITimeManager;
|
||||
|
||||
public final class Log {
|
||||
|
||||
@ -36,7 +36,7 @@ public final class Log {
|
||||
}
|
||||
|
||||
public void setDate() {
|
||||
this.day = TimeManage.timeInInt();
|
||||
this.day = CMITimeManager.timeInInt();
|
||||
}
|
||||
|
||||
public int getDate() {
|
||||
|
@ -26,6 +26,7 @@ public class PlayerPoints {
|
||||
|
||||
public void takePoints(double points) {
|
||||
current -= points;
|
||||
total -= points;
|
||||
}
|
||||
|
||||
public boolean havePoints(double points) {
|
||||
|
@ -4,15 +4,12 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
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.event.server.ServerCommandEvent;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.actions.EnchantActionInfo;
|
||||
import com.gamingmesh.jobs.stuff.Util;
|
||||
|
||||
public class QuestProgression {
|
||||
|
||||
@ -160,22 +157,24 @@ public class QuestProgression {
|
||||
}
|
||||
}
|
||||
|
||||
boolean completed = isCompleted();
|
||||
|
||||
Job questJob = quest.getJob();
|
||||
if (questJob != null) {
|
||||
if (questJob != null && completed) {
|
||||
int maxQuest = jPlayer.getPlayerMaxQuest(questJob.getName());
|
||||
if (maxQuest > 0 && jPlayer.getDoneQuests() >= maxQuest) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isCompleted() &&
|
||||
objective != null) {
|
||||
if (!completed && objective != null) {
|
||||
Integer old = done.getOrDefault(objective, 0);
|
||||
done.put(objective, old < objective.getAmount() ? old + 1 : objective.getAmount());
|
||||
}
|
||||
|
||||
jPlayer.setSaved(false);
|
||||
|
||||
//needs to re-call isCompleted() because it might have changed above.
|
||||
if (!isCompleted() || !player.isOnline() || givenReward)
|
||||
return;
|
||||
|
||||
|
@ -24,6 +24,7 @@ import com.gamingmesh.jobs.stuff.blockLoc;
|
||||
|
||||
import net.Zrips.CMILib.Container.CMILocation;
|
||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
|
||||
public class BlockOwnerShip {
|
||||
|
||||
@ -380,7 +381,7 @@ public class BlockOwnerShip {
|
||||
}
|
||||
|
||||
if (total > 0) {
|
||||
Jobs.consoleMsg("&eLoaded &6" + total + " " + path.toLowerCase() + " &efor reassigning.");
|
||||
CMIMessages.consoleMessage("&eLoaded &6" + total + " " + path.toLowerCase() + " &efor reassigning.");
|
||||
}
|
||||
}
|
||||
|
||||
|
58
src/main/java/com/gamingmesh/jobs/container/resetTime.java
Normal file
58
src/main/java/com/gamingmesh/jobs/container/resetTime.java
Normal 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();
|
||||
}
|
||||
|
||||
}
|
@ -41,10 +41,11 @@ import com.gamingmesh.jobs.container.PlayerPoints;
|
||||
import com.gamingmesh.jobs.container.TopList;
|
||||
import com.gamingmesh.jobs.dao.JobsManager.DataBaseType;
|
||||
import com.gamingmesh.jobs.economy.PaymentData;
|
||||
import com.gamingmesh.jobs.stuff.TimeManage;
|
||||
import com.gamingmesh.jobs.stuff.Util;
|
||||
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
import net.Zrips.CMILib.Time.CMITimeManager;
|
||||
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
|
||||
|
||||
public abstract class JobsDAO {
|
||||
|
||||
@ -819,7 +820,7 @@ public abstract class JobsDAO {
|
||||
PreparedStatement prest = null;
|
||||
ResultSet res = null;
|
||||
try {
|
||||
int time = TimeManage.timeInInt();
|
||||
int time = CMITimeManager.timeInInt();
|
||||
prest = conn.prepareStatement("SELECT * FROM `" + DBTables.LogTable.getTableName() + "` WHERE `" + LogTableFields.time.getCollumn() + "` = ? ;");
|
||||
prest.setInt(1, time);
|
||||
res = prest.executeQuery();
|
||||
@ -1016,10 +1017,10 @@ public abstract class JobsDAO {
|
||||
public void triggerTableIdUpdate() {
|
||||
// Lets convert old fields
|
||||
if (!converted) {
|
||||
Bukkit.getServer().getScheduler().runTaskLater(plugin, () -> {
|
||||
Jobs.consoleMsg("&6[Jobs] Converting to new database format");
|
||||
CMIScheduler.get().runTaskLater(() -> {
|
||||
CMIMessages.consoleMessage("&6[Jobs] Converting to new database format");
|
||||
convertID();
|
||||
Jobs.consoleMsg("&6[Jobs] Converted to new database format");
|
||||
CMIMessages.consoleMessage("&6[Jobs] Converted to new database format");
|
||||
converted = true;
|
||||
}, 60L);
|
||||
}
|
||||
@ -2311,7 +2312,7 @@ public abstract class JobsDAO {
|
||||
PreparedStatement prest = null;
|
||||
ResultSet res = null;
|
||||
try {
|
||||
int time = TimeManage.timeInInt();
|
||||
int time = CMITimeManager.timeInInt();
|
||||
prest = conn.prepareStatement("SELECT * FROM `" + DBTables.LogTable.getTableName()
|
||||
+ "` WHERE `" + LogTableFields.userid.getCollumn() + "` = ? AND `" + LogTableFields.time.getCollumn() + "` = ? ;");
|
||||
prest.setInt(1, player.getUserId());
|
||||
@ -2508,12 +2509,12 @@ public abstract class JobsDAO {
|
||||
i++;
|
||||
|
||||
if (ii++ >= 100000) {
|
||||
Jobs.consoleMsg("&6[Jobs] Loading (" + i + ") BP");
|
||||
CMIMessages.consoleMessage("&6[Jobs] Loading (" + i + ") BP");
|
||||
ii = 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) {
|
||||
e.printStackTrace();
|
||||
@ -2577,7 +2578,7 @@ public abstract class JobsDAO {
|
||||
conn.setAutoCommit(true);
|
||||
|
||||
if (i > 0)
|
||||
Jobs.consoleMsg("&e[Jobs] Saved " + i + " new explorer entries.");
|
||||
CMIMessages.consoleMessage("&e[Jobs] Saved " + i + " new explorer entries.");
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
@ -2624,7 +2625,7 @@ public abstract class JobsDAO {
|
||||
conn.setAutoCommit(true);
|
||||
|
||||
if (i > 0)
|
||||
Jobs.consoleMsg("&e[Jobs] Updated " + i + " explorer entries.");
|
||||
CMIMessages.consoleMessage("&e[Jobs] Updated " + i + " explorer entries.");
|
||||
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -6,7 +6,7 @@ import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.container.LoadStatus;
|
||||
|
||||
import net.Zrips.CMILib.FileHandler.ConfigReader;
|
||||
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
|
||||
public class JobsManager {
|
||||
private JobsDAO dao;
|
||||
@ -70,9 +70,9 @@ public class JobsManager {
|
||||
public void start() {
|
||||
|
||||
if (Jobs.getJobsDAO() != null) {
|
||||
Jobs.consoleMsg("&eClosing existing database connection...");
|
||||
CMIMessages.consoleMessage("&eClosing existing database connection...");
|
||||
Jobs.getJobsDAO().closeConnections();
|
||||
Jobs.consoleMsg("&eClosed");
|
||||
CMIMessages.consoleMessage("&eClosed");
|
||||
}
|
||||
|
||||
ConfigReader c = Jobs.getGCManager().getConfig();
|
||||
@ -100,7 +100,7 @@ public class JobsManager {
|
||||
}
|
||||
} else {
|
||||
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");
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ import java.sql.Statement;
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.dao.JobsManager.DataBaseType;
|
||||
|
||||
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
|
||||
public class JobsMySQL extends JobsDAO {
|
||||
|
||||
@ -52,7 +52,7 @@ public class JobsMySQL extends JobsDAO {
|
||||
protected void checkUpdate() throws SQLException {
|
||||
JobsConnection conn = getConnection();
|
||||
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;
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ public class JobsMySQL extends JobsDAO {
|
||||
@Override
|
||||
public boolean createTable(String query) {
|
||||
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;
|
||||
}
|
||||
JobsConnection conn = getConnection();
|
||||
@ -88,7 +88,7 @@ public class JobsMySQL extends JobsDAO {
|
||||
statement = conn.createStatement();
|
||||
statement.execute(query);
|
||||
} catch (SQLException e) {
|
||||
Jobs.consoleMsg("&cCould not create table, SQLException: " + e.getMessage());
|
||||
CMIMessages.consoleMessage("&cCould not create table, SQLException: " + e.getMessage());
|
||||
return false;
|
||||
} finally {
|
||||
close(statement);
|
||||
@ -111,7 +111,7 @@ public class JobsMySQL extends JobsDAO {
|
||||
tables.close();
|
||||
return false;
|
||||
} 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;
|
||||
@ -125,7 +125,7 @@ public class JobsMySQL extends JobsDAO {
|
||||
return true;
|
||||
}
|
||||
} 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 {
|
||||
close(res);
|
||||
close(insert);
|
||||
@ -140,14 +140,14 @@ public class JobsMySQL extends JobsDAO {
|
||||
try {
|
||||
statement = getConnection().createStatement();
|
||||
} 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;
|
||||
}
|
||||
try {
|
||||
statement.executeQuery("SELECT `" + collumn + "` FROM `" + table + "`;");
|
||||
return true;
|
||||
} catch (SQLException e) {
|
||||
Jobs.consoleMsg("Not a collumn |" + "SELECT " + collumn + " FROM " + table + "|");
|
||||
CMIMessages.consoleMessage("Not a collumn |" + "SELECT " + collumn + " FROM " + table + "|");
|
||||
return false;
|
||||
} finally {
|
||||
close(statement);
|
||||
@ -160,11 +160,11 @@ public class JobsMySQL extends JobsDAO {
|
||||
try {
|
||||
statement = getConnection().createStatement();
|
||||
} 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;
|
||||
}
|
||||
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 + ";");
|
||||
return true;
|
||||
} catch (SQLException e) {
|
||||
@ -179,14 +179,14 @@ public class JobsMySQL extends JobsDAO {
|
||||
Statement statement = null;
|
||||
try {
|
||||
if (!isTable(table)) {
|
||||
Jobs.consoleMsg("&cTable \"" + table + "\" does not exist.");
|
||||
CMIMessages.consoleMessage("&cTable \"" + table + "\" does not exist.");
|
||||
return false;
|
||||
}
|
||||
statement = getConnection().createStatement();
|
||||
statement.executeUpdate("DELETE FROM " + table + ";");
|
||||
return true;
|
||||
} catch (SQLException e) {
|
||||
Jobs.consoleMsg("&cCould not wipe table, SQLException: " + e.getMessage());
|
||||
CMIMessages.consoleMessage("&cCould not wipe table, SQLException: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
} finally {
|
||||
@ -199,14 +199,14 @@ public class JobsMySQL extends JobsDAO {
|
||||
Statement statement = null;
|
||||
try {
|
||||
if (!isTable(table)) {
|
||||
Jobs.consoleMsg("&cTable \"" + table + "\" does not exist.");
|
||||
CMIMessages.consoleMessage("&cTable \"" + table + "\" does not exist.");
|
||||
return false;
|
||||
}
|
||||
statement = getConnection().createStatement();
|
||||
statement.executeUpdate("DROP TABLE IF EXISTS `" + table + "`;");
|
||||
return true;
|
||||
} catch (SQLException e) {
|
||||
Jobs.consoleMsg("&cCould not wipe table, SQLException: " + e.getMessage());
|
||||
CMIMessages.consoleMessage("&cCould not wipe table, SQLException: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
} finally {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user