diff --git a/bukkit/pom.xml b/bukkit/pom.xml
index 4910e090..a19fc13f 100644
--- a/bukkit/pom.xml
+++ b/bukkit/pom.xml
@@ -209,6 +209,14 @@
provided
+
+
+ org.geysermc
+ connector
+ 1.4.3-SNAPSHOT
+ provided
+
+
fr.xephi
diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java
index 25e3d00a..15915cc0 100644
--- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java
+++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java
@@ -36,6 +36,7 @@ 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.GeyserService;
import com.github.games647.fastlogin.core.shared.FastLoginCore;
import com.github.games647.fastlogin.core.shared.PlatformPlugin;
@@ -53,6 +54,7 @@ import org.bukkit.command.CommandSender;
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;
@@ -71,6 +73,7 @@ public class FastLoginBukkit extends JavaPlugin implements PlatformPlugin core;
private FloodgateService floodgateService;
+ private GeyserService geyserService;
private PremiumPlaceholder premiumPlaceholder;
@@ -146,6 +149,10 @@ public class FastLoginBukkit extends JavaPlugin implements PlatformPluginprovided
+
+
+ org.geysermc
+ connector
+ 1.4.3-SNAPSHOT
+ provided
+
+
me.vik1395
diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/FastLoginBungee.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/FastLoginBungee.java
index 0dcd99e7..76547e6a 100644
--- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/FastLoginBungee.java
+++ b/bungee/src/main/java/com/github/games647/fastlogin/bungee/FastLoginBungee.java
@@ -34,6 +34,7 @@ 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.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;
@@ -60,6 +61,7 @@ import net.md_5.bungee.api.plugin.Plugin;
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;
@@ -73,6 +75,7 @@ public class FastLoginBungee extends Plugin implements PlatformPlugin core;
private AsyncScheduler scheduler;
private FloodgateService floodgateService;
+ private GeyserService geyserService;
private Logger logger;
@Override
@@ -90,6 +93,10 @@ public class FastLoginBungee extends Plugin implements PlatformPluginprovided
+
+
+ org.geysermc
+ connector
+ 1.4.3-SNAPSHOT
+ provided
+
+
com.github.games647
diff --git a/core/src/main/java/com/github/games647/fastlogin/core/hooks/GeyserService.java b/core/src/main/java/com/github/games647/fastlogin/core/hooks/GeyserService.java
new file mode 100644
index 00000000..cba87850
--- /dev/null
+++ b/core/src/main/java/com/github/games647/fastlogin/core/hooks/GeyserService.java
@@ -0,0 +1,74 @@
+/*
+ * SPDX-License-Identifier: MIT
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2015-2021
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.github.games647.fastlogin.core.hooks;
+
+import java.util.UUID;
+
+import com.github.games647.fastlogin.core.shared.FastLoginCore;
+
+import org.geysermc.connector.GeyserConnector;
+import org.geysermc.connector.network.session.GeyserSession;
+
+public class GeyserService {
+
+ private final GeyserConnector geyser;
+ private final FastLoginCore, ?, ?> core;
+
+ public GeyserService(GeyserConnector geyser, FastLoginCore, ?, ?> core) {
+ this.geyser = geyser;
+ this.core = core;
+ }
+
+ /**
+ * The Geyser API does not support querying players by name, so this function
+ * iterates over every online Geyser Player and checks if the requested
+ * username can be found
+ *
+ * @param username the name of the player
+ * @return GeyserSession if found, null otherwise
+ */
+ public GeyserSession getGeyserPlayer(String username) {
+ for (GeyserSession gSess : geyser.getSessionManager().getSessions().values()) {
+ if (gSess.getName().equals(username)) {
+ return gSess;
+ }
+ }
+
+ return null;
+ }
+
+ public GeyserSession getGeyserPlayer(UUID uuid) {
+ return geyser.getPlayerByUuid(uuid);
+ }
+
+ public boolean isGeyserPlayer(UUID uuid) {
+ return getGeyserPlayer(uuid) != null;
+ }
+
+ public boolean isGeyserConnection(String username) {
+ return getGeyserPlayer(username) != null;
+ }
+}
diff --git a/core/src/main/java/com/github/games647/fastlogin/core/shared/PlatformPlugin.java b/core/src/main/java/com/github/games647/fastlogin/core/shared/PlatformPlugin.java
index aba983a3..1268a865 100644
--- a/core/src/main/java/com/github/games647/fastlogin/core/shared/PlatformPlugin.java
+++ b/core/src/main/java/com/github/games647/fastlogin/core/shared/PlatformPlugin.java
@@ -27,6 +27,7 @@ package com.github.games647.fastlogin.core.shared;
import com.github.games647.fastlogin.core.AsyncScheduler;
import com.github.games647.fastlogin.core.hooks.FloodgateService;
+import com.github.games647.fastlogin.core.hooks.GeyserService;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.nio.file.Path;
@@ -56,6 +57,8 @@ public interface PlatformPlugin {
FloodgateService getFloodgateService();
+ GeyserService getGeyserService();
+
default ThreadFactory getThreadFactory() {
return new ThreadFactoryBuilder()
.setNameFormat(getName() + " Pool Thread #%1$d")
diff --git a/velocity/src/main/java/com/github/games647/fastlogin/velocity/FastLoginVelocity.java b/velocity/src/main/java/com/github/games647/fastlogin/velocity/FastLoginVelocity.java
index 68edf7a0..69ae0899 100644
--- a/velocity/src/main/java/com/github/games647/fastlogin/velocity/FastLoginVelocity.java
+++ b/velocity/src/main/java/com/github/games647/fastlogin/velocity/FastLoginVelocity.java
@@ -27,6 +27,7 @@ package com.github.games647.fastlogin.velocity;
import com.github.games647.fastlogin.core.AsyncScheduler;
import com.github.games647.fastlogin.core.hooks.FloodgateService;
+import com.github.games647.fastlogin.core.hooks.GeyserService;
import com.github.games647.fastlogin.core.message.ChangePremiumMessage;
import com.github.games647.fastlogin.core.message.ChannelMessage;
import com.github.games647.fastlogin.core.message.SuccessMessage;
@@ -144,6 +145,11 @@ public class FastLoginVelocity implements PlatformPlugin {
return null;
}
+ @Override
+ public GeyserService getGeyserService() {
+ return null;
+ }
+
public FastLoginCore getCore() {
return core;
}