mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-02 14:29:07 +01:00
Option to show duplicate user messages. Disabled by default.
This commit is contained in:
parent
52547b94a5
commit
7f7003ca5f
@ -125,8 +125,9 @@ public class PlayerManager {
|
|||||||
// Checking duplicated UUID's which usually is a cause of previous bugs
|
// Checking duplicated UUID's which usually is a cause of previous bugs
|
||||||
if (playerUUIDMap.containsKey(info.getUuid()) && playerUUIDMap.get(info.getUuid()).getID() != info.getID()) {
|
if (playerUUIDMap.containsKey(info.getUuid()) && playerUUIDMap.get(info.getUuid()).getID() != info.getID()) {
|
||||||
int id = playerUUIDMap.get(info.getUuid()).getID();
|
int id = playerUUIDMap.get(info.getUuid()).getID();
|
||||||
CMIMessages.consoleMessage("&7Duplicate! &5" + info.getName() + " &7same UUID for 2 entries in database. Please remove of one them from users table id1: &2" + id + " &7id2: &2" + info.getID());
|
if (Jobs.getGCManager().isInformDuplicates())
|
||||||
|
CMIMessages.consoleMessage("&7Duplicate! &5" + info.getName() + " &7same UUID for 2 entries in database. Please remove of one them from users table id1: &2" + id + " &7id2: &2" + info
|
||||||
|
.getID());
|
||||||
if (id < info.getID()) {
|
if (id < info.getID()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -135,8 +136,9 @@ public class PlayerManager {
|
|||||||
// Checking duplicated names which usually is a cause of previous bugs
|
// Checking duplicated names which usually is a cause of previous bugs
|
||||||
if (playerNameMap.containsKey(info.getName().toLowerCase()) && playerNameMap.get(info.getName().toLowerCase()).getID() != info.getID()) {
|
if (playerNameMap.containsKey(info.getName().toLowerCase()) && playerNameMap.get(info.getName().toLowerCase()).getID() != info.getID()) {
|
||||||
int id = playerNameMap.get(info.getName().toLowerCase()).getID();
|
int id = playerNameMap.get(info.getName().toLowerCase()).getID();
|
||||||
CMIMessages.consoleMessage("&7Name Duplicate! &5" + info.getName() + " &7same UUID for 2 entries in database. Please remove of one them from users table id1: &2" + id + " &7id2: &2" + info
|
if (Jobs.getGCManager().isInformDuplicates())
|
||||||
.getID());
|
CMIMessages.consoleMessage("&7Name Duplicate! &5" + info.getName() + " &7same UUID for 2 entries in database. Please remove of one them from users table id1: &2" + id + " &7id2: &2" + info
|
||||||
|
.getID());
|
||||||
if (id < info.getID()) {
|
if (id < info.getID()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -283,7 +285,7 @@ public class PlayerManager {
|
|||||||
jPlayer.onConnect();
|
jPlayer.onConnect();
|
||||||
jPlayer.reloadHonorific();
|
jPlayer.reloadHonorific();
|
||||||
Jobs.getPermissionHandler().recalculatePermissions(jPlayer);
|
Jobs.getPermissionHandler().recalculatePermissions(jPlayer);
|
||||||
|
|
||||||
addPlayerToCache(jPlayer);
|
addPlayerToCache(jPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,123 +9,123 @@ import com.gamingmesh.jobs.container.Job;
|
|||||||
|
|
||||||
public class moneyboost implements Cmd {
|
public class moneyboost implements Cmd {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||||
if (args.length > 3 || args.length <= 1) {
|
if (args.length > 3 || args.length <= 1) {
|
||||||
Jobs.getCommandManager().sendUsage(sender, "moneyboost");
|
Jobs.getCommandManager().sendUsage(sender, "moneyboost");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
double rate = 1.0;
|
double rate = 1.0;
|
||||||
if (args[0].equalsIgnoreCase("all")) {
|
if (args[0].equalsIgnoreCase("all")) {
|
||||||
try {
|
try {
|
||||||
rate = Double.parseDouble(args[args.length > 2 ? 2 : 1]);
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
int[] times = parseTime(args);
|
|
||||||
|
|
||||||
for (Job job : Jobs.getJobs()) {
|
|
||||||
job.addBoost(CurrencyType.MONEY, rate, times);
|
|
||||||
}
|
|
||||||
|
|
||||||
sender.sendMessage(
|
|
||||||
Jobs.getLanguage().getMessage("command.moneyboost.output.boostalladded", "%boost%", rate));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("reset")) {
|
|
||||||
if (args[1].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(args[1]);
|
|
||||||
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(args[0]);
|
|
||||||
if (job == null) {
|
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
rate = Double.parseDouble(args[args.length > 2 ? 2 : 1]);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
Jobs.getCommandManager().sendUsage(sender, "moneyboost");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
job.addBoost(CurrencyType.MONEY, rate, parseTime(args));
|
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.boostadded", "%boost%", rate,
|
|
||||||
"%jobname%", job.getName()));
|
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int[] times = parseTime(args);
|
||||||
|
|
||||||
|
for (Job job : Jobs.getJobs()) {
|
||||||
|
job.addBoost(CurrencyType.MONEY, rate, times);
|
||||||
|
}
|
||||||
|
|
||||||
|
sender.sendMessage(
|
||||||
|
Jobs.getLanguage().getMessage("command.moneyboost.output.boostalladded", "%boost%", rate));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int[] parseTime(String[] args) {
|
if (args[0].equalsIgnoreCase("reset")) {
|
||||||
int[] arr = new int[3];
|
if (args[1].equalsIgnoreCase("all")) {
|
||||||
|
for (Job one : Jobs.getJobs()) {
|
||||||
if (args.length < 2) {
|
one.addBoost(CurrencyType.MONEY, 1.0);
|
||||||
return arr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String time = args[1].toLowerCase();
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.allreset"));
|
||||||
if (time.isEmpty()) {
|
} else if (args.length > 1) {
|
||||||
return arr;
|
Job job = Jobs.getJob(args[1]);
|
||||||
|
if (job == null) {
|
||||||
|
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] split = time.split("h|hour", 2);
|
job.addBoost(CurrencyType.MONEY, 1.0);
|
||||||
|
|
||||||
if (split.length > 0) {
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.jobsboostreset",
|
||||||
try {
|
"%jobname%", job.getName()));
|
||||||
arr[2] = Integer.parseInt(split[0]);
|
}
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
arr[2] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
time = time.replaceAll(arr[2] + "+[h|hour]+", "");
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
if ((split = time.split("m|minute", 2)).length > 0) {
|
|
||||||
try {
|
|
||||||
arr[1] = Integer.parseInt(split[0]);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
arr[1] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
time = time.replaceAll(arr[1] + "+[m|minute]+", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((split = time.split("s|second", 2)).length > 0) {
|
|
||||||
try {
|
|
||||||
arr[0] = Integer.parseInt(split[0]);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
arr[0] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
time = time.replaceAll(arr[0] + "+[s|second]+", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (arr[0] == 0 && arr[1] == 0 && arr[2] == 0) {
|
|
||||||
return new int[3];
|
|
||||||
}
|
|
||||||
|
|
||||||
return arr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Job job = Jobs.getJob(args[0]);
|
||||||
|
if (job == null) {
|
||||||
|
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
rate = Double.parseDouble(args[args.length > 2 ? 2 : 1]);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
Jobs.getCommandManager().sendUsage(sender, "moneyboost");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
job.addBoost(CurrencyType.MONEY, rate, parseTime(args));
|
||||||
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.boostadded", "%boost%", rate,
|
||||||
|
"%jobname%", job.getName()));
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] split = time.split("h|hour", 2);
|
||||||
|
|
||||||
|
if (split.length > 0) {
|
||||||
|
try {
|
||||||
|
arr[2] = Integer.parseInt(split[0]);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
arr[2] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
time = time.replaceAll(arr[2] + "+[h|hour]+", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((split = time.split("m|minute", 2)).length > 0) {
|
||||||
|
try {
|
||||||
|
arr[1] = Integer.parseInt(split[0]);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
arr[1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
time = time.replaceAll(arr[1] + "+[m|minute]+", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((split = time.split("s|second", 2)).length > 0) {
|
||||||
|
try {
|
||||||
|
arr[0] = Integer.parseInt(split[0]);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
arr[0] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
time = time.replaceAll(arr[0] + "+[s|second]+", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arr[0] == 0 && arr[1] == 0 && arr[2] == 0) {
|
||||||
|
return new int[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,7 @@ public class GeneralConfigManager {
|
|||||||
public float maxPaymentCurveFactor;
|
public float maxPaymentCurveFactor;
|
||||||
|
|
||||||
private boolean FurnacesReassign, BrewingStandsReassign, useTnTFinder = false, ShowNewVersion;
|
private boolean FurnacesReassign, BrewingStandsReassign, useTnTFinder = false, ShowNewVersion;
|
||||||
|
private boolean InformDuplicates;
|
||||||
|
|
||||||
private FireworkEffect fireworkEffect;
|
private FireworkEffect fireworkEffect;
|
||||||
|
|
||||||
@ -341,6 +342,10 @@ public class GeneralConfigManager {
|
|||||||
c.addComment("Optimizations.NewVersion",
|
c.addComment("Optimizations.NewVersion",
|
||||||
"When set to true staff will be informed about new Jobs plugin version", "You need to have jobs.versioncheck permission node");
|
"When set to true staff will be informed about new Jobs plugin version", "You need to have jobs.versioncheck permission node");
|
||||||
ShowNewVersion = c.get("Optimizations.NewVersion", true);
|
ShowNewVersion = c.get("Optimizations.NewVersion", true);
|
||||||
|
|
||||||
|
c.addComment("Optimizations.InformDuplicates",
|
||||||
|
"Can be used to check if your database contains any duplicated user entries.");
|
||||||
|
InformDuplicates = c.get("Optimizations.InformDuplicates", false);
|
||||||
|
|
||||||
c.addComment("Optimizations.DecimalPlaces.Money",
|
c.addComment("Optimizations.DecimalPlaces.Money",
|
||||||
"Decimal places to be shown");
|
"Decimal places to be shown");
|
||||||
@ -1154,4 +1159,8 @@ public class GeneralConfigManager {
|
|||||||
public FireworkEffect getFireworkEffect() {
|
public FireworkEffect getFireworkEffect() {
|
||||||
return fireworkEffect;
|
return fireworkEffect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isInformDuplicates() {
|
||||||
|
return InformDuplicates;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user