mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-07-29 18:27:36 +02:00
Fix & Move allowFloodgateNameConflict=linked
This commit is contained in:
@ -31,14 +31,18 @@ public class FloodgateHook {
|
||||
*/
|
||||
public void checkNameConflict(String username, LoginSource source, FloodgatePlayer floodgatePlayer) {
|
||||
String allowConflict = plugin.getCore().getConfig().get("allowFloodgateNameConflict").toString().toLowerCase();
|
||||
if (allowConflict.equals("false")) {
|
||||
|
||||
// check if the Bedrock player is linked to a Java account
|
||||
boolean isLinked = floodgatePlayer.getLinkedPlayer() != null;
|
||||
|
||||
if (allowConflict.equals("false")
|
||||
|| allowConflict.equals("linked") && !isLinked) {
|
||||
|
||||
// check for conflicting Premium Java name
|
||||
Optional<Profile> premiumUUID = Optional.empty();
|
||||
try {
|
||||
premiumUUID = plugin.getCore().getResolver().findProfile(username);
|
||||
} catch (IOException | RateLimitException e) {
|
||||
e.printStackTrace();
|
||||
plugin.getLog().error(
|
||||
"Could not check wether Floodgate Player {}'s name conflicts a premium Java player's name.",
|
||||
username);
|
||||
@ -55,7 +59,6 @@ public class FloodgateHook {
|
||||
try {
|
||||
source.kick("Your name conflicts an existing Java Premium Player's name");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
plugin.getLog().error("Could not kick Player {}", username);
|
||||
}
|
||||
}
|
||||
|
@ -26,25 +26,10 @@ public class FloodgateAuthTask implements Runnable {
|
||||
plugin.getLog().info(
|
||||
"Player {} is connecting through Geyser Floodgate.",
|
||||
player.getName());
|
||||
String allowNameConflict = plugin.getCore().getConfig().get("allowFloodgateNameConflict").toString().toLowerCase();
|
||||
|
||||
// check if the Bedrock player is linked to a Java account
|
||||
boolean isLinked = floodgatePlayer.getLinkedPlayer() != null;
|
||||
if (allowNameConflict.equals("linked") && !isLinked) {
|
||||
plugin.getLog().info(
|
||||
"Bedrock Player {}'s name conflits an existing Java Premium Player's name",
|
||||
player.getName());
|
||||
|
||||
// kicking must be synchronous
|
||||
// https://www.spigotmc.org/threads/asynchronous-player-kick-problem.168580/
|
||||
Bukkit.getScheduler().runTask(plugin, new Runnable() {
|
||||
public void run() {
|
||||
player.kickPlayer("This name is allready in use by a Premium Java Player");
|
||||
}
|
||||
});
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
AuthPlugin<Player> authPlugin = plugin.getCore().getAuthPluginHook();
|
||||
|
||||
String autoLoginFloodgate = plugin.getCore().getConfig().get("autoLoginFloodgate").toString().toLowerCase();
|
||||
|
Reference in New Issue
Block a user