mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-07 00:38:42 +01:00
Split boost times and add info about timed boosts
This commit is contained in:
parent
e560b9328f
commit
e933bc3a84
@ -9,6 +9,7 @@ import org.bukkit.potion.PotionData;
|
|||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
import org.bukkit.potion.PotionType;
|
import org.bukkit.potion.PotionType;
|
||||||
|
|
||||||
|
import com.gamingmesh.jobs.container.Potion;
|
||||||
import com.gamingmesh.jobs.stuff.Util;
|
import com.gamingmesh.jobs.stuff.Util;
|
||||||
|
|
||||||
public class ItemManager {
|
public class ItemManager {
|
||||||
@ -50,7 +51,11 @@ public class ItemManager {
|
|||||||
mojangName = mojangName == null ? mat.toString().replace("_", "").replace(" ", "").toLowerCase()
|
mojangName = mojangName == null ? mat.toString().replace("_", "").replace(" ", "").toLowerCase()
|
||||||
: mojangName.replace("_", "").replace(" ", "").toLowerCase();
|
: mojangName.replace("_", "").replace(" ", "").toLowerCase();
|
||||||
|
|
||||||
if (byName.containsKey(cmiName)) {
|
if (one.isCanHavePotionType()) {
|
||||||
|
for (Potion p : Potion.values()) {
|
||||||
|
byName.put(cmiName + ":" + p.toString().toLowerCase(), one);
|
||||||
|
}
|
||||||
|
} else if (byName.containsKey(cmiName)) {
|
||||||
byName.put(cmiName + ":" + data, one);
|
byName.put(cmiName + ":" + data, one);
|
||||||
} else
|
} else
|
||||||
byName.put(cmiName, one);
|
byName.put(cmiName, one);
|
||||||
@ -92,7 +97,6 @@ public class ItemManager {
|
|||||||
if (one.getLegacyData() == 0)
|
if (one.getLegacyData() == 0)
|
||||||
byId.put(one.getLegacyId(), one);
|
byId.put(one.getLegacyId(), one);
|
||||||
byRealMaterial.put(mat, one);
|
byRealMaterial.put(mat, one);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +210,7 @@ public class ItemManager {
|
|||||||
cmat = CMIMaterial.get(name);
|
cmat = CMIMaterial.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmat != null && !cmat.equals(CMIMaterial.NONE)) {
|
if (cmat != null && cmat != CMIMaterial.NONE) {
|
||||||
cm = cmat.newCMIItemStack();
|
cm = cmat.newCMIItemStack();
|
||||||
} else
|
} else
|
||||||
cmat = CMIMaterial.get(subdata == null ? original : original + ":" + subdata);
|
cmat = CMIMaterial.get(subdata == null ? original : original + ":" + subdata);
|
||||||
|
@ -18,81 +18,32 @@ public class expboost implements Cmd {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
String time = "";
|
|
||||||
double rate = 1.0;
|
double rate = 1.0;
|
||||||
if (args[0].equalsIgnoreCase("all")) {
|
if (args[0].equalsIgnoreCase("all")) {
|
||||||
if (args.length > 2) {
|
|
||||||
time = args[1].toLowerCase();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
rate = Double.parseDouble(args[2]);
|
rate = Double.parseDouble(args[args.length > 2 ? 2 : 1]);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
Jobs.getCommandManager().sendUsage(sender, "expboost");
|
Jobs.getCommandManager().sendUsage(sender, "expboost");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
rate = Double.parseDouble(args[1]);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
Jobs.getCommandManager().sendUsage(sender, "expboost");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.length > 2) {
|
|
||||||
int sec = 0, min = 0, hour = 0;
|
|
||||||
|
|
||||||
if (!time.isEmpty()) {
|
|
||||||
if (time.contains("s")) {
|
|
||||||
sec = Integer.parseInt(time.split("s")[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (time.contains("m")) {
|
|
||||||
min = Integer.parseInt(time.split("m")[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (time.contains("h")) {
|
|
||||||
hour = Integer.parseInt(time.split("h")[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean succeed = false;
|
|
||||||
for (Job one : Jobs.getJobs()) {
|
|
||||||
if (time.isEmpty()) {
|
|
||||||
one.addBoost(CurrencyType.EXP, rate);
|
|
||||||
succeed = true;
|
|
||||||
} else if (sec != 0 || min != 0 || hour != 0) {
|
|
||||||
one.addBoost(CurrencyType.EXP, rate, hour, min, sec);
|
|
||||||
succeed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (succeed) {
|
|
||||||
sender.sendMessage(
|
|
||||||
Jobs.getLanguage().getMessage("command.expboost.output.boostalladded", "%boost%", rate));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (Job job : Jobs.getJobs()) {
|
for (Job job : Jobs.getJobs()) {
|
||||||
job.addBoost(CurrencyType.EXP, rate);
|
job.addBoost(CurrencyType.EXP, rate, parseTime(args));
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(
|
sender.sendMessage(
|
||||||
Jobs.getLanguage().getMessage("command.expboost.output.boostalladded", "%boost%", rate));
|
Jobs.getLanguage().getMessage("command.expboost.output.boostalladded", "%boost%", rate));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("reset") && args[1].equalsIgnoreCase("all")) {
|
if (args[0].equalsIgnoreCase("reset")) {
|
||||||
|
if (args[1].equalsIgnoreCase("all")) {
|
||||||
for (Job one : Jobs.getJobs()) {
|
for (Job one : Jobs.getJobs()) {
|
||||||
one.addBoost(CurrencyType.EXP, 1.0);
|
one.addBoost(CurrencyType.EXP, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.expboost.output.allreset"));
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.expboost.output.allreset"));
|
||||||
return true;
|
} else if (args.length > 1) {
|
||||||
}
|
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("reset") && args.length > 1) {
|
|
||||||
Job job = Jobs.getJob(args[1]);
|
Job job = Jobs.getJob(args[1]);
|
||||||
if (job == null) {
|
if (job == null) {
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||||
@ -101,8 +52,10 @@ public class expboost implements Cmd {
|
|||||||
|
|
||||||
job.addBoost(CurrencyType.EXP, 1.0);
|
job.addBoost(CurrencyType.EXP, 1.0);
|
||||||
|
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.expboost.output.jobsboostreset", "%jobname%",
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.expboost.output.jobsboostreset",
|
||||||
job.getName()));
|
"%jobname%", job.getName()));
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,50 +65,46 @@ public class expboost implements Cmd {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.length > 2) {
|
|
||||||
time = args[1].toLowerCase();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
rate = Double.parseDouble(args[2]);
|
rate = Double.parseDouble(args[args.length > 2 ? 2 : 1]);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
Jobs.getCommandManager().sendUsage(sender, "expboost");
|
Jobs.getCommandManager().sendUsage(sender, "expboost");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
rate = Double.parseDouble(args[1]);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
Jobs.getCommandManager().sendUsage(sender, "expboost");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!time.isEmpty()) {
|
job.addBoost(CurrencyType.EXP, rate, parseTime(args));
|
||||||
int sec = 0, min = 0, hour = 0;
|
|
||||||
|
|
||||||
if (time.contains("s")) {
|
|
||||||
sec = Integer.parseInt(time.split("s")[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (time.contains("m")) {
|
|
||||||
min = Integer.parseInt(time.split("m")[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (time.contains("h")) {
|
|
||||||
hour = Integer.parseInt(time.split("h")[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sec != 0 || min != 0 || hour != 0) {
|
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.expboost.output.boostadded", "%boost%", rate,
|
|
||||||
"%jobname%", job.getName()));
|
|
||||||
job.addBoost(CurrencyType.EXP, rate, hour, min, sec);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
job.addBoost(CurrencyType.EXP, rate);
|
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.expboost.output.boostadded", "%boost%", rate,
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.expboost.output.boostadded", "%boost%", rate,
|
||||||
"%jobname%", job.getName()));
|
"%jobname%", job.getName()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int[] parseTime(String[] args) {
|
||||||
|
int[] arr = new int[3];
|
||||||
|
if (args.length < 2) {
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
String time = args[1].toLowerCase();
|
||||||
|
if (time.isEmpty()) {
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (time.contains("s") || time.contains("second")) {
|
||||||
|
arr[0] = Integer.parseInt(time.split("s|second")[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (time.contains("m") || time.contains("minute")) {
|
||||||
|
arr[1] = Integer.parseInt(time.split("m|minute")[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (time.contains("h") || time.contains("hour")) {
|
||||||
|
arr[2] = Integer.parseInt(time.split("h|hour")[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arr[0] == 0 && arr[1] == 0 && arr[2] == 0) {
|
||||||
|
return new int[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,81 +18,32 @@ public class moneyboost implements Cmd {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
String time = "";
|
|
||||||
double rate = 1.0;
|
double rate = 1.0;
|
||||||
if (args[0].equalsIgnoreCase("all")) {
|
if (args[0].equalsIgnoreCase("all")) {
|
||||||
if (args.length > 2) {
|
|
||||||
time = args[1].toLowerCase();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
rate = Double.parseDouble(args[2]);
|
rate = Double.parseDouble(args[args.length > 2 ? 2 : 1]);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
Jobs.getCommandManager().sendUsage(sender, "moneyboost");
|
Jobs.getCommandManager().sendUsage(sender, "moneyboost");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
rate = Double.parseDouble(args[1]);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
Jobs.getCommandManager().sendUsage(sender, "moneyboost");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.length > 2) {
|
|
||||||
int sec = 0, min = 0, hour = 0;
|
|
||||||
|
|
||||||
if (!time.isEmpty()) {
|
|
||||||
if (time.contains("s")) {
|
|
||||||
sec = Integer.parseInt(time.split("s")[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (time.contains("m")) {
|
|
||||||
min = Integer.parseInt(time.split("m")[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (time.contains("h")) {
|
|
||||||
hour = Integer.parseInt(time.split("h")[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean succeed = false;
|
|
||||||
for (Job one : Jobs.getJobs()) {
|
|
||||||
if (time.isEmpty()) {
|
|
||||||
one.addBoost(CurrencyType.MONEY, rate);
|
|
||||||
succeed = true;
|
|
||||||
} else if (sec != 0 || min != 0 || hour != 0) {
|
|
||||||
one.addBoost(CurrencyType.MONEY, rate, hour, min, sec);
|
|
||||||
succeed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (succeed) {
|
|
||||||
sender.sendMessage(
|
|
||||||
Jobs.getLanguage().getMessage("command.moneyboost.output.boostalladded", "%boost%", rate));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (Job job : Jobs.getJobs()) {
|
for (Job job : Jobs.getJobs()) {
|
||||||
job.addBoost(CurrencyType.MONEY, rate);
|
job.addBoost(CurrencyType.MONEY, rate, parseTime(args));
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(
|
sender.sendMessage(
|
||||||
Jobs.getLanguage().getMessage("command.moneyboost.output.boostalladded", "%boost%", rate));
|
Jobs.getLanguage().getMessage("command.moneyboost.output.boostalladded", "%boost%", rate));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("reset") && args[1].equalsIgnoreCase("all")) {
|
if (args[0].equalsIgnoreCase("reset")) {
|
||||||
|
if (args[1].equalsIgnoreCase("all")) {
|
||||||
for (Job one : Jobs.getJobs()) {
|
for (Job one : Jobs.getJobs()) {
|
||||||
one.addBoost(CurrencyType.MONEY, 1.0);
|
one.addBoost(CurrencyType.MONEY, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.allreset"));
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.allreset"));
|
||||||
return true;
|
} else if (args.length > 1) {
|
||||||
}
|
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("reset") && args.length > 1) {
|
|
||||||
Job job = Jobs.getJob(args[1]);
|
Job job = Jobs.getJob(args[1]);
|
||||||
if (job == null) {
|
if (job == null) {
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||||
@ -101,8 +52,10 @@ public class moneyboost implements Cmd {
|
|||||||
|
|
||||||
job.addBoost(CurrencyType.MONEY, 1.0);
|
job.addBoost(CurrencyType.MONEY, 1.0);
|
||||||
|
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.jobsboostreset", "%jobname%",
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.jobsboostreset",
|
||||||
job.getName()));
|
"%jobname%", job.getName()));
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,50 +65,46 @@ public class moneyboost implements Cmd {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.length > 2) {
|
|
||||||
time = args[1].toLowerCase();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
rate = Double.parseDouble(args[2]);
|
rate = Double.parseDouble(args[args.length > 2 ? 2 : 1]);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
Jobs.getCommandManager().sendUsage(sender, "moneyboost");
|
Jobs.getCommandManager().sendUsage(sender, "moneyboost");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
rate = Double.parseDouble(args[1]);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
Jobs.getCommandManager().sendUsage(sender, "moneyboost");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!time.isEmpty()) {
|
job.addBoost(CurrencyType.MONEY, rate, parseTime(args));
|
||||||
int sec = 0, min = 0, hour = 0;
|
|
||||||
|
|
||||||
if (time.contains("s")) {
|
|
||||||
sec = Integer.parseInt(time.split("s")[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (time.contains("m")) {
|
|
||||||
min = Integer.parseInt(time.split("m")[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (time.contains("h")) {
|
|
||||||
hour = Integer.parseInt(time.split("h")[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sec != 0 || min != 0 || hour != 0) {
|
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.boostadded", "%boost%",
|
|
||||||
rate, "%jobname%", job.getName()));
|
|
||||||
job.addBoost(CurrencyType.MONEY, rate, hour, min, sec);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
job.addBoost(CurrencyType.MONEY, rate);
|
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.boostadded", "%boost%", rate,
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.boostadded", "%boost%", rate,
|
||||||
"%jobname%", job.getName()));
|
"%jobname%", job.getName()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int[] parseTime(String[] args) {
|
||||||
|
int[] arr = new int[3];
|
||||||
|
if (args.length < 2) {
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
String time = args[1].toLowerCase();
|
||||||
|
if (time.isEmpty()) {
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (time.contains("s") || time.contains("second")) {
|
||||||
|
arr[0] = Integer.parseInt(time.split("s|second")[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (time.contains("m") || time.contains("minute")) {
|
||||||
|
arr[1] = Integer.parseInt(time.split("m|minute")[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (time.contains("h") || time.contains("hour")) {
|
||||||
|
arr[2] = Integer.parseInt(time.split("h|hour")[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arr[0] == 0 && arr[1] == 0 && arr[2] == 0) {
|
||||||
|
return new int[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,81 +18,32 @@ public class pointboost implements Cmd {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
String time = "";
|
|
||||||
double rate = 1.0;
|
double rate = 1.0;
|
||||||
if (args[0].equalsIgnoreCase("all")) {
|
if (args[0].equalsIgnoreCase("all")) {
|
||||||
if (args.length > 2) {
|
|
||||||
time = args[1].toLowerCase();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
rate = Double.parseDouble(args[2]);
|
rate = Double.parseDouble(args[args.length > 2 ? 2 : 1]);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
Jobs.getCommandManager().sendUsage(sender, "pointboost");
|
Jobs.getCommandManager().sendUsage(sender, "pointboost");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
rate = Double.parseDouble(args[1]);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
Jobs.getCommandManager().sendUsage(sender, "pointboost");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.length > 2) {
|
|
||||||
int sec = 0, min = 0, hour = 0;
|
|
||||||
|
|
||||||
if (!time.isEmpty()) {
|
|
||||||
if (time.contains("s")) {
|
|
||||||
sec = Integer.parseInt(time.split("s")[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (time.contains("m")) {
|
|
||||||
min = Integer.parseInt(time.split("m")[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (time.contains("h")) {
|
|
||||||
hour = Integer.parseInt(time.split("h")[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean succeed = false;
|
|
||||||
for (Job one : Jobs.getJobs()) {
|
|
||||||
if (time.isEmpty()) {
|
|
||||||
one.addBoost(CurrencyType.POINTS, rate);
|
|
||||||
succeed = true;
|
|
||||||
} else if (sec != 0 || min != 0 || hour != 0) {
|
|
||||||
one.addBoost(CurrencyType.POINTS, rate, hour, min, sec);
|
|
||||||
succeed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (succeed) {
|
|
||||||
sender.sendMessage(
|
|
||||||
Jobs.getLanguage().getMessage("command.pointboost.output.boostalladded", "%boost%", rate));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (Job job : Jobs.getJobs()) {
|
for (Job job : Jobs.getJobs()) {
|
||||||
job.addBoost(CurrencyType.POINTS, rate);
|
job.addBoost(CurrencyType.POINTS, rate, parseTime(args));
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(
|
sender.sendMessage(
|
||||||
Jobs.getLanguage().getMessage("command.pointboost.output.boostalladded", "%boost%", rate));
|
Jobs.getLanguage().getMessage("command.pointboost.output.boostalladded", "%boost%", rate));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("reset") && args[1].equalsIgnoreCase("all")) {
|
if (args[0].equalsIgnoreCase("reset")) {
|
||||||
|
if (args[1].equalsIgnoreCase("all")) {
|
||||||
for (Job one : Jobs.getJobs()) {
|
for (Job one : Jobs.getJobs()) {
|
||||||
one.addBoost(CurrencyType.POINTS, 1.0);
|
one.addBoost(CurrencyType.POINTS, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.pointboost.output.allreset"));
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.pointboost.output.allreset"));
|
||||||
return true;
|
} else if (args.length > 1) {
|
||||||
}
|
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("reset") && args.length > 1) {
|
|
||||||
Job job = Jobs.getJob(args[1]);
|
Job job = Jobs.getJob(args[1]);
|
||||||
if (job == null) {
|
if (job == null) {
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||||
@ -101,8 +52,10 @@ public class pointboost implements Cmd {
|
|||||||
|
|
||||||
job.addBoost(CurrencyType.POINTS, 1.0);
|
job.addBoost(CurrencyType.POINTS, 1.0);
|
||||||
|
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.pointboost.output.jobsboostreset", "%jobname%",
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.pointboost.output.jobsboostreset",
|
||||||
job.getName()));
|
"%jobname%", job.getName()));
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,50 +65,46 @@ public class pointboost implements Cmd {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.length > 2) {
|
|
||||||
time = args[1].toLowerCase();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
rate = Double.parseDouble(args[2]);
|
rate = Double.parseDouble(args[args.length > 2 ? 2 : 1]);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
Jobs.getCommandManager().sendUsage(sender, "pointboost");
|
Jobs.getCommandManager().sendUsage(sender, "pointboost");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
rate = Double.parseDouble(args[1]);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
Jobs.getCommandManager().sendUsage(sender, "pointboost");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!time.isEmpty()) {
|
job.addBoost(CurrencyType.POINTS, rate, parseTime(args));
|
||||||
int sec = 0, min = 0, hour = 0;
|
|
||||||
|
|
||||||
if (time.contains("s")) {
|
|
||||||
sec = Integer.parseInt(time.split("s")[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (time.contains("m")) {
|
|
||||||
min = Integer.parseInt(time.split("m")[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (time.contains("h")) {
|
|
||||||
hour = Integer.parseInt(time.split("h")[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sec != 0 || min != 0 || hour != 0) {
|
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.pointboost.output.boostadded", "%boost%",
|
|
||||||
rate, "%jobname%", job.getName()));
|
|
||||||
job.addBoost(CurrencyType.POINTS, rate, hour, min, sec);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
job.addBoost(CurrencyType.POINTS, rate);
|
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.pointboost.output.boostadded", "%boost%", rate,
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.pointboost.output.boostadded", "%boost%", rate,
|
||||||
"%jobname%", job.getName()));
|
"%jobname%", job.getName()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int[] parseTime(String[] args) {
|
||||||
|
int[] arr = new int[3];
|
||||||
|
if (args.length < 2) {
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
String time = args[1].toLowerCase();
|
||||||
|
if (time.isEmpty()) {
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (time.contains("s") || time.contains("second")) {
|
||||||
|
arr[0] = Integer.parseInt(time.split("s|second")[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (time.contains("m") || time.contains("minute")) {
|
||||||
|
arr[1] = Integer.parseInt(time.split("m|minute")[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (time.contains("h") || time.contains("hour")) {
|
||||||
|
arr[2] = Integer.parseInt(time.split("h|hour")[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arr[0] == 0 && arr[1] == 0 && arr[2] == 0) {
|
||||||
|
return new int[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -842,6 +842,8 @@ public class ConfigManager {
|
|||||||
// uses subType
|
// uses subType
|
||||||
subType = ":" + item.split("-")[1];
|
subType = ":" + item.split("-")[1];
|
||||||
item = item.split("-")[0];
|
item = item.split("-")[0];
|
||||||
|
} else if (item.contains(":")) { // when we uses tipped arrow effect types
|
||||||
|
item = item.split(":")[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
CMIMaterial material = CMIMaterial.get(item + (subType));
|
CMIMaterial material = CMIMaterial.get(item + (subType));
|
||||||
@ -1051,7 +1053,7 @@ public class ConfigManager {
|
|||||||
itemSection.getStringList("lore").stream().map(CMIChatColor::translate).forEach(lore::add);
|
itemSection.getStringList("lore").stream().map(CMIChatColor::translate).forEach(lore::add);
|
||||||
|
|
||||||
HashMap<Enchantment, Integer> enchants = new HashMap<>();
|
HashMap<Enchantment, Integer> enchants = new HashMap<>();
|
||||||
if (itemSection.contains("enchants"))
|
if (itemSection.isList("enchants"))
|
||||||
for (String eachLine : itemSection.getStringList("enchants")) {
|
for (String eachLine : itemSection.getStringList("enchants")) {
|
||||||
if (!eachLine.contains("="))
|
if (!eachLine.contains("="))
|
||||||
continue;
|
continue;
|
||||||
|
@ -122,8 +122,8 @@ public class LanguageManager {
|
|||||||
c.get("command.help.output.nextPageGui", "&6Next Page");
|
c.get("command.help.output.nextPageGui", "&6Next Page");
|
||||||
|
|
||||||
c.get("command.moneyboost.help.info", "Boosts money gain for all players");
|
c.get("command.moneyboost.help.info", "Boosts money gain for all players");
|
||||||
c.get("command.moneyboost.help.args", "[jobname]/all/reset [rate]/all");
|
c.get("command.moneyboost.help.args", "[jobname]/all/reset [time]/[rate]");
|
||||||
Jobs.getGCManager().getCommandArgs().put("moneyboost", Arrays.asList("[jobname]", "[rate]"));
|
Jobs.getGCManager().getCommandArgs().put("moneyboost", Arrays.asList("[jobname]%%all%%reset", "[time]%%[rate]"));
|
||||||
c.get("command.moneyboost.output.allreset", "All money boosts turned off");
|
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.jobsboostreset", "Money boost has been turned off for %jobname%");
|
||||||
c.get("command.moneyboost.output.nothingtoreset", "Nothing to reset");
|
c.get("command.moneyboost.output.nothingtoreset", "Nothing to reset");
|
||||||
@ -132,8 +132,8 @@ public class LanguageManager {
|
|||||||
c.get("command.moneyboost.output.infostats", "&c-----> &aMoney rate x%boost% enabled&c <-------");
|
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.info", "Boosts point gain for all players");
|
||||||
c.get("command.pointboost.help.args", "[jobname]/all/reset [rate]/all");
|
c.get("command.pointboost.help.args", "[jobname]/all/reset [time]/[rate]");
|
||||||
Jobs.getGCManager().getCommandArgs().put("pointboost", Arrays.asList("[jobname]", "[rate]"));
|
Jobs.getGCManager().getCommandArgs().put("pointboost", Arrays.asList("[jobname]%%all%%reset", "[time]%%[rate]"));
|
||||||
c.get("command.pointboost.output.allreset", "All point boosts turned off");
|
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.jobsboostreset", "Point boost has been turned off for %jobname%");
|
||||||
c.get("command.pointboost.output.nothingtoreset", "Nothing to reset");
|
c.get("command.pointboost.output.nothingtoreset", "Nothing to reset");
|
||||||
@ -142,8 +142,8 @@ public class LanguageManager {
|
|||||||
c.get("command.pointboost.output.infostats", "&c-----> &aPoints rate x%boost% enabled&c <-------");
|
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.info", "Boosts exp gain for all players");
|
||||||
c.get("command.expboost.help.args", "[jobname]/all/reset [rate]/all");
|
c.get("command.expboost.help.args", "[jobname]/all/reset [time]/[rate]");
|
||||||
Jobs.getGCManager().getCommandArgs().put("expboost", Arrays.asList("[jobname]", "[rate]"));
|
Jobs.getGCManager().getCommandArgs().put("expboost", Arrays.asList("[jobname]%%all%%reset", "[time]%%[rate]"));
|
||||||
c.get("command.expboost.output.allreset", "All exp boosts turned off");
|
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.jobsboostreset", "Exp boost has been turned off for %jobname%");
|
||||||
c.get("command.expboost.output.nothingtoreset", "Nothing to reset");
|
c.get("command.expboost.output.nothingtoreset", "Nothing to reset");
|
||||||
|
@ -83,7 +83,7 @@ public class NameTranslatorManager {
|
|||||||
return nameLs + ":" + nameMeta;
|
return nameLs + ":" + nameMeta;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mat.equals(CMIMaterial.NONE)) {
|
if (mat == CMIMaterial.NONE) {
|
||||||
return fallbackMaterialName;
|
return fallbackMaterialName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,11 +106,11 @@ public class NameTranslatorManager {
|
|||||||
case TAME:
|
case TAME:
|
||||||
for (NameList one : ListOfEntities) {
|
for (NameList one : ListOfEntities) {
|
||||||
String ids = one.getId() + ":" + one.getMeta();
|
String ids = one.getId() + ":" + one.getMeta();
|
||||||
if (!one.getMeta().equalsIgnoreCase("") && ids.equalsIgnoreCase(id + ":" + meta) && !one.getId().equalsIgnoreCase("0")) {
|
if (!one.getMeta().equalsIgnoreCase("") && ids.equalsIgnoreCase(id + ":" + meta) && !one.getId().equals("0")) {
|
||||||
return one.getName();
|
return one.getName();
|
||||||
}
|
}
|
||||||
ids = one.getId();
|
ids = one.getId();
|
||||||
if (ids.equalsIgnoreCase(String.valueOf(id)) && !one.getId().equalsIgnoreCase("0")) {
|
if (ids.equalsIgnoreCase(String.valueOf(id)) && !one.getId().equals("0")) {
|
||||||
return one.getName();
|
return one.getName();
|
||||||
}
|
}
|
||||||
ids = one.getMinecraftName();
|
ids = one.getMinecraftName();
|
||||||
@ -391,9 +391,7 @@ public class NameTranslatorManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (Enchantment one : Enchantment.values()) {
|
for (Enchantment one : Enchantment.values()) {
|
||||||
if (one == null)
|
if (one == null || CMIEnchantment.getName(one) == null)
|
||||||
continue;
|
|
||||||
if (CMIEnchantment.getName(one) == null)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
String name = Util.firstToUpperCase(CMIEnchantment.getName(one).toString()).replace("_", " ");
|
String name = Util.firstToUpperCase(CMIEnchantment.getName(one).toString()).replace("_", " ");
|
||||||
|
@ -116,13 +116,18 @@ public class Job {
|
|||||||
boost.add(type, Point);
|
boost.add(type, Point);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addBoost(CurrencyType type, double point, int hour, int minute, int second) {
|
public void addBoost(CurrencyType type, double point, int[] times) {
|
||||||
|
if (times.length < 3) {
|
||||||
|
addBoost(type, point);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final Calendar cal = Calendar.getInstance();
|
final Calendar cal = Calendar.getInstance();
|
||||||
cal.setTime(new Date());
|
cal.setTime(new Date());
|
||||||
|
|
||||||
cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) + hour);
|
cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) + times[2]);
|
||||||
cal.set(Calendar.MINUTE, cal.get(Calendar.MINUTE) + minute);
|
cal.set(Calendar.MINUTE, cal.get(Calendar.MINUTE) + times[1]);
|
||||||
cal.set(Calendar.SECOND, cal.get(Calendar.SECOND) + second);
|
cal.set(Calendar.SECOND, cal.get(Calendar.SECOND) + times[0]);
|
||||||
|
|
||||||
long time = cal.getTimeInMillis();
|
long time = cal.getTimeInMillis();
|
||||||
boost.add(type, point, time);
|
boost.add(type, point, time);
|
||||||
|
@ -22,40 +22,30 @@ package com.gamingmesh.jobs.container;
|
|||||||
* <a href="https://papermc.io/javadocs/paper/1.13/org/bukkit/potion/PotionType.html">API reference for names</a>
|
* <a href="https://papermc.io/javadocs/paper/1.13/org/bukkit/potion/PotionType.html">API reference for names</a>
|
||||||
*/
|
*/
|
||||||
public enum Potion {
|
public enum Potion {
|
||||||
AWKWARD("awkward"),
|
AWKWARD,
|
||||||
FIRE_RESISTANCE("fire_resistance"),
|
FIRE_RESISTANCE,
|
||||||
INSTANT_DAMAGE("instant_damage"),
|
INSTANT_DAMAGE,
|
||||||
INSTANT_HEAL("instant_heal"),
|
INSTANT_HEAL,
|
||||||
INVISIBILITY("invisibility"),
|
INVISIBILITY,
|
||||||
JUMP("jump"),
|
JUMP,
|
||||||
LUCK("luck"),
|
LUCK,
|
||||||
MUNDANE("mundane"),
|
MUNDANE,
|
||||||
NIGHT_VISION("night_vision"),
|
NIGHT_VISION,
|
||||||
LONG_NIGHT_VISION("long_night_vision"),
|
LONG_NIGHT_VISION,
|
||||||
POISON("poison"),
|
POISON,
|
||||||
REGENERATION("regeneration"),
|
REGENERATION,
|
||||||
SLOW_FALLING("slow_falling"),
|
SLOW_FALLING,
|
||||||
SLOWNESS("slowness"),
|
SLOWNESS,
|
||||||
SPEED("speed"),
|
SPEED,
|
||||||
STRENGTH("strength"),
|
STRENGTH,
|
||||||
THICK("thick"),
|
THICK,
|
||||||
TURTLE_MASTER("turtle_master"),
|
TURTLE_MASTER,
|
||||||
WATER_BREATHING("water_breathing"),
|
WATER_BREATHING,
|
||||||
WEAKNESS("weakness");
|
WEAKNESS;
|
||||||
|
|
||||||
private final String name;
|
|
||||||
|
|
||||||
Potion(String name) {
|
|
||||||
this.name = name.toUpperCase();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Potion getByName(String name) {
|
public static Potion getByName(String name) {
|
||||||
for (Potion one : Potion.values()) {
|
for (Potion one : Potion.values()) {
|
||||||
if (one.name.equalsIgnoreCase(name)) {
|
if (one.toString().equalsIgnoreCase(name)) {
|
||||||
return one;
|
return one;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,6 +64,9 @@ public class TabComplete implements TabCompleter {
|
|||||||
List<String> temp = new ArrayList<>();
|
List<String> temp = new ArrayList<>();
|
||||||
for (String ar : t2) {
|
for (String ar : t2) {
|
||||||
switch (ar) {
|
switch (ar) {
|
||||||
|
case "[time]":
|
||||||
|
temp.add("1hour10minute20s");
|
||||||
|
break;
|
||||||
case "[questname]":
|
case "[questname]":
|
||||||
case "[quest]":
|
case "[quest]":
|
||||||
Job job = Jobs.getJob(args[i - 1]);
|
Job job = Jobs.getJob(args[i - 1]);
|
||||||
|
Loading…
Reference in New Issue
Block a user