Skip to content
Open
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
6 changes: 3 additions & 3 deletions bukkit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@

<!-- ProtocolLib -->
<repository>
<id>dmulloy2-repo</id>
<id>dmulloy2-public</id>
<url>https://repo.dmulloy2.net/repository/public/</url>
</repository>

Expand Down Expand Up @@ -206,9 +206,9 @@

<!--Library for listening and sending Minecraft packets-->
<dependency>
<groupId>com.comphenix.protocol</groupId>
<groupId>net.dmulloy2</groupId>
<artifactId>ProtocolLib</artifactId>
<version>5.3.0</version>
<version>5.5.0-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.geysermc.floodgate.api.FloodgateApi;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.api.GeyserApi;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;

Expand Down Expand Up @@ -161,7 +161,7 @@ private void registerCommands() {

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

if (getServer().getPluginManager().getPlugin("floodgate") != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
import net.md_5.bungee.api.plugin.PluginManager;
import net.md_5.bungee.api.scheduler.GroupedThreadFactory;
import org.geysermc.floodgate.api.FloodgateApi;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.api.GeyserApi;
import org.slf4j.Logger;

import java.nio.file.Path;
Expand Down Expand Up @@ -92,7 +92,7 @@ public void onEnable() {
}

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

//events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@
import java.util.Optional;
import java.util.UUID;

/**
* @param <B> is an instance of either FloodgatePlayer or GeyserSession
*/
public abstract class BedrockService<B> {
public abstract class BedrockService<GeyserConnection> {

protected final FastLoginCore<?, ?, ?> core;
protected final String allowConflict;
Expand Down Expand Up @@ -107,11 +104,11 @@ private void kickPlayer(LoginSource source, String username, String message) {
* @param prefixedUsername the name of the player with the prefix appended
* @return Bedrock Player if found, null otherwise
*/
public B getBedrockPlayer(String prefixedUsername) {
public GeyserConnection getBedrockPlayer(String prefixedUsername) {
return null;
}

public B getBedrockPlayer(UUID uuid) {
public GeyserConnection getBedrockPlayer(UUID uuid) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,33 @@

import com.github.games647.fastlogin.core.shared.FastLoginCore;
import com.github.games647.fastlogin.core.shared.LoginSource;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.api.GeyserApi;
import org.geysermc.geyser.api.connection.GeyserConnection;
import org.geysermc.geyser.api.network.AuthType;
import org.geysermc.geyser.session.GeyserSession;

import java.util.UUID;

public class GeyserService extends BedrockService<GeyserSession> {
public class GeyserService extends BedrockService<GeyserConnection> {

private final GeyserImpl geyser;
private final GeyserApi geyser;
private final FastLoginCore<?, ?, ?> core;
private final AuthType authType;

public GeyserService(GeyserImpl geyser, FastLoginCore<?, ?, ?> core) {
public GeyserService(GeyserApi geyser, FastLoginCore<?, ?, ?> core) {
super(core);
this.geyser = geyser;
this.core = core;
this.authType = GeyserImpl.getInstance().getConfig().getRemote().authType();
}

@Override
public boolean performChecks(String username, LoginSource source) {
// AuthType.FLOODGATE will be handled by FloodgateService
AuthType authType = geyser.defaultRemoteServer().authType();
if (authType == AuthType.ONLINE) {
// authenticate everyone, as if they were Java players, since they have signed
// in through Mojang
return false;
}

if ("true".equals(allowConflict)) {
core.getPlugin().getLog().info("Skipping name conflict checking for player {}", username);
} else {
Expand All @@ -63,17 +63,17 @@ public boolean performChecks(String username, LoginSource source) {
}

@Override
public GeyserSession getBedrockPlayer(String username) {
for (GeyserSession gSess : geyser.getSessionManager().getAllSessions()) {
if (username.equals(gSess.getClientData().getUsername())) {
return gSess;
public GeyserConnection getBedrockPlayer(String username) {
for (GeyserConnection connection : geyser.onlineConnections()) {
if (username.equals(connection.name())) {
return connection;
}
}
return null;
}

@Override
public GeyserSession getBedrockPlayer(UUID uuid) {
public GeyserConnection getBedrockPlayer(UUID uuid) {
return geyser.connectionByUuid(uuid);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.geysermc.floodgate.api.FloodgateApi;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.api.GeyserApi;
import org.slf4j.Logger;

import java.io.IOException;
Expand Down Expand Up @@ -106,7 +106,7 @@ public void onProxyInitialization(ProxyInitializeEvent event) {
}

if (isPluginInstalled("Geyser-Velocity")) {
geyserService = new GeyserService(GeyserImpl.getInstance(), core);
geyserService = new GeyserService(GeyserApi.api(), core);
}

server.getEventManager().register(this, new ConnectListener(this, core.getAntiBotService()));
Expand Down