Skip to content

Commit dbe9ac2

Browse files
author
games647
authored
Merge pull request #525 from Smart123s/fg2-bc
Fix Floodgate 2.0 on BungeeCord
2 parents c1d3f27 + 1b7b2ff commit dbe9ac2

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

bungee/pom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,23 @@
124124
</dependency>
125125

126126
<!-- Bedrock player bridge -->
127+
<!-- Should be removed one Floodgate 2.0 gets a stable release -->
127128
<dependency>
128129
<groupId>org.geysermc</groupId>
129130
<artifactId>floodgate-bungee</artifactId>
130131
<version>1.0-SNAPSHOT</version>
131132
<scope>provided</scope>
132133
</dependency>
133134

135+
<!-- Bedrock player bridge -->
136+
<!-- Version 2.0 -->
137+
<dependency>
138+
<groupId>org.geysermc.floodgate</groupId>
139+
<artifactId>bungee</artifactId>
140+
<version>2.0-SNAPSHOT</version>
141+
<scope>provided</scope>
142+
</dependency>
143+
134144
<!--Login plugin-->
135145
<dependency>
136146
<groupId>me.vik1395</groupId>

bungee/src/main/java/com/github/games647/fastlogin/bungee/FastLoginBungee.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,15 @@ public void onEnable() {
8787

8888
//events
8989
PluginManager pluginManager = getProxy().getPluginManager();
90-
boolean floodgateAvail = pluginManager.getPlugin("floodgate") != null;
91-
ConnectListener connectListener = new ConnectListener(this, core.getRateLimiter(), floodgateAvail);
90+
91+
//check Floodgate version
92+
String floodgateVersion = "0";
93+
Plugin floodgatePlugin = pluginManager.getPlugin("floodgate");
94+
if (floodgatePlugin != null) {
95+
floodgatePlugin.getDescription().getVersion();
96+
}
97+
98+
ConnectListener connectListener = new ConnectListener(this, core.getRateLimiter(), floodgateVersion);
9299

93100
pluginManager.registerListener(this, connectListener);
94101
pluginManager.registerListener(this, new PluginMessageListener(this));

bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/ConnectListener.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,12 @@ public class ConnectListener implements Listener {
9898
private final FastLoginBungee plugin;
9999
private final RateLimiter rateLimiter;
100100
private final Property[] emptyProperties = {};
101-
private final boolean floodGateAvailable;
101+
private final String floodgateVersion;
102102

103-
public ConnectListener(FastLoginBungee plugin, RateLimiter rateLimiter, boolean floodgateAvailable) {
103+
public ConnectListener(FastLoginBungee plugin, RateLimiter rateLimiter, String floodgateVersion) {
104104
this.plugin = plugin;
105105
this.rateLimiter = rateLimiter;
106-
this.floodGateAvailable = floodgateAvailable;
106+
this.floodgateVersion = floodgateVersion;
107107
}
108108

109109
@EventHandler
@@ -211,6 +211,12 @@ private boolean isBedrockPlayer(UUID correctedUUID) {
211211
// Floodgate will set a correct UUID at the beginning of the PreLoginEvent
212212
// and will cancel the online mode login for those players
213213
// Therefore we just ignore those
214-
return floodGateAvailable && FloodgateAPI.isBedrockPlayer(correctedUUID);
214+
if (floodgateVersion.startsWith("1")) {
215+
return FloodgateAPI.isBedrockPlayer(correctedUUID);
216+
} else if (floodgateVersion.startsWith("2")) {
217+
return FloodgateAPI.isBedrockPlayer(correctedUUID);
218+
}
219+
220+
return false;
215221
}
216222
}

0 commit comments

Comments
 (0)