Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

# Setup Java
- name: Set up JDK
uses: actions/setup-java@v2.3.0
with:
distribution: 'adopt'
# Use Java 16, because it's minimum required version by Geyser
java-version: 16
cache: 'maven'

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ jobs:
uses: actions/setup-java@v2.3.0
with:
distribution: 'adopt'
# Use Java 11, because it's minimum required version
java-version: 11
# Use Java 16, because it's minimum required version by Geyser
java-version: 16
cache: 'maven'

# Build and test (included in package)
Expand Down
8 changes: 8 additions & 0 deletions bukkit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,14 @@
<scope>provided</scope>
</dependency>

<!-- Bedrock player bridge, used for low level checks -->
<dependency>
<groupId>org.geysermc</groupId>
<artifactId>connector</artifactId>
<version>1.4.3-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

<!--Login Plugins-->
<dependency>
<groupId>fr.xephi</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
import com.github.games647.fastlogin.bukkit.task.DelayedAuthHook;
import com.github.games647.fastlogin.core.CommonUtil;
import com.github.games647.fastlogin.core.PremiumStatus;
import com.github.games647.fastlogin.core.hooks.FloodgateService;
import com.github.games647.fastlogin.core.hooks.bedrock.BedrockService;
import com.github.games647.fastlogin.core.hooks.bedrock.FloodgateService;
import com.github.games647.fastlogin.core.hooks.bedrock.GeyserService;
import com.github.games647.fastlogin.core.shared.FastLoginCore;
import com.github.games647.fastlogin.core.shared.PlatformPlugin;

Expand All @@ -53,6 +55,7 @@
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.geysermc.connector.GeyserConnector;
import org.geysermc.floodgate.api.FloodgateApi;
import org.slf4j.Logger;

Expand All @@ -71,6 +74,7 @@ public class FastLoginBukkit extends JavaPlugin implements PlatformPlugin<Comman
private final BukkitScheduler scheduler;
private FastLoginCore<Player, CommandSender, FastLoginBukkit> core;
private FloodgateService floodgateService;
private GeyserService geyserService;

private PremiumPlaceholder premiumPlaceholder;

Expand Down Expand Up @@ -146,6 +150,10 @@ public void onEnable() {
}

