* Spigot: https://www.spigotmc.org/resources/authme-reloaded.6269/
*/
public class AuthMeHook implements AuthPlugin {
- private final boolean v3APIAvailable;
-
- public AuthMeHook() {
- boolean apiAvailable = true;
- try {
- Class.forName("fr.xephi.authme.api.v3.AuthMeApi");
- } catch (ClassNotFoundException classNotFoundEx) {
- apiAvailable = false;
- }
-
- this.v3APIAvailable = apiAvailable;
- }
-
@Override
public boolean forceLogin(Player player) {
- if (v3APIAvailable) {
- //skips registration and login
- if (AuthMeApi.getInstance().isAuthenticated(player)) {
- return false;
- } else {
- AuthMeApi.getInstance().forceLogin(player);
- }
+ //skips registration and login
+ if (AuthMeApi.getInstance().isAuthenticated(player)) {
+ return false;
} else {
- //skips registration and login
- if (NewAPI.getInstance().isAuthenticated(player)) {
- return false;
- } else {
- NewAPI.getInstance().forceLogin(player);
- }
+ AuthMeApi.getInstance().forceLogin(player);
}
return true;
@@ -53,21 +31,13 @@ public class AuthMeHook implements AuthPlugin {
@Override
public boolean isRegistered(String playerName) throws Exception {
- if (v3APIAvailable) {
- return AuthMeApi.getInstance().isRegistered(playerName);
- }
-
- return NewAPI.getInstance().isRegistered(playerName);
+ return AuthMeApi.getInstance().isRegistered(playerName);
}
@Override
public boolean forceRegister(Player player, String password) {
//this automatically registers the player too
- if (v3APIAvailable) {
- AuthMeApi.getInstance().forceRegister(player, password);
- } else {
- NewAPI.getInstance().forceRegister(player, password);
- }
+ AuthMeApi.getInstance().forceRegister(player, password);
return true;
}
diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/CrazyLoginHook.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/CrazyLoginHook.java
index 0961d3c1..1c25a000 100644
--- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/CrazyLoginHook.java
+++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/CrazyLoginHook.java
@@ -21,7 +21,7 @@ import org.bukkit.entity.Player;
*
* Project page:
*
- * Bukkits: http://dev.bukkit.org/server-mods/crazylogin/
+ * Bukkit: https://dev.bukkit.org/server-mods/crazylogin/
*/
public class CrazyLoginHook implements AuthPlugin {
diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/LoginSecurityHook.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/LoginSecurityHook.java
index 879732f2..72150455 100644
--- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/LoginSecurityHook.java
+++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/LoginSecurityHook.java
@@ -8,8 +8,8 @@ import com.lenis0012.bukkit.loginsecurity.session.PlayerSession;
import com.lenis0012.bukkit.loginsecurity.session.action.LoginAction;
import com.lenis0012.bukkit.loginsecurity.session.action.RegisterAction;
-import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
+import org.bukkit.plugin.java.JavaPlugin;
/**
* Github: https://github.com/lenis0012/LoginSecurity-2 Project page:
@@ -19,7 +19,7 @@ import org.bukkit.entity.Player;
*/
public class LoginSecurityHook implements AuthPlugin {
- private final FastLoginBukkit plugin = (FastLoginBukkit) Bukkit.getPluginManager().getPlugin("FastLogin");
+ private final FastLoginBukkit plugin = JavaPlugin.getPlugin(FastLoginBukkit.class);
@Override
public boolean forceLogin(Player player) {
diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/UltraAuthHook.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/UltraAuthHook.java
index b3fdba9b..77217d36 100644
--- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/UltraAuthHook.java
+++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/UltraAuthHook.java
@@ -16,7 +16,7 @@ import ultraauth.managers.PlayerManager;
/**
* Project page:
*
- * Bukkit: http://dev.bukkit.org/bukkit-plugins/ultraauth-aa/
+ * Bukkit: https://dev.bukkit.org/bukkit-plugins/ultraauth-aa/
*
* Spigot: https://www.spigotmc.org/resources/ultraauth.17044/
*/
diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/ProtocolLibLoginSource.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/ProtocolLibLoginSource.java
index 8483b470..7d4eaf65 100644
--- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/ProtocolLibLoginSource.java
+++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/ProtocolLibLoginSource.java
@@ -41,7 +41,7 @@ public class ProtocolLibLoginSource implements LoginSource {
@Override
public void setOnlineMode() throws Exception {
//randomized server id to make sure the request is for our server
- //this could be relevant http://www.sk89q.com/2011/09/minecraft-name-spoofing-exploit/
+ //this could be relevant https://www.sk89q.com/2011/09/minecraft-name-spoofing-exploit/
serverId = Long.toString(random.nextLong(), 16);
verifyToken = EncryptionUtil.generateVerifyToken(random);
@@ -72,7 +72,7 @@ public class ProtocolLibLoginSource implements LoginSource {
private void sentEncryptionRequest() throws InvocationTargetException {
ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
- /**
+ /*
* Packet Information: http://wiki.vg/Protocol#Encryption_Request
*
* ServerID="" (String) key=public server key verifyToken=random 4 byte array
diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/VerifyResponseTask.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/VerifyResponseTask.java
index 6ce003c6..63a50200 100644
--- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/VerifyResponseTask.java
+++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/VerifyResponseTask.java
@@ -91,7 +91,7 @@ public class VerifyResponseTask implements Runnable {
}
//this makes sure the request from the client is for us
- //this might be r https://www.sk89q.com/2011/09/minecraft-name-spoofing-exploit/
+ //this might be relevant https://www.sk89q.com/2011/09/minecraft-name-spoofing-exploit/
String generatedId = session.getServerId();
String serverId = EncryptionUtil.getServerIdHashString(generatedId, loginKey, publicKey);
@@ -141,7 +141,7 @@ public class VerifyResponseTask implements Runnable {
}
//try to get the networkManager from ProtocolLib
- private Object getNetworkManager() throws IllegalAccessException, NoSuchFieldException, ClassNotFoundException {
+ private Object getNetworkManager() throws IllegalAccessException, ClassNotFoundException {
Object injectorContainer = TemporaryPlayerFactory.getInjectorFromPlayer(player);
//ChannelInjector
diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/tasks/DelayedAuthHook.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/tasks/DelayedAuthHook.java
index 03c3bc24..eb5656c9 100644
--- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/tasks/DelayedAuthHook.java
+++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/tasks/DelayedAuthHook.java
@@ -53,7 +53,7 @@ public class DelayedAuthHook implements Runnable {
for (Class extends AuthPlugin> clazz : supportedHooks) {
String pluginName = clazz.getSimpleName().replace("Hook", "");
//uses only member classes which uses AuthPlugin interface (skip interfaces)
- if (Bukkit.getServer().getPluginManager().getPlugin(pluginName) != null) {
+ if (Bukkit.getServer().getPluginManager().isPluginEnabled(pluginName)) {
//check only for enabled plugins. A single plugin could be disabled by plugin managers
authPluginHook = clazz.newInstance();
plugin.getLogger().log(Level.INFO, "Hooking into auth plugin: {0}", pluginName);
diff --git a/bukkit/src/main/resources/plugin.yml b/bukkit/src/main/resources/plugin.yml
index c266c75c..1121a13b 100644
--- a/bukkit/src/main/resources/plugin.yml
+++ b/bukkit/src/main/resources/plugin.yml
@@ -1,7 +1,7 @@
# project data for Bukkit in order to register our plugin with all it components
# ${-} are variables from Maven (pom.xml) which will be replaced after the build
name: ${project.parent.name}
-version: ${project.version}-git${git.commit.id}
+version: ${project.version}-${git.commit.id.abbrev}
main: ${project.groupId}.${project.artifactId}.${project.name}
# meta data for plugin managers
diff --git a/bungee/src/main/resources/bungee.yml b/bungee/src/main/resources/bungee.yml
index fbf8ee5f..3de34445 100644
--- a/bungee/src/main/resources/bungee.yml
+++ b/bungee/src/main/resources/bungee.yml
@@ -5,7 +5,7 @@ name: ${project.parent.name}
# ${-} will be automatically replaced by Maven
main: ${project.groupId}.${project.artifactId}.${project.name}
-version: ${project.version}-git${git.commit.id}
+version: ${project.version}-${git.commit.id.abbrev}
author: games647, https://github.com/games647/FastLogin/graphs/contributors
softDepends:
diff --git a/core/src/main/java/com/github/games647/fastlogin/core/CompatibleCacheBuilder.java b/core/src/main/java/com/github/games647/fastlogin/core/CompatibleCacheBuilder.java
index 6d311983..c093c88b 100644
--- a/core/src/main/java/com/github/games647/fastlogin/core/CompatibleCacheBuilder.java
+++ b/core/src/main/java/com/github/games647/fastlogin/core/CompatibleCacheBuilder.java
@@ -22,7 +22,6 @@ public class CompatibleCacheBuilder {
*
* @param Key type
* @param Value type
- *
* @return A new cache builder.
*/
public static CompatibleCacheBuilder newBuilder() {
@@ -30,7 +29,7 @@ public class CompatibleCacheBuilder {
}
private final CacheBuilder builder;
-
+
@SuppressWarnings("unchecked")
private CompatibleCacheBuilder() {
builder = (CacheBuilder) CacheBuilder.newBuilder();
@@ -46,16 +45,15 @@ public class CompatibleCacheBuilder {
* 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 value, you should always choose it
* explicitly.
*
* @param concurrencyLevel New concurrency level
* @return This for chaining
- *
* @throws IllegalArgumentException if {@code concurrencyLevel} is non-positive
- * @throws IllegalStateException if a concurrency level was already set
+ * @throws IllegalStateException if a concurrency level was already set
*/
public CompatibleCacheBuilder concurrencyLevel(int concurrencyLevel) {
builder.concurrencyLevel(concurrencyLevel);
@@ -67,23 +65,22 @@ public class CompatibleCacheBuilder {
* 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.
- *
+ *
*
* 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 absence 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
- * @param unit the unit that {@code duration} is expressed in
+ * @param unit the unit that {@code duration} is expressed in
* @return This for chaining
- *
* @throws IllegalArgumentException if {@code duration} is negative
- * @throws IllegalStateException if the time to idle or time to live was already set
+ * @throws IllegalStateException if the time to idle or time to live was already set
*/
public CompatibleCacheBuilder expireAfterAccess(long duration, TimeUnit unit) {
builder.expireAfterAccess(duration, unit);
@@ -93,23 +90,22 @@ public class CompatibleCacheBuilder {
/**
* 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.
- *
+ *
*
* 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 absence 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 automatically removed
- * @param unit the unit that {@code duration} is expressed in
+ * @param unit the unit that {@code duration} is expressed in
* @return This for chaining
- *
* @throws IllegalArgumentException if {@code duration} is negative
- * @throws IllegalStateException if the time to live or time to idle was already set
+ * @throws IllegalStateException if the time to live or time to idle was already set
*/
public CompatibleCacheBuilder expireAfterWrite(long duration, TimeUnit unit) {
builder.expireAfterWrite(duration, unit);
@@ -124,9 +120,8 @@ public class CompatibleCacheBuilder {
*
* @param initialCapacity - initial capacity
* @return This for chaining
- *
* @throws IllegalArgumentException if {@code initialCapacity} is negative
- * @throws IllegalStateException if an initial capacity was already set
+ * @throws IllegalStateException if an initial capacity was already set
*/
public CompatibleCacheBuilder initialCapacity(int initialCapacity) {
builder.initialCapacity(initialCapacity);
@@ -138,17 +133,16 @@ public class CompatibleCacheBuilder {
* 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 {@link #expireAfterWrite expireAfterWrite}{@code (0, unit)} or {@link #expireAfterAccess expireAfterAccess}{@code (0,
- * unit)}. It can be useful in testing, or to disable caching temporarily without a code change.
+ * unit)}. It can be useful in testing, or to disable caching temporarily without a code change.
*
* @param size the maximum size of the cache
* @return This for chaining
- *
* @throws IllegalArgumentException if {@code size} is negative
- * @throws IllegalStateException if a maximum size was already set
+ * @throws IllegalStateException if a maximum size was already set
*/
public CompatibleCacheBuilder maximumSize(int size) {
builder.maximumSize(size);
@@ -158,13 +152,13 @@ public class CompatibleCacheBuilder {
/**
* 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.
- *
+ *
*
* 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).
- *
+ *
*
* 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
@@ -173,17 +167,16 @@ public class CompatibleCacheBuilder {
* 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.
*
- * @param Key type
- * @param Value type
+ * @param Key type
+ * @param Value type
* @param listener - removal listener
* @return This for chaining
- *
* @throws IllegalStateException if a removal listener was already set
*/
@SuppressWarnings("unchecked")
@@ -195,14 +188,13 @@ public class CompatibleCacheBuilder {
/**
* Specifies a nanosecond-precision time source for use in determining when 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 {@link #expireAfterAccess}.
*
* @param ticker - ticker
* @return This for chaining
- *
* @throws IllegalStateException if a ticker was already set
*/
public CompatibleCacheBuilder ticker(Ticker ticker) {
@@ -215,18 +207,17 @@ public class CompatibleCacheBuilder {
* {@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.
- *
+ *
*
* Note: when this method is used, the resulting cache will use identity ({@code ==}) comparison to determine
* equality of values.
*
* @return This for chaining
- *
* @throws IllegalStateException if the value strength was already set
*/
public CompatibleCacheBuilder softValues() {
@@ -237,13 +228,12 @@ public class CompatibleCacheBuilder {
/**
* 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 identity ({@code ==}) comparison to
* determine equality of keys.
*
* @return This for chaining
- *
* @throws IllegalStateException if the key strength was already set
*/
public CompatibleCacheBuilder weakKeys() {
@@ -254,17 +244,16 @@ public class CompatibleCacheBuilder {
/**
* 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.
- *
+ *
*
* Note: when this method is used, the resulting cache will use identity ({@code ==}) comparison to determine
* equality of values.
*
* @return This for chaining
- *
* @throws IllegalStateException if the value strength was already set
*/
public CompatibleCacheBuilder weakValues() {
@@ -277,8 +266,8 @@ public class CompatibleCacheBuilder {
*
* We can't return the direct Cache instance as it changed in Guava 13.
*
- * @param Key type
- * @param Value type
+ * @param Key type
+ * @param Value type
* @param loader - cache loader
* @return The cache as a a map.
*/
diff --git a/core/src/main/java/com/github/games647/fastlogin/core/shared/FastLoginCore.java b/core/src/main/java/com/github/games647/fastlogin/core/shared/FastLoginCore.java
index 46d353e8..7f30ae71 100644
--- a/core/src/main/java/com/github/games647/fastlogin/core/shared/FastLoginCore.java
+++ b/core/src/main/java/com/github/games647/fastlogin/core/shared/FastLoginCore.java
@@ -203,11 +203,15 @@ public class FastLoginCore