mirror of
https://github.com/LordBoos/boosCooldowns.git
synced 2025-02-16 20:41:25 +01:00
Improved group handling
This commit is contained in:
parent
fbb90cec8f
commit
12ff7d5458
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
name: boosCooldowns
|
name: boosCooldowns
|
||||||
main: cz.boosik.boosCooldown.boosCoolDown
|
main: cz.boosik.boosCooldown.boosCoolDown
|
||||||
version: 3.4.3
|
version: 3.5.0
|
||||||
authors: [LordBoos (ingame name boosik)]
|
authors: [LordBoos (ingame name boosik)]
|
||||||
softdepend: [Vault]
|
softdepend: [Vault]
|
||||||
description: >
|
description: >
|
||||||
|
@ -105,39 +105,19 @@ public class boosConfigManager {
|
|||||||
return conf.getBoolean("options.options.command_logging", false);
|
return conf.getBoolean("options.options.command_logging", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int getCoolDown(String pre) {
|
static int getCoolDown(String pre, Player player) {
|
||||||
int coolDown = 0;
|
int coolDown = 0;
|
||||||
|
String group = getCoolGrp(player);
|
||||||
pre = pre.toLowerCase();
|
pre = pre.toLowerCase();
|
||||||
coolDown = conf.getInt("commands.cooldowns.cooldown." + pre, coolDown);
|
coolDown = conf.getInt("commands.cooldowns." + group + "." + pre,
|
||||||
|
coolDown);
|
||||||
return coolDown;
|
return coolDown;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getCoolDown2(String pre) {
|
private static Set<String> getCooldownGroups() {
|
||||||
int coolDown = 0;
|
Set<String> groups = conf.getConfigurationSection("commands.cooldowns")
|
||||||
pre = pre.toLowerCase();
|
.getKeys(false);
|
||||||
coolDown = conf.getInt("commands.cooldowns.cooldown2." + pre, coolDown);
|
return groups;
|
||||||
return coolDown;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getCoolDown3(String pre) {
|
|
||||||
int coolDown = 0;
|
|
||||||
pre = pre.toLowerCase();
|
|
||||||
coolDown = conf.getInt("commands.cooldowns.cooldown3." + pre, coolDown);
|
|
||||||
return coolDown;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getCoolDown4(String pre) {
|
|
||||||
int coolDown = 0;
|
|
||||||
pre = pre.toLowerCase();
|
|
||||||
coolDown = conf.getInt("commands.cooldowns.cooldown4." + pre, coolDown);
|
|
||||||
return coolDown;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getCoolDown5(String pre) {
|
|
||||||
int coolDown = 0;
|
|
||||||
pre = pre.toLowerCase();
|
|
||||||
coolDown = conf.getInt("commands.cooldowns.cooldown5." + pre, coolDown);
|
|
||||||
return coolDown;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static String getCoolDownMessage() {
|
static String getCoolDownMessage() {
|
||||||
@ -147,30 +127,21 @@ public class boosConfigManager {
|
|||||||
"&6Wait&e &seconds& seconds&6 before you can use command&e &command& &6again.&f");
|
"&6Wait&e &seconds& seconds&6 before you can use command&e &command& &6again.&f");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getCooldownsGrp(Player player) {
|
public static Set<String> getCooldowns(Player player) {
|
||||||
String cooldown;
|
String cool = getCoolGrp(player);
|
||||||
if (player.hasPermission("booscooldowns.cooldown2")) {
|
Set<String> cooldowns = conf.getConfigurationSection(
|
||||||
cooldown = "cooldown2";
|
"commands.cooldowns." + cool).getKeys(false);
|
||||||
} else if (player.hasPermission("booscooldowns.cooldown3")) {
|
return cooldowns;
|
||||||
cooldown = "cooldown3";
|
|
||||||
} else if (player.hasPermission("booscooldowns.cooldown4")) {
|
|
||||||
cooldown = "cooldown4";
|
|
||||||
} else if (player.hasPermission("booscooldowns.cooldown5")) {
|
|
||||||
cooldown = "cooldown5";
|
|
||||||
} else {
|
|
||||||
cooldown = "cooldown";
|
|
||||||
}
|
|
||||||
return cooldown;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Set<String> getCooldownsList(Player player) {
|
private static String getCoolGrp(Player player) {
|
||||||
String cool = getCooldownsGrp(player);
|
String cool = "cooldown";
|
||||||
boosCoolDown.log.info("Cooldown group: " + cool);
|
for (String group : getCooldownGroups()) {
|
||||||
ConfigurationSection cooldownsList;
|
if (player.hasPermission("booscooldowns." + group)) {
|
||||||
cooldownsList = conf.getConfigurationSection("commands.cooldowns."
|
cool = group;
|
||||||
+ cool);
|
}
|
||||||
Set<String> cooldowns = cooldownsList.getKeys(false);
|
}
|
||||||
return cooldowns;
|
return cool;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getInteractBlockedMessage() {
|
public static String getInteractBlockedMessage() {
|
||||||
@ -180,53 +151,26 @@ public class boosConfigManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getLimGrp(Player player) {
|
public static String getLimGrp(Player player) {
|
||||||
String lim;
|
String lim = "limit";
|
||||||
if (player.hasPermission("booscooldowns.limit2")) {
|
for (String group : getLimitGroups()) {
|
||||||
lim = "limit2";
|
if (player.hasPermission("booscooldowns." + group)) {
|
||||||
} else if (player.hasPermission("booscooldowns.limit3")) {
|
lim = group;
|
||||||
lim = "limit3";
|
}
|
||||||
} else if (player.hasPermission("booscooldowns.limit4")) {
|
|
||||||
lim = "limit4";
|
|
||||||
} else if (player.hasPermission("booscooldowns.limit5")) {
|
|
||||||
lim = "limit5";
|
|
||||||
} else {
|
|
||||||
lim = "limit";
|
|
||||||
}
|
}
|
||||||
return lim;
|
return lim;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getLimit(String pre) {
|
private static Set<String> getLimitGroups() {
|
||||||
int limit = -1;
|
Set<String> groups = conf.getConfigurationSection("commands.limits")
|
||||||
pre = pre.toLowerCase();
|
.getKeys(false);
|
||||||
limit = conf.getInt("commands.limits.limit." + pre, limit);
|
return groups;
|
||||||
return limit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getLimit2(String pre) {
|
public static int getLimit(String pre, Player player) {
|
||||||
int limit = -1;
|
int limit = -1;
|
||||||
|
String group = getLimGrp(player);
|
||||||
pre = pre.toLowerCase();
|
pre = pre.toLowerCase();
|
||||||
limit = conf.getInt("commands.limits.limit2." + pre, limit);
|
limit = conf.getInt("commands.limits." + group + "." + pre, limit);
|
||||||
return limit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getLimit3(String pre) {
|
|
||||||
int limit = -1;
|
|
||||||
pre = pre.toLowerCase();
|
|
||||||
limit = conf.getInt("commands.limits.limit3." + pre, limit);
|
|
||||||
return limit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getLimit4(String pre) {
|
|
||||||
int limit = -1;
|
|
||||||
pre = pre.toLowerCase();
|
|
||||||
limit = conf.getInt("commands.limits.limit4." + pre, limit);
|
|
||||||
return limit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getLimit5(String pre) {
|
|
||||||
int limit = -1;
|
|
||||||
pre = pre.toLowerCase();
|
|
||||||
limit = conf.getInt("commands.limits.limit5." + pre, limit);
|
|
||||||
return limit;
|
return limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,11 +181,11 @@ public class boosConfigManager {
|
|||||||
"&6Limit for command &e&command&&6 is &e&limit&&6. You can still use it &e×&&6 times.&f");
|
"&6Limit for command &e&command&&6 is &e&limit&&6. You can still use it &e×&&6 times.&f");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ConfigurationSection getLimits(Player player) {
|
public static Set<String> getLimits(Player player) {
|
||||||
String lim = getLimGrp(player);
|
String lim = getLimGrp(player);
|
||||||
ConfigurationSection uses = conf
|
Set<String> limits = conf.getConfigurationSection(
|
||||||
.getConfigurationSection("commands.limits." + lim);
|
"commands.limits." + lim).getKeys(false);
|
||||||
return uses;
|
return limits;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean getLimitsEnabled() {
|
public static boolean getLimitsEnabled() {
|
||||||
@ -272,39 +216,40 @@ public class boosConfigManager {
|
|||||||
"Price of &command& was %s and you now have %s");
|
"Price of &command& was %s and you now have %s");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getPrice(String pre) {
|
public static String getPotionEffect(String pre) {
|
||||||
double price = 0.0;
|
String effect = null;
|
||||||
pre = pre.toLowerCase();
|
pre = pre.toLowerCase();
|
||||||
price = conf.getDouble("commands.prices.price." + pre, price);
|
effect = conf.getString("commands.warmupPotionEffects.effect." + pre,
|
||||||
|
effect);
|
||||||
|
return effect;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double getPrice(String pre, Player player) {
|
||||||
|
double price = 0.0;
|
||||||
|
String group = getPriceGrp(player);
|
||||||
|
pre = pre.toLowerCase();
|
||||||
|
price = conf.getDouble("commands.prices." + group + "." + pre, price);
|
||||||
return price;
|
return price;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getPrice2(String pre) {
|
private static String getPriceGrp(Player player) {
|
||||||
double price = 0.0;
|
String price = "price";
|
||||||
pre = pre.toLowerCase();
|
for (String group : getPriceGroups()) {
|
||||||
price = conf.getDouble("commands.prices.price2." + pre, price);
|
if (player.hasPermission("booscooldowns." + group)) {
|
||||||
|
price = group;
|
||||||
|
}
|
||||||
|
}
|
||||||
return price;
|
return price;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getPrice3(String pre) {
|
private static Set<String> getPriceGroups() {
|
||||||
double price = 0.0;
|
Set<String> groups = conf.getConfigurationSection("commands.prices")
|
||||||
pre = pre.toLowerCase();
|
.getKeys(false);
|
||||||
price = conf.getDouble("commands.prices.price3." + pre, price);
|
return groups;
|
||||||
return price;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getPrice4(String pre) {
|
public static int getSaveInterval() {
|
||||||
double price = 0.0;
|
return conf.getInt("options.options.save_interval_in_minutes", 15);
|
||||||
pre = pre.toLowerCase();
|
|
||||||
price = conf.getDouble("commands.prices.price4." + pre, price);
|
|
||||||
return price;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static double getPrice5(String pre) {
|
|
||||||
Double price = 0.0;
|
|
||||||
pre = pre.toLowerCase();
|
|
||||||
price = conf.getDouble("commands.prices.price5." + pre, price);
|
|
||||||
return price;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean getSignCommands() {
|
public static boolean getSignCommands() {
|
||||||
@ -328,38 +273,21 @@ public class boosConfigManager {
|
|||||||
return conf.getString("options.units.seconds", "seconds");
|
return conf.getString("options.units.seconds", "seconds");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getWarmUp(String pre) {
|
public static String getWarmGrp(Player player) {
|
||||||
int warmUp = -1;
|
String warm = "warmup";
|
||||||
pre = pre.toLowerCase();
|
for (String group : getWarmupGroups()) {
|
||||||
warmUp = conf.getInt("commands.warmups.warmup." + pre, warmUp);
|
if (player.hasPermission("booscooldowns." + group)) {
|
||||||
return warmUp;
|
warm = group;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return warm;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getWarmUp2(String pre) {
|
public static int getWarmUp(String pre, Player player) {
|
||||||
int warmUp = -1;
|
int warmUp = -1;
|
||||||
|
String group = getWarmGrp(player);
|
||||||
pre = pre.toLowerCase();
|
pre = pre.toLowerCase();
|
||||||
warmUp = conf.getInt("commands.warmups.warmup2." + pre, warmUp);
|
warmUp = conf.getInt("commands.warmups." + group + "." + pre, warmUp);
|
||||||
return warmUp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getWarmUp3(String pre) {
|
|
||||||
int warmUp = -1;
|
|
||||||
pre = pre.toLowerCase();
|
|
||||||
warmUp = conf.getInt("commands.warmups.warmup3." + pre, warmUp);
|
|
||||||
return warmUp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getWarmUp4(String pre) {
|
|
||||||
int warmUp = -1;
|
|
||||||
pre = pre.toLowerCase();
|
|
||||||
warmUp = conf.getInt("commands.warmups.warmup4." + pre, warmUp);
|
|
||||||
return warmUp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getWarmUp5(String pre) {
|
|
||||||
int warmUp = -1;
|
|
||||||
pre = pre.toLowerCase();
|
|
||||||
warmUp = conf.getInt("commands.warmups.warmup5." + pre, warmUp);
|
|
||||||
return warmUp;
|
return warmUp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,12 +306,25 @@ public class boosConfigManager {
|
|||||||
"&6Warm-ups have been cancelled due to moving.&f");
|
"&6Warm-ups have been cancelled due to moving.&f");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Set<String> getWarmupGroups() {
|
||||||
|
Set<String> groups = conf.getConfigurationSection("commands.warmups")
|
||||||
|
.getKeys(false);
|
||||||
|
return groups;
|
||||||
|
}
|
||||||
|
|
||||||
static String getWarmUpMessage() {
|
static String getWarmUpMessage() {
|
||||||
return conf
|
return conf
|
||||||
.getString("options.messages.warming_up",
|
.getString("options.messages.warming_up",
|
||||||
"&6Wait&e &seconds& seconds&6 before command&e &command& &6has warmed up.&f");
|
"&6Wait&e &seconds& seconds&6 before command&e &command& &6has warmed up.&f");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Set<String> getWarmups(Player player) {
|
||||||
|
String warm = getWarmGrp(player);
|
||||||
|
Set<String> warmups = conf.getConfigurationSection(
|
||||||
|
"commands.warmups." + warm).getKeys(false);
|
||||||
|
return warmups;
|
||||||
|
}
|
||||||
|
|
||||||
static void load() {
|
static void load() {
|
||||||
try {
|
try {
|
||||||
conf.load(confFile);
|
conf.load(confFile);
|
||||||
@ -561,16 +502,4 @@ public class boosConfigManager {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getSaveInterval() {
|
|
||||||
return conf.getInt("options.options.save_interval_in_minutes", 15);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getPotionEffect(String pre) {
|
|
||||||
String effect = null;
|
|
||||||
pre = pre.toLowerCase();
|
|
||||||
effect = conf.getString("commands.warmupPotionEffects.effect." + pre,
|
|
||||||
effect);
|
|
||||||
return effect;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -34,43 +34,13 @@ public class boosCoolDownListener<a> implements Listener {
|
|||||||
if (player.hasPermission("booscooldowns.nolimit")
|
if (player.hasPermission("booscooldowns.nolimit")
|
||||||
|| player.hasPermission("booscooldowns.nolimit." + pre)) {
|
|| player.hasPermission("booscooldowns.nolimit." + pre)) {
|
||||||
} else {
|
} else {
|
||||||
if (player.hasPermission("booscooldowns.limit2")) {
|
limit = boosConfigManager.getLimit(pre, player);
|
||||||
limit = boosConfigManager.getLimit2(pre);
|
|
||||||
if (limit == -1) {
|
|
||||||
return false;
|
|
||||||
} else if (limit <= uses) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else if (player.hasPermission("booscooldowns.limit3")) {
|
|
||||||
limit = boosConfigManager.getLimit3(pre);
|
|
||||||
if (limit == -1) {
|
|
||||||
return false;
|
|
||||||
} else if (limit <= uses) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else if (player.hasPermission("booscooldowns.limit4")) {
|
|
||||||
limit = boosConfigManager.getLimit4(pre);
|
|
||||||
if (limit == -1) {
|
|
||||||
return false;
|
|
||||||
} else if (limit <= uses) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else if (player.hasPermission("booscooldowns.limit5")) {
|
|
||||||
limit = boosConfigManager.getLimit5(pre);
|
|
||||||
if (limit == -1) {
|
|
||||||
return false;
|
|
||||||
} else if (limit <= uses) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
limit = boosConfigManager.getLimit(pre);
|
|
||||||
if (limit == -1) {
|
if (limit == -1) {
|
||||||
return false;
|
return false;
|
||||||
} else if (limit <= uses) {
|
} else if (limit <= uses) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,61 +303,19 @@ public class boosCoolDownListener<a> implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int preCDCheck(Player player, String preSub) {
|
private int preCDCheck(Player player, String preSub) {
|
||||||
if (player.hasPermission("booscooldowns.cooldown2")) {
|
return boosConfigManager.getCoolDown(preSub, player);
|
||||||
return boosConfigManager.getCoolDown2(preSub);
|
|
||||||
} else if (player.hasPermission("booscooldowns.cooldown3")) {
|
|
||||||
return boosConfigManager.getCoolDown3(preSub);
|
|
||||||
} else if (player.hasPermission("booscooldowns.cooldown4")) {
|
|
||||||
return boosConfigManager.getCoolDown4(preSub);
|
|
||||||
} else if (player.hasPermission("booscooldowns.cooldown5")) {
|
|
||||||
return boosConfigManager.getCoolDown5(preSub);
|
|
||||||
} else {
|
|
||||||
return boosConfigManager.getCoolDown(preSub);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int preLimitCheck(Player player, String preSub) {
|
private int preLimitCheck(Player player, String preSub) {
|
||||||
if (player.hasPermission("booscooldowns.limit2")) {
|
return boosConfigManager.getLimit(preSub, player);
|
||||||
return boosConfigManager.getLimit2(preSub);
|
|
||||||
} else if (player.hasPermission("booscooldowns.limit3")) {
|
|
||||||
return boosConfigManager.getLimit3(preSub);
|
|
||||||
} else if (player.hasPermission("booscooldowns.limit4")) {
|
|
||||||
return boosConfigManager.getLimit4(preSub);
|
|
||||||
} else if (player.hasPermission("booscooldowns.limit5")) {
|
|
||||||
return boosConfigManager.getLimit5(preSub);
|
|
||||||
} else {
|
|
||||||
return boosConfigManager.getLimit(preSub);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private double prePriceCheck(Player player, String preSub) {
|
private double prePriceCheck(Player player, String preSub) {
|
||||||
if (player.hasPermission("booscooldowns.price2")) {
|
return boosConfigManager.getPrice(preSub, player);
|
||||||
return boosConfigManager.getPrice2(preSub);
|
|
||||||
} else if (player.hasPermission("booscooldowns.price3")) {
|
|
||||||
return boosConfigManager.getPrice3(preSub);
|
|
||||||
} else if (player.hasPermission("booscooldowns.price4")) {
|
|
||||||
return boosConfigManager.getPrice4(preSub);
|
|
||||||
} else if (player.hasPermission("booscooldowns.price5")) {
|
|
||||||
return boosConfigManager.getPrice5(preSub);
|
|
||||||
} else {
|
|
||||||
return boosConfigManager.getPrice(preSub);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int preSubCheck(Player player, String preSub) {
|
private int preSubCheck(Player player, String preSub) {
|
||||||
|
return boosConfigManager.getWarmUp(preSub, player);
|
||||||
if (player.hasPermission("booscooldowns.warmup2")) {
|
|
||||||
return boosConfigManager.getWarmUp2(preSub);
|
|
||||||
} else if (player.hasPermission("booscooldowns.warmup3")) {
|
|
||||||
return boosConfigManager.getWarmUp3(preSub);
|
|
||||||
} else if (player.hasPermission("booscooldowns.warmup4")) {
|
|
||||||
return boosConfigManager.getWarmUp4(preSub);
|
|
||||||
} else if (player.hasPermission("booscooldowns.warmup5")) {
|
|
||||||
return boosConfigManager.getWarmUp5(preSub);
|
|
||||||
} else {
|
|
||||||
return boosConfigManager.getWarmUp(preSub);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void start(PlayerCommandPreprocessEvent event, Player player,
|
private void start(PlayerCommandPreprocessEvent event, Player player,
|
||||||
|
@ -8,6 +8,7 @@ import java.text.SimpleDateFormat;
|
|||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
@ -142,7 +143,7 @@ public class boosCoolDownManager {
|
|||||||
static boolean coolDown(Player player, String pre) {
|
static boolean coolDown(Player player, String pre) {
|
||||||
pre = pre.toLowerCase();
|
pre = pre.toLowerCase();
|
||||||
int coolDownSeconds = 0;
|
int coolDownSeconds = 0;
|
||||||
coolDownSeconds = getCooldownGroup(player, pre, coolDownSeconds);
|
coolDownSeconds = getCooldownTime(player, pre);
|
||||||
if (coolDownSeconds > 0
|
if (coolDownSeconds > 0
|
||||||
&& !player.hasPermission("booscooldowns.nocooldown")
|
&& !player.hasPermission("booscooldowns.nocooldown")
|
||||||
&& !player.hasPermission("booscooldowns.nocooldown." + pre)) {
|
&& !player.hasPermission("booscooldowns.nocooldown." + pre)) {
|
||||||
@ -151,19 +152,8 @@ public class boosCoolDownManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int getCooldownGroup(Player player, String pre,
|
private static int getCooldownTime(Player player, String pre) {
|
||||||
int coolDownSeconds) {
|
int coolDownSeconds = boosConfigManager.getCoolDown(pre, player);
|
||||||
if (player.hasPermission("booscooldowns.cooldown2")) {
|
|
||||||
coolDownSeconds = boosConfigManager.getCoolDown2(pre);
|
|
||||||
} else if (player.hasPermission("booscooldowns.cooldown3")) {
|
|
||||||
coolDownSeconds = boosConfigManager.getCoolDown3(pre);
|
|
||||||
} else if (player.hasPermission("booscooldowns.cooldown4")) {
|
|
||||||
coolDownSeconds = boosConfigManager.getCoolDown4(pre);
|
|
||||||
} else if (player.hasPermission("booscooldowns.cooldown5")) {
|
|
||||||
coolDownSeconds = boosConfigManager.getCoolDown5(pre);
|
|
||||||
} else {
|
|
||||||
coolDownSeconds = boosConfigManager.getCoolDown(pre);
|
|
||||||
}
|
|
||||||
return coolDownSeconds;
|
return coolDownSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,24 +177,13 @@ public class boosCoolDownManager {
|
|||||||
int limitNum = 0;
|
int limitNum = 0;
|
||||||
int num;
|
int num;
|
||||||
String message;
|
String message;
|
||||||
String lim = boosConfigManager.getLimGrp(player);
|
Set<String> uses = boosConfigManager.getLimits(player);
|
||||||
ConfigurationSection uses = boosConfigManager.getLimits(player);
|
|
||||||
if (uses != null) {
|
if (uses != null) {
|
||||||
for (String key : uses.getKeys(false)) {
|
for (String key : uses) {
|
||||||
usesNum = confusers.getInt("users."
|
usesNum = confusers.getInt("users."
|
||||||
+ player.getName().toLowerCase().hashCode() + ".uses."
|
+ player.getName().toLowerCase().hashCode() + ".uses."
|
||||||
+ key, usesNum);
|
+ key, usesNum);
|
||||||
if (lim.equals("limit")) {
|
limitNum = boosConfigManager.getLimit(key, player);
|
||||||
limitNum = boosConfigManager.getLimit(key);
|
|
||||||
} else if (lim.equals("limit2")) {
|
|
||||||
limitNum = boosConfigManager.getLimit2(key);
|
|
||||||
} else if (lim.equals("limit3")) {
|
|
||||||
limitNum = boosConfigManager.getLimit3(key);
|
|
||||||
} else if (lim.equals("limit4")) {
|
|
||||||
limitNum = boosConfigManager.getLimit4(key);
|
|
||||||
} else if (lim.equals("limit5")) {
|
|
||||||
limitNum = boosConfigManager.getLimit5(key);
|
|
||||||
}
|
|
||||||
num = limitNum - usesNum;
|
num = limitNum - usesNum;
|
||||||
if (num < 0) {
|
if (num < 0) {
|
||||||
num = 0;
|
num = 0;
|
||||||
@ -253,7 +232,7 @@ public class boosCoolDownManager {
|
|||||||
static boolean checkCoolDownOK(Player player, String pre, String message) {
|
static boolean checkCoolDownOK(Player player, String pre, String message) {
|
||||||
pre = pre.toLowerCase();
|
pre = pre.toLowerCase();
|
||||||
int coolDownSeconds = 0;
|
int coolDownSeconds = 0;
|
||||||
coolDownSeconds = getCooldownGroup(player, pre, coolDownSeconds);
|
coolDownSeconds = getCooldownTime(player, pre);
|
||||||
if (coolDownSeconds > 0) {
|
if (coolDownSeconds > 0) {
|
||||||
Date lastTime = getTime(player, pre);
|
Date lastTime = getTime(player, pre);
|
||||||
if (lastTime == null) {
|
if (lastTime == null) {
|
||||||
@ -389,7 +368,7 @@ public class boosCoolDownManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void startAllCooldowns(Player player) {
|
public static void startAllCooldowns(Player player) {
|
||||||
for (String a : boosConfigManager.getCooldownsList(player)) {
|
for (String a : boosConfigManager.getCooldowns(player)) {
|
||||||
coolDown(player, a);
|
coolDown(player, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: boosCooldowns
|
name: boosCooldowns
|
||||||
main: cz.boosik.boosCooldown.boosCoolDown
|
main: cz.boosik.boosCooldown.boosCoolDown
|
||||||
version: 3.4.3
|
version: 3.5.0
|
||||||
authors: [LordBoos (ingame name boosik)]
|
authors: [LordBoos (ingame name boosik)]
|
||||||
softdepend: [Vault]
|
softdepend: [Vault]
|
||||||
description: >
|
description: >
|
||||||
|
Loading…
Reference in New Issue
Block a user