diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java
index 02cf0862..74d42207 100644
--- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java
+++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java
@@ -256,6 +256,7 @@ public class FastLoginBukkit extends JavaPlugin implements PlatformPlugin
* allowFloodgateNameConflict
* autoLoginFloodgate
+ * autoRegisterFloodgate
*
*
*
@@ -264,7 +265,7 @@ public class FastLoginBukkit extends JavaPlugin implements PlatformPlugin authPlugin = plugin.getCore().getAuthPluginHook();
String autoLoginFloodgate = plugin.getCore().getConfig().get("autoLoginFloodgate").toString().toLowerCase();
- boolean autoRegisterFloodgate = plugin.getCore().getConfig().getBoolean("autoRegisterFloodgate");
+ String autoRegisterFloodgate = plugin.getCore().getConfig().get("autoRegisterFloodgate").toString().toLowerCase();
+ String allowNameConflict = plugin.getCore().getConfig().get("allowFloodgateNameConflict").toString().toLowerCase();
boolean isRegistered;
try {
@@ -69,13 +74,39 @@ public class FloodgateAuthTask implements Runnable {
player.getName());
return;
}
-
- if (!isRegistered && !autoRegisterFloodgate) {
+
+ //decide if checks should be made for conflicting Java player names
+ if (!isLinked //linked players have the same name as their Java profile
+ // if allowNameConflict is 'false' or 'linked' and the player had a conflicting
+ // name, than they would have been kicked in FloodgateHook#checkNameConflict
+ && allowNameConflict.equals("true") &&
+ (
+ autoLoginFloodgate.equals("no-conflict")
+ || !isRegistered && autoRegisterFloodgate.equals("no-conflict"))
+ ) {
+ // check for conflicting Premium Java name
+ Optional premiumUUID = Optional.empty();
+ try {
+ premiumUUID = plugin.getCore().getResolver().findProfile(player.getName());
+ } catch (IOException | RateLimitException e) {
+ plugin.getLog().error(
+ "Could not check wether Floodgate Player {}'s name conflits a premium Java player's name.",
+ player.getName());
+ return;
+ }
+
+ //stop execution if player's name is conflicting
+ if (premiumUUID.isPresent()) {
+ return;
+ }
+ }
+
+ if (!isRegistered && autoRegisterFloodgate.equals("false")) {
plugin.getLog().info(
"Auto registration is disabled for Floodgate players in config.yml");
return;
}
-
+
// logging in from bedrock for a second time threw an error with UUID
StoredProfile profile = plugin.getCore().getStorage().loadProfile(player.getName());
if (profile == null) {
@@ -83,7 +114,7 @@ public class FloodgateAuthTask implements Runnable {
}
BukkitLoginSession session = new BukkitLoginSession(player.getName(), isRegistered, profile);
-
+
// enable auto login based on the value of 'autoLoginFloodgate' in config.yml
session.setVerified(autoLoginFloodgate.equals("true")
|| (autoLoginFloodgate.equals("linked") && isLinked));
diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/FastLoginBungee.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/FastLoginBungee.java
index e26b2710..9f4a598c 100644
--- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/FastLoginBungee.java
+++ b/bungee/src/main/java/com/github/games647/fastlogin/bungee/FastLoginBungee.java
@@ -50,7 +50,6 @@ import java.util.List;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ThreadFactory;
-import net.md_5.bungee.BungeeServerInfo;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.PendingConnection;
diff --git a/core/src/main/resources/config.yml b/core/src/main/resources/config.yml
index ecb1c44a..5164aa9c 100644
--- a/core/src/main/resources/config.yml
+++ b/core/src/main/resources/config.yml
@@ -194,9 +194,14 @@ autoLogin: true
# !!!!!!!! WARNING: FLOODGATE SUPPORT IS AN EXPERIMENTAL FEATURE !!!!!!!!
# Enabling any of these settings might lead to people gaining unauthorized access to other's accounts!
-# This enables auto login for every player connecting through Floodgate.
-# Possible values: false, true, linked
-# Linked means that only Bedrock accounts linked to a Java account will be logged in automatically
+# Automatically log in players connecting through Floodgate.
+# Possible values:
+# false: Disables auto login for every player connecting through Floodgate
+# true: Enables auto login for every player connecting through Floodgate
+# linked: Only Bedrock accounts that are linked to a Java account will be logged in automatically
+# no-conflict: Bedrock players will only be automatically logged in if the Mojang API reports
+# that there is no existing Premium Java MC account with their name.
+# This option can be useful if you are not using 'username-prefix' in floodgate/config.yml
# !!!!!!!! WARNING: FLOODGATE SUPPORT IS AN EXPERIMENTAL FEATURE !!!!!!!!
# Enabling this might lead to people gaining unauthorized access to other's accounts!
autoLoginFloodgate: false
@@ -225,8 +230,14 @@ autoLoginFloodgate: false
# Enabling this might lead to people gaining unauthorized access to other's accounts!
allowFloodgateNameConflict: false
-# This enables auto registering every player connecting through Floodgate.
-# autoLoginFloodgate must be 'true' for this to work
+# Automatically register players connecting through Floodgate.
+# autoLoginFloodgate must be available for the player to use this
+# Possible values:
+# false: Disables auto registering for every player connecting through Floodgate
+# true: Enables auto registering for every player connecting through Floodgate
+# no-conflict: Bedrock players will only be automatically registered if the Mojang API reports
+# that there is no existing Premium Java MC account with their name.
+# This option can be useful if you are not using 'username-prefix' in floodgate/config.yml
# !!!!!!!! WARNING: FLOODGATE SUPPORT IS AN EXPERIMENTAL FEATURE !!!!!!!!
# Enabling this might lead to people gaining unauthorized access to other's accounts!
autoRegisterFloodgate: false