mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-25 12:05:16 +01:00
Fixed when the boost commands are not worked
This commit is contained in:
parent
e409c3a1d7
commit
834da89d10
@ -4,6 +4,7 @@
|
||||
- Fixed SQLException when inserting a job
|
||||
- Adding and taking exp should calculating correctly
|
||||
- Fixed exception if the enchantment level is null
|
||||
- Fixed when the boost commands are not worked
|
||||
|
||||
# 4.14.0
|
||||
- Fixed %titlename% placeholder does not showed anything
|
||||
|
@ -19,17 +19,21 @@ public class expboost implements Cmd {
|
||||
}
|
||||
|
||||
double rate = 1.0;
|
||||
if (!args[1].equalsIgnoreCase("all") && !args[0].equalsIgnoreCase("reset"))
|
||||
if (!args[1].equalsIgnoreCase("all") && !args[0].equalsIgnoreCase("reset")) {
|
||||
try {
|
||||
rate = Double.parseDouble(args[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "expboost");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Job job = Jobs.getJob(args[0]);
|
||||
if (job == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||
if (args[0].equalsIgnoreCase("all")) {
|
||||
for (Job one : Jobs.getJobs()) {
|
||||
one.addBoost(CurrencyType.EXP, rate);
|
||||
}
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.expboost.output.boostalladded", "%boost%", rate));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -40,7 +44,15 @@ public class expboost implements Cmd {
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.expboost.output.allreset"));
|
||||
return true;
|
||||
} else if (args[0].equalsIgnoreCase("reset")) {
|
||||
}
|
||||
|
||||
Job job = Jobs.getJob(args[0]);
|
||||
if (job == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("reset")) {
|
||||
boolean found = false;
|
||||
for (Job one : Jobs.getJobs()) {
|
||||
if (one.getName().equalsIgnoreCase(args[1])) {
|
||||
@ -56,15 +68,6 @@ public class expboost implements Cmd {
|
||||
}
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("all")) {
|
||||
for (Job one : Jobs.getJobs()) {
|
||||
one.addBoost(CurrencyType.EXP, rate);
|
||||
}
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.expboost.output.boostalladded", "%boost%", rate));
|
||||
return true;
|
||||
}
|
||||
|
||||
job.addBoost(CurrencyType.EXP, rate);
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.expboost.output.boostadded", "%boost%", rate, "%jobname%", job.getName()));
|
||||
return true;
|
||||
|
@ -13,27 +13,29 @@ public class moneyboost implements Cmd {
|
||||
@Override
|
||||
@JobCommand(2400)
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
|
||||
if (args.length > 2 || args.length <= 1) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "moneyboost");
|
||||
return true;
|
||||
}
|
||||
|
||||
double rate = 1.0;
|
||||
if (!args[1].equalsIgnoreCase("all") && !args[0].equalsIgnoreCase("reset"))
|
||||
if (!args[1].equalsIgnoreCase("all") && !args[0].equalsIgnoreCase("reset")) {
|
||||
try {
|
||||
rate = Double.parseDouble(args[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "moneyboost");
|
||||
return true;
|
||||
}
|
||||
|
||||
Job job = Jobs.getJob(args[0]);
|
||||
if (job == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("all")) {
|
||||
for (Job one : Jobs.getJobs()) {
|
||||
one.addBoost(CurrencyType.MONEY, rate);
|
||||
}
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.boostalladded", "%boost%", rate));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("reset") && args[1].equalsIgnoreCase("all")) {
|
||||
for (Job one : Jobs.getJobs()) {
|
||||
@ -42,7 +44,15 @@ public class moneyboost implements Cmd {
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.allreset"));
|
||||
return true;
|
||||
} else if (args[0].equalsIgnoreCase("reset")) {
|
||||
}
|
||||
|
||||
Job job = Jobs.getJob(args[0]);
|
||||
if (job == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("reset")) {
|
||||
boolean found = false;
|
||||
for (Job one : Jobs.getJobs()) {
|
||||
if (one.getName().equalsIgnoreCase(args[1])) {
|
||||
@ -58,15 +68,6 @@ public class moneyboost implements Cmd {
|
||||
}
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("all")) {
|
||||
for (Job one : Jobs.getJobs()) {
|
||||
one.addBoost(CurrencyType.MONEY, rate);
|
||||
}
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.boostalladded", "%boost%", rate));
|
||||
return true;
|
||||
}
|
||||
|
||||
job.addBoost(CurrencyType.MONEY, rate);
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.boostadded", "%boost%", rate, "%jobname%", job.getName()));
|
||||
return true;
|
||||
|
@ -13,27 +13,27 @@ public class pointboost implements Cmd {
|
||||
@Override
|
||||
@JobCommand(2400)
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
|
||||
if (args.length > 2 || args.length <= 1) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "pointboost");
|
||||
return true;
|
||||
}
|
||||
|
||||
double rate = 1.0;
|
||||
if (!args[1].equalsIgnoreCase("all") && !args[0].equalsIgnoreCase("reset"))
|
||||
if (!args[1].equalsIgnoreCase("all") && !args[0].equalsIgnoreCase("reset")) {
|
||||
try {
|
||||
rate = Double.parseDouble(args[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "pointboost");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
String PlayerName = sender.getName();
|
||||
String jobName = args[0];
|
||||
Job job = Jobs.getJob(jobName);
|
||||
if (args[0].equalsIgnoreCase("all")) {
|
||||
for (Job one : Jobs.getJobs()) {
|
||||
one.addBoost(CurrencyType.POINTS, rate);
|
||||
}
|
||||
|
||||
if (PlayerName == null) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "pointboost");
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.pointboost.output.boostalladded", "%boost%", rate));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -43,7 +43,15 @@ public class pointboost implements Cmd {
|
||||
}
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.pointboost.output.allreset"));
|
||||
return true;
|
||||
} else if (args[0].equalsIgnoreCase("reset")) {
|
||||
}
|
||||
|
||||
Job job = Jobs.getJob(args[0]);
|
||||
if (job == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("reset")) {
|
||||
boolean found = false;
|
||||
for (Job one : Jobs.getJobs()) {
|
||||
if (one.getName().equalsIgnoreCase(args[1])) {
|
||||
@ -59,19 +67,6 @@ public class pointboost implements Cmd {
|
||||
}
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("all")) {
|
||||
|
||||
for (Job one : Jobs.getJobs()) {
|
||||
one.addBoost(CurrencyType.POINTS, rate);
|
||||
}
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.pointboost.output.boostalladded", "%boost%", rate));
|
||||
return true;
|
||||
}
|
||||
if (job == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||
return true;
|
||||
}
|
||||
job.addBoost(CurrencyType.POINTS, rate);
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.pointboost.output.boostadded", "%boost%", rate, "%jobname%", job.getName()));
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user