build(CacheLoader su
}
/**
- * Guides the allowed concurrency among update operations. Used as a hint
- * for internal sizing. The table is internally partitioned to try to permit
- * the indicated number of concurrent updates without contention. Because
- * assignment of entries to these partitions is not necessarily uniform, the
- * actual concurrency observed may vary. Ideally, you should choose a value
- * to accommodate as many threads as will ever concurrently modify the
- * table. Using a significantly higher value than you need can waste space
- * and time, and a significantly lower value can lead to thread contention.
- * But overestimates and underestimates within an order of magnitude do not
- * usually have much noticeable impact. A value of one permits only one
- * thread to modify the cache at a time, but since read operations can
- * proceed concurrently, this still yields higher concurrency than full
- * synchronization. Defaults to 4.
+ * Guides the allowed concurrency among update operations. Used as a hint for
+ * internal sizing. The table is internally partitioned to try to permit the
+ * indicated number of concurrent updates without contention. Because assignment
+ * of entries to these partitions is not necessarily uniform, the actual
+ * concurrency observed may vary. Ideally, you should choose a value to
+ * accommodate as many threads as will ever concurrently modify the table. Using
+ * a significantly higher value than you need can waste space and time, and a
+ * significantly lower value can lead to thread contention. But overestimates
+ * and underestimates within an order of magnitude do not usually have much
+ * noticeable impact. A value of one permits only one thread to modify the cache
+ * at a time, but since read operations can proceed concurrently, this still
+ * yields higher concurrency than full synchronization. Defaults to 4.
*
*
* Note:The default may change in the future. If you care about this
@@ -123,28 +122,28 @@ public CompatibleCacheBuilder concurrencyLevel(int concurrencyLevel) {
}
/**
- * Specifies that each entry should be automatically removed from the cache
- * once a fixed duration has elapsed after the entry's creation, or last
- * access. Access time is reset by {@link com.google.common.cache.Cache#get
+ * Specifies that each entry should be automatically removed from the cache once
+ * a fixed duration has elapsed after the entry's creation, or last access.
+ * Access time is reset by {@link com.google.common.cache.Cache#get
* Cache.get()}, but not by operations on the view returned by
* {@link com.google.common.cache.Cache#asMap() Cache.asMap()}.
*
*
* When {@code duration} is zero, elements will be evicted immediately after
* being loaded into the cache. This has the same effect as invoking
- * {@link #maximumSize maximumSize}{@code (0)}. It can be useful in testing,
- * or to disable caching temporarily without a code change.
+ * {@link #maximumSize maximumSize}{@code (0)}. It can be useful in testing, or
+ * to disable caching temporarily without a code change.
*
*
- * Expired entries may be counted by
- * {@link com.google.common.cache.Cache#size Cache.size()}, but will never
- * be visible to read or write operations. Expired entries are currently
- * cleaned up during write operations, or during occasional read operations
- * in the absense of writes; though this behavior may change in the future.
+ * Expired entries may be counted by {@link com.google.common.cache.Cache#size
+ * Cache.size()}, but will never be visible to read or write operations. Expired
+ * entries are currently cleaned up during write operations, or during
+ * occasional read operations in the absense of writes; though this behavior may
+ * change in the future.
*
* @param duration
- * the length of time after an entry is last accessed that it
- * should be automatically removed
+ * the length of time after an entry is last accessed that it should
+ * be automatically removed
* @param unit
* the unit that {@code duration} is expressed in
* @return This for chaining
@@ -163,22 +162,22 @@ public CompatibleCacheBuilder expireAfterAccess(long duration, TimeUnit un
}
/**
- * Specifies that each entry should be automatically removed from the cache
- * once a fixed duration has elapsed after the entry's creation, or the most
- * recent replacement of its value.
+ * Specifies that each entry should be automatically removed from the cache once
+ * a fixed duration has elapsed after the entry's creation, or the most recent
+ * replacement of its value.
*
*
* When {@code duration} is zero, elements will be evicted immediately after
* being loaded into the cache. This has the same effect as invoking
- * {@link #maximumSize maximumSize}{@code (0)}. It can be useful in testing,
- * or to disable caching temporarily without a code change.
+ * {@link #maximumSize maximumSize}{@code (0)}. It can be useful in testing, or
+ * to disable caching temporarily without a code change.
*
*
- * Expired entries may be counted by
- * {@link com.google.common.cache.Cache#size Cache.size()}, but will never
- * be visible to read or write operations. Expired entries are currently
- * cleaned up during write operations, or during occasional read operations
- * in the absense of writes; though this behavior may change in the future.
+ * Expired entries may be counted by {@link com.google.common.cache.Cache#size
+ * Cache.size()}, but will never be visible to read or write operations. Expired
+ * entries are currently cleaned up during write operations, or during
+ * occasional read operations in the absense of writes; though this behavior may
+ * change in the future.
*
* @param duration
* the length of time after an entry is created that it should be
@@ -201,12 +200,12 @@ public CompatibleCacheBuilder expireAfterWrite(long duration, TimeUnit uni
}
/**
- * Sets the minimum total size for the internal hash tables. For example, if
- * the initial capacity is {@code 60}, and the concurrency level is
- * {@code 8}, then eight segments are created, each having a hash table of
- * size eight. Providing a large enough estimate at construction time avoids
- * the need for expensive resizing operations later, but setting this value
- * unnecessarily high wastes memory.
+ * Sets the minimum total size for the internal hash tables. For example, if the
+ * initial capacity is {@code 60}, and the concurrency level is {@code 8}, then
+ * eight segments are created, each having a hash table of size eight. Providing
+ * a large enough estimate at construction time avoids the need for expensive
+ * resizing operations later, but setting this value unnecessarily high wastes
+ * memory.
*
* @param initialCapacity
* - initial capacity
@@ -223,15 +222,15 @@ public CompatibleCacheBuilder initialCapacity(int initialCapacity) {
}
/**
- * Specifies the maximum number of entries the cache may contain. Note that
- * the cache may evict an entry before this limit is exceeded. As the
- * cache size grows close to the maximum, the cache evicts entries that are
- * less likely to be used again. For example, the cache may evict an entry
- * because it hasn't been used recently or very often.
+ * Specifies the maximum number of entries the cache may contain. Note that the
+ * cache may evict an entry before this limit is exceeded. As the cache
+ * size grows close to the maximum, the cache evicts entries that are less
+ * likely to be used again. For example, the cache may evict an entry because it
+ * hasn't been used recently or very often.
*
*
- * When {@code size} is zero, elements will be evicted immediately after
- * being loaded into the cache. This has the same effect as invoking
+ * When {@code size} is zero, elements will be evicted immediately after being
+ * loaded into the cache. This has the same effect as invoking
* {@link #expireAfterWrite expireAfterWrite}{@code (0, unit)} or
* {@link #expireAfterAccess expireAfterAccess}{@code (0,
* unit)}. It can be useful in testing, or to disable caching temporarily
@@ -256,35 +255,34 @@ public CompatibleCacheBuilder maximumSize(int size) {
/**
* Specifies a listener instance, which all caches built using this
- * {@code CacheBuilder} will notify each time an entry is removed from the
- * cache by any means.
+ * {@code CacheBuilder} will notify each time an entry is removed from the cache
+ * by any means.
*
*
* Each cache built by this {@code CacheBuilder} after this method is called
- * invokes the supplied listener after removing an element for any reason
- * (see removal causes in {@link com.google.common.cache.RemovalCause
- * RemovalCause}). It will invoke the listener during invocations of any of
- * that cache's public methods (even read-only methods).
+ * invokes the supplied listener after removing an element for any reason (see
+ * removal causes in {@link com.google.common.cache.RemovalCause RemovalCause}).
+ * It will invoke the listener during invocations of any of that cache's public
+ * methods (even read-only methods).
*
*
* Important note: Instead of returning this as a
* {@code CacheBuilder} instance, this method returns
* {@code CacheBuilder}. From this point on, either the original
- * reference or the returned reference may be used to complete configuration
- * and build the cache, but only the "generic" one is type-safe. That is, it
- * will properly prevent you from building caches whose key or value types
- * are incompatible with the types accepted by the listener already
- * provided; the {@code CacheBuilder} type cannot do this. For best results,
- * simply use the standard method-chaining idiom, as illustrated in the
- * documentation at top, configuring a {@code CacheBuilder} and building
- * your {@link com.google.common.cache.Cache Cache} all in a single
- * statement.
+ * reference or the returned reference may be used to complete configuration and
+ * build the cache, but only the "generic" one is type-safe. That is, it will
+ * properly prevent you from building caches whose key or value types are
+ * incompatible with the types accepted by the listener already provided; the
+ * {@code CacheBuilder} type cannot do this. For best results, simply use the
+ * standard method-chaining idiom, as illustrated in the documentation at top,
+ * configuring a {@code CacheBuilder} and building your
+ * {@link com.google.common.cache.Cache Cache} all in a single statement.
*
*
* Warning: if you ignore the above advice, and use this
- * {@code CacheBuilder} to build a cache whose key or value type is
- * incompatible with the listener, you will likely experience a
- * {@link ClassCastException} at some undefined point in the future.
+ * {@code CacheBuilder} to build a cache whose key or value type is incompatible
+ * with the listener, you will likely experience a {@link ClassCastException} at
+ * some undefined point in the future.
*
* @param
* Key type
@@ -305,21 +303,20 @@ public CompatibleCacheBuilder removalListen
}
/**
- * Specifies that each value (not key) stored in the cache should be wrapped
- * in a {@link java.lang.ref.SoftReference SoftReference} (by default,
- * strong references are used). Softly-referenced objects will be
- * garbage-collected in a globally least-recently-used manner, in
- * response to memory demand.
+ * Specifies that each value (not key) stored in the cache should be wrapped in
+ * a {@link java.lang.ref.SoftReference SoftReference} (by default, strong
+ * references are used). Softly-referenced objects will be garbage-collected in
+ * a globally least-recently-used manner, in response to memory demand.
*
*
* Warning: in most circumstances it is better to set a per-cache
- * {@linkplain #maximumSize maximum size} instead of using soft references.
- * You should only use this method if you are well familiar with the
- * practical consequences of soft references.
+ * {@linkplain #maximumSize maximum size} instead of using soft references. You
+ * should only use this method if you are well familiar with the practical
+ * consequences of soft references.
*
*
- * Note: when this method is used, the resulting cache will use
- * identity ({@code ==}) comparison to determine equality of values.
+ * Note: when this method is used, the resulting cache will use identity
+ * ({@code ==}) comparison to determine equality of values.
*
* @return This for chaining
*
@@ -336,8 +333,8 @@ public CompatibleCacheBuilder softValues() {
* entries should be expired. By default, {@link System#nanoTime} is used.
*
*
- * The primary intent of this method is to facilitate testing of caches
- * which have been configured with {@link #expireAfterWrite} or
+ * The primary intent of this method is to facilitate testing of caches which
+ * have been configured with {@link #expireAfterWrite} or
* {@link #expireAfterAccess}.
*
* @param ticker
@@ -353,9 +350,9 @@ public CompatibleCacheBuilder ticker(Ticker ticker) {
}
/**
- * Specifies that each key (not value) stored in the cache should be wrapped
- * in a {@link java.lang.ref.WeakReference WeakReference} (by default,
- * strong references are used).
+ * Specifies that each key (not value) stored in the cache should be wrapped in
+ * a {@link java.lang.ref.WeakReference WeakReference} (by default, strong
+ * references are used).
*
*
* Warning: when this method is used, the resulting cache will use
@@ -372,18 +369,18 @@ public CompatibleCacheBuilder weakKeys() {
}
/**
- * Specifies that each value (not key) stored in the cache should be wrapped
- * in a {@link java.lang.ref.WeakReference WeakReference} (by default,
- * strong references are used).
+ * Specifies that each value (not key) stored in the cache should be wrapped in
+ * a {@link java.lang.ref.WeakReference WeakReference} (by default, strong
+ * references are used).
*
*
- * Weak values will be garbage collected once they are weakly reachable.
- * This makes them a poor candidate for caching; consider
- * {@link #softValues} instead.
+ * Weak values will be garbage collected once they are weakly reachable. This
+ * makes them a poor candidate for caching; consider {@link #softValues}
+ * instead.
*
*
- * Note: when this method is used, the resulting cache will use
- * identity ({@code ==}) comparison to determine equality of values.
+ * Note: when this method is used, the resulting cache will use identity
+ * ({@code ==}) comparison to determine equality of values.
*
* @return This for chaining
*
diff --git a/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/Util/Misc/MiscUtils.java b/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/Util/Misc/MiscUtils.java
index 4ed7ddd0d8..68e8a11c1a 100644
--- a/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/Util/Misc/MiscUtils.java
+++ b/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/Util/Misc/MiscUtils.java
@@ -15,6 +15,7 @@
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
+import org.bukkit.OfflinePlayer;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
@@ -79,6 +80,7 @@ public void executeConsoleCommands(final Player player, final ArrayList
final ArrayList commands = ArrayUtils.getInstance().replaceJavascript(player,
ArrayUtils.getInstance().replacePlaceHolder(cmds, placeholders));
for (final String cmd : commands) {
+ plugin.debug("Executing console command: " + cmd);
Bukkit.getScheduler().runTask(plugin.getPlugin(), new Runnable() {
@Override
@@ -92,30 +94,12 @@ public void run() {
}
}
- @SuppressWarnings("deprecation")
- public void executeConsoleCommands(final String playerName, final ArrayList cmds,
- final HashMap placeholders) {
- if (cmds != null && !cmds.isEmpty()) {
- placeholders.put("player", playerName);
- final ArrayList commands = ArrayUtils.getInstance().replaceJavascript(
- Bukkit.getOfflinePlayer(playerName),
- ArrayUtils.getInstance().replacePlaceHolder(cmds, placeholders));
- Bukkit.getScheduler().runTask(plugin.getPlugin(), new Runnable() {
-
- @Override
- public void run() {
- for (String cmd : commands) {
- Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), cmd);
- }
- }
- });
- }
- }
-
public void executeConsoleCommands(Player player, String command, HashMap placeholders) {
if (command != null && !command.isEmpty()) {
final String cmd = StringUtils.getInstance().replaceJavascript(player,
StringUtils.getInstance().replacePlaceHolder(command, placeholders));
+
+ plugin.debug("Executing console command: " + command);
Bukkit.getScheduler().runTask(plugin.getPlugin(), new Runnable() {
@Override
@@ -128,6 +112,27 @@ public void run() {
}
+ @SuppressWarnings("deprecation")
+ public void executeConsoleCommands(final String playerName, final ArrayList cmds,
+ final HashMap placeholders) {
+ if (cmds != null && !cmds.isEmpty()) {
+ placeholders.put("player", playerName);
+ final ArrayList commands = ArrayUtils.getInstance().replaceJavascript(
+ Bukkit.getOfflinePlayer(playerName),
+ ArrayUtils.getInstance().replacePlaceHolder(cmds, placeholders));
+ for (final String cmd : commands) {
+ plugin.debug("Executing console command: " + cmd);
+ Bukkit.getScheduler().runTask(plugin.getPlugin(), new Runnable() {
+
+ @Override
+ public void run() {
+ Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), cmd);
+ }
+ });
+ }
+ }
+ }
+
/**
* Gets the connection.
*
@@ -248,6 +253,15 @@ public int getYearFromMili(long time) {
return LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault()).getYear();
}
+ public ItemStack setSkullOwner(OfflinePlayer player) {
+ if ((player.hasPlayedBefore() || player.isOnline()) || Bukkit.getOnlineMode()) {
+ return new ItemBuilder(new ItemStack(Material.SKULL_ITEM, 1, (short) 3)).setSkullOwner(player)
+ .toItemStack(player);
+ } else {
+ return setSkullOwner(player.getName());
+ }
+ }
+
/**
* Sets the skull owner.
*
@@ -255,7 +269,7 @@ public int getYearFromMili(long time) {
* the player name
* @return the item stack
*/
- @SuppressWarnings("deprecation")
+ @Deprecated
public ItemStack setSkullOwner(String playerName) {
return new ItemBuilder(new ItemStack(Material.SKULL_ITEM, 1, (short) 3)).setSkullOwner(playerName)
.toItemStack();
diff --git a/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/Util/Misc/PlayerUtils.java b/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/Util/Misc/PlayerUtils.java
index 8c166162ac..1e837cd0e7 100644
--- a/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/Util/Misc/PlayerUtils.java
+++ b/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/Util/Misc/PlayerUtils.java
@@ -1,5 +1,6 @@
package com.Ben12345rocks.AdvancedCore.Util.Misc;
+import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.Bukkit;
@@ -127,7 +128,7 @@ public String getUUID(String playerName) {
if (playerName == null) {
return null;
}
-
+
OfflinePlayer p = Bukkit.getOfflinePlayer(playerName);
if (plugin.isAlternateUUIDLookUp() || (!p.hasPlayedBefore() && !p.isOnline())) {
@@ -136,6 +137,12 @@ public String getUUID(String playerName) {
String uuid = uuids.get(playerName);
if (uuid != null) {
return uuid;
+ } else {
+ for (Entry entry : uuids.entrySet()) {
+ if (entry.getKey().equalsIgnoreCase(playerName)) {
+ return entry.getValue();
+ }
+ }
}
}
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
@@ -151,15 +158,6 @@ public String getUUID(String playerName) {
return p.getUniqueId().toString();
}
-
- @SuppressWarnings("deprecation")
- public boolean isValidUser(String name) {
- OfflinePlayer p = Bukkit.getOfflinePlayer(name);
- if (p.hasPlayedBefore() || p.isOnline()) {
- return true;
- }
- return UserManager.getInstance().userExist(name);
- }
/**
* Checks for permission.
@@ -259,6 +257,16 @@ public boolean isPlayerOnline(String playerName) {
return false;
}
+ @SuppressWarnings("deprecation")
+ public boolean isValidUser(String name) {
+ OfflinePlayer p = Bukkit.getOfflinePlayer(name);
+ if (p.hasPlayedBefore() || p.isOnline()) {
+ plugin.extraDebug(name + " has joined before");
+ return true;
+ }
+ return UserManager.getInstance().userExist(name);
+ }
+
/**
* Sets the player meta.
*
diff --git a/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/Util/Misc/StringUtils.java b/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/Util/Misc/StringUtils.java
index ea1f5512b3..367364883e 100644
--- a/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/Util/Misc/StringUtils.java
+++ b/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/Util/Misc/StringUtils.java
@@ -68,6 +68,17 @@ public boolean containsIgnorecase(String str1, String str2) {
return str1.toLowerCase().contains(str2.toLowerCase());
}
+ public boolean isDouble(String st) {
+ try {
+ @SuppressWarnings("unused")
+ double num = Double.parseDouble(st);
+ return true;
+
+ } catch (NumberFormatException ex) {
+ return false;
+ }
+ }
+
/**
* Checks if is int.
*
@@ -85,17 +96,6 @@ public boolean isInt(String st) {
return false;
}
}
-
- public boolean isDouble(String st) {
- try {
- @SuppressWarnings("unused")
- double num = Double.parseDouble(st);
- return true;
-
- } catch (NumberFormatException ex) {
- return false;
- }
- }
/**
* Replace ignore case.
@@ -123,16 +123,16 @@ public String replaceJavascript(CommandSender player, String text) {
return replaceJavascript(text, engine);
}
- public String replaceJavascript(Player player, String text) {
- JavascriptEngine engine = new JavascriptEngine().addPlayer(player);
- return replaceJavascript(replacePlaceHolders(player, text), engine);
- }
-
public String replaceJavascript(OfflinePlayer player, String text) {
JavascriptEngine engine = new JavascriptEngine().addPlayer(player);
return replaceJavascript(text, engine);
}
+ public String replaceJavascript(Player player, String text) {
+ JavascriptEngine engine = new JavascriptEngine().addPlayer(player);
+ return replaceJavascript(replacePlaceHolders(player, text), engine);
+ }
+
public String replaceJavascript(String text) {
return replaceJavascript(text, null);
}
diff --git a/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/Util/Prompt/PromptReturnString.java b/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/Util/Prompt/PromptReturnString.java
index e1006a1bd2..f1a821c708 100644
--- a/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/Util/Prompt/PromptReturnString.java
+++ b/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/Util/Prompt/PromptReturnString.java
@@ -16,8 +16,7 @@ public abstract class PromptReturnString extends StringPrompt {
/*
* (non-Javadoc)
*
- * @see
- * org.bukkit.conversations.Prompt#acceptInput(org.bukkit.conversations.
+ * @see org.bukkit.conversations.Prompt#acceptInput(org.bukkit.conversations.
* ConversationContext, java.lang.String)
*/
@Override
@@ -31,8 +30,7 @@ public Prompt acceptInput(ConversationContext context, String input) {
/*
* (non-Javadoc)
*
- * @see
- * org.bukkit.conversations.Prompt#getPromptText(org.bukkit.conversations
+ * @see org.bukkit.conversations.Prompt#getPromptText(org.bukkit.conversations
* .ConversationContext)
*/
@Override
diff --git a/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/Util/ValueRequest/Requesters/NumberRequester.java b/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/Util/ValueRequest/Requesters/NumberRequester.java
index 65706a603a..806e1f21d2 100644
--- a/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/Util/ValueRequest/Requesters/NumberRequester.java
+++ b/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/Util/ValueRequest/Requesters/NumberRequester.java
@@ -61,8 +61,9 @@ public NumberRequester() {
* @param listener
* the listener
*/
- public void request(Player player, InputMethod method, String currentValue, LinkedHashMap options,
- String promptText, boolean allowCustomOption, NumberListener listener) {
+ public void request(Player player, InputMethod method, String currentValue,
+ LinkedHashMap options, String promptText, boolean allowCustomOption,
+ NumberListener listener) {
if ((options == null || options.size() == 0) && method.equals(InputMethod.INVENTORY) && allowCustomOption) {
method = InputMethod.ANVIL;
}
diff --git a/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/Util/ValueRequest/Requesters/StringRequester.java b/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/Util/ValueRequest/Requesters/StringRequester.java
index 3d314473eb..a2d68e038c 100644
--- a/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/Util/ValueRequest/Requesters/StringRequester.java
+++ b/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/Util/ValueRequest/Requesters/StringRequester.java
@@ -62,8 +62,9 @@ public StringRequester() {
* @param listener
* the listener
*/
- public void request(Player player, InputMethod method, String currentValue, LinkedHashMap options,
- String promptText, boolean allowCustomOption, StringListener listener) {
+ public void request(Player player, InputMethod method, String currentValue,
+ LinkedHashMap options, String promptText, boolean allowCustomOption,
+ StringListener listener) {
if ((options == null || options.size() == 0) && method.equals(InputMethod.INVENTORY) && allowCustomOption) {
method = InputMethod.ANVIL;
}
diff --git a/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/Util/ValueRequest/ValueRequestBuilder.java b/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/Util/ValueRequest/ValueRequestBuilder.java
index a121d129c4..8d69ff8e96 100644
--- a/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/Util/ValueRequest/ValueRequestBuilder.java
+++ b/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/Util/ValueRequest/ValueRequestBuilder.java
@@ -28,23 +28,14 @@ public ValueRequestBuilder(BooleanListener listener) {
booleanListener = listener;
}
- public ValueRequestBuilder(NumberListener listener, Number[] options) {
- numberListener = listener;
- numberOptions = options;
- }
-
- public ValueRequestBuilder(StringListener listener, String[] options) {
- stringListener = listener;
- stringOptions = options;
- }
-
- public ValueRequestBuilder(NumberListener listener, LinkedHashMap options) {
- numberListener = listener;
- numberItemOptions = options;
- }
+ public ValueRequestBuilder(LinkedHashMap options, final Listener listener) {
+ stringListener = new StringListener() {
- public ValueRequestBuilder(StringListener listener, LinkedHashMap options) {
- stringListener = listener;
+ @Override
+ public void onInput(Player player, String value) {
+ listener.onInput(player, value);
+ }
+ };
stringItemOptions = options;
}
@@ -58,6 +49,17 @@ public void onInput(Player player, boolean value) {
};
}
+ public ValueRequestBuilder(final Listener listener, LinkedHashMap options) {
+ numberListener = new NumberListener() {
+
+ @Override
+ public void onInput(Player player, Number value) {
+ listener.onInput(player, value);
+ }
+ };
+ numberItemOptions = options;
+ }
+
public ValueRequestBuilder(final Listener listener, Number[] options) {
numberListener = new NumberListener() {
@@ -80,28 +82,26 @@ public void onInput(Player player, String value) {
stringOptions = options;
}
- public ValueRequestBuilder(final Listener listener, LinkedHashMap options) {
- numberListener = new NumberListener() {
-
- @Override
- public void onInput(Player player, Number value) {
- listener.onInput(player, value);
- }
- };
+ public ValueRequestBuilder(NumberListener listener, LinkedHashMap options) {
+ numberListener = listener;
numberItemOptions = options;
}
- public ValueRequestBuilder(LinkedHashMap options, final Listener listener) {
- stringListener = new StringListener() {
+ public ValueRequestBuilder(NumberListener listener, Number[] options) {
+ numberListener = listener;
+ numberOptions = options;
+ }
- @Override
- public void onInput(Player player, String value) {
- listener.onInput(player, value);
- }
- };
+ public ValueRequestBuilder(StringListener listener, LinkedHashMap options) {
+ stringListener = listener;
stringItemOptions = options;
}
+ public ValueRequestBuilder(StringListener listener, String[] options) {
+ stringListener = listener;
+ stringOptions = options;
+ }
+
public ValueRequestBuilder allowCustomOption(boolean allowCustomOption) {
this.allowCustomOption = allowCustomOption;
return this;
diff --git a/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/mysql/MySQL.java b/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/mysql/MySQL.java
index f5921465f1..eca43230af 100644
--- a/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/mysql/MySQL.java
+++ b/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/mysql/MySQL.java
@@ -43,7 +43,7 @@ public ArrayList load(String key) {
private String name;
- private Set uuids = (Set) Collections.synchronizedSet(new HashSet());
+ private Set uuids = Collections.synchronizedSet(new HashSet());
private boolean useBatchUpdates = true;
@@ -250,6 +250,15 @@ public ArrayList getRowsQuery() {
return result;
}
+ public Set getUuids() {
+ if (uuids == null || uuids.size() == 0) {
+ uuids.clear();
+ uuids.addAll(getUuidsQuery());
+ return uuids;
+ }
+ return uuids;
+ }
+
public ArrayList getUuidsQuery() {
ArrayList uuids = new ArrayList();
@@ -261,15 +270,6 @@ public ArrayList getUuidsQuery() {
return uuids;
}
- public Set getUuids() {
- if (uuids == null || uuids.size() == 0) {
- uuids.clear();
- uuids.addAll(getUuidsQuery());
- return uuids;
- }
- return uuids;
- }
-
public synchronized void insert(String index, String column, Object value, DataType dataType) {
insertQuery(index, column, value, dataType);
@@ -289,6 +289,10 @@ public synchronized void insertQuery(String index, String column, Object value,
}
}
+ public boolean isUseBatchUpdates() {
+ return useBatchUpdates;
+ }
+
public void loadData() {
columns = getColumnsQueury();
@@ -300,10 +304,6 @@ public void loadData() {
}
}
- public boolean isUseBatchUpdates() {
- return useBatchUpdates;
- }
-
public void loadPlayer(String uuid) {
table.put(uuid, getExactQuery(new Column("uuid", uuid, DataType.STRING)));
if (uuids.contains(uuid)) {
@@ -311,6 +311,12 @@ public void loadPlayer(String uuid) {
}
}
+ public void loadPlayerIfNeeded(String uuid) {
+ if (!containsKey(uuid)) {
+ loadPlayer(uuid);
+ }
+ }
+
public void removePlayer(String uuid) {
table.remove(uuid);
}
@@ -385,10 +391,4 @@ public synchronized void updateBatch() {
}
}
-
- public void loadPlayerIfNeeded(String uuid) {
- if (!containsKey(uuid)) {
- loadPlayer(uuid);
- }
- }
}
diff --git a/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/mysql/api/ConnectionManager.java b/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/mysql/api/ConnectionManager.java
index 2cf66d5d7b..6e0d022869 100644
--- a/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/mysql/api/ConnectionManager.java
+++ b/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/mysql/api/ConnectionManager.java
@@ -17,7 +17,7 @@ public class ConnectionManager {
private String database;
private int connectionTimeout;
private int maximumPoolsize;
- //private int maxConnections;
+ // private int maxConnections;
public ConnectionManager(String host, String port, String username, String password, String database) {
this.host = host;
@@ -27,7 +27,7 @@ public ConnectionManager(String host, String port, String username, String passw
this.database = database;
connectionTimeout = 20000;
maximumPoolsize = 5;
- //maxConnections = 1;
+ // maxConnections = 1;
}
@@ -44,7 +44,7 @@ public ConnectionManager(String host, String port, String username, String passw
} else {
maximumPoolsize = 5;
}
- //this.maxConnections = maxConnections;
+ // this.maxConnections = maxConnections;
}
public ConnectionManager(String host, String port, String username, String password, String database,
@@ -56,7 +56,7 @@ public ConnectionManager(String host, String port, String username, String passw
this.database = database;
this.connectionTimeout = connectionTimeout;
this.maximumPoolsize = maximumPoolsize;
- //this.maxConnections = maxConnections;
+ // this.maxConnections = maxConnections;
}
public void close() {
@@ -72,7 +72,7 @@ public Connection getConnection() {
if (isClosed()) {
AdvancedCoreHook.getInstance().debug("Connection closed... opening....");
open();
- }
+ }
return dataSource.getConnection();
} catch (SQLException e) {
e.printStackTrace();
diff --git a/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/mysql/api/queries/InsertQuery.java b/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/mysql/api/queries/InsertQuery.java
index b7819ac394..1a0f1bb6c6 100644
--- a/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/mysql/api/queries/InsertQuery.java
+++ b/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/mysql/api/queries/InsertQuery.java
@@ -85,8 +85,8 @@ public InsertQuery set(String column, String value) {
}
/**
- * Set a column to insert to. Automatically sets the value to ? to be used
- * with prepared statements.
+ * Set a column to insert to. Automatically sets the value to ? to be used with
+ * prepared statements.
*
* @param column
* the column to insert to
diff --git a/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/mysql/api/queries/UpdateQuery.java b/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/mysql/api/queries/UpdateQuery.java
index c6b7f417c3..20faf55a1f 100644
--- a/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/mysql/api/queries/UpdateQuery.java
+++ b/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/mysql/api/queries/UpdateQuery.java
@@ -60,11 +60,11 @@ public String build() {
}
/**
- * Set the value of a column. Automatically sets the value to ? to be used
- * with prepared statements.
+ * Set the value of a column. Automatically sets the value to ? to be used with
+ * prepared statements.
*
- * MySQLAPIBukkit does not do any interpretation so you have to add
- * apostrophes yourself.
+ * MySQLAPIBukkit does not do any interpretation so you have to add apostrophes
+ * yourself.
*
* @param column
* the column to set the value for
diff --git a/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/sql/DataType.java b/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/sql/DataType.java
index 24a5a97239..52ef86a2bb 100644
--- a/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/sql/DataType.java
+++ b/AdvancedCore/src/com/Ben12345rocks/AdvancedCore/sql/DataType.java
@@ -2,8 +2,6 @@
public enum DataType {
- STRING,
- INTEGER,
- FLOAT
+ STRING, INTEGER, FLOAT
}