Revert "Move Floodgate conflict chechking to core"

This reverts commit b0ef1a59ac.
This commit is contained in:
Smart123s
2021-05-16 17:54:50 +02:00
parent b9dd921885
commit b2b61539e1
6 changed files with 24 additions and 63 deletions
-14
View File
@@ -53,12 +53,6 @@
<id>codemc-repo</id>
<url>https://repo.codemc.io/repository/maven-public/</url>
</repository>
<!-- Floodgate -->
<repository>
<id>nukkitx-snapshot</id>
<url>https://repo.nukkitx.com/maven-snapshots/</url>
</repository>
</repositories>
<dependencies>
@@ -98,14 +92,6 @@
<version>0.4</version>
</dependency>
<!--Floodgate for Xbox Live Authentication-->
<dependency>
<groupId>org.geysermc.floodgate</groupId>
<artifactId>api</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- APIs we can use because they are available in all platforms (Spigot, Bungee) -->
<dependency>
<groupId>com.google.guava</groupId>
@@ -33,9 +33,6 @@ import com.github.games647.fastlogin.core.shared.event.FastLoginPreLoginEvent;
import java.util.Optional;
import org.geysermc.floodgate.api.FloodgateApi;
import org.geysermc.floodgate.api.player.FloodgatePlayer;
import net.md_5.bungee.config.Configuration;
public abstract class JoinManagement<P extends C, C, S extends LoginSource> {
@@ -48,28 +45,8 @@ public abstract class JoinManagement<P extends C, C, S extends LoginSource> {
this.authHook = authHook;
}
public void onLogin(String username, S source, boolean floodgateAvailable) {
public void onLogin(String username, S source) {
core.getPlugin().getLog().info("Handling player {}", username);
// check if the player is connecting through Geyser
if (floodgateAvailable && getFloodgatePlayer(username) != null) {
if (core.getConfig().get("allowFloodgateNameConflict").toString().equalsIgnoreCase("false")) {
core.getPlugin().getLog().info(
"Bedrock Player {}'s name conflits an existing Java Premium Player's name",
username);
try {
source.kick("Your name conflits an existing Java Premium Player's name");
} catch (Exception e) {
e.printStackTrace();
core.getPlugin().getLog().error("Could not kick Player {}", username);
}
} else {
core.getPlugin().getLog().info("Skipping name conflict checking for player {}", username);
return;
}
}
StoredProfile profile = core.getStorage().loadProfile(username);
if (profile == null) {
return;
@@ -153,24 +130,6 @@ public abstract class JoinManagement<P extends C, C, S extends LoginSource> {
return false;
}
/**
* Get a FloodgatePlayyer by their name.
* This is not supported by FloodgateApi.
* <br>
* <b>WARNING: This method does not check if the floodgate plugin is actually installed on the server!</b>
* @param username the name of the player
* @return FloodgatePlayer if found, null if the player is not online
*/
protected static FloodgatePlayer getFloodgatePlayer(String username) {
// the Floodgate API requires UUID, which is inaccessible at NameCheckTask.java
for (FloodgatePlayer floodgatePlayer : FloodgateApi.getInstance().getPlayers()) {
if (floodgatePlayer.getUsername().equals(username)) {
return floodgatePlayer;
}
}
return null;
}
public abstract FastLoginPreLoginEvent callFastLoginPreLoginEvent(String username, S source, StoredProfile profile);