private boolean initializeFloodgate() {
if (getServer().getPluginManager().getPlugin("Geyser-Spigot") != null) {
geyserService = new GeyserService(GeyserConnector.getInstance(), core);
}

if (getServer().getPluginManager().getPlugin("floodgate") != null) {
floodgateService = new FloodgateService(FloodgateApi.getInstance(), core);

Expand Down Expand Up @@ -276,11 +284,22 @@ public boolean isPluginInstalled(String name) {
return Bukkit.getServer().getPluginManager().getPlugin(name) != null;
}

@Override
public FloodgateService getFloodgateService() {
return floodgateService;
}

public GeyserService getGeyserService() {
return geyserService;
}

@Override
public BedrockService<?> getBedrockService() {
if (floodgateService != null) {
return floodgateService;
}
return geyserService;
}

/**
* Send warning messages to log if incompatible plugins are used
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import com.github.games647.fastlogin.bukkit.FastLoginBukkit;
import com.github.games647.fastlogin.bukkit.task.FloodgateAuthTask;
import com.github.games647.fastlogin.bukkit.task.ForceLoginTask;
import com.github.games647.fastlogin.core.hooks.FloodgateService;
import com.github.games647.fastlogin.core.hooks.bedrock.FloodgateService;

import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
Expand Down Expand Up @@ -82,7 +82,7 @@ private void delayForceLogin(Player player) {
BukkitLoginSession session = plugin.getSession(player.getAddress());
FloodgateService floodgateService = plugin.getFloodgateService();
if (floodgateService != null) {
FloodgatePlayer floodgatePlayer = floodgateService.getFloodgatePlayer(player.getUniqueId());
FloodgatePlayer floodgatePlayer = floodgateService.getBedrockPlayer(player.getUniqueId());
if (floodgatePlayer != null) {
Runnable floodgateAuthTask = new FloodgateAuthTask(plugin.getCore(), player, floodgatePlayer);
Bukkit.getScheduler().runTaskAsynchronously(plugin, floodgateAuthTask);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class NameCheckTask extends JoinManagement<Player, CommandSender, Protoco

public NameCheckTask(FastLoginBukkit plugin, Random random, Player player, PacketEvent packetEvent,
String username, PublicKey publicKey) {
super(plugin.getCore(), plugin.getCore().getAuthPluginHook(), plugin.getFloodgateService());
super(plugin.getCore(), plugin.getCore().getAuthPluginHook(), plugin.getBedrockService());

this.plugin = plugin;
this.packetEvent = packetEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class ProtocolSupportListener extends JoinManagement<Player, CommandSende
private final RateLimiter rateLimiter;

public ProtocolSupportListener(FastLoginBukkit plugin, RateLimiter rateLimiter) {
super(plugin.getCore(), plugin.getCore().getAuthPluginHook(), plugin.getFloodgateService());
super(plugin.getCore(), plugin.getCore().getAuthPluginHook(), plugin.getBedrockService());

this.plugin = plugin;
this.rateLimiter = rateLimiter;
Expand Down
2 changes: 2 additions & 0 deletions bukkit/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ softdepend:
- ProtocolLib
# Premium variable
- PlaceholderAPI
# Bedrock Player Bridge
- Geyser-Spigot
- floodgate
# Auth plugins
- AuthMe
Expand Down
17 changes: 8 additions & 9 deletions bungee/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,6 @@
<scope>provided</scope>
</dependency>

<!-- Bedrock player bridge -->
<!-- Should be removed one Floodgate 2.0 gets a stable release -->
<dependency>
<groupId>org.geysermc</groupId>
<artifactId>floodgate-bungee</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

<!-- Bedrock player bridge -->
<!-- Version 2.0 -->
<dependency>
Expand All @@ -141,6 +132,14 @@
<scope>provided</scope>
</dependency>

<!-- Bedrock player bridge, used for low level checks -->
<dependency>
<groupId>org.geysermc</groupId>
<artifactId>connector</artifactId>
<version>1.4.3-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

<!--Login plugin-->
<dependency>
<groupId>me.vik1395</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
import com.github.games647.fastlogin.core.AsyncScheduler;
import com.github.games647.fastlogin.core.CommonUtil;
import com.github.games647.fastlogin.core.hooks.AuthPlugin;
import com.github.games647.fastlogin.core.hooks.FloodgateService;
import com.github.games647.fastlogin.core.hooks.bedrock.BedrockService;
import com.github.games647.fastlogin.core.hooks.bedrock.FloodgateService;
import com.github.games647.fastlogin.core.hooks.bedrock.GeyserService;
import com.github.games647.fastlogin.core.message.ChangePremiumMessage;
import com.github.games647.fastlogin.core.message.ChannelMessage;
import com.github.games647.fastlogin.core.message.NamespaceKey;
Expand All @@ -60,6 +62,7 @@
import net.md_5.bungee.api.plugin.PluginManager;
import net.md_5.bungee.api.scheduler.GroupedThreadFactory;

import org.geysermc.connector.GeyserConnector;
import org.geysermc.floodgate.api.FloodgateApi;
import org.slf4j.Logger;

Expand All @@ -73,6 +76,7 @@ public class FastLoginBungee extends Plugin implements PlatformPlugin<CommandSen
private FastLoginCore<ProxiedPlayer, CommandSender, FastLoginBungee> core;
private AsyncScheduler scheduler;
private FloodgateService floodgateService;
private GeyserService geyserService;
private Logger logger;

@Override
Expand All @@ -90,6 +94,10 @@ public void onEnable() {
floodgateService = new FloodgateService(FloodgateApi.getInstance(), core);
}

if (isPluginInstalled("Geyser-BungeeCord")) {
geyserService = new GeyserService(GeyserConnector.getInstance(), core);
}

//events
PluginManager pluginManager = getProxy().getPluginManager();

Expand Down Expand Up @@ -193,8 +201,19 @@ public boolean isPluginInstalled(String name) {
return getProxy().getPluginManager().getPlugin(name) != null;
}

@Override
public FloodgateService getFloodgateService() {
return floodgateService;
}

public GeyserService getGeyserService() {
return geyserService;
}

@Override
public BedrockService<?> getBedrockService() {
if (floodgateService != null) {
return floodgateService;
}
return geyserService;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import com.github.games647.fastlogin.bungee.task.ForceLoginTask;
import com.github.games647.fastlogin.core.RateLimiter;
import com.github.games647.fastlogin.core.StoredProfile;
import com.github.games647.fastlogin.core.hooks.FloodgateService;
import com.github.games647.fastlogin.core.hooks.bedrock.FloodgateService;
import com.github.games647.fastlogin.core.shared.LoginSession;
import com.google.common.base.Throwables;

Expand Down Expand Up @@ -186,7 +186,7 @@ public void onServerConnected(ServerConnectedEvent serverConnectedEvent) {

FloodgateService floodgateService = plugin.getFloodgateService();
if (floodgateService != null) {
FloodgatePlayer floodgatePlayer = floodgateService.getFloodgatePlayer(player.getUniqueId());
FloodgatePlayer floodgatePlayer = floodgateService.getBedrockPlayer(player.getUniqueId());
if (floodgatePlayer != null) {
Runnable floodgateAuthTask = new FloodgateAuthTask(plugin.getCore(), player, floodgatePlayer, server);
plugin.getScheduler().runAsync(floodgateAuthTask);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import com.github.games647.fastlogin.bungee.FastLoginBungee;
import com.github.games647.fastlogin.bungee.task.AsyncToggleMessage;
import com.github.games647.fastlogin.core.StoredProfile;
import com.github.games647.fastlogin.core.hooks.FloodgateService;
import com.github.games647.fastlogin.core.hooks.bedrock.FloodgateService;
import com.github.games647.fastlogin.core.message.ChangePremiumMessage;
import com.github.games647.fastlogin.core.message.NamespaceKey;
import com.github.games647.fastlogin.core.message.SuccessMessage;
Expand Down Expand Up @@ -121,7 +121,7 @@ private void onSuccessMessage(ProxiedPlayer forPlayer) {
FloodgateService floodgateService = plugin.getFloodgateService();
if (!shouldPersist && floodgateService != null) {
// always save floodgate players to lock this username
shouldPersist = floodgateService.isFloodgatePlayer(forPlayer.getUniqueId());
shouldPersist = floodgateService.isBedrockPlayer(forPlayer.getUniqueId());
}

if (shouldPersist) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class AsyncPremiumCheck extends JoinManagement<ProxiedPlayer, CommandSend

public AsyncPremiumCheck(FastLoginBungee plugin, PreLoginEvent preLoginEvent, PendingConnection connection,
String username) {
super(plugin.getCore(), plugin.getCore().getAuthPluginHook(), plugin.getFloodgateService());
super(plugin.getCore(), plugin.getCore().getAuthPluginHook(), plugin.getBedrockService());

this.plugin = plugin;
this.preLoginEvent = preLoginEvent;
Expand Down
3 changes: 3 additions & 0 deletions bungee/src/main/resources/bungee.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ softDepends:
- BungeeAuth
- BungeeCordAuthenticatorBungee
- SodionAuth
# Bedrock Player Bridge
- Geyser-BungeeCord
- floodgate

description: |
${project.description}
8 changes: 8 additions & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@
<scope>provided</scope>
</dependency>

<!-- Bedrock player bridge -->
<dependency>
<groupId>org.geysermc</groupId>
<artifactId>connector</artifactId>
<version>1.4.3-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

<!--Common component for contacting the Mojang API-->
<dependency>
<groupId>com.github.games647</groupId>
Expand Down
Loading