Remove NMS, update json chat component

This commit is contained in:
boosik 2020-07-10 11:36:04 +02:00
parent 4c7a663c43
commit 7a2b32a3d2
37 changed files with 557 additions and 818 deletions

View File

@ -5,11 +5,8 @@ import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import nms.NMS;
import nms.NMSNotHookedException;
import nms.NMSSetupResponse;
import net.md_5.bungee.chat.ComponentSerializer;
/**
* A JSON Object is the base for any JSON message using this library.
@ -21,16 +18,16 @@ import nms.NMSSetupResponse;
*/
public class JSON {
private List<JSONComponentSimple> components = new ArrayList<JSONComponentSimple>();
private final List<JSONComponentSimple> components = new ArrayList<JSONComponentSimple>();
private String generatedJSON;
private boolean generated;
/**
* Constructs a new JSON Object with a base JSONComponentSimple Object.
*
* @param JSONComponentSimple (JSONComponentSimple) - the base JSONComponentSimple Object
* @param jsonComponent (JSONComponentSimple) - the base JSONComponentSimple Object
*/
public JSON(JSONComponentSimple jsonComponent) {
public JSON(final JSONComponentSimple jsonComponent) {
if (jsonComponent == null) {
throw new IllegalArgumentException("component cannot be null!");
@ -48,14 +45,14 @@ public class JSON {
*
* @param components (JSONComponentSimple[]) - the JSONComponentSimple Objects
*/
public JSON(JSONComponentSimple... components) {
public JSON(final JSONComponentSimple... components) {
if (components == null) {
throw new IllegalArgumentException("component cannot be null!");
}
if (components.length > 0) {
for (JSONComponentSimple component : components) {
for (final JSONComponentSimple component : components) {
this.components.add(component);
}
}
@ -65,22 +62,13 @@ public class JSON {
}
/**
* This method needs to be called in the onEnable() method.
*
* @see NMS#setup()
*/
public static NMSSetupResponse setup(Plugin pl) {
return NMS.setup(pl);
}
/**
* Sends a JSON message to a player.
*
* @param to (Player) - the player to send the message to
* @param json (String) - the raw JSON to send
*/
public static void sendJSON(Player to, String json) {
public static void sendJSON(final Player to, final String json) {
if (to == null) {
throw new IllegalArgumentException("player cannot be null!");
@ -88,12 +76,7 @@ public class JSON {
if (json == null) {
throw new IllegalArgumentException("json cannot be null!");
}
try {
NMS.getHook().sendJSON(json, to);
} catch (NMSNotHookedException e) {
e.printStackTrace();
}
to.spigot().sendMessage(ComponentSerializer.parse(json));
}
/**
@ -103,7 +86,7 @@ public class JSON {
* @param to (Player) - the player to send the message to
* @param json (JSON) - the JSON Object to send
*/
public static void sendJSON(Player to, JSON json) {
public static void sendJSON(final Player to, final JSON json) {
sendJSON(to, json.get());
}
@ -113,14 +96,14 @@ public class JSON {
* @param jsons (JSON[]) - the JSON Objects to combine
* @return (JSON) - the combined JSON.
*/
public static JSON combineToNewJSON(JSON... jsons) {
public static JSON combineToNewJSON(final JSON... jsons) {
JSON baseJSON;
final JSON baseJSON;
baseJSON = (JSON) jsons[0].clone();
baseJSON = jsons[0].clone();
for (int i = 1; i < jsons.length; i++) {
for (JSONComponentSimple comp : jsons[i].getComponents()) {
for (final JSONComponentSimple comp : jsons[i].getComponents()) {
baseJSON.add(comp.clone());
}
}
@ -135,7 +118,7 @@ public class JSON {
@Override
public JSON clone() {
JSONComponentSimple[] comps = new JSONComponentSimple[components.size()];
final JSONComponentSimple[] comps = new JSONComponentSimple[components.size()];
for (int i = 0; i < components.size(); i++) {
comps[i] = components.get(i).clone();
@ -151,7 +134,7 @@ public class JSON {
* @param component (JSONComponentSimple) - the JSONComponentSimple to add.
* @return (JSON) - this JSON Object, for chaining.
*/
public JSON add(JSONComponentSimple component) {
public JSON add(final JSONComponentSimple component) {
if (component == null) {
throw new IllegalArgumentException("component cannot be null!");
@ -171,7 +154,7 @@ public class JSON {
* @param component (JSONComponentSimple) - the JSONComponentSimple to remove.
* @return (JSON) - this JSON Object, for chaining.
*/
public JSON remove(JSONComponentSimple component) {
public JSON remove(final JSONComponentSimple component) {
if (component == null) {
throw new IllegalArgumentException("component cannot be null!");
@ -201,10 +184,10 @@ public class JSON {
* @param jsons (JSON[]) - the JSON Objects to add to this one
* @return JSON - this JSON Object, with all other JSON Objects added.
*/
public JSON combine(JSON... jsons) {
public JSON combine(final JSON... jsons) {
for (JSON json : jsons) {
for (JSONComponentSimple component : json.getComponents()) {
for (final JSON json : jsons) {
for (final JSONComponentSimple component : json.getComponents()) {
this.add(component);
}
}
@ -223,7 +206,7 @@ public class JSON {
generatedJSON = "{\"text\":\"\",\"extra\":[";
for (JSONComponentSimple component : components) {
for (final JSONComponentSimple component : components) {
generatedJSON += component.get() + ",";
}
@ -256,7 +239,7 @@ public class JSON {
* @param player (Player) - the player to send the message to
* @return (JSON) - this JSON Object, for chaining.
*/
public JSON send(Player player) {
public JSON send(final Player player) {
if (player == null) {
throw new IllegalArgumentException("player cannot be null!");
@ -278,7 +261,7 @@ public class JSON {
String s = "";
for (JSONComponentSimple comp : components) {
for (final JSONComponentSimple comp : components) {
s += ChatColor.RESET + comp.getChatColorVersion();
}

View File

@ -16,7 +16,7 @@ public interface JSONClickAction<T> {
* @return (?) - the value.
* @see #setValue(Object)
*/
public T getValue();
T getValue();
/**
* Sets the value of this JSONClickAction.
@ -24,7 +24,7 @@ public interface JSONClickAction<T> {
* @param newValue (?) - the new value
* @return (JSONHoverAction: ?) - this JSONClickAction Object, for chaining.
*/
public JSONClickAction<T> setValue(T newValue);
JSONClickAction<T> setValue(T newValue);
/**
* Gets the value associated with this JSONClickAction transformed to a String.
@ -32,7 +32,7 @@ public interface JSONClickAction<T> {
* @return (String) - the value as a String.
* @see #getValue()
*/
public String getValueString();
String getValueString();
/**
* Gets the action name associated with this JSONClickAction.
@ -40,12 +40,12 @@ public interface JSONClickAction<T> {
*
* @return (String) - the action name.
*/
public String getActionName();
String getActionName();
/**
* Runs a command as the player who clicks on the text in the chat.
*/
public class RunCommand
class RunCommand
implements JSONClickAction<String> {
/**
@ -62,7 +62,7 @@ public interface JSONClickAction<T> {
*
* @param value (String) - the value associated with this JSONClickAction
*/
public RunCommand(String value) {
public RunCommand(final String value) {
this.value = value;
@ -74,7 +74,7 @@ public interface JSONClickAction<T> {
}
@Override
public JSONClickAction<String> setValue(String newValue) {
public JSONClickAction<String> setValue(final String newValue) {
value = newValue;
return this;
}
@ -94,7 +94,7 @@ public interface JSONClickAction<T> {
/**
* Pastes a command in the chat of the player who clicks on the text in the chat.
*/
public class SuggestCommand
class SuggestCommand
implements JSONClickAction<String> {
/**
@ -111,7 +111,7 @@ public interface JSONClickAction<T> {
*
* @param value (String) - the value associated with this JSONClickAction
*/
public SuggestCommand(String value) {
public SuggestCommand(final String value) {
this.value = value;
@ -123,7 +123,7 @@ public interface JSONClickAction<T> {
}
@Override
public JSONClickAction<String> setValue(String newValue) {
public JSONClickAction<String> setValue(final String newValue) {
value = newValue;
return this;
}
@ -143,7 +143,7 @@ public interface JSONClickAction<T> {
/**
* Opens a URL in the default browser of the player who clicks on the text in the chat.
*/
public class OpenURL
class OpenURL
implements JSONClickAction<String> {
/**
@ -160,7 +160,7 @@ public interface JSONClickAction<T> {
*
* @param value (String) - the value associated with this JSONClickAction
*/
public OpenURL(String value) {
public OpenURL(final String value) {
this.value = value;
@ -172,7 +172,7 @@ public interface JSONClickAction<T> {
}
@Override
public JSONClickAction<String> setValue(String newValue) {
public JSONClickAction<String> setValue(final String newValue) {
value = newValue;
return this;
}

View File

@ -30,14 +30,14 @@ public enum JSONColor {
private final String code;
JSONColor(String code) {
JSONColor(final String code) {
this.code = code;
}
public static JSONColor fromString(String text) {
if (text != null) {
text = text.replace("§", "&");
for (JSONColor b : JSONColor.values()) {
for (final JSONColor b : JSONColor.values()) {
if (text.equalsIgnoreCase(b.code)) {
return b;
}

View File

@ -11,7 +11,7 @@ public class JSONComponent
private JSONHoverAction<?> hoverAction;
private JSONClickAction<?> clickAction;
public JSONComponent(String text) {
public JSONComponent(final String text) {
super(text);
}
@ -77,7 +77,7 @@ public class JSONComponent
* @return (JSONComponent) - this JSONComponent Object, for chaining.
* @see #getHoverAction()
*/
public JSONComponent setHoverAction(JSONHoverAction<?> hoverAction) {
public JSONComponent setHoverAction(final JSONHoverAction<?> hoverAction) {
if (hoverAction == null) {
throw new IllegalArgumentException("hoverAction cannot be null!");
}
@ -102,7 +102,7 @@ public class JSONComponent
* @return (JSONComponent) - this JSONComponent Object, for chaining.
* @see #getClickAction()
*/
public JSONComponent setClickAction(JSONClickAction<?> clickAction) {
public JSONComponent setClickAction(final JSONClickAction<?> clickAction) {
if (clickAction == null) {
throw new IllegalArgumentException("clickAction cannot be null!");
}

View File

@ -28,7 +28,7 @@ public class JSONComponentSimple {
*
* @param text (String) - the base text this JSONComponent contains
*/
public JSONComponentSimple(String text) {
public JSONComponentSimple(final String text) {
if (text == null) {
throw new IllegalArgumentException("text cannot be null!");
@ -51,11 +51,11 @@ public class JSONComponentSimple {
* @return (JSONComponent) - the JSONComponent matching the String or null if the String is invalid.
* @see #toString()
*/
public static JSONComponentSimple fromString(String str) {
public static JSONComponentSimple fromString(final String str) {
try {
String[] parts = str.split("|||");
final String[] parts = str.split("|||");
if (parts == null || parts.length != 7) {
return null;
@ -69,7 +69,7 @@ public class JSONComponentSimple {
.setUnderlined(Boolean.valueOf(parts[5]))
.setObfuscated(Boolean.valueOf(parts[6]));
} catch (Exception e) {
} catch (final Exception e) {
return null;
}
@ -114,11 +114,11 @@ public class JSONComponentSimple {
* @param withComponents (JSONComponent[]) - the JSONComponent Objects to combine this JSONComponent with
* @return (JSON) - a newly created JSON Object containing this and all specified JSONComponent Objects.
*/
public JSON combine(JSONComponentSimple... withComponents) {
public JSON combine(final JSONComponentSimple... withComponents) {
JSON json = new JSON(this);
final JSON json = new JSON(this);
for (JSONComponentSimple with : withComponents) {
for (final JSONComponentSimple with : withComponents) {
json.add(with);
}
@ -134,7 +134,7 @@ public class JSONComponentSimple {
* @see JSON#add(JSONComponent)
* @see JSONComponent#toJSON()
*/
public JSONComponentSimple addToJSON(JSON json) {
public JSONComponentSimple addToJSON(final JSON json) {
json.add(this);
@ -173,7 +173,7 @@ public class JSONComponentSimple {
* @return (JSONComponent) - this JSONComponent Object, for chaining.
* @see JSONComponent_old#get()
*/
public JSONComponentSimple send(Player to) {
public JSONComponentSimple send(final Player to) {
JSON.sendJSON(to, get());
@ -231,7 +231,7 @@ public class JSONComponentSimple {
* @param text (String) - the new text
* @return (JSONComponent) - this JSONComponent Object, for chaining.
*/
public JSONComponentSimple setText(String text) {
public JSONComponentSimple setText(final String text) {
if (text == null) {
throw new IllegalArgumentException("text cannot be null!");
}
@ -259,7 +259,7 @@ public class JSONComponentSimple {
* @param color (JSONColor) - the color to set this JSONObject to
* @return (JSONComponent) - this JSONComponent Object, for chaining.
*/
public JSONComponentSimple setColor(JSONColor color) {
public JSONComponentSimple setColor(final JSONColor color) {
if (color == null) {
throw new IllegalArgumentException("color cannot be null!");
}
@ -284,7 +284,7 @@ public class JSONComponentSimple {
* @param bold (boolean) - whether the text should be bold
* @return (JSONComponent) - this JSONComponent Object, for chaining.
*/
public JSONComponentSimple setBold(boolean bold) {
public JSONComponentSimple setBold(final boolean bold) {
this.bold = bold;
generated = false;
return this;
@ -306,7 +306,7 @@ public class JSONComponentSimple {
* @param italic (boolean) - whether the text should be italic
* @return (JSONComponent) - this JSONComponent Object, for chaining.
*/
public JSONComponentSimple setItalic(boolean italic) {
public JSONComponentSimple setItalic(final boolean italic) {
this.italic = italic;
generated = false;
return this;
@ -328,7 +328,7 @@ public class JSONComponentSimple {
* @param strikethrough (boolean) - whether the text should be strikethrough
* @return (JSONComponent) - this JSONComponent Object, for chaining.
*/
public JSONComponentSimple setStrikethrough(boolean strikethrough) {
public JSONComponentSimple setStrikethrough(final boolean strikethrough) {
this.strikethrough = strikethrough;
generated = false;
return this;
@ -350,7 +350,7 @@ public class JSONComponentSimple {
* @param underlined (boolean) - whether the text should be underlined
* @return (JSONComponent) - this JSONComponent Object, for chaining.
*/
public JSONComponentSimple setUnderlined(boolean underlined) {
public JSONComponentSimple setUnderlined(final boolean underlined) {
this.underlined = underlined;
generated = false;
return this;
@ -372,7 +372,7 @@ public class JSONComponentSimple {
* @param obfuscated (boolean) - whether the text should be obfuscated
* @return (JSONComponent) - this JSONComponent Object, for chaining.
*/
public JSONComponentSimple setObfuscated(boolean obfuscated) {
public JSONComponentSimple setObfuscated(final boolean obfuscated) {
this.obfuscated = obfuscated;
generated = false;
return this;

View File

@ -4,6 +4,8 @@ import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import cz.boosik.boosCooldown.BoosCoolDown;
/**
* Represents a hover action.
* All rights reserved.
@ -20,7 +22,7 @@ public interface JSONHoverAction<T> {
* @return (?) - the value.
* @see #setValue(Object)
*/
public T getValue();
T getValue();
/**
* Sets the value of this JSONHoverAction.
@ -28,7 +30,7 @@ public interface JSONHoverAction<T> {
* @param newValue (?) - the new value
* @return (JSONHoverAction: ?) - this JSONHoverAction Object, for chaining.
*/
public JSONHoverAction<T> setValue(T newValue);
JSONHoverAction<T> setValue(T newValue);
/**
* Gets the value associated with this JSONHoverAction transformed to a String.
@ -36,7 +38,7 @@ public interface JSONHoverAction<T> {
* @return (String) - the value as a String.
* @see #getValue()
*/
public String getValueString();
String getValueString();
/**
* Gets the action name associated with this JSONHoverAction.
@ -44,12 +46,12 @@ public interface JSONHoverAction<T> {
*
* @return (String) - the action name.
*/
public String getActionName();
String getActionName();
/**
* Shows some JSON-formed text when hovering over the text in the chat.
*/
public class ShowText
class ShowText
implements JSONHoverAction<JSON> {
/**
@ -66,7 +68,7 @@ public interface JSONHoverAction<T> {
*
* @param value (JSON) - the value associated with this JSONHoverAction
*/
public ShowText(JSON value) {
public ShowText(final JSON value) {
this.value = value;
@ -78,7 +80,7 @@ public interface JSONHoverAction<T> {
}
@Override
public JSONHoverAction<JSON> setValue(JSON newValue) {
public JSONHoverAction<JSON> setValue(final JSON newValue) {
value = newValue;
return this;
}
@ -98,7 +100,7 @@ public interface JSONHoverAction<T> {
/**
* Shows some JSON-formed text when hovering over the text in the chat.
*/
public class ShowStringText
class ShowStringText
implements JSONHoverAction<String> {
/**
@ -115,7 +117,7 @@ public interface JSONHoverAction<T> {
*
* @param value (JSON) - the value associated with this JSONHoverAction
*/
public ShowStringText(String value) {
public ShowStringText(final String value) {
this.value = value;
@ -127,7 +129,7 @@ public interface JSONHoverAction<T> {
}
@Override
public JSONHoverAction<String> setValue(String newValue) {
public JSONHoverAction<String> setValue(final String newValue) {
value = newValue;
return this;
}
@ -147,7 +149,7 @@ public interface JSONHoverAction<T> {
/**
* Shows an item when hovering over the text in the chat.
*/
public class ShowItem
class ShowItem
implements JSONHoverAction<Material> {
/**
@ -164,7 +166,7 @@ public interface JSONHoverAction<T> {
*
* @param value (JSON) - the value associated with this JSONHoverAction
*/
public ShowItem(Material value) {
public ShowItem(final Material value) {
this.value = value;
@ -176,7 +178,7 @@ public interface JSONHoverAction<T> {
}
@Override
public JSONHoverAction<Material> setValue(Material newValue) {
public JSONHoverAction<Material> setValue(final Material newValue) {
value = newValue;
return this;
}
@ -213,18 +215,18 @@ public interface JSONHoverAction<T> {
*
* @param value (JSON) - the value associated with this JSONHoverAction
*/
public ShowItemStack(ItemStack value) {
public ShowItemStack(final ItemStack value) {
this.value = value;
}
public static String toTitleCase(String givenString) {
public static String toTitleCase(final String givenString) {
if (givenString == null || "".equals(givenString)) {
return "";
}
String[] arr = givenString.split(" ");
StringBuffer sb = new StringBuffer();
final String[] arr = givenString.split(" ");
final StringBuffer sb = new StringBuffer();
for (int i = 0; i < arr.length; i++) {
sb.append(Character.toUpperCase(arr[i].charAt(0)))
@ -239,25 +241,25 @@ public interface JSONHoverAction<T> {
}
@Override
public JSONHoverAction<ItemStack> setValue(ItemStack newValue) {
public JSONHoverAction<ItemStack> setValue(final ItemStack newValue) {
value = newValue;
return this;
}
@Override
public String getValueString() {
String material = value.getData().getItemType().toString().toLowerCase();
final String material = value.getData().getItemType().toString().toLowerCase();
String value2 = "{id:\\\"minecraft:" + material + "\\\",Damage:" + value.getDurability() + ",Count:" + value.getAmount() + ",tag:{";
if (value.getItemMeta().hasEnchants()) {
value2 += "ench:[";
value2 += "Enchantments:[";
int i = 0;
int size = value.getItemMeta().getEnchants().keySet().size();
for (Enchantment ench : value.getItemMeta().getEnchants().keySet()) {
final int size = value.getItemMeta().getEnchants().keySet().size();
for (final Enchantment ench : value.getItemMeta().getEnchants().keySet()) {
if (i + 1 == size) {
value2 += "{lvl:" + value.getItemMeta().getEnchants().get(ench) + "s,id:" + ench.getKey() + "s}";
value2 += "{lvl:" + value.getItemMeta().getEnchants().get(ench) + ",id:\\\"" + ench.getKey() + "\\\"}";
} else {
value2 += "{lvl:" + value.getItemMeta().getEnchants().get(ench) + "s,id:" + ench.getKey() + "s},";
value2 += "{lvl:" + value.getItemMeta().getEnchants().get(ench) + ",id:\\\"" + ench.getKey() + "\\\"},";
}
i++;
}
@ -274,7 +276,7 @@ public interface JSONHoverAction<T> {
if (value.getItemMeta().hasLore()) {
value2 += ",Lore:[";
for (String lore : value.getItemMeta().getLore()) {
for (final String lore : value.getItemMeta().getLore()) {
value2 = value2 + (value.getItemMeta().getLore().size() == 1 || value
.getItemMeta()
.getLore()

View File

@ -25,7 +25,6 @@ import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitScheduler;
import org.mcstats.MetricsLite;
import com.coloredcarrot.mcapi.json.JSON;
import cz.boosik.boosCooldown.Listeners.BoosEntityDamageListener;
import cz.boosik.boosCooldown.Listeners.BoosPlayerDeathListener;
import cz.boosik.boosCooldown.Listeners.BoosPlayerGameModeChangeListener;
@ -40,7 +39,6 @@ import cz.boosik.boosCooldown.Managers.BoosLimitManager;
import cz.boosik.boosCooldown.Runnables.BoosGlobalLimitResetRunnable;
import net.milkbowl.vault.Vault;
import net.milkbowl.vault.economy.Economy;
import nms.NMSSetupResponse;
import util.BoosChat;
public class BoosCoolDown extends JavaPlugin implements Runnable {
@ -52,7 +50,7 @@ public class BoosCoolDown extends JavaPlugin implements Runnable {
private static boolean usingVault = false;
private PluginManager pm;
public static void commandLogger(String player, String command) {
public static void commandLogger(final String player, final String command) {
log.info("[" + "boosLogger" + "] " + player + " used command " + command);
}
@ -68,26 +66,26 @@ public class BoosCoolDown extends JavaPlugin implements Runnable {
return log;
}
static boolean isPluginOnForPlayer(Player player) {
boolean on;
static boolean isPluginOnForPlayer(final Player player) {
final boolean on;
on = !player.hasPermission("booscooldowns.exception") && !player.isOp();
return on;
}
private static void startLimitResetTimersGlobal() {
YamlConfiguration confusers = BoosConfigManager.getConfusers();
ConfigurationSection global = confusers.getConfigurationSection("global");
final YamlConfiguration confusers = BoosConfigManager.getConfusers();
final 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);
Date endDate = getTime(confTime);
Date startDate = getCurrTime();
Calendar calcurrTime = Calendar.getInstance();
final Set<String> globalKeys = global.getKeys(false);
final BukkitScheduler scheduler = Bukkit.getScheduler();
for (final String key : globalKeys) {
final String confTime = confusers.getString("global." + key + ".reset");
final long limitResetDelay = BoosConfigManager.getLimitResetDelayGlobal(key);
final Date endDate = getTime(confTime);
final Date startDate = getCurrTime();
final Calendar calcurrTime = Calendar.getInstance();
calcurrTime.setTime(startDate);
Calendar callastTime = Calendar.getInstance();
final Calendar callastTime = Calendar.getInstance();
callastTime.setTime(endDate);
long time = secondsBetween(calcurrTime, callastTime, limitResetDelay);
if (limitResetDelay != -65535) {
@ -105,16 +103,16 @@ public class BoosCoolDown extends JavaPlugin implements Runnable {
}
}
public static void startLimitResetTimerGlobal(String key) {
YamlConfiguration confusers = BoosConfigManager.getConfusers();
BukkitScheduler scheduler = Bukkit.getScheduler();
String confTime = confusers.getString("global." + key + ".reset");
long limitResetDelay = BoosConfigManager.getLimitResetDelayGlobal(key);
Date endDate = getTime(confTime);
Date startDate = getCurrTime();
Calendar calcurrTime = Calendar.getInstance();
public static void startLimitResetTimerGlobal(final String key) {
final YamlConfiguration confusers = BoosConfigManager.getConfusers();
final BukkitScheduler scheduler = Bukkit.getScheduler();
final String confTime = confusers.getString("global." + key + ".reset");
final long limitResetDelay = BoosConfigManager.getLimitResetDelayGlobal(key);
final Date endDate = getTime(confTime);
final Date startDate = getCurrTime();
final Calendar calcurrTime = Calendar.getInstance();
calcurrTime.setTime(startDate);
Calendar callastTime = Calendar.getInstance();
final Calendar callastTime = Calendar.getInstance();
callastTime.setTime(endDate);
long time = secondsBetween(calcurrTime, callastTime, limitResetDelay);
if (limitResetDelay != -65535) {
@ -130,7 +128,7 @@ public class BoosCoolDown extends JavaPlugin implements Runnable {
}
}
private static long secondsBetween(Calendar startDate, Calendar endDate, long limitResetDelay) {
private static long secondsBetween(final Calendar startDate, final Calendar endDate, final long limitResetDelay) {
long secondsBetween = 0;
secondsBetween = ((endDate.getTimeInMillis() - startDate.getTimeInMillis()) / 1000) + limitResetDelay;
return secondsBetween;
@ -138,27 +136,27 @@ public class BoosCoolDown extends JavaPlugin implements Runnable {
private static Date getCurrTime() {
String currTime = "";
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
final Calendar cal = Calendar.getInstance();
final SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
currTime = sdf.format(cal.getTime());
Date time;
final Date time;
try {
time = sdf.parse(currTime);
return time;
} catch (ParseException e) {
} catch (final ParseException e) {
return null;
}
}
private static Date getTime(String confTime) {
private static Date getTime(final String confTime) {
if (confTime != null && !confTime.equals("")) {
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
Date lastDate;
final SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
final Date lastDate;
try {
lastDate = sdf.parse(confTime);
return lastDate;
} catch (ParseException e) {
} catch (final ParseException e) {
return null;
}
}
@ -166,7 +164,7 @@ public class BoosCoolDown extends JavaPlugin implements Runnable {
}
private void initializeVault() {
Plugin x = pm.getPlugin("Vault");
final Plugin x = pm.getPlugin("Vault");
if (x != null & x instanceof Vault) {
log.info("[" + pdfFile.getName() + "]" + " found [Vault] searching for economy plugin.");
usingVault = true;
@ -181,10 +179,9 @@ public class BoosCoolDown extends JavaPlugin implements Runnable {
}
}
@SuppressWarnings("deprecation")
@Override
public boolean onCommand(CommandSender sender, Command c, String commandLabel, String[] args) {
String command = c.getName().toLowerCase();
public boolean onCommand(final CommandSender sender, final Command c, final String commandLabel, final String[] args) {
final String command = c.getName().toLowerCase();
if (command.equalsIgnoreCase("booscooldowns")) {
if (args.length == 1) {
if (sender.hasPermission("booscooldowns.reload") && args[0].equalsIgnoreCase("reload")) {
@ -193,13 +190,13 @@ public class BoosCoolDown extends JavaPlugin implements Runnable {
return true;
} else if (sender.hasPermission("booscooldowns.list.limits") && args[0].equalsIgnoreCase("limits")) {
try {
Player send = (Player) sender;
Set<String> commands = BoosConfigManager.getCommands(send);
for (String comm : commands) {
int lim = BoosConfigManager.getLimit(comm, send);
final Player send = (Player) sender;
final Set<String> commands = BoosConfigManager.getCommands(send);
for (final String comm : commands) {
final int lim = BoosConfigManager.getLimit(comm, send);
BoosLimitManager.getLimitListMessages(send, comm, lim);
}
} catch (ClassCastException e) {
} catch (final ClassCastException e) {
log.warning("You cannot use this command from console!");
}
return true;
@ -212,49 +209,49 @@ public class BoosCoolDown extends JavaPlugin implements Runnable {
return true;
}
} else if (args.length == 2) {
String jmeno = args[1];
Player player = Bukkit.getPlayerExact(jmeno);
UUID uuid = player.getUniqueId();
final String jmeno = args[1];
final Player player = Bukkit.getPlayerExact(jmeno);
final UUID uuid = player.getUniqueId();
if (args[0].equalsIgnoreCase("chat")) {
player.chat(args[1]);
} else if (sender.hasPermission("booscooldowns.clearcooldowns") && args[0].equalsIgnoreCase("clearcooldowns")) {
String co = "cooldown";
final String co = "cooldown";
BoosConfigManager.clearSomething(co, uuid);
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")) {
String co = "uses";
final String co = "uses";
BoosConfigManager.clearSomething(co, uuid);
BoosChat.sendMessageToCommandSender(sender, "&6[" + pdfFile.getName() + "]&e" + " uses of player " + jmeno + " cleared");
return true;
} else if (sender.hasPermission("booscooldowns.clearwarmups") && command.equalsIgnoreCase("booscooldowns")
&& args[0].equalsIgnoreCase("clearwarmups")) {
String co = "warmup";
final String co = "warmup";
BoosConfigManager.clearSomething(co, uuid);
BoosChat.sendMessageToCommandSender(sender, "&6[" + pdfFile.getName() + "]&e" + " warmups of player " + jmeno + " cleared");
return true;
}
} else if (args.length == 3) {
String jmeno = args[1];
Player player = Bukkit.getPlayerExact(jmeno);
UUID uuid = player.getUniqueId();
String command2 = args[2].trim();
final String jmeno = args[1];
final Player player = Bukkit.getPlayerExact(jmeno);
final UUID uuid = player.getUniqueId();
final String command2 = args[2].trim();
if (sender.hasPermission("booscooldowns.clearcooldowns") && args[0].equalsIgnoreCase("clearcooldowns")) {
String co = "cooldown";
final String co = "cooldown";
BoosConfigManager.clearSomething(co, uuid, command2);
BoosChat.sendMessageToCommandSender(sender,
"&6[" + pdfFile.getName() + "]&e" + " cooldown for command " + command2 + " of player " + uuid + " cleared");
return true;
} else if (sender.hasPermission("booscooldowns.clearuses") && args[0].equalsIgnoreCase("clearuses")) {
String co = "uses";
final String co = "uses";
BoosConfigManager.clearSomething(co, uuid, command2);
BoosChat.sendMessageToCommandSender(sender,
"&6[" + pdfFile.getName() + "]&e" + " uses for command " + command2 + " of player " + jmeno + " cleared");
return true;
} else if (sender.hasPermission("booscooldowns.clearwarmups") && args[0].equalsIgnoreCase("clearwarmups")) {
String co = "warmup";
final String co = "warmup";
BoosConfigManager.clearSomething(co, uuid, command2);
BoosChat.sendMessageToCommandSender(sender,
"&6[" + pdfFile.getName() + "]&e" + " warmups for command " + command2 + " of player " + jmeno + " cleared");
@ -263,10 +260,10 @@ public class BoosCoolDown extends JavaPlugin implements Runnable {
}
} else if (args.length == 4) {
if (sender.hasPermission("booscooldowns.set") && args[0].equalsIgnoreCase("set")) {
String what = args[1];
final String what = args[1];
String comm = args[2];
String value = args[3];
String group = "default";
final String value = args[3];
final String group = "default";
if (comm.startsWith("/") || comm.equals("*")) {
if (comm.contains("_")) {
comm = comm.replace("_", " ");
@ -283,10 +280,10 @@ public class BoosCoolDown extends JavaPlugin implements Runnable {
} else if (args.length == 5) {
if (sender.hasPermission("booscooldowns.set") && args[0].equalsIgnoreCase("set")) {
String what = args[1];
final String what = args[1];
String comm = args[2];
String value = args[3];
String group = args[4];
final String value = args[3];
final String group = args[4];
if (comm.startsWith("/") || comm.equals("*")) {
if (comm.contains("_")) {
comm = comm.replace("_", " ");
@ -302,9 +299,9 @@ public class BoosCoolDown extends JavaPlugin implements Runnable {
}
} 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;
}
}
@ -327,7 +324,7 @@ public class BoosCoolDown extends JavaPlugin implements Runnable {
@Override
public void onEnable() {
pdfFile = this.getDescription();
PluginDescriptionFile pdfFile = this.getDescription();
final PluginDescriptionFile pdfFile = this.getDescription();
log.info("[" + pdfFile.getName() + "]" + " version " + pdfFile.getVersion() + " by " + pdfFile.getAuthors() + " is enabled!");
this.saveDefaultConfig();
new BoosConfigManager(this);
@ -337,7 +334,7 @@ public class BoosCoolDown extends JavaPlugin implements Runnable {
registerListeners();
initializeVault();
hookPlayerPoints();
BukkitScheduler scheduler = this.getServer().getScheduler();
final BukkitScheduler scheduler = this.getServer().getScheduler();
startLimitResetTimersGlobal();
if (BoosConfigManager.getAutoSave()) {
scheduler.scheduleSyncRepeatingTask(this,
@ -350,22 +347,11 @@ public class BoosCoolDown extends JavaPlugin implements Runnable {
BoosConfigManager.clear();
}
try {
MetricsLite metrics = new MetricsLite(this);
final MetricsLite metrics = new MetricsLite(this);
metrics.start();
} catch (IOException e) {
} catch (final IOException e) {
// Failed to submit the stats :-(
}
NMSSetupResponse nmsSetupResponse = JSON.setup(this);
if (nmsSetupResponse.isCompatible()) {
getLogger().info("[" + pdfFile.getName() + "]" + " Hooked server version " + nmsSetupResponse.getVersion());
} else {
getLogger().warning("[" + pdfFile.getName() + "]" + " Your server version (" + (nmsSetupResponse.getVersion() == null ? "UNKNOWN" : nmsSetupResponse
.getVersion()) + ") is not compatible with this plugin!");
getServer().getPluginManager().disablePlugin(this);
return;
}
}
private void registerListeners() {
@ -412,7 +398,7 @@ public class BoosCoolDown extends JavaPlugin implements Runnable {
private boolean setupEconomy() {
if (usingVault) {
RegisteredServiceProvider<Economy> economyProvider = getServer()
final RegisteredServiceProvider<Economy> economyProvider = getServer()
.getServicesManager()
.getRegistration(net.milkbowl.vault.economy.Economy.class);
if (economyProvider != null) {
@ -425,9 +411,9 @@ public class BoosCoolDown extends JavaPlugin implements Runnable {
private boolean hookPlayerPoints() {
if (BoosConfigManager.getPlayerPointsEnabled()) {
Plugin x = pm.getPlugin("PlayerPoints");
final Plugin x = pm.getPlugin("PlayerPoints");
if (x != null && x instanceof PlayerPoints) {
RegisteredServiceProvider<PlayerPoints> playerPointsProvider = getServer()
final RegisteredServiceProvider<PlayerPoints> playerPointsProvider = getServer()
.getServicesManager()
.getRegistration(org.black_ixx.playerpoints.PlayerPoints.class);
if (playerPointsProvider != null) {

View File

@ -39,20 +39,21 @@ public class BoosCoolDownListener implements Listener {
public static Map<String, Boolean> commandQueue = new ConcurrentHashMap<>();
private static BoosCoolDown plugin;
BoosCoolDownListener(BoosCoolDown instance) {
BoosCoolDownListener(final BoosCoolDown instance) {
plugin = instance;
}
private void checkRestrictions(PlayerCommandPreprocessEvent event,
Player player, String regexCommad, String originalCommand,
int warmupTime, int cooldownTime, double price, String item,
int count, String name, List<String> lore, List<String> enchants, int limit, int xpPrice,
int xpRequirement, int playerPoints) {
private void checkRestrictions(
final PlayerCommandPreprocessEvent event,
final Player player, final String regexCommad, final String originalCommand,
final int warmupTime, final int cooldownTime, final double price, final String item,
final int count, final String name, final List<String> lore, final List<String> enchants, final int limit, final int xpPrice,
final int xpRequirement, final int playerPoints) {
boolean blocked = false;
String perm = BoosConfigManager.getPermission(player, regexCommad);
final String perm = BoosConfigManager.getPermission(player, regexCommad);
if (!(perm == null)) {
if (!player.hasPermission(perm)) {
String msg = BoosConfigManager.getPermissionMessage(player, regexCommad);
final String msg = BoosConfigManager.getPermissionMessage(player, regexCommad);
if (!(msg == null)) {
BoosChat.sendMessageToPlayer(player, msg);
}
@ -103,8 +104,8 @@ public class BoosCoolDownListener implements Listener {
regexCommad, originalCommand, playerPoints);
}
} else {
boolean warmupInProgress = BoosWarmUpManager.isWarmUpProcess(player, regexCommad);
boolean cooldownInProgress = BoosCoolDownManager.isCoolingdown(player, regexCommad, cooldownTime);
final boolean warmupInProgress = BoosWarmUpManager.isWarmUpProcess(player, regexCommad);
final boolean cooldownInProgress = BoosCoolDownManager.isCoolingdown(player, regexCommad, cooldownTime);
if (!BoosPriceManager.has(player, price)
&& !warmupInProgress && !cooldownInProgress) {
String msg;
@ -121,7 +122,7 @@ public class BoosCoolDownListener implements Listener {
&& !warmupInProgress && !cooldownInProgress) {
String msg;
msg = BoosConfigManager.getInsufficientItemsMessage();
JSON json = getItemStackJson(1, item, count, name, lore, enchants);
final JSON json = getItemStackJson(1, item, count, name, lore, enchants);
msg = msg.replaceAll("&command&", originalCommand);
BoosChat.sendMessageToPlayer(player, msg);
json.send(player);
@ -156,7 +157,7 @@ public class BoosCoolDownListener implements Listener {
event.setCancelled(true);
}
if (!event.isCancelled()) {
String msg = BoosConfigManager.getMessage(
final String msg = BoosConfigManager.getMessage(
regexCommad, player);
if (!msg.equals("")) {
BoosChat.sendMessageToPlayer(player, msg);
@ -166,13 +167,13 @@ public class BoosCoolDownListener implements Listener {
event.setCancelled(true);
}
if (!event.isCancelled()) {
List<String> linkGroup = BoosConfigManager.getSharedLimits(
final List<String> linkGroup = BoosConfigManager.getSharedLimits(
regexCommad, player);
if (linkGroup.isEmpty()) {
BoosLimitManager.setUses(player, regexCommad);
} else {
BoosLimitManager.setUses(player, regexCommad);
for (String a : linkGroup) {
for (final String a : linkGroup) {
BoosLimitManager.setUses(player, a);
}
}
@ -180,7 +181,7 @@ public class BoosCoolDownListener implements Listener {
BoosCoolDown.commandLogger(player.getName(), originalCommand);
}
}
for (String key : commandQueue.keySet()) {
for (final String key : commandQueue.keySet()) {
if (key.startsWith(String.valueOf(player.getUniqueId()))) {
commandQueue.remove(key);
}
@ -188,13 +189,13 @@ public class BoosCoolDownListener implements Listener {
}
@EventHandler(priority = EventPriority.HIGHEST)
private void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
Player player = event.getPlayer();
UUID uuid = player.getUniqueId();
private void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent event) {
final Player player = event.getPlayer();
final UUID uuid = player.getUniqueId();
if (BoosConfigManager.getSyntaxBlocker() && !player.isOp() && !player.hasPermission("booscooldowns.syntaxblockerexception")) {
if (event.getMessage().contains(":")) {
Pattern p = Pattern.compile("^/([a-zA-Z0-9_]+):");
Matcher m = p.matcher(event.getMessage());
final Pattern p = Pattern.compile("^/([a-zA-Z0-9_]+):");
final Matcher m = p.matcher(event.getMessage());
if (m.find()) {
{
BoosChat.sendMessageToPlayer(player, BoosConfigManager
@ -206,8 +207,8 @@ public class BoosCoolDownListener implements Listener {
}
}
if (BoosConfigManager.getConfirmCommandEnabled(player)) {
for (String key : commandQueue.keySet()) {
String[] keyList = key.split("@");
for (final String key : commandQueue.keySet()) {
final String[] keyList = key.split("@");
if (keyList[0].equals(String.valueOf(uuid))) {
if (!keyList[1].equals(event.getMessage())) {
commandQueue.remove(key);
@ -225,9 +226,9 @@ public class BoosCoolDownListener implements Listener {
originalCommand = originalCommand.replace("$", "SdollarS");
originalCommand = originalCommand.trim().replaceAll(" +", " ");
String regexCommad = "";
Set<String> aliases = BoosConfigManager.getAliases();
Set<String> commands = BoosConfigManager.getCommands(player);
boolean on;
final Set<String> aliases = BoosConfigManager.getAliases();
final Set<String> commands = BoosConfigManager.getCommands(player);
final boolean on;
String item = "";
String name = "";
List<String> lore = new ArrayList<>();
@ -247,8 +248,8 @@ public class BoosCoolDownListener implements Listener {
event.setMessage(originalCommand);
}
if (on && commands != null) {
for (String group : commands) {
String group2 = group.replace("*", ".*");
for (final String group : commands) {
final String group2 = group.replace("*", ".*");
if (originalCommand.matches("(?i)" + group2)) {
regexCommad = group;
if (BoosConfigManager.getWarmupEnabled()) {
@ -290,8 +291,7 @@ public class BoosCoolDownListener implements Listener {
}
}
if (!BoosConfigManager.getConfirmCommandEnabled(player) || (commandQueue
.keySet()
.contains(uuid + "@" + originalCommand) && commandQueue.get(uuid + "@" + originalCommand))) {
.containsKey(uuid + "@" + originalCommand) && commandQueue.get(uuid + "@" + originalCommand))) {
this.checkRestrictions(event, player, regexCommad, originalCommand,
warmupTime, cooldownTime, price, item, count, name, lore, enchants, limit,
xpPrice, xpRequirement, playerPoints);
@ -333,30 +333,30 @@ public class BoosCoolDownListener implements Listener {
if (count > 0) {
String itemMessage = BoosConfigManager.getItsItemCostMessage();
itemMessage = itemMessage.replace("&itemprice&", "").replace("&itemname&", "");
JSON json = getItemStackJson(2, item, count, name, lore, enchants);
final JSON json = getItemStackJson(2, item, count, name, lore, enchants);
BoosChat.sendMessageToPlayer(player, " " + itemMessage);
json.send(player);
}
if (limit > 0) {
int uses = BoosLimitManager.getUses(player, regexCommad);
final int uses = BoosLimitManager.getUses(player, regexCommad);
String limitMessage = BoosConfigManager.getItsLimitMessage();
limitMessage = limitMessage.replace("&limit&", String.valueOf(limit))
.replace("&uses&", String.valueOf(limit - uses));
BoosChat.sendMessageToPlayer(player, " " + limitMessage);
}
String yesString = BoosConfigManager.getConfirmCommandMessage();
JSONClickAction yesClick = new JSONClickAction.RunCommand(yesString);
JSONHoverAction yesHover = new JSONHoverAction.ShowStringText(BoosConfigManager.getConfirmCommandHint());
JSONComponent yes = new JSONComponent(" " + yesString);
final String yesString = BoosConfigManager.getConfirmCommandMessage();
final JSONClickAction yesClick = new JSONClickAction.RunCommand(yesString);
final JSONHoverAction yesHover = new JSONHoverAction.ShowStringText(BoosConfigManager.getConfirmCommandHint());
final JSONComponent yes = new JSONComponent(" " + yesString);
yes.setColor(JSONColor.GREEN).setBold(true);
yes.setClickAction(yesClick);
yes.setHoverAction(yesHover);
yes.send(player);
String noString = BoosConfigManager.getCancelCommandMessage();
JSONClickAction noClick = new JSONClickAction.RunCommand(noString);
JSONHoverAction noHover = new JSONHoverAction.ShowStringText(BoosConfigManager.getCancelCommandHint());
JSONComponent no = new JSONComponent(" " + noString);
final String noString = BoosConfigManager.getCancelCommandMessage();
final JSONClickAction noClick = new JSONClickAction.RunCommand(noString);
final JSONHoverAction noHover = new JSONHoverAction.ShowStringText(BoosConfigManager.getCancelCommandHint());
final JSONComponent no = new JSONComponent(" " + noString);
no.setColor(JSONColor.RED).setBold(true);
no.setClickAction(noClick);
no.setHoverAction(noHover);
@ -376,11 +376,11 @@ public class BoosCoolDownListener implements Listener {
}
@EventHandler(priority = EventPriority.NORMAL)
private void onPlayerChatEvent(AsyncPlayerChatEvent event) {
private void onPlayerChatEvent(final AsyncPlayerChatEvent event) {
final Player player = event.getPlayer();
UUID uuid = player.getUniqueId();
final UUID uuid = player.getUniqueId();
if (BoosConfigManager.getConfirmCommandEnabled(player)) {
for (String key : commandQueue.keySet()) {
for (final String key : commandQueue.keySet()) {
final String[] keyList = key.split("@");
if (keyList[0].equals(String.valueOf(uuid))) {
if (event.getMessage().equalsIgnoreCase(BoosConfigManager.getConfirmCommandMessage())) {
@ -404,9 +404,10 @@ public class BoosCoolDownListener implements Listener {
}
}
private void start(PlayerCommandPreprocessEvent event, Player player,
String regexCommad, String originalCommand, int warmupTime,
int cooldownTime) {
private void start(
final PlayerCommandPreprocessEvent event, final Player player,
final String regexCommad, final String originalCommand, final int warmupTime,
final int cooldownTime) {
if (!BoosWarmUpManager.checkWarmUpOK(player, regexCommad)) {
if (BoosCoolDownManager.checkCoolDownOK(player, regexCommad,
originalCommand, cooldownTime)) {

View File

@ -14,10 +14,10 @@ import util.BoosChat;
public class BoosEntityDamageListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
private void onEntityDamage(EntityDamageEvent event) {
Entity entity = event.getEntity();
private void onEntityDamage(final EntityDamageEvent event) {
final Entity entity = event.getEntity();
if (entity != null && entity instanceof Player) {
Player player = (Player) entity;
final Player player = (Player) entity;
if (!player.hasPermission("booscooldowns.nocancel.damage")) {
if (BoosWarmUpManager.hasWarmUps(player)) {
BoosChat.sendMessageToPlayer(player, BoosConfigManager

View File

@ -13,17 +13,17 @@ import cz.boosik.boosCooldown.Managers.BoosCoolDownManager;
public class BoosPlayerDeathListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
private void onPlayerDeath(PlayerDeathEvent event) {
Entity entity = event.getEntity();
private void onPlayerDeath(final PlayerDeathEvent event) {
final Entity entity = event.getEntity();
if (entity != null) {
Player player = (Player) entity;
final Player player = (Player) entity;
clearCooldownsOnDeath(player);
clearUsesOnDeath(player);
startCooldownsOnDeath(player);
}
}
private void startCooldownsOnDeath(Player player) {
private void startCooldownsOnDeath(final Player player) {
if (player != null) {
if (BoosConfigManager.getStartCooldownsOnDeath()) {
BoosCoolDownManager.startAllCooldowns(player, "");
@ -31,7 +31,7 @@ public class BoosPlayerDeathListener implements Listener {
}
}
private void clearUsesOnDeath(Player player) {
private void clearUsesOnDeath(final Player player) {
if (player != null
&& player.hasPermission("booscooldowns.clear.uses.death")) {
if (BoosConfigManager.getCleanUsesOnDeath()) {
@ -40,7 +40,7 @@ public class BoosPlayerDeathListener implements Listener {
}
}
private void clearCooldownsOnDeath(Player player) {
private void clearCooldownsOnDeath(final Player player) {
if (player != null
&& player.hasPermission("booscooldowns.clear.cooldowns.death")) {
if (BoosConfigManager.getCleanCooldownsOnDeath()) {

View File

@ -14,10 +14,10 @@ import util.BoosChat;
public class BoosPlayerGameModeChangeListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
private void onPlayerGameModeChange(PlayerGameModeChangeEvent event) {
Entity entity = event.getPlayer();
private void onPlayerGameModeChange(final PlayerGameModeChangeEvent event) {
final Entity entity = event.getPlayer();
if (entity != null) {
Player player = (Player) entity;
final Player player = (Player) entity;
if (!player
.hasPermission("booscooldowns.nocancel.gamemodechange")) {
if (BoosWarmUpManager.hasWarmUps(player)) {

View File

@ -14,10 +14,10 @@ import util.BoosChat;
public class BoosPlayerInteractListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
private void onPlayerInteract(PlayerInteractEvent event) {
Entity entity = event.getPlayer();
private void onPlayerInteract(final PlayerInteractEvent event) {
final Entity entity = event.getPlayer();
if (entity != null) {
Player player = (Player) entity;
final Player player = (Player) entity;
if (!player
.hasPermission("booscooldowns.dontblock.interact")) {
if (BoosWarmUpManager.hasWarmUps(player)) {

View File

@ -14,12 +14,12 @@ public class BoosPlayerMoveListener implements Listener {
private int tempTimer = 0;
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
private void onPlayerMove(PlayerMoveEvent event) {
private void onPlayerMove(final PlayerMoveEvent event) {
if (tempTimer < 10) {
tempTimer = tempTimer + 1;
} else {
Player player = event.getPlayer();
final Player player = event.getPlayer();
if (player != null
&& !player.hasPermission("booscooldowns.nocancel.move")) {
if (BoosWarmUpManager.hasWarmUps(player) && (event.getFrom().getX() != event.getTo().getX() || event.getFrom().getZ() != event

View File

@ -13,8 +13,8 @@ import util.BoosChat;
public class BoosPlayerToggleSneakListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
private void onPlayerToggleSneak(PlayerToggleSneakEvent event) {
Player player = event.getPlayer();
private void onPlayerToggleSneak(final PlayerToggleSneakEvent event) {
final Player player = event.getPlayer();
if (player != null
&& !player.hasPermission("booscooldowns.nocancel.sneak")) {
if (BoosWarmUpManager.hasWarmUps(player)) {

View File

@ -13,8 +13,8 @@ import util.BoosChat;
public class BoosPlayerToggleSprintListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
private void onPlayerToggleSprint(PlayerToggleSprintEvent event) {
Player player = event.getPlayer();
private void onPlayerToggleSprint(final PlayerToggleSprintEvent event) {
final Player player = event.getPlayer();
if (player != null
&& !player.hasPermission("booscooldowns.nocancel.sprint")) {
if (BoosWarmUpManager.hasWarmUps(player)) {

View File

@ -12,10 +12,10 @@ import util.BoosChat;
public class BoosSignChangeListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
private void onSignChange(SignChangeEvent event) {
Player player = event.getPlayer();
String line1 = event.getLine(0);
String line2 = event.getLine(1);
private void onSignChange(final SignChangeEvent event) {
final Player player = event.getPlayer();
final String line1 = event.getLine(0);
final String line2 = event.getLine(1);
if (line1.equals("[boosCooldowns]")) {
if (line2.equals("player")
&& !player

View File

@ -16,12 +16,12 @@ import util.BoosChat;
public class BoosSignInteractListener implements Listener {
private final BoosCoolDown plugin;
public BoosSignInteractListener(BoosCoolDown instance) {
public BoosSignInteractListener(final BoosCoolDown instance) {
plugin = instance;
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
private void onSignInteract(PlayerInteractEvent event) {
private void onSignInteract(final PlayerInteractEvent event) {
String msg;
if (event.isCancelled()) {
return;
@ -49,12 +49,12 @@ public class BoosSignInteractListener implements Listener {
|| event.getClickedBlock().getType() == Material.BIRCH_SIGN
|| event.getClickedBlock().getType() == Material.BIRCH_WALL_SIGN) {
Sign s = (Sign) event.getClickedBlock().getState();
String line1 = s.getLine(0);
String line2 = s.getLine(1);
String line3 = s.getLine(2);
String line4 = s.getLine(3);
Player player = event.getPlayer();
final Sign s = (Sign) event.getClickedBlock().getState();
final String line1 = s.getLine(0);
final String line2 = s.getLine(1);
final String line3 = s.getLine(2);
final String line4 = s.getLine(3);
final Player player = event.getPlayer();
if (line1.equals("[boosCooldowns]")) {
if (line2.equals("player")
&& player

View File

@ -7,8 +7,8 @@ import org.bukkit.entity.Player;
public class BoosAliasManager {
public static String checkCommandAlias(String originalCommand,
Set<String> aliases, Player player) {
String[] splitCommand = originalCommand.split(" ", 4);
final Set<String> aliases, final Player player) {
final String[] splitCommand = originalCommand.split(" ", 4);
String one = "";
String two = "";
String three = "";
@ -21,8 +21,8 @@ public class BoosAliasManager {
}
}
}
for (String alias : aliases) {
String alias2 = alias.replace("*", ".+");
for (final String alias : aliases) {
final String alias2 = alias.replace("*", ".+");
if (originalCommand.matches("(?i)" + alias2)) {
originalCommand = BoosConfigManager.getAlias(alias);
if (originalCommand.contains("$1")) {

View File

@ -25,7 +25,7 @@ public class BoosConfigManager {
private static File confusersFile;
@SuppressWarnings("static-access")
public BoosConfigManager(BoosCoolDown boosCoolDown) {
public BoosConfigManager(final BoosCoolDown boosCoolDown) {
confFile = new File(boosCoolDown.getDataFolder(), "config.yml");
if (confFile.exists()) {
conf = new YamlConfiguration();
@ -44,7 +44,7 @@ public class BoosConfigManager {
} else {
try {
confusersFile.createNewFile();
} catch (IOException e) {
} catch (final IOException e) {
e.printStackTrace();
BoosCoolDown.getLog().severe("[boosCooldowns] Could not save storage file!");
}
@ -52,22 +52,22 @@ public class BoosConfigManager {
}
public static void clear() {
ConfigurationSection userSection = confusers.getConfigurationSection("users");
final ConfigurationSection userSection = confusers.getConfigurationSection("users");
if (userSection == null) {
return;
}
for (String user : userSection.getKeys(false)) {
ConfigurationSection cooldown = confusers.getConfigurationSection("users." + user + ".cooldown");
for (final String user : userSection.getKeys(false)) {
final ConfigurationSection cooldown = confusers.getConfigurationSection("users." + user + ".cooldown");
if (cooldown != null) {
for (String key : cooldown.getKeys(false)) {
for (final String key : cooldown.getKeys(false)) {
confusers.set("users." + user + ".cooldown." + key, null);
}
}
confusers.set("users." + user + ".cooldown", null);
ConfigurationSection warmup = confusers.getConfigurationSection("users." + user + ".warmup");
final ConfigurationSection warmup = confusers.getConfigurationSection("users." + user + ".warmup");
if (warmup != null) {
for (String key : warmup.getKeys(false)) {
for (final String key : warmup.getKeys(false)) {
confusers.set("users." + user + ".warmup." + key, null);
}
}
@ -79,8 +79,8 @@ public class BoosConfigManager {
loadConfusers();
}
public static void clearSomething(String co, UUID uuid) {
ConfigurationSection userSection = confusers.getConfigurationSection("users." + uuid + "." + co);
public static void clearSomething(final String co, final UUID uuid) {
final ConfigurationSection userSection = confusers.getConfigurationSection("users." + uuid + "." + co);
if (userSection == null) {
return;
}
@ -89,20 +89,20 @@ public class BoosConfigManager {
loadConfusers();
}
public static void clearSomething(String co, UUID uuid, String command) {
int pre2 = command.toLowerCase().hashCode();
public static void clearSomething(final String co, final UUID uuid, final String command) {
final int pre2 = command.toLowerCase().hashCode();
confusers.set("users." + uuid + "." + co + "." + pre2, 0);
saveConfusers();
loadConfusers();
}
static String getAlias(String message) {
static String getAlias(final String message) {
return conf.getString("commands.aliases." + message);
}
public static Set<String> getAliases() {
Set<String> aliases = null;
ConfigurationSection aliasesSection = conf.getConfigurationSection("commands.aliases");
final ConfigurationSection aliasesSection = conf.getConfigurationSection("commands.aliases");
if (aliasesSection != null) {
aliases = conf.getConfigurationSection("commands.aliases").getKeys(false);
}
@ -166,15 +166,15 @@ public class BoosConfigManager {
return conf.getBoolean("options.options.clear_on_restart", false);
}
static String getCommandBlockedMessage() {
public static String getCommandBlockedMessage() {
return conf.getString("options.messages.limit_achieved", "&6You cannot use this command anymore!&f");
}
private static String getCommandGroup(Player player) {
private static String getCommandGroup(final Player player) {
String cmdGroup = "default";
Set<String> groups = getCommandGroups();
final Set<String> groups = getCommandGroups();
if (groups != null) {
for (String group : groups) {
for (final String group : groups) {
if (player.hasPermission("booscooldowns." + group)) {
cmdGroup = group;
}
@ -184,7 +184,7 @@ public class BoosConfigManager {
}
private static Set<String> getCommandGroups() {
ConfigurationSection groupsSection = conf.getConfigurationSection("commands.groups");
final ConfigurationSection groupsSection = conf.getConfigurationSection("commands.groups");
Set<String> groups = null;
if (groupsSection != null) {
groups = groupsSection.getKeys(false);
@ -196,10 +196,10 @@ public class BoosConfigManager {
return conf.getBoolean("options.options.command_logging", false);
}
public static Set<String> getCommands(Player player) {
String group = getCommandGroup(player);
public static Set<String> getCommands(final Player player) {
final String group = getCommandGroup(player);
Set<String> commands = null;
ConfigurationSection commandsSection = conf.getConfigurationSection("commands.groups." + group);
final ConfigurationSection commandsSection = conf.getConfigurationSection("commands.groups." + group);
if (commandsSection != null) {
commands = commandsSection.getKeys(false);
}
@ -210,10 +210,10 @@ public class BoosConfigManager {
return confusers;
}
public static int getCoolDown(String regexCommand, Player player) {
int coolDown;
public static int getCoolDown(final String regexCommand, final Player player) {
final int coolDown;
String coolDownString = "";
String group = getCommandGroup(player);
final String group = getCommandGroup(player);
coolDownString = conf.getString("commands.groups." + group + "." + regexCommand + ".cooldown", "0");
coolDown = parseTime(coolDownString);
return coolDown;
@ -227,8 +227,8 @@ public class BoosConfigManager {
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);
static Set<String> getCooldowns(final Player player) {
final String cool = getCommandGroup(player);
return conf.getConfigurationSection("commands.groups." + cool).getKeys(false);
}
@ -241,29 +241,29 @@ public class BoosConfigManager {
return conf.getString("options.messages.interact_blocked_during_warmup", "&6You can't do this when command is warming-up!&f");
}
public static List<String> getItemCostLore(String regexCommand, Player player) {
public static List<String> getItemCostLore(final String regexCommand, final Player player) {
return conf.getStringList("commands.groups." + getCommandGroup(player) + "." + regexCommand + ".itemcost.lore");
}
public static List<String> getItemCostEnchants(String regexCommand, Player player) {
public static List<String> getItemCostEnchants(final String regexCommand, final Player player) {
return conf.getStringList("commands.groups." + getCommandGroup(player) + "." + regexCommand + ".itemcost.enchants");
}
public static String getItemCostName(String regexCommand, Player player) {
public static String getItemCostName(final String regexCommand, final Player player) {
return conf.getString("commands.groups." + getCommandGroup(player) + "." + regexCommand + ".itemcost.name", "");
}
public static String getItemCostItem(String regexCommand, Player player) {
public static String getItemCostItem(final String regexCommand, final Player player) {
return conf.getString("commands.groups." + getCommandGroup(player) + "." + regexCommand + ".itemcost.item", "");
}
public static int getItemCostCount(String regexCommand, Player player) {
public static int getItemCostCount(final String regexCommand, final Player player) {
return conf.getInt("commands.groups." + getCommandGroup(player) + "." + regexCommand + ".itemcost.count", 0);
}
public static int getLimit(String regexCommand, Player player) {
int limit;
String group = getCommandGroup(player);
public static int getLimit(final String regexCommand, final Player player) {
final int limit;
final String group = getCommandGroup(player);
limit = conf.getInt("commands.groups." + group + "." + regexCommand + ".limit", -1);
return limit;
}
@ -282,27 +282,27 @@ public class BoosConfigManager {
}
static Set<String> getAllPlayers() {
ConfigurationSection users = confusers.getConfigurationSection("users");
final ConfigurationSection users = confusers.getConfigurationSection("users");
return users.getKeys(false);
}
static List<String> getSharedCooldowns(String pre, Player player) {
List<String> sharedCooldowns;
String group = getCommandGroup(player);
static List<String> getSharedCooldowns(final String pre, final Player player) {
final List<String> sharedCooldowns;
final String group = getCommandGroup(player);
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);
public static List<String> getSharedLimits(final String pre, final Player player) {
final List<String> sharedLimits;
final String group = getCommandGroup(player);
sharedLimits = conf.getStringList("commands.groups." + group + "." + pre + ".shared_limit");
return sharedLimits;
}
public static String getMessage(String regexCommand, Player player) {
public static String getMessage(final String regexCommand, final Player player) {
String message = "";
String group = getCommandGroup(player);
final String group = getCommandGroup(player);
message = conf.getString("commands.groups." + group + "." + regexCommand + ".message", "");
return message;
}
@ -315,8 +315,8 @@ public class BoosConfigManager {
return conf.getString("options.messages.paid_for_command", "Price of &command& was %s and you now have %s");
}
static List<String> getPotionEffects(String regexCommand, Player player) {
String group = getCommandGroup(player);
static List<String> getPotionEffects(final String regexCommand, final Player player) {
final String group = getCommandGroup(player);
return conf.getStringList("commands.groups." + group + "." + regexCommand + ".potion");
}
@ -324,9 +324,9 @@ public class BoosConfigManager {
return conf.getBoolean("options.options.cancel_potions_on_warmup_cancel", false);
}
public static double getPrice(String regexCommand, Player player) {
double price;
String group = getCommandGroup(player);
public static double getPrice(final String regexCommand, final Player player) {
final double price;
final String group = getCommandGroup(player);
price = conf.getDouble("commands.groups." + group + "." + regexCommand + ".price", 0.0);
return price;
}
@ -359,10 +359,10 @@ public class BoosConfigManager {
return conf.getString("options.units.seconds", "seconds");
}
public static int getWarmUp(String regexCommand, Player player) {
int warmUp;
public static int getWarmUp(final String regexCommand, final Player player) {
final int warmUp;
String warmUpString = "";
String group = getCommandGroup(player);
final String group = getCommandGroup(player);
warmUpString = conf.getString("commands.groups." + group + "." + regexCommand + ".warmup", "0");
warmUp = parseTime(warmUpString);
return warmUp;
@ -391,13 +391,13 @@ public class BoosConfigManager {
public static void load() {
try {
conf.load(confFile);
} catch (FileNotFoundException e) {
} catch (final FileNotFoundException e) {
e.printStackTrace();
BoosCoolDown.getLog().severe("[boosCooldowns] Configuration file not found!");
} catch (IOException e) {
} catch (final IOException e) {
e.printStackTrace();
BoosCoolDown.getLog().severe("[boosCooldowns] Could not read configuration file!");
} catch (InvalidConfigurationException e) {
} catch (final InvalidConfigurationException e) {
e.printStackTrace();
BoosCoolDown.getLog().severe("[boosCooldowns] Configuration file is invalid!");
}
@ -406,13 +406,13 @@ public class BoosConfigManager {
public static void loadConfusers() {
try {
confusers.load(confusersFile);
} catch (FileNotFoundException e) {
} catch (final FileNotFoundException e) {
e.printStackTrace();
BoosCoolDown.getLog().severe("[boosCooldowns] Storage file not found!");
} catch (IOException e) {
} catch (final IOException e) {
e.printStackTrace();
BoosCoolDown.getLog().severe("[boosCooldowns] Could not read storage file!");
} catch (InvalidConfigurationException e) {
} catch (final InvalidConfigurationException e) {
e.printStackTrace();
BoosCoolDown.getLog().severe("[boosCooldowns] Storage file is invalid!");
}
@ -427,35 +427,35 @@ public class BoosConfigManager {
try {
confFile.createNewFile();
confusers.save(confusersFile);
} catch (IOException e) {
} catch (final IOException e) {
e.printStackTrace();
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, final String what, final String value) {
group = group.toLowerCase();
command = command.toLowerCase();
int value2;
final int value2;
try {
value2 = Integer.parseInt(value);
reload();
conf.set("commands.groups." + group + "." + command + "." + what, value2);
} catch (NumberFormatException e1) {
} catch (final NumberFormatException e1) {
reload();
conf.set("commands.groups." + group + "." + command + "." + what, value);
}
try {
conf.save(confFile);
} catch (IOException e) {
} catch (final IOException e) {
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));
public static void toggleConfirmations(final Player player) {
final 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());
@ -466,7 +466,7 @@ public class BoosConfigManager {
loadConfusers();
}
public static Boolean getConfirmationsPlayer(Player player) {
public static Boolean getConfirmationsPlayer(final Player player) {
return (Boolean) confusers.get("users." + player.getUniqueId() + ".confirmations", null);
}
@ -479,7 +479,7 @@ public class BoosConfigManager {
}
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");
}
public static boolean getItemCostEnabled() {
@ -490,9 +490,9 @@ public class BoosConfigManager {
return conf.getBoolean("options.options.player_points_prices_enabled", true);
}
public static int getPlayerPointsPrice(String regexCommand, Player player) {
int price;
String group = getCommandGroup(player);
public static int getPlayerPointsPrice(final String regexCommand, final Player player) {
final int price;
final String group = getCommandGroup(player);
price = conf.getInt("commands.groups." + group + "." + regexCommand + ".playerpoints", 0);
return price;
}
@ -501,16 +501,16 @@ public class BoosConfigManager {
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);
public static int getXpPrice(final String regexCommand, final Player player) {
final int price;
final String group = getCommandGroup(player);
price = conf.getInt("commands.groups." + group + "." + regexCommand + ".xpcost", 0);
return price;
}
public static int getXpRequirement(String regexCommand, Player player) {
int price;
String group = getCommandGroup(player);
public static int getXpRequirement(final String regexCommand, final Player player) {
final int price;
final String group = getCommandGroup(player);
price = conf.getInt("commands.groups." + group + "." + regexCommand + ".xprequirement", 0);
return price;
}
@ -535,10 +535,10 @@ public class BoosConfigManager {
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;
static long getLimitResetDelay(final String regexCommand, final Player player) {
final long limitreset;
String limitResetString = "";
String group = getCommandGroup(player);
final String group = getCommandGroup(player);
limitResetString = conf.getString("commands.groups." + group + "." + regexCommand + ".limit_reset_delay", "0");
limitreset = parseTime(limitResetString);
return limitreset;
@ -549,11 +549,11 @@ public class BoosConfigManager {
"&6Wait&e &seconds& &unit&&6 before your limit for command&e &command& &6is reset.&f");
}
static void clearSomething2(String co, String uuid, int hashedCommand) {
static void clearSomething2(final String co, final String uuid, final int hashedCommand) {
confusers.set("users." + uuid + "." + co + "." + hashedCommand, 0);
}
public static long getLimitResetDelayGlobal(String command) {
public static long getLimitResetDelayGlobal(final String command) {
long delay = 0;
String delayString = "";
delayString = conf.getString("global." + command + ".limit_reset_delay", "0");
@ -565,15 +565,15 @@ public class BoosConfigManager {
return conf.getConfigurationSection("global").getKeys(false);
}
private static int parseTime(String time) {
String[] timeString = time.split(" ", 2);
private static int parseTime(final String time) {
final String[] timeString = time.split(" ", 2);
if (timeString[0].equals("cancel")) {
return -65535;
}
int timeNumber = Integer.valueOf(timeString[0]);
final int timeNumber = Integer.valueOf(timeString[0]);
int timeMultiplier = 1;
if (timeString.length > 1) {
String timeUnit = timeString[1];
final String timeUnit = timeString[1];
switch (timeUnit) {
case "minute":
case "minutes":
@ -607,13 +607,13 @@ public class BoosConfigManager {
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);
public static String getPermission(final Player player, final String regexCommad) {
final String group = getCommandGroup(player);
return conf.getString("commands.groups." + group + "." + regexCommad + ".permission");
}
public static String getPermissionMessage(Player player, String regexCommad) {
String group = getCommandGroup(player);
public static String getPermissionMessage(final Player player, final String regexCommad) {
final String group = getCommandGroup(player);
return conf.getString("commands.groups." + group + "." + regexCommad + ".denied_message");
}
@ -674,8 +674,8 @@ public class BoosConfigManager {
return conf.getBoolean("options.options.syntax_blocker_enabled", true);
}
public static boolean getConfirmCommandEnabled(Player player) {
Boolean playersChoice = getConfirmationsPlayer(player);
public static boolean getConfirmCommandEnabled(final Player player) {
final Boolean playersChoice = getConfirmationsPlayer(player);
if (playersChoice != null) {
return playersChoice;
} else {

View File

@ -12,68 +12,66 @@ import util.BoosChat;
public class BoosCoolDownManager {
static void cancelCooldown(Player player, String regexCommand) {
int pre2 = regexCommand.toLowerCase().hashCode();
static void cancelCooldown(final Player player, final String regexCommand) {
final int pre2 = regexCommand.toLowerCase().hashCode();
BoosConfigManager.getConfusers().set(
"users." + player.getUniqueId() + ".cooldown." + pre2, null);
}
public static boolean isCoolingdown(Player player, String regexCommand, int time) {
Date lastTime = getTime(player, regexCommand);
public static boolean isCoolingdown(final Player player, final String regexCommand, final int time) {
final Date lastTime = getTime(player, regexCommand);
if (lastTime == null) {
return false;
}
Calendar calcurrTime = Calendar.getInstance();
final Calendar calcurrTime = Calendar.getInstance();
calcurrTime.setTime(getCurrTime());
Calendar callastTime = Calendar.getInstance();
final Calendar callastTime = Calendar.getInstance();
callastTime.setTime(lastTime);
long secondsBetween = secondsBetween(callastTime, calcurrTime);
if ((secondsBetween > time) || secondsBetween == 0) {
return false;
}
return true;
final long secondsBetween = secondsBetween(callastTime, calcurrTime);
return (secondsBetween <= time) && secondsBetween != 0;
}
private static boolean cd(Player player, String regexCommand,
String originalCommand, int coolDownSeconds) {
Date lastTime = getTime(player, regexCommand);
List<String> linkGroup = BoosConfigManager.getSharedCooldowns(
private static boolean cd(
final Player player, final String regexCommand,
final String originalCommand, final int coolDownSeconds) {
final Date lastTime = getTime(player, regexCommand);
final List<String> linkGroup = BoosConfigManager.getSharedCooldowns(
regexCommand, player);
if (lastTime == null) {
if (linkGroup.isEmpty()) {
setTime(player, regexCommand);
} else {
setTime(player, regexCommand);
for (String a : linkGroup) {
for (final String a : linkGroup) {
setTime(player, a);
}
}
return false;
} else {
Calendar calcurrTime = Calendar.getInstance();
final Calendar calcurrTime = Calendar.getInstance();
calcurrTime.setTime(getCurrTime());
Calendar callastTime = Calendar.getInstance();
final Calendar callastTime = Calendar.getInstance();
callastTime.setTime(lastTime);
long secondsBetween = secondsBetween(callastTime, calcurrTime);
final long secondsBetween = secondsBetween(callastTime, calcurrTime);
long waitSeconds = coolDownSeconds - secondsBetween;
long waitMinutes = (long) Math.floor(waitSeconds / 60.0);
long waitHours = (long) Math.floor(waitMinutes / 60.0);
final long waitHours = (long) Math.floor(waitMinutes / 60.0);
if (secondsBetween > coolDownSeconds) {
if (linkGroup.isEmpty()) {
setTime(player, regexCommand);
} else {
setTime(player, regexCommand);
for (String a : linkGroup) {
for (final String a : linkGroup) {
setTime(player, a);
}
}
return false;
} else {
String msg = BoosConfigManager.getCoolDownMessage();
StringBuilder stringBuilder = new StringBuilder();
final StringBuilder stringBuilder = new StringBuilder();
msg = msg.replaceAll("&command&", originalCommand);
if (waitSeconds >= 3600) {
stringBuilder.append(Long.toString(waitHours));
stringBuilder.append(waitHours);
stringBuilder.append(" ");
stringBuilder.append(BoosConfigManager.getUnitHoursMessage());
stringBuilder.append(", ");
@ -81,7 +79,7 @@ public class BoosCoolDownManager {
}
if (waitSeconds >= 60) {
waitMinutes = waitMinutes - (waitHours * 60);
stringBuilder.append(Long.toString(waitMinutes));
stringBuilder.append(waitMinutes);
stringBuilder.append(" ");
stringBuilder.append(BoosConfigManager.getUnitMinutesMessage());
stringBuilder.append(", ");
@ -105,8 +103,9 @@ public class BoosCoolDownManager {
}
}
public static boolean coolDown(Player player, String regexCommand,
String originalCommand, int time) {
public static boolean coolDown(
final Player player, String regexCommand,
final String originalCommand, final int time) {
regexCommand = regexCommand.toLowerCase();
return time > 0 && !player.hasPermission("booscooldowns.nocooldown") && !player.hasPermission("booscooldowns.nocooldown." + originalCommand) && cd(
player,
@ -117,63 +116,64 @@ public class BoosCoolDownManager {
private static Date getCurrTime() {
String currTime = "";
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
final Calendar cal = Calendar.getInstance();
final SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
currTime = sdf.format(cal.getTime());
Date time = null;
try {
time = sdf.parse(currTime);
return time;
} catch (ParseException e) {
} catch (final ParseException e) {
return null;
}
}
private static Date getTime(Player player, String regexCommand) {
int pre2 = regexCommand.toLowerCase().hashCode();
private static Date getTime(final Player player, final String regexCommand) {
final int pre2 = regexCommand.toLowerCase().hashCode();
String confTime = "";
confTime = BoosConfigManager.getConfusers().getString(
"users." + player.getUniqueId() + ".cooldown." + pre2, null);
if (confTime != null && !confTime.equals("")) {
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
final SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
Date lastDate = null;
try {
lastDate = sdf.parse(confTime);
return lastDate;
} catch (ParseException e) {
} catch (final ParseException e) {
return null;
}
}
return null;
}
public static boolean checkCoolDownOK(Player player, String regexCommand,
String originalCommand, int time) {
public static boolean checkCoolDownOK(
final Player player, String regexCommand,
final String originalCommand, final int time) {
regexCommand = regexCommand.toLowerCase();
if (time > 0) {
Date lastTime = getTime(player, regexCommand);
final Date lastTime = getTime(player, regexCommand);
if (lastTime == null) {
return true;
} else {
Calendar calcurrTime = Calendar.getInstance();
final Calendar calcurrTime = Calendar.getInstance();
calcurrTime.setTime(getCurrTime());
Calendar callastTime = Calendar.getInstance();
final Calendar callastTime = Calendar.getInstance();
callastTime.setTime(lastTime);
long secondsBetween = secondsBetween(callastTime, calcurrTime);
final long secondsBetween = secondsBetween(callastTime, calcurrTime);
long waitSeconds = time - secondsBetween;
long waitMinutes = (long) Math.floor(waitSeconds / 60.0);
long waitHours = (long) Math.floor(waitMinutes / 60.0);
final long waitHours = (long) Math.floor(waitMinutes / 60.0);
if (secondsBetween > time) {
return true;
} else {
String msg = BoosConfigManager.getCoolDownMessage();
StringBuilder stringBuilder = new StringBuilder();
final StringBuilder stringBuilder = new StringBuilder();
msg = msg.replaceAll("&command&", originalCommand);
if (waitSeconds >= 3600) {
stringBuilder.append(Long.toString(waitHours));
stringBuilder.append(waitHours);
stringBuilder.append(" ");
stringBuilder.append(BoosConfigManager.getUnitHoursMessage());
stringBuilder.append(", ");
@ -181,7 +181,7 @@ public class BoosCoolDownManager {
}
if (waitSeconds >= 60) {
waitMinutes = waitMinutes - (waitHours * 60);
stringBuilder.append(Long.toString(waitMinutes));
stringBuilder.append(waitMinutes);
stringBuilder.append(" ");
stringBuilder.append(BoosConfigManager.getUnitMinutesMessage());
stringBuilder.append(", ");
@ -207,27 +207,27 @@ public class BoosCoolDownManager {
return true;
}
private static long secondsBetween(Calendar startDate, Calendar endDate) {
private static long secondsBetween(final Calendar startDate, final Calendar endDate) {
long secondsBetween = 0;
secondsBetween = (endDate.getTimeInMillis() - startDate
.getTimeInMillis()) / 1000;
return secondsBetween;
}
private static void setTime(Player player, String regexCommand) {
int pre2 = regexCommand.toLowerCase().hashCode();
private static void setTime(final Player player, final String regexCommand) {
final int pre2 = regexCommand.toLowerCase().hashCode();
String currTime = "";
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
final Calendar cal = Calendar.getInstance();
final SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
currTime = sdf.format(cal.getTime());
BoosConfigManager.getConfusers()
.set("users." + player.getUniqueId() + ".cooldown." + pre2,
currTime);
}
public static void startAllCooldowns(Player player, String message) {
for (String a : BoosConfigManager.getCooldowns(player)) {
int cooldownTime = BoosConfigManager.getCoolDown(a, player);
public static void startAllCooldowns(final Player player, final String message) {
for (final String a : BoosConfigManager.getCooldowns(player)) {
final int cooldownTime = BoosConfigManager.getCoolDown(a, player);
coolDown(player, a, message, cooldownTime);
}

View File

@ -18,13 +18,14 @@ import util.BoosChat;
public class BoosItemCostManager {
private static boolean payItemForCommand(Player player,
String originalCommand, String item, int count, String name, List<String> lore, List<String> enchants) {
private static boolean payItemForCommand(
final Player player,
final String originalCommand, final String item, final int count, final String name, final List<String> lore, final List<String> enchants) {
ItemStack itemStack = createItemStack(item, count, name, lore, enchants);
ItemStack itemStackSingle = createItemStack(item, 1, name, lore, enchants);
final ItemStack itemStack = createItemStack(item, count, name, lore, enchants);
final ItemStack itemStackSingle = createItemStack(item, 1, name, lore, enchants);
Inventory inventory = player.getInventory();
final Inventory inventory = player.getInventory();
Boolean trans = false;
if (inventory.containsAtLeast(itemStackSingle, count)) {
inventory.removeItem(itemStack);
@ -33,7 +34,7 @@ public class BoosItemCostManager {
if (trans) {
String msg = String.format(
BoosConfigManager.getPaidItemsForCommandMessage(), "");
JSON json = getItemStackJson(1, item, count, name, lore, enchants);
final JSON json = getItemStackJson(1, item, count, name, lore, enchants);
msg = msg.replaceAll("&command&", originalCommand);
BoosChat.sendMessageToPlayer(player, msg);
json.send(player);
@ -43,9 +44,10 @@ public class BoosItemCostManager {
}
}
public static void payItemForCommand(PlayerCommandPreprocessEvent event,
Player player, String regexCommand, String originalCommand,
String item, int count, String name, List<String> lore, List<String> enchants) {
public static void payItemForCommand(
final PlayerCommandPreprocessEvent event,
final Player player, final String regexCommand, final String originalCommand,
final String item, final int count, final String name, final List<String> lore, final List<String> enchants) {
if (count > 0) {
if (!player.hasPermission("booscooldowns.noitemcost")
&& !player.hasPermission("booscooldowns.noitemcost."
@ -59,21 +61,21 @@ public class BoosItemCostManager {
}
}
public static boolean has(Player player, String item, int count, String name, List<String> lore, List<String> enchants) {
public static boolean has(final Player player, final String item, final int count, final String name, final List<String> lore, final List<String> enchants) {
if (item.equals("")) {
return true;
}
if (count <= 0) {
return true;
}
ItemStack itemStack = createItemStack(item, 1, name, lore, enchants);
Inventory inventory = player.getInventory();
final ItemStack itemStack = createItemStack(item, 1, name, lore, enchants);
final Inventory inventory = player.getInventory();
return inventory.containsAtLeast(itemStack, count);
}
public static ItemStack createItemStack(String item, int count, String name, List<String> lore, List<String> enchants) {
ItemStack itemStack = new ItemStack(Material.getMaterial(item), count);
ItemMeta itemMeta = itemStack.getItemMeta();
public static ItemStack createItemStack(final String item, final int count, final String name, final List<String> lore, final List<String> enchants) {
final ItemStack itemStack = new ItemStack(Material.getMaterial(item), count);
final ItemMeta itemMeta = itemStack.getItemMeta();
if (name != null) {
itemMeta.setDisplayName(name);
}
@ -81,9 +83,9 @@ public class BoosItemCostManager {
itemMeta.setLore(lore);
}
if (!enchants.isEmpty()) {
for (String enchantString : enchants) {
String[] enchantArray = enchantString.split(",");
Enchantment enchant = Enchantment.getByName(enchantArray[0]);
for (final String enchantString : enchants) {
final String[] enchantArray = enchantString.split(",");
final Enchantment enchant = Enchantment.getByName(enchantArray[0]);
itemMeta.addEnchant(enchant, Integer.valueOf(enchantArray[1]), true);
}
}
@ -91,8 +93,8 @@ public class BoosItemCostManager {
return itemStack;
}
public static JSON getItemStackJson(int indent, String item, int count, String name, List<String> lore, List<String> enchants) {
ItemStack itemStack = createItemStack(item, count, name, lore, enchants);
public static JSON getItemStackJson(final int indent, final String item, final int count, final String name, final List<String> lore, final List<String> enchants) {
final ItemStack itemStack = createItemStack(item, count, name, lore, enchants);
JSONColor itemColor;
if (itemStack.getItemMeta().hasEnchants()) {
itemColor = JSONColor.fromString("&b");
@ -104,17 +106,17 @@ public class BoosItemCostManager {
for (int i = 0; i < indent; i++) {
indentation += " ";
}
JSONComponent comp1 = new JSONComponent(indentation);
JSONComponent comp2 = new JSONComponent(String.valueOf(count) + "x ");
final JSONComponent comp1 = new JSONComponent(indentation);
final JSONComponent comp2 = new JSONComponent(count + "x ");
comp2.setColor(JSONColor.YELLOW);
JSONComponent comp3 = new JSONComponent("[");
final JSONComponent comp3 = new JSONComponent("[");
comp3.setColor(itemColor);
JSONComponent comp4 = new JSONComponent(name == null || name.equals("") ? toTitleCase(itemStack
final JSONComponent comp4 = new JSONComponent(name == null || name.equals("") ? toTitleCase(itemStack
.getType()
.toString()
.toLowerCase()) : name);
comp4.setColor(itemColor);
JSONComponent comp5 = new JSONComponent("]");
final JSONComponent comp5 = new JSONComponent("]");
comp5.setColor(itemColor);
comp3.setHoverAction(new JSONHoverAction.ShowItemStack(itemStack));
comp4.setHoverAction(new JSONHoverAction.ShowItemStack(itemStack));
@ -122,12 +124,12 @@ public class BoosItemCostManager {
return new JSON(comp1, comp2, comp3, comp4, comp5);
}
public static String toTitleCase(String givenString) {
public static String toTitleCase(final String givenString) {
if (givenString == null || "".equals(givenString)) {
return "";
}
String[] arr = givenString.split(" ");
StringBuffer sb = new StringBuffer();
final String[] arr = givenString.split(" ");
final StringBuffer sb = new StringBuffer();
for (int i = 0; i < arr.length; i++) {
sb.append(Character.toUpperCase(arr[i].charAt(0)))

View File

@ -13,18 +13,19 @@ import util.BoosChat;
public class BoosLimitManager {
public static boolean blocked(Player player, String regexCommand,
String originalCommand, int limit) {
public static boolean blocked(
final Player player, final String regexCommand,
final String originalCommand, final int limit) {
Date time = getTime(player, regexCommand);
Date confTime = getTime(regexCommand);
Calendar calcurrTime = Calendar.getInstance();
final Date confTime = getTime(regexCommand);
final Calendar calcurrTime = Calendar.getInstance();
calcurrTime.setTime(getCurrTime());
Calendar callastTime = Calendar.getInstance();
Calendar callastTimeGlobal = Calendar.getInstance();
final Calendar callastTime = Calendar.getInstance();
final Calendar callastTimeGlobal = Calendar.getInstance();
int uses = getUses(player, regexCommand);
long limitResetDelay = BoosConfigManager.getLimitResetDelay(
final long limitResetDelay = BoosConfigManager.getLimitResetDelay(
regexCommand, player);
long limitResetDelayGlobal = BoosConfigManager
final long limitResetDelayGlobal = BoosConfigManager
.getLimitResetDelayGlobal(regexCommand);
if (time != null) {
callastTime.setTime(time);
@ -53,10 +54,10 @@ public class BoosLimitManager {
return false;
} else if (limit <= uses) {
if (limitResetDelay > 0) {
long waitSeconds = secondsBetween(callastTime,
final long waitSeconds = secondsBetween(callastTime,
calcurrTime, limitResetDelay);
long waitMinutes = Math.round(waitSeconds / 60) + 1;
long waitHours = Math.round(waitMinutes / 60) + 1;
final long waitMinutes = Math.round(waitSeconds / 60) + 1;
final long waitHours = Math.round(waitMinutes / 60) + 1;
String msg = BoosConfigManager.getLimitResetMessage();
msg = msg.replaceAll("&command&", originalCommand);
if (waitSeconds >= 60 && 3600 >= waitSeconds) {
@ -79,10 +80,10 @@ public class BoosLimitManager {
} else if (limitResetDelayGlobal > 0) {
if (confTime != null) {
callastTimeGlobal.setTime(confTime);
long waitSeconds = secondsBetween(callastTimeGlobal,
final long waitSeconds = secondsBetween(callastTimeGlobal,
calcurrTime, limitResetDelayGlobal);
long waitMinutes = (long) Math.ceil(waitSeconds / 60.0);
long waitHours = (long) Math.ceil(waitMinutes / 60.0);
final long waitMinutes = (long) Math.ceil(waitSeconds / 60.0);
final long waitHours = (long) Math.ceil(waitMinutes / 60.0);
String msg = BoosConfigManager.getLimitResetMessage();
msg = msg.replaceAll("&command&", originalCommand);
if (waitSeconds >= 60 && 3600 >= waitSeconds) {
@ -104,7 +105,7 @@ public class BoosLimitManager {
BoosChat.sendMessageToPlayer(player, msg);
}
} else {
String msg = String.format(BoosConfigManager
final String msg = String.format(BoosConfigManager
.getCommandBlockedMessage());
BoosChat.sendMessageToPlayer(player, msg);
}
@ -114,8 +115,8 @@ public class BoosLimitManager {
return false;
}
public static int getUses(Player player, String regexCommand) {
int regexCommand2 = regexCommand.toLowerCase().hashCode();
public static int getUses(final Player player, final String regexCommand) {
final int regexCommand2 = regexCommand.toLowerCase().hashCode();
int uses = 0;
uses = BoosConfigManager.getConfusers().getInt(
"users." + player.getUniqueId() + ".uses." + regexCommand2,
@ -123,17 +124,17 @@ public class BoosLimitManager {
return uses;
}
public static void setUses(Player player, String regexCommand) {
public static void setUses(final Player player, final String regexCommand) {
if (BoosConfigManager.getLimitsEnabled()) {
if (BoosConfigManager.getCommands(player).contains(regexCommand)) {
int regexCommand2 = regexCommand.toLowerCase().hashCode();
final int regexCommand2 = regexCommand.toLowerCase().hashCode();
int uses = getUses(player, regexCommand);
uses = uses + 1;
try {
BoosConfigManager.getConfusers().set(
"users." + player.getUniqueId() + ".uses."
+ regexCommand2, uses);
} catch (IllegalArgumentException e) {
} catch (final IllegalArgumentException e) {
BoosCoolDown
.getLog()
.warning(
@ -145,9 +146,9 @@ public class BoosLimitManager {
}
}
public static void getLimitListMessages(Player send, String comm, int lim) {
public static void getLimitListMessages(final Player send, final String comm, final int lim) {
if (lim != -1) {
int uses = getUses(send, comm);
final int uses = getUses(send, comm);
String message = BoosConfigManager.getLimitListMessage();
int num = lim - uses;
if (num < 0) {
@ -163,80 +164,81 @@ public class BoosLimitManager {
private static Date getCurrTime() {
String currTime = "";
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
final Calendar cal = Calendar.getInstance();
final SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
currTime = sdf.format(cal.getTime());
Date time = null;
try {
time = sdf.parse(currTime);
return time;
} catch (ParseException e) {
} catch (final ParseException e) {
return null;
}
}
private static Date getTime(Player player, String regexCommand) {
int pre2 = regexCommand.toLowerCase().hashCode();
private static Date getTime(final Player player, final String regexCommand) {
final int pre2 = regexCommand.toLowerCase().hashCode();
String confTime = "";
confTime = BoosConfigManager.getConfusers().getString(
"users." + player.getUniqueId() + ".lastused." + pre2, null);
if (confTime != null && !confTime.equals("")) {
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
final SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
Date lastDate = null;
try {
lastDate = sdf.parse(confTime);
return lastDate;
} catch (ParseException e) {
} catch (final ParseException e) {
return null;
}
}
return null;
}
private static Date getTime(String regexCommand) {
private static Date getTime(final String regexCommand) {
String confTime = "";
confTime = BoosConfigManager.getConfusers().getString(
"global." + regexCommand + ".reset", null);
if (confTime != null && !confTime.equals("")) {
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
final SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
Date lastDate = null;
try {
lastDate = sdf.parse(confTime);
return lastDate;
} catch (ParseException e) {
} catch (final ParseException e) {
return null;
}
}
return null;
}
private static void setTime(Player player, String regexCommand) {
int pre2 = regexCommand.toLowerCase().hashCode();
private static void setTime(final Player player, final String regexCommand) {
final int pre2 = regexCommand.toLowerCase().hashCode();
String currTime = "";
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
final Calendar cal = Calendar.getInstance();
final SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
currTime = sdf.format(cal.getTime());
BoosConfigManager.getConfusers()
.set("users." + player.getUniqueId() + ".lastused." + pre2,
currTime);
}
private static long secondsBetween(Calendar startDate, Calendar endDate,
long limitResetDelay) {
private static long secondsBetween(
final Calendar startDate, final Calendar endDate,
final long limitResetDelay) {
long secondsBetween = 0;
secondsBetween = ((startDate.getTimeInMillis() - endDate
.getTimeInMillis()) / 1000) + limitResetDelay;
return secondsBetween;
}
public static void clearAllLimits(int hashedCommand) {
Set<String> players = BoosConfigManager.getAllPlayers();
for (String player : players) {
public static void clearAllLimits(final int hashedCommand) {
final Set<String> players = BoosConfigManager.getAllPlayers();
for (final String player : players) {
BoosConfigManager.clearSomething2("uses", player, hashedCommand);
}
BoosConfigManager.saveConfusers();
@ -244,7 +246,7 @@ public class BoosLimitManager {
}
public static void setGlobalLimitResetDate() {
for (String command : BoosConfigManager.getLimitResetCommandsGlobal()) {
for (final String command : BoosConfigManager.getLimitResetCommandsGlobal()) {
if (BoosConfigManager.getLimitResetDelayGlobal(command) == -65535) {
BoosConfigManager.getConfusers().set("global." + command, null);
} else {
@ -255,16 +257,16 @@ public class BoosLimitManager {
BoosConfigManager.loadConfusers();
}
public static void setGlobalLimitResetDate(String command) {
public static void setGlobalLimitResetDate(final String command) {
setTime(command);
BoosConfigManager.saveConfusers();
BoosConfigManager.loadConfusers();
}
private static void setTime(String command) {
private static void setTime(final String command) {
String currTime = "";
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
final Calendar cal = Calendar.getInstance();
final SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
currTime = sdf.format(cal.getTime());
BoosConfigManager.getConfusers().set("global." + command + ".reset",
currTime);

View File

@ -10,8 +10,9 @@ import util.BoosChat;
public class BoosPlayerPointsManager {
private static final PlayerPoints playerPoints = BoosCoolDown.getPlayerPoints();
private static boolean payForCommand(Player player,
String originalCommand, int price) {
private static boolean payForCommand(
final Player player,
final String originalCommand, final int price) {
if (playerPoints == null) {
return true;
}
@ -30,9 +31,10 @@ public class BoosPlayerPointsManager {
}
}
public static void payForCommand(PlayerCommandPreprocessEvent event,
Player player, String regexCommand, String originalCommand,
int price) {
public static void payForCommand(
final PlayerCommandPreprocessEvent event,
final Player player, final String regexCommand, final String originalCommand,
final int price) {
if (price > 0) {
if (!player.hasPermission("booscooldowns.noplayerpoints")
&& !player.hasPermission("booscooldowns.noplayerpoints."
@ -45,7 +47,7 @@ public class BoosPlayerPointsManager {
}
}
public static boolean has(Player player, int price) {
public static boolean has(final Player player, final int price) {
return playerPoints == null || price <= 0 || playerPoints.getAPI().look(player.getUniqueId()) >= price;
}
}

View File

@ -11,12 +11,13 @@ import util.BoosChat;
public class BoosPriceManager {
private static final Economy economy = BoosCoolDown.getEconomy();
private static boolean payForCommand(Player player,
String originalCommand, double price) {
private static boolean payForCommand(
final Player player,
final String originalCommand, final double price) {
if (economy == null) {
return true;
}
EconomyResponse r = economy.withdrawPlayer(player, price);
final EconomyResponse r = economy.withdrawPlayer(player, price);
String msg = "";
if (r.transactionSuccess()) {
msg = String.format(BoosConfigManager.getPaidForCommandMessage(),
@ -32,9 +33,10 @@ public class BoosPriceManager {
}
}
public static void payForCommand(PlayerCommandPreprocessEvent event,
Player player, String regexCommand, String originalCommand,
double price) {
public static void payForCommand(
final PlayerCommandPreprocessEvent event,
final Player player, final String regexCommand, final String originalCommand,
final double price) {
if (price > 0) {
if (!player.hasPermission("booscooldowns.noprice")
&& !player.hasPermission("booscooldowns.noprice."
@ -47,7 +49,7 @@ public class BoosPriceManager {
}
}
public static boolean has(Player player, double price) {
public static boolean has(final Player player, final double price) {
return economy == null || price <= 0 || economy.has(player, price);
}
}

View File

@ -17,22 +17,22 @@ public class BoosWarmUpManager {
private static final ConcurrentHashMap<String, BoosWarmUpTimer> playercommands = new ConcurrentHashMap<>();
private static void applyPotionEffect(Player player, String regexCommand, int warmUpSeconds) {
for (String potionUnparsed : BoosConfigManager.getPotionEffects(regexCommand, player)) {
String[] potionParsed = potionUnparsed.split(",");
PotionEffectType type = PotionEffectType.getByName(potionParsed[0]);
private static void applyPotionEffect(final Player player, final String regexCommand, final int warmUpSeconds) {
for (final String potionUnparsed : BoosConfigManager.getPotionEffects(regexCommand, player)) {
final String[] potionParsed = potionUnparsed.split(",");
final PotionEffectType type = PotionEffectType.getByName(potionParsed[0]);
final int duration = potionParsed.length == 3 ? Integer.valueOf(potionParsed[2]) * 20 : warmUpSeconds * 20;
player.addPotionEffect(new PotionEffect(type, duration, Integer.valueOf(potionParsed[1]) - 1), true);
}
}
public static void cancelWarmUps(Player player) {
Iterator<String> iter = ((Map<String, BoosWarmUpTimer>) playercommands).keySet().iterator();
public static void cancelWarmUps(final Player player) {
final Iterator<String> iter = ((Map<String, BoosWarmUpTimer>) playercommands).keySet().iterator();
while (iter.hasNext()) {
final String key = iter.next();
if (key.startsWith(player.getUniqueId() + "@")) {
if (BoosConfigManager.getCancelPotionsOnWarmupCancel()) {
for (String potionUnparsed : BoosConfigManager.getPotionEffects(playercommands.get(key).getRegexCommand(), player)) {
for (final String potionUnparsed : BoosConfigManager.getPotionEffects(playercommands.get(key).getRegexCommand(), player)) {
player.removePotionEffect(PotionEffectType.getByName(potionUnparsed.split(",")[0]));
}
}
@ -42,8 +42,8 @@ public class BoosWarmUpManager {
}
}
public static boolean hasWarmUps(Player player) {
for (String key : ((Map<String, BoosWarmUpTimer>) playercommands).keySet()) {
public static boolean hasWarmUps(final Player player) {
for (final String key : ((Map<String, BoosWarmUpTimer>) playercommands).keySet()) {
if (key.startsWith(player.getUniqueId() + "@")) {
return true;
}
@ -51,63 +51,64 @@ public class BoosWarmUpManager {
return false;
}
public static boolean checkWarmUpOK(Player player, String regexCommand) {
int pre2 = regexCommand.toLowerCase().hashCode();
public static boolean checkWarmUpOK(final Player player, final String regexCommand) {
final int pre2 = regexCommand.toLowerCase().hashCode();
int ok = 0;
ok = BoosConfigManager.getConfusers().getInt(
"users." + player.getUniqueId() + ".warmup." + pre2, ok);
return ok == 1;
}
public static boolean isWarmUpProcess(Player player, String regexCommand) {
public static boolean isWarmUpProcess(final Player player, String regexCommand) {
regexCommand = regexCommand.toLowerCase();
return playercommands.containsKey(player.getUniqueId() + "@"
+ regexCommand);
}
private static void killTimer(Player player) {
for (String key : ((Map<String, BoosWarmUpTimer>) playercommands).keySet()) {
private static void killTimer(final Player player) {
for (final String key : ((Map<String, BoosWarmUpTimer>) playercommands).keySet()) {
if (key.startsWith(player.getUniqueId() + "@")) {
playercommands.get(key).cancel();
}
}
}
public static void removeWarmUp(Player player, String regexCommand) {
int pre2 = regexCommand.toLowerCase().hashCode();
public static void removeWarmUp(final Player player, final String regexCommand) {
final int pre2 = regexCommand.toLowerCase().hashCode();
BoosConfigManager.getConfusers().set(
"users." + player.getUniqueId() + ".warmup." + pre2, null);
}
public static void removeWarmUpOK(Player player, String regexCommand) {
int pre2 = regexCommand.toLowerCase().hashCode();
public static void removeWarmUpOK(final Player player, final String regexCommand) {
final int pre2 = regexCommand.toLowerCase().hashCode();
BoosConfigManager.getConfusers().set(
"users." + player.getUniqueId() + ".warmup." + pre2, null);
}
public static void removeWarmUpProcess(String tag) {
public static void removeWarmUpProcess(final String tag) {
BoosWarmUpManager.playercommands.remove(tag);
}
public static void setWarmUpOK(Player player, String regexCommand) {
int pre2 = regexCommand.toLowerCase().hashCode();
public static void setWarmUpOK(final Player player, final String regexCommand) {
final int pre2 = regexCommand.toLowerCase().hashCode();
BoosConfigManager.getConfusers().set(
"users." + player.getUniqueId() + ".warmup." + pre2, 1);
}
public static void startWarmUp(BoosCoolDown bCoolDown, Player player,
String regexCommand, String originalCommand, int warmUpSeconds) {
public static void startWarmUp(
final BoosCoolDown bCoolDown, final Player player,
String regexCommand, final String originalCommand, int warmUpSeconds) {
regexCommand = regexCommand.toLowerCase();
int warmUpSecondsTem = warmUpSeconds;
final int warmUpSecondsTem = warmUpSeconds;
long warmUpMinutes = (long) Math.floor(warmUpSeconds / 60.0);
long warmUpHours = (long) Math.floor(warmUpMinutes / 60.0);
final long warmUpHours = (long) Math.floor(warmUpMinutes / 60.0);
if (!isWarmUpProcess(player, regexCommand)) {
BoosWarmUpManager.removeWarmUpOK(player, regexCommand);
String msg = BoosConfigManager.getWarmUpMessage();
StringBuilder stringBuilder = new StringBuilder();
final StringBuilder stringBuilder = new StringBuilder();
msg = msg.replaceAll("&command&", originalCommand);
if (warmUpSeconds >= 3600) {
stringBuilder.append(Long.toString(warmUpHours));
stringBuilder.append(warmUpHours);
stringBuilder.append(" ");
stringBuilder.append(BoosConfigManager.getUnitHoursMessage());
stringBuilder.append(", ");
@ -115,7 +116,7 @@ public class BoosWarmUpManager {
}
if (warmUpSeconds >= 60) {
warmUpMinutes = warmUpMinutes - (warmUpHours * 60);
stringBuilder.append(Long.toString(warmUpMinutes));
stringBuilder.append(warmUpMinutes);
stringBuilder.append(" ");
stringBuilder.append(BoosConfigManager.getUnitMinutesMessage());
stringBuilder.append(", ");
@ -135,8 +136,8 @@ public class BoosWarmUpManager {
BoosChat.sendMessageToPlayer(player, msg);
Timer scheduler = new Timer();
BoosWarmUpTimer scheduleMe = new BoosWarmUpTimer(bCoolDown, player, regexCommand, originalCommand);
final Timer scheduler = new Timer();
final BoosWarmUpTimer scheduleMe = new BoosWarmUpTimer(bCoolDown, player, regexCommand, originalCommand);
playercommands.put(player.getUniqueId() + "@" + regexCommand,
scheduleMe);
scheduler.schedule(scheduleMe, warmUpSecondsTem * 1000);

View File

@ -7,9 +7,10 @@ import util.BoosChat;
public class BoosXpCostManager {
private static boolean payXPForCommand(Player player,
String originalCommand, int xpPrice) {
int xp = player.getLevel();
private static boolean payXPForCommand(
final Player player,
final String originalCommand, final int xpPrice) {
final int xp = player.getLevel();
Boolean trans = false;
if (xp >= xpPrice) {
player.setLevel(xp - xpPrice);
@ -26,9 +27,10 @@ public class BoosXpCostManager {
}
}
public static void payXPForCommand(PlayerCommandPreprocessEvent event,
Player player, String regexCommand, String originalCommand,
int xpPrice) {
public static void payXPForCommand(
final PlayerCommandPreprocessEvent event,
final Player player, final String regexCommand, final String originalCommand,
final int xpPrice) {
if (xpPrice > 0) {
if (!player.hasPermission("booscooldowns.noxpcost")
&& !player.hasPermission("booscooldowns.noxpcost."
@ -42,11 +44,11 @@ public class BoosXpCostManager {
}
}
public static boolean has(Player player, int xpPrice) {
public static boolean has(final Player player, final int xpPrice) {
if (xpPrice <= 0) {
return true;
}
int xp = player.getLevel();
final int xp = player.getLevel();
return xp >= xpPrice;
}
}

View File

@ -10,7 +10,7 @@ public class BoosGlobalLimitResetRunnable implements Runnable {
private final String command;
public BoosGlobalLimitResetRunnable(String key) {
public BoosGlobalLimitResetRunnable(final String key) {
this.command = key;
}

View File

@ -15,8 +15,9 @@ public class BoosWarmUpTimer extends TimerTask {
private final String originalCommand;
private final String regexCommand;
public BoosWarmUpTimer(BoosCoolDown bCoolDown, Player player,
String regexCommand, String originalCommand) {
public BoosWarmUpTimer(
final BoosCoolDown bCoolDown, final Player player,
final String regexCommand, final String originalCommand) {
this.bCoolDown = bCoolDown;
this.player = player;
this.regexCommand = regexCommand;

View File

@ -1,28 +0,0 @@
package nms;
import org.bukkit.entity.Player;
/**
* All rights reserved.
*
* @author ColoredCarrot
*/
public interface INMSHook {
/**
* Sends a JSON message to a player.
*
* @param json (String) - the plain JSON
* @param player (Player) - the player
*/
void sendJSON(String json, Player player);
/**
* Sends an actionbar to a player.
*
* @param json (String) - the plain JSON
* @param player (Player) - the player
*/
void sendActionBar(String json, Player player);
}

View File

@ -1,77 +0,0 @@
package nms;
import org.bukkit.plugin.Plugin;
/**
* All rights reserved.
*
* @author ColoredCarrot
*/
public class NMS {
private static INMSHook hook;
private static String version;
private static boolean compatible = true;
/**
* Gets the server version and adjusts this API accordingly.
*
* @param pl (Plugin) - the instance of your plugin
* @return (NMSSetupResponse) - the setup response.
*/
public static NMSSetupResponse setup(Plugin pl) {
String version;
try {
version = pl.getServer().getClass().getPackage().getName().replace('.', ',').split(",")[3];
} catch (ArrayIndexOutOfBoundsException e) {
return new NMSSetupResponse(null, false);
}
try {
hook = new NMSHook();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
return new NMSSetupResponse(version, true);
}
/**
* Gets the NMS hook, if NMS is hooked.
*
* @return (INMSHook) - the INMSHook.
* @throws NMSNotHookedException if NMS is not hooked (by using {@link #setup(Plugin)})
*/
public static INMSHook getHook()
throws NMSNotHookedException {
if (!compatible) {
throw new NMSNotHookedException();
}
return hook;
}
/**
* Gets the found server version.
*
* @return (String) - the server version in form of "v1_9_R1" or null
*/
public static String getVersion() {
return version;
}
/**
* Checks whether this API is compatible with the found server version.
*
* @return
*/
public static boolean isCompatibleVersionFound() {
return compatible;
}
}

View File

@ -1,84 +0,0 @@
package nms;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
/**
* All rights reserved.
*
* @author ColoredCarrot
*/
public class NMSHook
implements INMSHook {
private String version = Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
private Class<?> chatSerializer = version.startsWith("v1_7")
? Class.forName("net.minecraft.server." + version + ".ChatSerializer")
: Class.forName("net.minecraft.server." + version + ".IChatBaseComponent$ChatSerializer");
private Class<?> chatComponent = Class.forName("net.minecraft.server." + version + ".IChatBaseComponent");
private Class<?> packet = Class.forName("net.minecraft.server." + version + ".PacketPlayOutChat");
public NMSHook() throws ClassNotFoundException {
}
public void sendJSON(String json, Player player) {
try {
Object nmsPlayer = getNmsPlayer(player);
Object connection = getConnection(nmsPlayer);
Constructor constructor = packet.getConstructor(chatComponent);
Object text = getText(json);
Object packetFinal = constructor.newInstance(text);
sendPacket(packetFinal, text, connection);
} catch (Exception ex) {
ex.printStackTrace();
}
}
public void sendActionBar(String json, Player player) {
try {
Object nmsPlayer = getNmsPlayer(player);
Object connection = getConnection(nmsPlayer);
Constructor constructor = packet.getConstructor(chatComponent, byte.class);
Object text = getText(json);
Object packetFinal = constructor.newInstance(text, (byte) 2);
sendPacket(packetFinal, text, connection);
} catch (Exception ex) {
ex.printStackTrace();
}
}
private void sendPacket(Object packetFinal, Object text, Object connection) throws IllegalAccessException, NoSuchFieldException,
ClassNotFoundException, NoSuchMethodException, InvocationTargetException {
Field field = packetFinal.getClass().getDeclaredField("a");
field.setAccessible(true);
field.set(packetFinal, text);
connection
.getClass()
.getMethod("sendPacket", Class.forName("net.minecraft.server." + version + ".Packet"))
.invoke(connection, packetFinal);
}
private Object getNmsPlayer(Player player) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
return player.getClass().getMethod("getHandle").invoke(player);
}
private Object getConnection(Object nmsPlayer) throws NoSuchFieldException, IllegalAccessException {
return nmsPlayer.getClass().getField("playerConnection").get(nmsPlayer);
}
private Object getText(String json) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
return chatSerializer.getMethod("a", String.class).invoke(chatSerializer, json);
}
}

View File

@ -1,20 +0,0 @@
package nms;
/**
* All rights reserved.
*
* @author ColoredCarrot
*/
public class NMSNotHookedException
extends Exception {
/**
*
*/
private static final long serialVersionUID = -1482736539139159745L;
public NMSNotHookedException() {
super("NMS not hooked!");
}
}

View File

@ -1,36 +0,0 @@
package nms;
/**
* All rights reserved.
*
* @author ColoredCarrot
*/
public class NMSSetupResponse {
private String version;
private boolean compatible;
protected NMSSetupResponse(String version, boolean compatible) {
this.version = version;
this.compatible = compatible;
}
/**
* Gets the found server version in form of "v1_9_R1".
*
* @return (String) - the server version or null if it's not found.
*/
public String getVersion() {
return version;
}
/**
* Gets if the found server version is compatible with this API.
*
* @return
*/
public boolean isCompatible() {
return compatible;
}
}

View File

@ -40,6 +40,7 @@ import java.net.Proxy;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Collection;
import java.util.UUID;
import java.util.logging.Level;
@ -110,7 +111,7 @@ public class MetricsLite {
*/
private volatile BukkitTask task = null;
public MetricsLite(Plugin plugin) throws IOException {
public MetricsLite(final Plugin plugin) throws IOException {
if (plugin == null) {
throw new IllegalArgumentException("Plugin cannot be null");
}
@ -143,19 +144,19 @@ public class MetricsLite {
* @param input
* @return
*/
public static byte[] gzip(String input) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
public static byte[] gzip(final String input) {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
GZIPOutputStream gzos = null;
try {
gzos = new GZIPOutputStream(baos);
gzos.write(input.getBytes("UTF-8"));
} catch (IOException e) {
gzos.write(input.getBytes(StandardCharsets.UTF_8));
} catch (final IOException e) {
e.printStackTrace();
} finally {
if (gzos != null) try {
gzos.close();
} catch (IOException ignore) {
} catch (final IOException ignore) {
}
}
@ -170,7 +171,7 @@ public class MetricsLite {
* @param value
* @throws UnsupportedEncodingException
*/
private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException {
private static void appendJSONPair(final StringBuilder json, final String key, final String value) throws UnsupportedEncodingException {
boolean isValueNumeric = false;
try {
@ -178,7 +179,7 @@ public class MetricsLite {
Double.parseDouble(value);
isValueNumeric = true;
}
} catch (NumberFormatException e) {
} catch (final NumberFormatException e) {
isValueNumeric = false;
}
@ -202,12 +203,12 @@ public class MetricsLite {
* @param text
* @return
*/
private static String escapeJSON(String text) {
StringBuilder builder = new StringBuilder();
private static String escapeJSON(final String text) {
final StringBuilder builder = new StringBuilder();
builder.append('"');
for (int index = 0; index < text.length(); index++) {
char chr = text.charAt(index);
final char chr = text.charAt(index);
switch (chr) {
case '"':
@ -229,7 +230,7 @@ public class MetricsLite {
break;
default:
if (chr < ' ') {
String t = "000" + Integer.toHexString(chr);
final String t = "000" + Integer.toHexString(chr);
builder.append("\\u" + t.substring(t.length() - 4));
} else {
builder.append(chr);
@ -295,7 +296,7 @@ public class MetricsLite {
// After the first post we set firstPost to false
// Each post thereafter will be a ping
firstPost = false;
} catch (IOException e) {
} catch (final IOException e) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + e.getMessage());
}
@ -317,12 +318,12 @@ public class MetricsLite {
try {
// Reload the metrics file
configuration.load(getConfigFile());
} catch (IOException ex) {
} catch (final IOException ex) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
}
return true;
} catch (InvalidConfigurationException ex) {
} catch (final InvalidConfigurationException ex) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
}
@ -386,7 +387,7 @@ public class MetricsLite {
// plugin.getDataFolder() => base/plugins/PluginA/
// pluginsFolder => base/plugins/
// The base is not necessarily relative to the startup directory.
File pluginsFolder = plugin.getDataFolder().getParentFile();
final File pluginsFolder = plugin.getDataFolder().getParentFile();
// return => base/plugins/PluginMetrics/config.yml
return new File(new File(pluginsFolder, "PluginMetrics"), "config.yml");
@ -399,13 +400,13 @@ public class MetricsLite {
*/
private int getOnlinePlayers() {
try {
Method onlinePlayerMethod = Bukkit.class.getMethod("getOnlinePlayers");
final Method onlinePlayerMethod = Bukkit.class.getMethod("getOnlinePlayers");
if (onlinePlayerMethod.getReturnType().equals(Collection.class)) {
return ((Collection<?>) onlinePlayerMethod.invoke(Bukkit.class)).size();
} else {
return ((Player[]) onlinePlayerMethod.invoke(Bukkit.class)).length;
}
} catch (Exception ex) {
} catch (final Exception ex) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
}
@ -417,19 +418,19 @@ public class MetricsLite {
/**
* Generic method that posts a plugin to the metrics website
*/
private void postPlugin(boolean isPing) throws IOException {
private void postPlugin(final boolean isPing) throws IOException {
// Server software specific section
PluginDescriptionFile description = plugin.getDescription();
String pluginName = description.getName();
boolean onlineMode = Bukkit.getServer().getOnlineMode(); // TRUE if online mode is enabled
String pluginVersion = description.getVersion();
String serverVersion = Bukkit.getVersion();
int playersOnline = this.getOnlinePlayers();
final PluginDescriptionFile description = plugin.getDescription();
final String pluginName = description.getName();
final boolean onlineMode = Bukkit.getServer().getOnlineMode(); // TRUE if online mode is enabled
final String pluginVersion = description.getVersion();
final String serverVersion = Bukkit.getVersion();
final int playersOnline = this.getOnlinePlayers();
// END server software specific section -- all code below does not use any code outside of this class / Java
// Construct the post data
StringBuilder json = new StringBuilder(1024);
final StringBuilder json = new StringBuilder(1024);
json.append('{');
// The plugin's description file containg all of the plugin data such as name, version, author, etc
@ -439,11 +440,11 @@ public class MetricsLite {
appendJSONPair(json, "players_online", Integer.toString(playersOnline));
// New data as of R6
String osname = System.getProperty("os.name");
final String osname = System.getProperty("os.name");
String osarch = System.getProperty("os.arch");
String osversion = System.getProperty("os.version");
String java_version = System.getProperty("java.version");
int coreCount = Runtime.getRuntime().availableProcessors();
final String osversion = System.getProperty("os.version");
final String java_version = System.getProperty("java.version");
final int coreCount = Runtime.getRuntime().availableProcessors();
// normalize os arch .. amd64 -> x86_64
if (osarch.equals("amd64")) {
@ -466,10 +467,10 @@ public class MetricsLite {
json.append('}');
// Create the url
URL url = new URL(BASE_URL + String.format(REPORT_URL, urlEncode(pluginName)));
final URL url = new URL(BASE_URL + String.format(REPORT_URL, urlEncode(pluginName)));
// Connect to the website
URLConnection connection;
final URLConnection connection;
// Mineshafter creates a socks proxy, so we can safely bypass it
// It does not reroute POST requests so we need to go around it
@ -480,8 +481,8 @@ public class MetricsLite {
}
byte[] uncompressed = json.toString().getBytes();
byte[] compressed = gzip(json.toString());
final byte[] uncompressed = json.toString().getBytes();
final byte[] compressed = gzip(json.toString());
// Headers
connection.addRequestProperty("User-Agent", "MCStats/" + REVISION);
@ -499,7 +500,7 @@ public class MetricsLite {
}
// Write the data
OutputStream os = connection.getOutputStream();
final OutputStream os = connection.getOutputStream();
os.write(compressed);
os.flush();
@ -531,7 +532,7 @@ public class MetricsLite {
try {
Class.forName("mineshafter.MineServer");
return true;
} catch (Exception e) {
} catch (final Exception e) {
return false;
}
}

View File

@ -74,7 +74,7 @@ options:
paid_items_for_command: '&6Price of&e &command& &6was &e%s'
paid_xp_for_command: '&6Price of&e &command& &6was &e%s levels'
paid_player_points_for_command: '&6Price of&e &command& &6was &e%s PlayerPoints &6and you now have&e %s PlayerPoints'
insufficient_items: '&6You have not enough items!&e &command& &6needs &e%s'
insufficient_items: '&6You have not enough items!&e &command& &6needs'
insufficient_xp: '&6You have not enough XP!&e &command& &6needs &e%s'
insufficient_xp_requirement: '&6Your level is too low to use this!&e &command& &6needs &e%s'
insufficient_player_points: '&6You have not enough PlayerPoints!&e &command& &6needs &e%s'

View File

@ -1,6 +1,6 @@
name: boosCooldowns
main: cz.boosik.boosCooldown.BoosCoolDown
version: 3.16.0
version: 3.16.1
authors: [LordBoos (boosik)]
softdepend: [Vault, PlayerPoints]
description: >

View File

@ -11,12 +11,11 @@
<packaging>pom</packaging>
<url>http://maven.apache.org</url>
<properties>
<boosCooldowns.version>3.16.0</boosCooldowns.version>
<boosCooldowns.version>3.16.1</boosCooldowns.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<minecraft.version>1.16.1</minecraft.version>
<bukkit.version>R0.1</bukkit.version>
<bukkit.packet>v1_16_R1</bukkit.packet>
</properties>
<pluginRepositories>
<pluginRepository>