Add option to disable command confirmations per player
This commit is contained in:
parent
6779923320
commit
498f2441ce
|
@ -32,6 +32,7 @@ import java.util.UUID;
|
|||
import java.util.logging.Logger;
|
||||
|
||||
public class BoosCoolDown extends JavaPlugin implements Runnable {
|
||||
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
private static PluginDescriptionFile pdfFile;
|
||||
private static Economy economy = null;
|
||||
|
@ -39,8 +40,7 @@ public class BoosCoolDown extends JavaPlugin implements Runnable {
|
|||
private PluginManager pm;
|
||||
|
||||
public static void commandLogger(String player, String command) {
|
||||
log.info("[" + "boosLogger" + "] " + player + " used command "
|
||||
+ command);
|
||||
log.info("[" + "boosLogger" + "] " + player + " used command " + command);
|
||||
}
|
||||
|
||||
public static Economy getEconomy() {
|
||||
|
@ -59,39 +59,29 @@ public class BoosCoolDown extends JavaPlugin implements Runnable {
|
|||
|
||||
private static void startLimitResetTimersGlobal() {
|
||||
YamlConfiguration confusers = BoosConfigManager.getConfusers();
|
||||
ConfigurationSection global = confusers
|
||||
.getConfigurationSection("global");
|
||||
ConfigurationSection global = confusers.getConfigurationSection("global");
|
||||
if (global != null) {
|
||||
Set<String> globalKeys = global.getKeys(false);
|
||||
BukkitScheduler scheduler = Bukkit.getScheduler();
|
||||
for (String key : globalKeys) {
|
||||
String confTime = confusers.getString("global." + key
|
||||
+ ".reset");
|
||||
long limitResetDelay = BoosConfigManager
|
||||
.getLimitResetDelayGlobal(key);
|
||||
String confTime = confusers.getString("global." + key + ".reset");
|
||||
long limitResetDelay = BoosConfigManager.getLimitResetDelayGlobal(key);
|
||||
Date endDate = getTime(confTime);
|
||||
Date startDate = getCurrTime();
|
||||
Calendar calcurrTime = Calendar.getInstance();
|
||||
calcurrTime.setTime(startDate);
|
||||
Calendar callastTime = Calendar.getInstance();
|
||||
callastTime.setTime(endDate);
|
||||
long time = secondsBetween(calcurrTime, callastTime,
|
||||
limitResetDelay);
|
||||
long time = secondsBetween(calcurrTime, callastTime, limitResetDelay);
|
||||
if (limitResetDelay != -65535) {
|
||||
if (time <= 0) {
|
||||
time = 1;
|
||||
}
|
||||
BoosCoolDown.getLog().info(
|
||||
"[boosCooldowns] Starting timer for " + time
|
||||
+ " seconds to reset limits for command "
|
||||
+ key);
|
||||
scheduler.scheduleSyncDelayedTask(Bukkit.getPluginManager()
|
||||
.getPlugin("boosCooldowns"),
|
||||
new BoosGlobalLimitResetRunnable(key), time * 20);
|
||||
BoosCoolDown.getLog().info("[boosCooldowns] Starting timer for " + time + " seconds to reset limits for command " + key);
|
||||
scheduler.scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("boosCooldowns"), new BoosGlobalLimitResetRunnable(key),
|
||||
time * 20);
|
||||
} else {
|
||||
BoosCoolDown.getLog().info(
|
||||
"[boosCooldowns] Stoping timer to reset limits for command "
|
||||
+ key);
|
||||
BoosCoolDown.getLog().info("[boosCooldowns] Stoping timer to reset limits for command " + key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -113,24 +103,16 @@ public class BoosCoolDown extends JavaPlugin implements Runnable {
|
|||
if (time <= 0) {
|
||||
time = 1;
|
||||
}
|
||||
BoosCoolDown.getLog().info(
|
||||
"[boosCooldowns] Starting timer for " + time
|
||||
+ " seconds to reset limits for command " + key);
|
||||
scheduler.scheduleSyncDelayedTask(Bukkit.getPluginManager()
|
||||
.getPlugin("boosCooldowns"),
|
||||
new BoosGlobalLimitResetRunnable(key), time * 20);
|
||||
BoosCoolDown.getLog().info("[boosCooldowns] Starting timer for " + time + " seconds to reset limits for command " + key);
|
||||
scheduler.scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("boosCooldowns"), new BoosGlobalLimitResetRunnable(key), time * 20);
|
||||
} else {
|
||||
BoosCoolDown.getLog().info(
|
||||
"[boosCooldowns] Stoping timer to reset limits for command "
|
||||
+ key);
|
||||
BoosCoolDown.getLog().info("[boosCooldowns] Stoping timer to reset limits for command " + key);
|
||||
}
|
||||
}
|
||||
|
||||
private static long secondsBetween(Calendar startDate, Calendar endDate,
|
||||
long limitResetDelay) {
|
||||
private static long secondsBetween(Calendar startDate, Calendar endDate, long limitResetDelay) {
|
||||
long secondsBetween = 0;
|
||||
secondsBetween = ((endDate.getTimeInMillis() - startDate
|
||||
.getTimeInMillis()) / 1000) + limitResetDelay;
|
||||
secondsBetween = ((endDate.getTimeInMillis() - startDate.getTimeInMillis()) / 1000) + limitResetDelay;
|
||||
return secondsBetween;
|
||||
}
|
||||
|
||||
|
@ -166,93 +148,69 @@ public class BoosCoolDown extends JavaPlugin implements Runnable {
|
|||
private void initializeVault() {
|
||||
Plugin x = pm.getPlugin("Vault");
|
||||
if (x != null & x instanceof Vault) {
|
||||
log.info("[" + pdfFile.getName() + "]"
|
||||
+ " found [Vault] searching for economy plugin.");
|
||||
log.info("[" + pdfFile.getName() + "]" + " found [Vault] searching for economy plugin.");
|
||||
usingVault = true;
|
||||
if (setupEconomy()) {
|
||||
log.info("[" + pdfFile.getName() + "]" + " found ["
|
||||
+ economy.getName()
|
||||
+ "] plugin, enabling prices support.");
|
||||
log.info("[" + pdfFile.getName() + "]" + " found [" + economy.getName() + "] plugin, enabling prices support.");
|
||||
} else {
|
||||
log.info("["
|
||||
+ pdfFile.getName()
|
||||
+ "]"
|
||||
+ " economy plugin not found, disabling prices support.");
|
||||
log.info("[" + pdfFile.getName() + "]" + " economy plugin not found, disabling prices support.");
|
||||
}
|
||||
} else {
|
||||
log.info("[" + pdfFile.getName() + "]"
|
||||
+ " [Vault] not found disabling economy support.");
|
||||
log.info("[" + pdfFile.getName() + "]" + " [Vault] not found disabling economy support.");
|
||||
usingVault = false;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command c,
|
||||
String commandLabel, String[] args) {
|
||||
public boolean onCommand(CommandSender sender, Command c, String commandLabel, String[] args) {
|
||||
String command = c.getName().toLowerCase();
|
||||
if (command.equalsIgnoreCase("booscooldowns")) {
|
||||
if (args.length == 1) {
|
||||
if (sender.hasPermission("booscooldowns.reload")
|
||||
&& args[0].equalsIgnoreCase("reload")) {
|
||||
if (sender.hasPermission("booscooldowns.reload") && args[0].equalsIgnoreCase("reload")) {
|
||||
reload();
|
||||
boosChat.sendMessageToCommandSender(sender,
|
||||
"&6[" + pdfFile.getName() + "]&e"
|
||||
+ " config reloaded");
|
||||
boosChat.sendMessageToCommandSender(sender, "&6[" + pdfFile.getName() + "]&e" + " config reloaded");
|
||||
return true;
|
||||
}
|
||||
if (sender.hasPermission("booscooldowns.list.limits")
|
||||
&& args[0].equalsIgnoreCase("limits")) {
|
||||
} else if (sender.hasPermission("booscooldowns.list.limits") && args[0].equalsIgnoreCase("limits")) {
|
||||
try {
|
||||
Player send = (Player) sender;
|
||||
Set<String> commands = BoosConfigManager
|
||||
.getCommands(send);
|
||||
Set<String> commands = BoosConfigManager.getCommands(send);
|
||||
for (String comm : commands) {
|
||||
int lim = BoosConfigManager.getLimit(comm, send);
|
||||
BoosLimitManager.getLimitListMessages(send, comm,
|
||||
lim);
|
||||
BoosLimitManager.getLimitListMessages(send, comm, lim);
|
||||
}
|
||||
} catch (ClassCastException e) {
|
||||
log.warning("You cannot use this command from console!");
|
||||
}
|
||||
return true;
|
||||
} else if (sender.hasPermission("booscooldowns.globalreset")
|
||||
&& args[0].equalsIgnoreCase("startglobalreset")) {
|
||||
} else if (sender.hasPermission("booscooldowns.globalreset") && args[0].equalsIgnoreCase("startglobalreset")) {
|
||||
BoosLimitManager.setGlobalLimitResetDate();
|
||||
startLimitResetTimersGlobal();
|
||||
return true;
|
||||
} else if (args[0].equalsIgnoreCase("confirmations")) {
|
||||
BoosConfigManager.toggleConfirmations((Player)sender);
|
||||
return true;
|
||||
}
|
||||
} else if (args.length == 2) {
|
||||
String jmeno = args[1];
|
||||
Player player = Bukkit.getPlayerExact(jmeno);
|
||||
UUID uuid = player.getUniqueId();
|
||||
if (sender.hasPermission("booscooldowns.clearcooldowns")
|
||||
&& args[0].equalsIgnoreCase("clearcooldowns")) {
|
||||
if (sender.hasPermission("booscooldowns.clearcooldowns") && args[0].equalsIgnoreCase("clearcooldowns")) {
|
||||
String co = "cooldown";
|
||||
BoosConfigManager.clearSomething(co, uuid);
|
||||
boosChat.sendMessageToCommandSender(sender,
|
||||
"&6[" + pdfFile.getName() + "]&e"
|
||||
+ " cooldowns of player " + jmeno
|
||||
+ " cleared");
|
||||
boosChat.sendMessageToCommandSender(sender, "&6[" + pdfFile.getName() + "]&e" + " cooldowns of player " + jmeno + " cleared");
|
||||
return true;
|
||||
} else if (sender.hasPermission("booscooldowns.clearuses")
|
||||
&& command.equalsIgnoreCase("booscooldowns")
|
||||
&& args[0].equalsIgnoreCase("clearuses")) {
|
||||
} else if (sender.hasPermission("booscooldowns.clearuses") && command.equalsIgnoreCase("booscooldowns") && args[0].equalsIgnoreCase(
|
||||
"clearuses")) {
|
||||
String co = "uses";
|
||||
BoosConfigManager.clearSomething(co, uuid);
|
||||
boosChat.sendMessageToCommandSender(sender,
|
||||
"&6[" + pdfFile.getName() + "]&e"
|
||||
+ " uses of player " + jmeno + " cleared");
|
||||
boosChat.sendMessageToCommandSender(sender, "&6[" + pdfFile.getName() + "]&e" + " uses of player " + jmeno + " cleared");
|
||||
return true;
|
||||
} else if (sender.hasPermission("booscooldowns.clearwarmups")
|
||||
&& command.equalsIgnoreCase("booscooldowns")
|
||||
} else if (sender.hasPermission("booscooldowns.clearwarmups") && command.equalsIgnoreCase("booscooldowns")
|
||||
&& args[0].equalsIgnoreCase("clearwarmups")) {
|
||||
String co = "warmup";
|
||||
BoosConfigManager.clearSomething(co, uuid);
|
||||
boosChat.sendMessageToCommandSender(sender,
|
||||
"&6[" + pdfFile.getName() + "]&e"
|
||||
+ " warmups of player " + jmeno
|
||||
+ " cleared");
|
||||
boosChat.sendMessageToCommandSender(sender, "&6[" + pdfFile.getName() + "]&e" + " warmups of player " + jmeno + " cleared");
|
||||
return true;
|
||||
}
|
||||
} else if (args.length == 3) {
|
||||
|
@ -260,38 +218,28 @@ public class BoosCoolDown extends JavaPlugin implements Runnable {
|
|||
Player player = Bukkit.getPlayerExact(jmeno);
|
||||
UUID uuid = player.getUniqueId();
|
||||
String command2 = args[2].trim();
|
||||
if (sender.hasPermission("booscooldowns.clearcooldowns")
|
||||
&& args[0].equalsIgnoreCase("clearcooldowns")) {
|
||||
if (sender.hasPermission("booscooldowns.clearcooldowns") && args[0].equalsIgnoreCase("clearcooldowns")) {
|
||||
String co = "cooldown";
|
||||
BoosConfigManager.clearSomething(co, uuid, command2);
|
||||
boosChat.sendMessageToCommandSender(sender,
|
||||
"&6[" + pdfFile.getName() + "]&e"
|
||||
+ " cooldown for command " + command2
|
||||
+ " of player " + uuid + " cleared");
|
||||
"&6[" + pdfFile.getName() + "]&e" + " cooldown for command " + command2 + " of player " + uuid + " cleared");
|
||||
return true;
|
||||
} else if (sender.hasPermission("booscooldowns.clearuses")
|
||||
&& args[0].equalsIgnoreCase("clearuses")) {
|
||||
} else if (sender.hasPermission("booscooldowns.clearuses") && args[0].equalsIgnoreCase("clearuses")) {
|
||||
String co = "uses";
|
||||
BoosConfigManager.clearSomething(co, uuid, command2);
|
||||
boosChat.sendMessageToCommandSender(sender,
|
||||
"&6[" + pdfFile.getName() + "]&e"
|
||||
+ " uses for command " + command2
|
||||
+ " of player " + jmeno + " cleared");
|
||||
"&6[" + pdfFile.getName() + "]&e" + " uses for command " + command2 + " of player " + jmeno + " cleared");
|
||||
return true;
|
||||
} else if (sender.hasPermission("booscooldowns.clearwarmups")
|
||||
&& args[0].equalsIgnoreCase("clearwarmups")) {
|
||||
} else if (sender.hasPermission("booscooldowns.clearwarmups") && args[0].equalsIgnoreCase("clearwarmups")) {
|
||||
String co = "warmup";
|
||||
BoosConfigManager.clearSomething(co, uuid, command2);
|
||||
boosChat.sendMessageToCommandSender(sender,
|
||||
"&6[" + pdfFile.getName() + "]&e"
|
||||
+ " warmups for command " + command2
|
||||
+ " of player " + jmeno + " cleared");
|
||||
"&6[" + pdfFile.getName() + "]&e" + " warmups for command " + command2 + " of player " + jmeno + " cleared");
|
||||
return true;
|
||||
|
||||
}
|
||||
} else if (args.length == 4) {
|
||||
if (sender.hasPermission("booscooldowns.set")
|
||||
&& args[0].equalsIgnoreCase("set")) {
|
||||
if (sender.hasPermission("booscooldowns.set") && args[0].equalsIgnoreCase("set")) {
|
||||
String what = args[1];
|
||||
String comm = args[2];
|
||||
String value = args[3];
|
||||
|
@ -300,24 +248,18 @@ public class BoosCoolDown extends JavaPlugin implements Runnable {
|
|||
if (comm.contains("_")) {
|
||||
comm = comm.replace("_", " ");
|
||||
}
|
||||
BoosConfigManager.setAddToConfigFile(group, comm, what,
|
||||
value);
|
||||
boosChat.sendMessageToCommandSender(sender, "&6["
|
||||
+ pdfFile.getName() + "]&e " + what
|
||||
+ " for command" + comm + " in group " + group
|
||||
+ " is now set to " + value);
|
||||
BoosConfigManager.setAddToConfigFile(group, comm, what, value);
|
||||
boosChat.sendMessageToCommandSender(sender,
|
||||
"&6[" + pdfFile.getName() + "]&e " + what + " for command" + comm + " in group " + group + " is now set to " + value);
|
||||
return true;
|
||||
} else {
|
||||
boosChat.sendMessageToCommandSender(sender, "&6["
|
||||
+ pdfFile.getName() + "]&e"
|
||||
+ " Command has to start with \"/\".");
|
||||
boosChat.sendMessageToCommandSender(sender, "&6[" + pdfFile.getName() + "]&e" + " Command has to start with \"/\".");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
} else if (args.length == 5) {
|
||||
if (sender.hasPermission("booscooldowns.set")
|
||||
&& args[0].equalsIgnoreCase("set")) {
|
||||
if (sender.hasPermission("booscooldowns.set") && args[0].equalsIgnoreCase("set")) {
|
||||
String what = args[1];
|
||||
String comm = args[2];
|
||||
String value = args[3];
|
||||
|
@ -326,29 +268,23 @@ public class BoosCoolDown extends JavaPlugin implements Runnable {
|
|||
if (comm.contains("_")) {
|
||||
comm = comm.replace("_", " ");
|
||||
}
|
||||
BoosConfigManager.setAddToConfigFile(group, comm, what,
|
||||
value);
|
||||
boosChat.sendMessageToCommandSender(sender, "&6["
|
||||
+ pdfFile.getName() + "]&e " + what
|
||||
+ " for command" + comm + " in group " + group
|
||||
+ " is now set to " + value);
|
||||
BoosConfigManager.setAddToConfigFile(group, comm, what, value);
|
||||
boosChat.sendMessageToCommandSender(sender,
|
||||
"&6[" + pdfFile.getName() + "]&e " + what + " for command" + comm + " in group " + group + " is now set to " + value);
|
||||
return true;
|
||||
} else {
|
||||
boosChat.sendMessageToCommandSender(sender, "&6["
|
||||
+ pdfFile.getName() + "]&e"
|
||||
+ " Command has to start with \"/\".");
|
||||
boosChat.sendMessageToCommandSender(sender, "&6[" + pdfFile.getName() + "]&e" + " Command has to start with \"/\".");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// boosChat.sendMessageToCommandSender(sender,
|
||||
// "&6[" + pdfFile.getName() + "]&e"
|
||||
// + " Invalid command or access denied!");
|
||||
// boosChat.sendMessageToCommandSender(sender,
|
||||
// "&6[" + pdfFile.getName() + "]&e"
|
||||
// + " Invalid command or access denied!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} return false;
|
||||
|
||||
}
|
||||
|
||||
|
@ -361,17 +297,14 @@ public class BoosCoolDown extends JavaPlugin implements Runnable {
|
|||
BoosConfigManager.saveConfusers();
|
||||
log.info("[" + pdfFile.getName() + "]" + " cooldowns saved!");
|
||||
}
|
||||
log.info("[" + pdfFile.getName() + "]" + " version "
|
||||
+ pdfFile.getVersion() + " disabled!");
|
||||
log.info("[" + pdfFile.getName() + "]" + " version " + pdfFile.getVersion() + " disabled!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
pdfFile = this.getDescription();
|
||||
PluginDescriptionFile pdfFile = this.getDescription();
|
||||
log.info("[" + pdfFile.getName() + "]" + " version "
|
||||
+ pdfFile.getVersion() + " by " + pdfFile.getAuthors()
|
||||
+ " is enabled!");
|
||||
log.info("[" + pdfFile.getName() + "]" + " version " + pdfFile.getVersion() + " by " + pdfFile.getAuthors() + " is enabled!");
|
||||
this.saveDefaultConfig();
|
||||
new BoosConfigManager(this);
|
||||
BoosConfigManager.load();
|
||||
|
@ -382,9 +315,7 @@ public class BoosCoolDown extends JavaPlugin implements Runnable {
|
|||
BukkitScheduler scheduler = this.getServer().getScheduler();
|
||||
startLimitResetTimersGlobal();
|
||||
if (BoosConfigManager.getAutoSave()) {
|
||||
scheduler.scheduleSyncRepeatingTask(this, this,
|
||||
BoosConfigManager.getSaveInterval() * 1200,
|
||||
BoosConfigManager.getSaveInterval() * 1200);
|
||||
scheduler.scheduleSyncRepeatingTask(this, this, BoosConfigManager.getSaveInterval() * 1200, BoosConfigManager.getSaveInterval() * 1200);
|
||||
}
|
||||
|
||||
if (BoosConfigManager.getClearOnRestart()) {
|
||||
|
@ -405,9 +336,7 @@ public class BoosCoolDown extends JavaPlugin implements Runnable {
|
|||
if (BoosConfigManager.getCancelWarmUpOnDamage()) {
|
||||
pm.registerEvents(new BoosEntityDamageListener(), this);
|
||||
}
|
||||
if (BoosConfigManager.getCleanCooldownsOnDeath()
|
||||
|| BoosConfigManager.getCleanUsesOnDeath()
|
||||
|| BoosConfigManager.getStartCooldownsOnDeath()) {
|
||||
if (BoosConfigManager.getCleanCooldownsOnDeath() || BoosConfigManager.getCleanUsesOnDeath() || BoosConfigManager.getStartCooldownsOnDeath()) {
|
||||
pm.registerEvents(new BoosPlayerDeathListener(), this);
|
||||
}
|
||||
if (BoosConfigManager.getCancelWarmUpOnGameModeChange()) {
|
||||
|
@ -446,8 +375,8 @@ public class BoosCoolDown extends JavaPlugin implements Runnable {
|
|||
private boolean setupEconomy() {
|
||||
if (usingVault) {
|
||||
RegisteredServiceProvider<Economy> economyProvider = getServer()
|
||||
.getServicesManager().getRegistration(
|
||||
net.milkbowl.vault.economy.Economy.class);
|
||||
.getServicesManager()
|
||||
.getRegistration(net.milkbowl.vault.economy.Economy.class);
|
||||
if (economyProvider != null) {
|
||||
economy = economyProvider.getProvider();
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ public class BoosCoolDownListener implements Listener {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (BoosConfigManager.getConfirmCommandEnabled()) {
|
||||
if (BoosConfigManager.getConfirmCommandEnabled(player)) {
|
||||
for (String key : commandQueue.keySet()) {
|
||||
String[] keyList = key.split("@");
|
||||
if (keyList[0].equals(String.valueOf(uuid))) {
|
||||
|
@ -229,13 +229,13 @@ public class BoosCoolDownListener implements Listener {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (!BoosConfigManager.getConfirmCommandEnabled() || (commandQueue.keySet().contains(uuid + "@" + originalCommand) && commandQueue.get(uuid + "@" + originalCommand))) {
|
||||
if (!BoosConfigManager.getConfirmCommandEnabled(player) || (commandQueue.keySet().contains(uuid + "@" + originalCommand) && commandQueue.get(uuid + "@" + originalCommand))) {
|
||||
this.checkRestrictions(event, player, regexCommad, originalCommand,
|
||||
warmupTime, cooldownTime, price, item, count, limit,
|
||||
xpPrice);
|
||||
} else {
|
||||
if ((price > 0 || xpPrice > 0 || count > 0 || limit > 0) && !BoosWarmUpManager.isWarmUpProcess(player, regexCommad) && !BoosCoolDownManager.isCoolingdown(player,regexCommad,cooldownTime)) {
|
||||
if (BoosConfigManager.getConfirmCommandEnabled()) {
|
||||
if (BoosConfigManager.getConfirmCommandEnabled(player)) {
|
||||
commandQueue.put(uuid + "@" + originalCommand, false);
|
||||
String questionMessage = BoosConfigManager.getQuestionMessage();
|
||||
questionMessage = questionMessage.replace("&command&", originalCommand);
|
||||
|
@ -287,7 +287,7 @@ public class BoosCoolDownListener implements Listener {
|
|||
private void onPlayerChatEvent(AsyncPlayerChatEvent event){
|
||||
Player player = event.getPlayer();
|
||||
UUID uuid = player.getUniqueId();
|
||||
if (BoosConfigManager.getConfirmCommandEnabled()) {
|
||||
if (BoosConfigManager.getConfirmCommandEnabled(player)) {
|
||||
for (String key : commandQueue.keySet()) {
|
||||
String[] keyList = key.split("@");
|
||||
if (keyList[0].equals(String.valueOf(uuid))) {
|
||||
|
|
|
@ -5,6 +5,7 @@ import org.bukkit.configuration.ConfigurationSection;
|
|||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import util.boosChat;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
|
@ -42,20 +43,18 @@ public class BoosConfigManager {
|
|||
confusersFile.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
BoosCoolDown.getLog().severe(
|
||||
"[boosCooldowns] Could not save storage file!");
|
||||
BoosCoolDown.getLog().severe("[boosCooldowns] Could not save storage file!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
ConfigurationSection userSection = confusers
|
||||
.getConfigurationSection("users");
|
||||
if (userSection == null)
|
||||
ConfigurationSection userSection = confusers.getConfigurationSection("users");
|
||||
if (userSection == null) {
|
||||
return;
|
||||
}
|
||||
for (String user : userSection.getKeys(false)) {
|
||||
ConfigurationSection cooldown = confusers
|
||||
.getConfigurationSection("users." + user + ".cooldown");
|
||||
ConfigurationSection cooldown = confusers.getConfigurationSection("users." + user + ".cooldown");
|
||||
if (cooldown != null) {
|
||||
for (String key : cooldown.getKeys(false)) {
|
||||
confusers.set("users." + user + ".cooldown." + key, null);
|
||||
|
@ -63,8 +62,7 @@ public class BoosConfigManager {
|
|||
}
|
||||
confusers.set("users." + user + ".cooldown", null);
|
||||
|
||||
ConfigurationSection warmup = confusers
|
||||
.getConfigurationSection("users." + user + ".warmup");
|
||||
ConfigurationSection warmup = confusers.getConfigurationSection("users." + user + ".warmup");
|
||||
if (warmup != null) {
|
||||
for (String key : warmup.getKeys(false)) {
|
||||
confusers.set("users." + user + ".warmup." + key, null);
|
||||
|
@ -79,10 +77,10 @@ public class BoosConfigManager {
|
|||
}
|
||||
|
||||
public static void clearSomething(String co, UUID uuid) {
|
||||
ConfigurationSection userSection = confusers
|
||||
.getConfigurationSection("users." + uuid + "." + co);
|
||||
if (userSection == null)
|
||||
ConfigurationSection userSection = confusers.getConfigurationSection("users." + uuid + "." + co);
|
||||
if (userSection == null) {
|
||||
return;
|
||||
}
|
||||
confusers.set("users." + uuid + "." + co, null);
|
||||
saveConfusers();
|
||||
loadConfusers();
|
||||
|
@ -101,34 +99,27 @@ public class BoosConfigManager {
|
|||
|
||||
public static Set<String> getAliases() {
|
||||
Set<String> aliases = null;
|
||||
ConfigurationSection aliasesSection = conf
|
||||
.getConfigurationSection("commands.aliases");
|
||||
ConfigurationSection aliasesSection = conf.getConfigurationSection("commands.aliases");
|
||||
if (aliasesSection != null) {
|
||||
aliases = conf.getConfigurationSection("commands.aliases").getKeys(
|
||||
false);
|
||||
aliases = conf.getConfigurationSection("commands.aliases").getKeys(false);
|
||||
}
|
||||
return aliases;
|
||||
}
|
||||
|
||||
public static boolean getBlockInteractDuringWarmup() {
|
||||
return conf.getBoolean("options.options.block_interact_during_warmup",
|
||||
false);
|
||||
return conf.getBoolean("options.options.block_interact_during_warmup", false);
|
||||
}
|
||||
|
||||
public static String getCancelWarmupByGameModeChangeMessage() {
|
||||
return conf.getString(
|
||||
"options.messages.warmup_cancelled_by_gamemode_change",
|
||||
"&6Warm-ups have been cancelled due to changing gamemode.&f");
|
||||
return conf.getString("options.messages.warmup_cancelled_by_gamemode_change", "&6Warm-ups have been cancelled due to changing gamemode.&f");
|
||||
}
|
||||
|
||||
public static boolean getCancelWarmUpOnDamage() {
|
||||
return conf
|
||||
.getBoolean("options.options.cancel_warmup_on_damage", false);
|
||||
return conf.getBoolean("options.options.cancel_warmup_on_damage", false);
|
||||
}
|
||||
|
||||
public static boolean getCancelWarmUpOnGameModeChange() {
|
||||
return conf.getBoolean(
|
||||
"options.options.cancel_warmup_on_gamemode_change", false);
|
||||
return conf.getBoolean("options.options.cancel_warmup_on_gamemode_change", false);
|
||||
}
|
||||
|
||||
public static boolean getCancelWarmupOnMove() {
|
||||
|
@ -140,33 +131,27 @@ public class BoosConfigManager {
|
|||
}
|
||||
|
||||
public static String getCancelWarmupOnSneakMessage() {
|
||||
return conf.getString("options.messages.warmup_cancelled_by_sneak",
|
||||
"&6Warm-ups have been cancelled due to sneaking.&f");
|
||||
return conf.getString("options.messages.warmup_cancelled_by_sneak", "&6Warm-ups have been cancelled due to sneaking.&f");
|
||||
}
|
||||
|
||||
public static boolean getCancelWarmupOnSprint() {
|
||||
return conf
|
||||
.getBoolean("options.options.cancel_warmup_on_sprint", false);
|
||||
return conf.getBoolean("options.options.cancel_warmup_on_sprint", false);
|
||||
}
|
||||
|
||||
public static String getCancelWarmupOnSprintMessage() {
|
||||
return conf.getString("options.messages.warmup_cancelled_by_sprint",
|
||||
"&6Warm-ups have been cancelled due to sprinting.&f");
|
||||
return conf.getString("options.messages.warmup_cancelled_by_sprint", "&6Warm-ups have been cancelled due to sprinting.&f");
|
||||
}
|
||||
|
||||
public static String getCannotCreateSignMessage() {
|
||||
return conf.getString("options.messages.cannot_create_sign",
|
||||
"&6You are not allowed to create this kind of signs!&f");
|
||||
return conf.getString("options.messages.cannot_create_sign", "&6You are not allowed to create this kind of signs!&f");
|
||||
}
|
||||
|
||||
public static String getCannotUseSignMessage() {
|
||||
return conf.getString("options.messages.cannot_use_sign",
|
||||
"&6You are not allowed to use this sign!&f");
|
||||
return conf.getString("options.messages.cannot_use_sign", "&6You are not allowed to use this sign!&f");
|
||||
}
|
||||
|
||||
public static boolean getCleanCooldownsOnDeath() {
|
||||
return conf.getBoolean("options.options.clear_cooldowns_on_death",
|
||||
false);
|
||||
return conf.getBoolean("options.options.clear_cooldowns_on_death", false);
|
||||
}
|
||||
|
||||
public static boolean getCleanUsesOnDeath() {
|
||||
|
@ -178,8 +163,7 @@ public class BoosConfigManager {
|
|||
}
|
||||
|
||||
static String getCommandBlockedMessage() {
|
||||
return conf.getString("options.messages.limit_achieved",
|
||||
"&6You cannot use this command anymore!&f");
|
||||
return conf.getString("options.messages.limit_achieved", "&6You cannot use this command anymore!&f");
|
||||
}
|
||||
|
||||
private static String getCommandGroup(Player player) {
|
||||
|
@ -196,8 +180,7 @@ public class BoosConfigManager {
|
|||
}
|
||||
|
||||
private static Set<String> getCommandGroups() {
|
||||
ConfigurationSection groupsSection = conf
|
||||
.getConfigurationSection("commands.groups");
|
||||
ConfigurationSection groupsSection = conf.getConfigurationSection("commands.groups");
|
||||
Set<String> groups = null;
|
||||
if (groupsSection != null) {
|
||||
groups = groupsSection.getKeys(false);
|
||||
|
@ -212,8 +195,7 @@ public class BoosConfigManager {
|
|||
public static Set<String> getCommands(Player player) {
|
||||
String group = getCommandGroup(player);
|
||||
Set<String> commands = null;
|
||||
ConfigurationSection commandsSection = conf
|
||||
.getConfigurationSection("commands.groups." + group);
|
||||
ConfigurationSection commandsSection = conf.getConfigurationSection("commands.groups." + group);
|
||||
if (commandsSection != null) {
|
||||
commands = commandsSection.getKeys(false);
|
||||
}
|
||||
|
@ -228,8 +210,7 @@ public class BoosConfigManager {
|
|||
int coolDown;
|
||||
String coolDownString = "";
|
||||
String group = getCommandGroup(player);
|
||||
coolDownString = conf.getString("commands.groups." + group + "."
|
||||
+ regexCommand + ".cooldown", "0");
|
||||
coolDownString = conf.getString("commands.groups." + group + "." + regexCommand + ".cooldown", "0");
|
||||
coolDown = parseTime(coolDownString);
|
||||
return coolDown;
|
||||
}
|
||||
|
@ -239,29 +220,21 @@ public class BoosConfigManager {
|
|||
}
|
||||
|
||||
static String getCoolDownMessage() {
|
||||
return conf
|
||||
.getString(
|
||||
"options.messages.cooling_down",
|
||||
"&6Wait&e &seconds& seconds&6 before you can use command&e &command& &6again.&f");
|
||||
return conf.getString("options.messages.cooling_down", "&6Wait&e &seconds& seconds&6 before you can use command&e &command& &6again.&f");
|
||||
}
|
||||
|
||||
static Set<String> getCooldowns(Player player) {
|
||||
String cool = getCommandGroup(player);
|
||||
return conf.getConfigurationSection(
|
||||
"commands.groups." + cool).getKeys(false);
|
||||
return conf.getConfigurationSection("commands.groups." + cool).getKeys(false);
|
||||
}
|
||||
|
||||
public static String getInsufficientFundsMessage() {
|
||||
return conf
|
||||
.getString(
|
||||
"options.messages.insufficient_funds",
|
||||
"&6You have insufficient funds!&e &command& &6costs &e%s &6but you only have &e%s");
|
||||
return conf.getString("options.messages.insufficient_funds",
|
||||
"&6You have insufficient funds!&e &command& &6costs &e%s &6but you only have &e%s");
|
||||
}
|
||||
|
||||
public static String getInteractBlockedMessage() {
|
||||
return conf.getString(
|
||||
"options.messages.interact_blocked_during_warmup",
|
||||
"&6You can't do this when command is warming-up!&f");
|
||||
return conf.getString("options.messages.interact_blocked_during_warmup", "&6You can't do this when command is warming-up!&f");
|
||||
}
|
||||
|
||||
public static String getItemCostItem(String regexCommand, Player player) {
|
||||
|
@ -269,8 +242,7 @@ public class BoosConfigManager {
|
|||
String temp;
|
||||
String[] command;
|
||||
String group = getCommandGroup(player);
|
||||
temp = conf.getString("commands.groups." + group + "." + regexCommand
|
||||
+ ".itemcost", "");
|
||||
temp = conf.getString("commands.groups." + group + "." + regexCommand + ".itemcost", "");
|
||||
command = temp.split(",");
|
||||
if (command.length == 2) {
|
||||
item = command[0];
|
||||
|
@ -283,8 +255,7 @@ public class BoosConfigManager {
|
|||
String temp;
|
||||
String[] command;
|
||||
String group = getCommandGroup(player);
|
||||
temp = conf.getString("commands.groups." + group + "." + regexCommand
|
||||
+ ".itemcost", "");
|
||||
temp = conf.getString("commands.groups." + group + "." + regexCommand + ".itemcost", "");
|
||||
command = temp.split(",");
|
||||
if (command.length == 2) {
|
||||
count = Integer.valueOf(command[1]);
|
||||
|
@ -295,8 +266,7 @@ public class BoosConfigManager {
|
|||
public static int getLimit(String regexCommand, Player player) {
|
||||
int limit;
|
||||
String group = getCommandGroup(player);
|
||||
limit = conf.getInt("commands.groups." + group + "." + regexCommand
|
||||
+ ".limit", -1);
|
||||
limit = conf.getInt("commands.groups." + group + "." + regexCommand + ".limit", -1);
|
||||
return limit;
|
||||
}
|
||||
|
||||
|
@ -305,10 +275,8 @@ public class BoosConfigManager {
|
|||
}
|
||||
|
||||
static String getLimitListMessage() {
|
||||
return conf
|
||||
.getString(
|
||||
"options.messages.limit_list",
|
||||
"&6Limit for command &e&command&&6 is &e&limit&&6. You can still use it &e×&&6 times.&f");
|
||||
return conf.getString("options.messages.limit_list",
|
||||
"&6Limit for command &e&command&&6 is &e&limit&&6. You can still use it &e×&&6 times.&f");
|
||||
}
|
||||
|
||||
static boolean getLimitsEnabled() {
|
||||
|
@ -323,35 +291,30 @@ public class BoosConfigManager {
|
|||
static List<String> getSharedCooldowns(String pre, Player player) {
|
||||
List<String> sharedCooldowns;
|
||||
String group = getCommandGroup(player);
|
||||
sharedCooldowns = conf.getStringList("commands.groups." + group + "."
|
||||
+ pre + ".shared_cooldown");
|
||||
sharedCooldowns = conf.getStringList("commands.groups." + group + "." + pre + ".shared_cooldown");
|
||||
return sharedCooldowns;
|
||||
}
|
||||
|
||||
public static List<String> getSharedLimits(String pre, Player player) {
|
||||
List<String> sharedLimits;
|
||||
String group = getCommandGroup(player);
|
||||
sharedLimits = conf.getStringList("commands.groups." + group + "."
|
||||
+ pre + ".shared_limit");
|
||||
sharedLimits = conf.getStringList("commands.groups." + group + "." + pre + ".shared_limit");
|
||||
return sharedLimits;
|
||||
}
|
||||
|
||||
public static String getMessage(String regexCommand, Player player) {
|
||||
String message = "";
|
||||
String group = getCommandGroup(player);
|
||||
message = conf.getString("commands.groups." + group + "."
|
||||
+ regexCommand + ".message", "");
|
||||
message = conf.getString("commands.groups." + group + "." + regexCommand + ".message", "");
|
||||
return message;
|
||||
}
|
||||
|
||||
static String getPaidErrorMessage() {
|
||||
return conf.getString("options.messages.paid_error",
|
||||
"An error has occured: %s");
|
||||
return conf.getString("options.messages.paid_error", "An error has occured: %s");
|
||||
}
|
||||
|
||||
static String getPaidForCommandMessage() {
|
||||
return conf.getString("options.messages.paid_for_command",
|
||||
"Price of &command& was %s and you now have %s");
|
||||
return conf.getString("options.messages.paid_for_command", "Price of &command& was %s and you now have %s");
|
||||
}
|
||||
|
||||
static String getPotionEffect(String regexCommand, Player player) {
|
||||
|
@ -359,8 +322,7 @@ public class BoosConfigManager {
|
|||
String temp;
|
||||
String[] command;
|
||||
String group = getCommandGroup(player);
|
||||
temp = conf.getString("commands.groups." + group + "." + regexCommand
|
||||
+ ".potion", "");
|
||||
temp = conf.getString("commands.groups." + group + "." + regexCommand + ".potion", "");
|
||||
command = temp.split(",");
|
||||
if (command.length == 2) {
|
||||
effect = command[0];
|
||||
|
@ -373,8 +335,7 @@ public class BoosConfigManager {
|
|||
String temp;
|
||||
String[] command;
|
||||
String group = getCommandGroup(player);
|
||||
temp = conf.getString("commands.groups." + group + "." + regexCommand
|
||||
+ ".potion", "");
|
||||
temp = conf.getString("commands.groups." + group + "." + regexCommand + ".potion", "");
|
||||
command = temp.split(",");
|
||||
if (command.length == 2) {
|
||||
effect = Integer.valueOf(command[1]);
|
||||
|
@ -385,8 +346,7 @@ public class BoosConfigManager {
|
|||
public static double getPrice(String regexCommand, Player player) {
|
||||
double price;
|
||||
String group = getCommandGroup(player);
|
||||
price = conf.getDouble("commands.groups." + group + "." + regexCommand
|
||||
+ ".price", 0.0);
|
||||
price = conf.getDouble("commands.groups." + group + "." + regexCommand + ".price", 0.0);
|
||||
return price;
|
||||
}
|
||||
|
||||
|
@ -403,8 +363,7 @@ public class BoosConfigManager {
|
|||
}
|
||||
|
||||
public static boolean getStartCooldownsOnDeath() {
|
||||
return conf.getBoolean("options.options.start_cooldowns_on_death",
|
||||
false);
|
||||
return conf.getBoolean("options.options.start_cooldowns_on_death", false);
|
||||
}
|
||||
|
||||
static String getUnitHoursMessage() {
|
||||
|
@ -423,25 +382,21 @@ public class BoosConfigManager {
|
|||
int warmUp;
|
||||
String warmUpString = "";
|
||||
String group = getCommandGroup(player);
|
||||
warmUpString = conf.getString("commands.groups." + group + "."
|
||||
+ regexCommand + ".warmup", "0");
|
||||
warmUpString = conf.getString("commands.groups." + group + "." + regexCommand + ".warmup", "0");
|
||||
warmUp = parseTime(warmUpString);
|
||||
return warmUp;
|
||||
}
|
||||
|
||||
static String getWarmUpAlreadyStartedMessage() {
|
||||
return conf.getString("options.messages.warmup_already_started",
|
||||
"&6Warm-Up process for&e &command& &6has already started.&f");
|
||||
return conf.getString("options.messages.warmup_already_started", "&6Warm-Up process for&e &command& &6has already started.&f");
|
||||
}
|
||||
|
||||
public static String getWarmUpCancelledByDamageMessage() {
|
||||
return conf.getString("options.messages.warmup_cancelled_by_damage",
|
||||
"&6Warm-ups have been cancelled due to receiving damage.&f");
|
||||
return conf.getString("options.messages.warmup_cancelled_by_damage", "&6Warm-ups have been cancelled due to receiving damage.&f");
|
||||
}
|
||||
|
||||
public static String getWarmUpCancelledByMoveMessage() {
|
||||
return conf.getString("options.messages.warmup_cancelled_by_move",
|
||||
"&6Warm-ups have been cancelled due to moving.&f");
|
||||
return conf.getString("options.messages.warmup_cancelled_by_move", "&6Warm-ups have been cancelled due to moving.&f");
|
||||
}
|
||||
|
||||
public static boolean getWarmupEnabled() {
|
||||
|
@ -449,9 +404,7 @@ public class BoosConfigManager {
|
|||
}
|
||||
|
||||
static String getWarmUpMessage() {
|
||||
return conf
|
||||
.getString("options.messages.warming_up",
|
||||
"&6Wait&e &seconds& seconds&6 before command&e &command& &6has warmed up.&f");
|
||||
return conf.getString("options.messages.warming_up", "&6Wait&e &seconds& seconds&6 before command&e &command& &6has warmed up.&f");
|
||||
}
|
||||
|
||||
public static void load() {
|
||||
|
@ -459,16 +412,13 @@ public class BoosConfigManager {
|
|||
conf.load(confFile);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
BoosCoolDown.getLog().severe(
|
||||
"[boosCooldowns] Configuration file not found!");
|
||||
BoosCoolDown.getLog().severe("[boosCooldowns] Configuration file not found!");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
BoosCoolDown.getLog().severe(
|
||||
"[boosCooldowns] Could not read configuration file!");
|
||||
BoosCoolDown.getLog().severe("[boosCooldowns] Could not read configuration file!");
|
||||
} catch (InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
BoosCoolDown.getLog().severe(
|
||||
"[boosCooldowns] Configuration file is invalid!");
|
||||
BoosCoolDown.getLog().severe("[boosCooldowns] Configuration file is invalid!");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -477,16 +427,13 @@ public class BoosConfigManager {
|
|||
confusers.load(confusersFile);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
BoosCoolDown.getLog().severe(
|
||||
"[boosCooldowns] Storage file not found!");
|
||||
BoosCoolDown.getLog().severe("[boosCooldowns] Storage file not found!");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
BoosCoolDown.getLog().severe(
|
||||
"[boosCooldowns] Could not read storage file!");
|
||||
BoosCoolDown.getLog().severe("[boosCooldowns] Could not read storage file!");
|
||||
} catch (InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
BoosCoolDown.getLog().severe(
|
||||
"[boosCooldowns] Storage file is invalid!");
|
||||
BoosCoolDown.getLog().severe("[boosCooldowns] Storage file is invalid!");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -501,49 +448,57 @@ public class BoosConfigManager {
|
|||
confusers.save(confusersFile);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
BoosCoolDown.getLog().severe(
|
||||
"[boosCooldowns] Could not save storage file!");
|
||||
BoosCoolDown.getLog().severe("[boosCooldowns] Could not save storage file!");
|
||||
}
|
||||
}
|
||||
|
||||
public static void setAddToConfigFile(String group, String command, String what,
|
||||
String value) {
|
||||
public static void setAddToConfigFile(String group, String command, String what, String value) {
|
||||
group = group.toLowerCase();
|
||||
command = command.toLowerCase();
|
||||
int value2;
|
||||
try {
|
||||
value2 = Integer.parseInt(value);
|
||||
reload();
|
||||
conf.set("commands.groups." + group + "." + command + "." + what,
|
||||
value2);
|
||||
conf.set("commands.groups." + group + "." + command + "." + what, value2);
|
||||
} catch (NumberFormatException e1) {
|
||||
reload();
|
||||
conf.set("commands.groups." + group + "." + command + "." + what,
|
||||
value);
|
||||
conf.set("commands.groups." + group + "." + command + "." + what, value);
|
||||
}
|
||||
try {
|
||||
conf.save(confFile);
|
||||
} catch (IOException e) {
|
||||
BoosCoolDown.getLog().severe(
|
||||
"[boosCooldowns] Could not save configuration file!");
|
||||
BoosCoolDown.getLog().severe("[boosCooldowns] Could not save configuration file!");
|
||||
|
||||
}
|
||||
reload();
|
||||
}
|
||||
|
||||
public static void toggleConfirmations(Player player) {
|
||||
Boolean def = confusers.getBoolean("users." + player.getUniqueId() + ".confirmations", getConfirmCommandEnabled(player));
|
||||
confusers.set("users." + player.getUniqueId() + ".confirmations", !def);
|
||||
if (def) {
|
||||
boosChat.sendMessageToPlayer(player, "&6[boosCooldowns]&e " + getConfirmToggleMessageFalse());
|
||||
} else {
|
||||
boosChat.sendMessageToPlayer(player, "&6[boosCooldowns]&e " + getConfirmToggleMessageTrue());
|
||||
}
|
||||
saveConfusers();
|
||||
loadConfusers();
|
||||
}
|
||||
|
||||
public static Boolean getConfirmationsPlayer(Player player) {
|
||||
return (Boolean)confusers.get("users." + player.getUniqueId() + ".confirmations", null);
|
||||
}
|
||||
|
||||
public static boolean getAutoSave() {
|
||||
return conf.getBoolean(
|
||||
"options.options.auto_save_enabled_CAN_CAUSE_BIG_LAGS", false);
|
||||
return conf.getBoolean("options.options.auto_save_enabled_CAN_CAUSE_BIG_LAGS", false);
|
||||
}
|
||||
|
||||
static String getPaidItemsForCommandMessage() {
|
||||
return conf.getString("options.messages.paid_items_for_command",
|
||||
"&6Price of&e &command& &6was &e%s");
|
||||
return conf.getString("options.messages.paid_items_for_command", "&6Price of&e &command& &6was &e%s");
|
||||
}
|
||||
|
||||
public static String getInsufficientItemsMessage() {
|
||||
return conf.getString("options.messages.insufficient_items",
|
||||
"&6You have not enough items!&e &command& &6needs &e%s");
|
||||
return conf.getString("options.messages.insufficient_items", "&6You have not enough items!&e &command& &6needs &e%s");
|
||||
}
|
||||
|
||||
public static boolean getItemCostEnabled() {
|
||||
|
@ -551,15 +506,13 @@ public class BoosConfigManager {
|
|||
}
|
||||
|
||||
static String getPaidXPForCommandMessage() {
|
||||
return conf.getString("options.messages.paid_xp_for_command",
|
||||
"&6Price of&e &command& &6was &e%s");
|
||||
return conf.getString("options.messages.paid_xp_for_command", "&6Price of&e &command& &6was &e%s");
|
||||
}
|
||||
|
||||
public static int getXpPrice(String regexCommand, Player player) {
|
||||
int price;
|
||||
String group = getCommandGroup(player);
|
||||
price = conf.getInt("commands.groups." + group + "." + regexCommand
|
||||
+ ".xpcost", 0);
|
||||
price = conf.getInt("commands.groups." + group + "." + regexCommand + ".xpcost", 0);
|
||||
return price;
|
||||
}
|
||||
|
||||
|
@ -568,31 +521,24 @@ public class BoosConfigManager {
|
|||
}
|
||||
|
||||
public static String getInsufficientXpMessage() {
|
||||
return conf.getString("options.messages.insufficient_xp",
|
||||
"&6You have not enough XP!&e &command& &6needs &e%s");
|
||||
return conf.getString("options.messages.insufficient_xp", "&6You have not enough XP!&e &command& &6needs &e%s");
|
||||
}
|
||||
|
||||
public static String getInvalidCommandSyntaxMessage() {
|
||||
return conf
|
||||
.getString("options.messages.invalid_command_syntax",
|
||||
"&6You are not allowed to use command syntax /<pluginname>:<command>!");
|
||||
return conf.getString("options.messages.invalid_command_syntax", "&6You are not allowed to use command syntax /<pluginname>:<command>!");
|
||||
}
|
||||
|
||||
static long getLimitResetDelay(String regexCommand, Player player) {
|
||||
long limitreset;
|
||||
String limitResetString = "";
|
||||
String group = getCommandGroup(player);
|
||||
limitResetString = conf.getString("commands.groups." + group + "."
|
||||
+ regexCommand + ".limit_reset_delay", "0");
|
||||
limitResetString = conf.getString("commands.groups." + group + "." + regexCommand + ".limit_reset_delay", "0");
|
||||
limitreset = parseTime(limitResetString);
|
||||
return limitreset;
|
||||
}
|
||||
|
||||
static String getLimitResetMessage() {
|
||||
return conf
|
||||
.getString(
|
||||
"options.messages.limit_reset",
|
||||
"&6Wait&e &seconds& &unit&&6 before your limit for command&e &command& &6is reset.&f");
|
||||
return conf.getString("options.messages.limit_reset", "&6Wait&e &seconds& &unit&&6 before your limit for command&e &command& &6is reset.&f");
|
||||
}
|
||||
|
||||
static void clearSomething2(String co, String uuid, int hashedCommand) {
|
||||
|
@ -602,8 +548,7 @@ public class BoosConfigManager {
|
|||
public static long getLimitResetDelayGlobal(String command) {
|
||||
long delay = 0;
|
||||
String delayString = "";
|
||||
delayString = conf.getString(
|
||||
"global." + command + ".limit_reset_delay", "0");
|
||||
delayString = conf.getString("global." + command + ".limit_reset_delay", "0");
|
||||
delay = parseTime(delayString);
|
||||
return delay;
|
||||
}
|
||||
|
@ -651,45 +596,45 @@ public class BoosConfigManager {
|
|||
}
|
||||
|
||||
public static String getLimitResetNowMessage() {
|
||||
return conf.getString("options.messages.limit_reset_now",
|
||||
"&6Reseting limits for command&e &command& &6now.&f");
|
||||
return conf.getString("options.messages.limit_reset_now", "&6Reseting limits for command&e &command& &6now.&f");
|
||||
}
|
||||
|
||||
public static String getPermission(Player player, String regexCommad) {
|
||||
String group = getCommandGroup(player);
|
||||
return conf.getString("commands.groups." + group + "."
|
||||
+ regexCommad + ".permission");
|
||||
return conf.getString("commands.groups." + group + "." + regexCommad + ".permission");
|
||||
}
|
||||
|
||||
public static String getPermissionMessage(Player player, String regexCommad) {
|
||||
String group = getCommandGroup(player);
|
||||
return conf.getString("commands.groups." + group + "."
|
||||
+ regexCommad + ".denied_message");
|
||||
return conf.getString("commands.groups." + group + "." + regexCommad + ".denied_message");
|
||||
}
|
||||
|
||||
public static String getCancelCommandMessage() {
|
||||
return conf.getString("options.messages.confirmation_cancel_command_execution",
|
||||
"No");
|
||||
return conf.getString("options.messages.confirmation_cancel_command_execution", "No");
|
||||
}
|
||||
|
||||
public static String getConfirmCommandMessage() {
|
||||
return conf.getString("options.messages.confirmation_confirm_command_execution",
|
||||
"Yes");
|
||||
return conf.getString("options.messages.confirmation_confirm_command_execution", "Yes");
|
||||
}
|
||||
|
||||
public static String getConfirmToggleMessageTrue() {
|
||||
return conf.getString("options.messages.confirmation_toggle_enable", "Confirmation messages are now enabled for you!");
|
||||
}
|
||||
|
||||
public static String getConfirmToggleMessageFalse() {
|
||||
return conf.getString("options.messages.confirmation_toggle_disable", "Confirmation messages are now disabled for you!");
|
||||
}
|
||||
|
||||
public static String getItsPriceMessage() {
|
||||
return conf.getString("options.messages.confirmation_price_of_command",
|
||||
"&6its price is&e &price& &6and you now have &e&balance&");
|
||||
return conf.getString("options.messages.confirmation_price_of_command", "&6its price is&e &price& &6and you now have &e&balance&");
|
||||
}
|
||||
|
||||
public static String getQuestionMessage() {
|
||||
return conf.getString("options.messages.confirmation_message",
|
||||
"&6Would you like to use command&e &command& &6?");
|
||||
return conf.getString("options.messages.confirmation_message", "&6Would you like to use command&e &command& &6?");
|
||||
}
|
||||
|
||||
public static String getItsItemCostMessage() {
|
||||
return conf.getString("options.messages.confirmation_item_price_of_command",
|
||||
"&6its price is&e &itemprice& &itemname&");
|
||||
return conf.getString("options.messages.confirmation_item_price_of_command", "&6its price is&e &itemprice& &itemname&");
|
||||
}
|
||||
|
||||
public static String getItsLimitMessage() {
|
||||
|
@ -698,22 +643,23 @@ public class BoosConfigManager {
|
|||
}
|
||||
|
||||
public static String getItsXpPriceMessage() {
|
||||
return conf.getString("options.messages.confirmation_xp_price_of_command",
|
||||
"&6its price is&e &xpprice& experience levels");
|
||||
return conf.getString("options.messages.confirmation_xp_price_of_command", "&6its price is&e &xpprice& experience levels");
|
||||
}
|
||||
|
||||
public static String getCommandCanceledMessage() {
|
||||
return conf.getString("options.messages.confirmation_command_cancelled",
|
||||
"&6Execution of command&e &command& &6was cancelled");
|
||||
return conf.getString("options.messages.confirmation_command_cancelled", "&6Execution of command&e &command& &6was cancelled");
|
||||
}
|
||||
|
||||
public static boolean getSyntaxBlocker() {
|
||||
return conf.getBoolean("options.options.syntax_blocker_enabled",
|
||||
true);
|
||||
return conf.getBoolean("options.options.syntax_blocker_enabled", true);
|
||||
}
|
||||
|
||||
public static boolean getConfirmCommandEnabled() {
|
||||
return conf.getBoolean("options.options.command_confirmation",
|
||||
true);
|
||||
public static boolean getConfirmCommandEnabled(Player player) {
|
||||
Boolean playersChoice = getConfirmationsPlayer(player);
|
||||
if (playersChoice != null) {
|
||||
return playersChoice;
|
||||
} else {
|
||||
return conf.getBoolean("options.options.command_confirmation", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ options:
|
|||
command_logging: false
|
||||
command_signs: false
|
||||
syntax_blocker_enabled: true
|
||||
command_confirmation: true
|
||||
units:
|
||||
seconds: seconds
|
||||
minutes: minutes
|
||||
|
@ -63,6 +64,8 @@ options:
|
|||
confirmation_confirm_command_execution: 'Yes'
|
||||
confirmation_cancel_command_execution: 'No'
|
||||
confirmation_command_cancelled: '&6Execution of command&e &command& &6was cancelled'
|
||||
confirmation_toggle_disable: 'Confirmation messages are now disabled for you!'
|
||||
confirmation_toggle_enable: 'Confirmation messages are now enabled for you!'
|
||||
commands:
|
||||
groups:
|
||||
default:
|
||||
|
|
Loading…
Reference in New Issue