mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-25 20:16:13 +01:00
Single command for boosts
This commit is contained in:
parent
3bfb0f60cc
commit
2346e7d623
@ -270,14 +270,17 @@ 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);
|
||||
|
177
src/main/java/com/gamingmesh/jobs/commands/list/boost.java
Normal file
177
src/main/java/com/gamingmesh/jobs/commands/list/boost.java
Normal file
@ -0,0 +1,177 @@
|
||||
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.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) {
|
||||
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 (allJobs) {
|
||||
if (type == null) {
|
||||
for (Job one : Jobs.getJobs()) {
|
||||
for (CurrencyType curr : CurrencyType.values()) {
|
||||
one.addBoost(curr, 1.0);
|
||||
}
|
||||
}
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.boost.output.allreset"));
|
||||
} else {
|
||||
for (Job one : Jobs.getJobs()) {
|
||||
one.addBoost(type, 1.0);
|
||||
}
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.boost.output.alltypereset", "%type%", type.getDisplayName()));
|
||||
}
|
||||
} else if (job != null) {
|
||||
if (type == null) {
|
||||
for (CurrencyType curr : CurrencyType.values()) {
|
||||
job.addBoost(curr, 1.0);
|
||||
}
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.jobsboostreset", "%jobname%", job.getName()));
|
||||
} else {
|
||||
job.addBoost(type, 1.0);
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.jobstypeboostreset", "%jobname%", job.getName(), "%type%", type.getDisplayName()));
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("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);
|
||||
}
|
||||
CMIDebug.d(timeDuration);
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.boost.output.boostadded", "%boost%", rate, "%jobname%", job.getName()));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private 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()));
|
||||
CMIDebug.c(job.getBoost().getTime(curr) - System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
if (split.length > 1)
|
||||
rm.addText(split[1]);
|
||||
rm.show(sender);
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -107,7 +107,7 @@ 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;
|
||||
|
||||
@ -586,9 +586,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",
|
||||
|
@ -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]");
|
||||
@ -248,9 +244,9 @@ public class LanguageManager {
|
||||
c.get("command.editjobs.help.modify.lookHover", "&6Press to grab info from block you are looking");
|
||||
|
||||
c.get("command.editquests.help.info", "Edit job quests.");
|
||||
c.get("command.editquests.help.args", "(page)");
|
||||
c.get("command.editquests.help.args", "(page)");
|
||||
c.get("command.editquests.help.output.list", "&6[questName] &7- &f[jobName]");
|
||||
|
||||
|
||||
c.get("command.editquests.help.output.name", "&eName: &f");
|
||||
c.get("command.editquests.help.output.job", " &eJob: &f");
|
||||
c.get("command.editquests.help.output.chance", " &eChance: &f");
|
||||
@ -301,11 +297,11 @@ public class LanguageManager {
|
||||
c.get("command.shop.help.info", "Opens special jobs shop.");
|
||||
c.get("command.shop.help.args", "");
|
||||
c.get("command.shop.info.title", "&e------- &8Jobs shop &e-------");
|
||||
|
||||
|
||||
c.get("command.shop.info.haveColor", "&2");
|
||||
c.get("command.shop.info.pointsPrice", "&ePoint cost: &c%currentpoints%&e/&6%price%");
|
||||
c.get("command.shop.info.moneyPrice", "&eMoney cost: &c%currentbalance%&e/&6%price%");
|
||||
|
||||
|
||||
c.get("command.shop.info.reqJobs", "&eRequired jobs:");
|
||||
c.get("command.shop.info.reqJobsList", " &6%jobsname%&e: &e%level% lvl");
|
||||
c.get("command.shop.info.reqTotalLevel", "&6Required total level: &e%totalLevel%");
|
||||
|
@ -9,65 +9,67 @@ public class BoostMultiplier implements Cloneable {
|
||||
|
||||
@Override
|
||||
public BoostMultiplier clone() {
|
||||
BoostMultiplier boost = new BoostMultiplier();
|
||||
for (CurrencyType type : CurrencyType.values()) {
|
||||
boost.add(type, map.get(type));
|
||||
}
|
||||
return boost;
|
||||
BoostMultiplier boost = new BoostMultiplier();
|
||||
for (CurrencyType type : CurrencyType.values()) {
|
||||
boost.add(type, map.get(type));
|
||||
}
|
||||
return boost;
|
||||
}
|
||||
|
||||
public BoostMultiplier() {
|
||||
for (CurrencyType one : CurrencyType.values()) {
|
||||
map.put(one, 0D);
|
||||
}
|
||||
for (CurrencyType one : CurrencyType.values()) {
|
||||
map.put(one, 0D);
|
||||
}
|
||||
}
|
||||
|
||||
public BoostMultiplier add(CurrencyType type, double amount) {
|
||||
map.put(type, amount);
|
||||
return this;
|
||||
map.put(type, amount);
|
||||
timers.remove(type);
|
||||
return this;
|
||||
}
|
||||
|
||||
public BoostMultiplier add(CurrencyType type, double amount, long time) {
|
||||
timers.put(type, time);
|
||||
return add(type, amount);
|
||||
add(type, amount);
|
||||
timers.put(type, time);
|
||||
return this;
|
||||
}
|
||||
|
||||
public BoostMultiplier add(double amount) {
|
||||
if (amount != 0) {
|
||||
for (CurrencyType one : CurrencyType.values()) {
|
||||
map.put(one, amount);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
if (amount != 0) {
|
||||
for (CurrencyType one : CurrencyType.values()) {
|
||||
map.put(one, amount);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public double get(CurrencyType type) {
|
||||
if (!isValid(type))
|
||||
return 0D;
|
||||
return map.getOrDefault(type, 0D);
|
||||
if (!isValid(type))
|
||||
return 0D;
|
||||
return map.getOrDefault(type, 0D);
|
||||
}
|
||||
|
||||
public Long getTime(CurrencyType type) {
|
||||
return timers.get(type);
|
||||
return timers.get(type);
|
||||
}
|
||||
|
||||
public boolean isValid(CurrencyType type) {
|
||||
Long time = getTime(type);
|
||||
if (time == null)
|
||||
return true;
|
||||
Long time = getTime(type);
|
||||
if (time == null)
|
||||
return true;
|
||||
|
||||
if (time < System.currentTimeMillis()) {
|
||||
map.remove(type);
|
||||
timers.remove(type);
|
||||
return false;
|
||||
}
|
||||
if (time < System.currentTimeMillis()) {
|
||||
map.remove(type);
|
||||
timers.remove(type);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void add(BoostMultiplier armorboost) {
|
||||
for (CurrencyType one : CurrencyType.values()) {
|
||||
map.put(one, get(one) + armorboost.get(one));
|
||||
}
|
||||
for (CurrencyType one : CurrencyType.values()) {
|
||||
map.put(one, get(one) + armorboost.get(one));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
package com.gamingmesh.jobs.container;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
|
||||
public enum CurrencyType {
|
||||
MONEY("Money", 1),
|
||||
EXP("Exp", 2),
|
||||
@ -25,33 +27,46 @@ public enum CurrencyType {
|
||||
|
||||
private String name;
|
||||
private int id = 0;
|
||||
private boolean enabled = true;
|
||||
|
||||
CurrencyType(String name, int id) {
|
||||
this.name = name;
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
return name;
|
||||
}
|
||||
|
||||
public static CurrencyType getByName(String name) {
|
||||
for (CurrencyType one : values()) {
|
||||
if (one.getName().equalsIgnoreCase(name))
|
||||
return one;
|
||||
}
|
||||
return null;
|
||||
for (CurrencyType one : values()) {
|
||||
if (one.getName().equalsIgnoreCase(name))
|
||||
return one;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static CurrencyType get(int id) {
|
||||
for (CurrencyType one : values()) {
|
||||
if (one.getId() == id)
|
||||
return one;
|
||||
}
|
||||
return null;
|
||||
for (CurrencyType one : values()) {
|
||||
if (one.getId() == id)
|
||||
return one;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return Jobs.getLanguage().getMessage("general.info.paymentType." + this.toString());
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
}
|
||||
|
@ -38,127 +38,127 @@ public class JobInfo {
|
||||
private Integer softIncomeLevelLimit, softExpLevelLimit, softPointsLevelLimit;
|
||||
|
||||
public JobInfo(ActionType actionType, int id, String meta, String name, double baseIncome, Parser moneyEquation, double baseXp, Parser xpEquation,
|
||||
Parser pointsEquation, double basePoints, int fromLevel, int untilLevel, String configPath) {
|
||||
this(actionType, id, meta, name, baseIncome, moneyEquation, baseXp, xpEquation, pointsEquation, basePoints, fromLevel, untilLevel, configPath, null, null, null);
|
||||
Parser pointsEquation, double basePoints, int fromLevel, int untilLevel, String configPath) {
|
||||
this(actionType, id, meta, name, baseIncome, moneyEquation, baseXp, xpEquation, pointsEquation, basePoints, fromLevel, untilLevel, configPath, null, null, null);
|
||||
}
|
||||
|
||||
public JobInfo(ActionType actionType, int id, String meta, String name, double baseIncome, Parser moneyEquation, double baseXp, Parser xpEquation,
|
||||
Parser pointsEquation, double basePoints, int fromLevel, int untilLevel, String configPath, Integer softIncomeLevelLimit, Integer softExpLevelLimit, Integer softPointsLevelLimit) {
|
||||
this.actionType = actionType;
|
||||
this.id = id;
|
||||
this.meta = meta;
|
||||
this.name = name;
|
||||
this.baseIncome = baseIncome;
|
||||
this.moneyEquation = moneyEquation;
|
||||
this.pointsEquation = pointsEquation;
|
||||
this.basePoints = basePoints;
|
||||
this.baseXp = baseXp;
|
||||
this.xpEquation = xpEquation;
|
||||
this.fromLevel = fromLevel;
|
||||
this.untilLevel = untilLevel;
|
||||
this.configPath = configPath;
|
||||
this.softIncomeLevelLimit = softIncomeLevelLimit;
|
||||
this.softExpLevelLimit = softExpLevelLimit;
|
||||
this.softPointsLevelLimit = softPointsLevelLimit;
|
||||
Parser pointsEquation, double basePoints, int fromLevel, int untilLevel, String configPath, Integer softIncomeLevelLimit, Integer softExpLevelLimit, Integer softPointsLevelLimit) {
|
||||
this.actionType = actionType;
|
||||
this.id = id;
|
||||
this.meta = meta;
|
||||
this.name = name;
|
||||
this.baseIncome = baseIncome;
|
||||
this.moneyEquation = moneyEquation;
|
||||
this.pointsEquation = pointsEquation;
|
||||
this.basePoints = basePoints;
|
||||
this.baseXp = baseXp;
|
||||
this.xpEquation = xpEquation;
|
||||
this.fromLevel = fromLevel;
|
||||
this.untilLevel = untilLevel;
|
||||
this.configPath = configPath;
|
||||
this.softIncomeLevelLimit = softIncomeLevelLimit;
|
||||
this.softExpLevelLimit = softExpLevelLimit;
|
||||
this.softPointsLevelLimit = softPointsLevelLimit;
|
||||
}
|
||||
|
||||
public int getFromLevel() {
|
||||
return fromLevel;
|
||||
return fromLevel;
|
||||
}
|
||||
|
||||
public int getUntilLevel() {
|
||||
return untilLevel;
|
||||
return untilLevel;
|
||||
}
|
||||
|
||||
public boolean isInLevelRange(int level) {
|
||||
return level >= fromLevel && (level <= untilLevel || untilLevel == -1);
|
||||
return level >= fromLevel && (level <= untilLevel || untilLevel == -1);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getRealisticName() {
|
||||
String materialName = name.toLowerCase().replace('_', ' ');
|
||||
materialName = Character.toUpperCase(materialName.charAt(0)) + materialName.substring(1);
|
||||
materialName = Jobs.getNameTranslatorManager().translate(actionType == ActionType.MMKILL ? name : materialName, this);
|
||||
materialName = CMIChatColor.translate(materialName);
|
||||
return materialName;
|
||||
String materialName = name.toLowerCase().replace('_', ' ');
|
||||
materialName = Character.toUpperCase(materialName.charAt(0)) + materialName.substring(1);
|
||||
materialName = Jobs.getNameTranslatorManager().translate(actionType == ActionType.MMKILL ? name : materialName, this);
|
||||
materialName = CMIChatColor.translate(materialName);
|
||||
return materialName;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
return id;
|
||||
}
|
||||
|
||||
public ActionType getActionType() {
|
||||
return actionType;
|
||||
return actionType;
|
||||
}
|
||||
|
||||
public String getMeta() {
|
||||
return meta;
|
||||
return meta;
|
||||
}
|
||||
|
||||
public double getBaseIncome() {
|
||||
return baseIncome;
|
||||
return baseIncome;
|
||||
}
|
||||
|
||||
public double getBaseXp() {
|
||||
return baseXp;
|
||||
return baseXp;
|
||||
}
|
||||
|
||||
public double getBasePoints() {
|
||||
return basePoints;
|
||||
return basePoints;
|
||||
}
|
||||
|
||||
public double getIncome(double level, int numjobs, int maxJobs) {
|
||||
if (softIncomeLevelLimit != null && level > softIncomeLevelLimit)
|
||||
level = softIncomeLevelLimit;
|
||||
if (baseIncome == 0 || !Jobs.getGCManager().PaymentMethodsMoney)
|
||||
return 0;
|
||||
moneyEquation.setVariable("joblevel", level);
|
||||
moneyEquation.setVariable("numjobs", numjobs);
|
||||
moneyEquation.setVariable("maxjobs", maxJobs);
|
||||
moneyEquation.setVariable("baseincome", baseIncome);
|
||||
return moneyEquation.getValue();
|
||||
if (softIncomeLevelLimit != null && level > softIncomeLevelLimit)
|
||||
level = softIncomeLevelLimit;
|
||||
if (baseIncome == 0 || !CurrencyType.MONEY.isEnabled())
|
||||
return 0;
|
||||
moneyEquation.setVariable("joblevel", level);
|
||||
moneyEquation.setVariable("numjobs", numjobs);
|
||||
moneyEquation.setVariable("maxjobs", maxJobs);
|
||||
moneyEquation.setVariable("baseincome", baseIncome);
|
||||
return moneyEquation.getValue();
|
||||
}
|
||||
|
||||
public double getExperience(double level, int numjobs, int maxJobs) {
|
||||
if (softExpLevelLimit != null && level > softExpLevelLimit)
|
||||
level = softExpLevelLimit;
|
||||
if (baseXp == 0 || !Jobs.getGCManager().PaymentMethodsExp)
|
||||
return 0;
|
||||
xpEquation.setVariable("joblevel", level);
|
||||
xpEquation.setVariable("numjobs", numjobs);
|
||||
xpEquation.setVariable("maxjobs", maxJobs);
|
||||
xpEquation.setVariable("baseexperience", baseXp);
|
||||
return xpEquation.getValue();
|
||||
if (softExpLevelLimit != null && level > softExpLevelLimit)
|
||||
level = softExpLevelLimit;
|
||||
if (baseXp == 0 || !CurrencyType.EXP.isEnabled())
|
||||
return 0;
|
||||
xpEquation.setVariable("joblevel", level);
|
||||
xpEquation.setVariable("numjobs", numjobs);
|
||||
xpEquation.setVariable("maxjobs", maxJobs);
|
||||
xpEquation.setVariable("baseexperience", baseXp);
|
||||
return xpEquation.getValue();
|
||||
}
|
||||
|
||||
public double getPoints(double level, int numjobs, int maxJobs) {
|
||||
if (softPointsLevelLimit != null && level > softPointsLevelLimit)
|
||||
level = softPointsLevelLimit;
|
||||
if (basePoints == 0 || !Jobs.getGCManager().PaymentMethodsPoints)
|
||||
return 0;
|
||||
pointsEquation.setVariable("joblevel", level);
|
||||
pointsEquation.setVariable("numjobs", numjobs);
|
||||
pointsEquation.setVariable("maxjobs", maxJobs);
|
||||
pointsEquation.setVariable("basepoints", basePoints);
|
||||
return pointsEquation.getValue();
|
||||
if (softPointsLevelLimit != null && level > softPointsLevelLimit)
|
||||
level = softPointsLevelLimit;
|
||||
if (basePoints == 0 || !CurrencyType.POINTS.isEnabled())
|
||||
return 0;
|
||||
pointsEquation.setVariable("joblevel", level);
|
||||
pointsEquation.setVariable("numjobs", numjobs);
|
||||
pointsEquation.setVariable("maxjobs", maxJobs);
|
||||
pointsEquation.setVariable("basepoints", basePoints);
|
||||
return pointsEquation.getValue();
|
||||
}
|
||||
|
||||
public String getConfigPath() {
|
||||
return configPath;
|
||||
return configPath;
|
||||
}
|
||||
|
||||
public void setBaseIncome(double baseIncome) {
|
||||
this.baseIncome = baseIncome;
|
||||
this.baseIncome = baseIncome;
|
||||
}
|
||||
|
||||
public void setBaseXp(double baseXp) {
|
||||
this.baseXp = baseXp;
|
||||
this.baseXp = baseXp;
|
||||
}
|
||||
|
||||
public void setBasePoints(double basePoints) {
|
||||
this.basePoints = basePoints;
|
||||
this.basePoints = basePoints;
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public final class TabComplete implements TabCompleter {
|
||||
temp.addAll(Jobs.getScheduleManager().getConf().getConfig().getConfigurationSection("Boost").getKeys(false));
|
||||
break;
|
||||
case "[time]":
|
||||
temp.add("1hour10minute20s");
|
||||
temp.add("1h10m20s");
|
||||
break;
|
||||
case "[questname]":
|
||||
case "[quest]":
|
||||
|
Loading…
Reference in New Issue
Block a user