From 94299d254786abd5fcb5df517e097c8cee1f87ab Mon Sep 17 00:00:00 2001
From: Smart123s <28480228+Smart123s@users.noreply.github.com>
Date: Sat, 23 Oct 2021 13:24:40 +0200
Subject: [PATCH 1/2] Prefixed names for packet level Floodgate checks
---
.../games647/fastlogin/core/hooks/FloodgateService.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/core/src/main/java/com/github/games647/fastlogin/core/hooks/FloodgateService.java b/core/src/main/java/com/github/games647/fastlogin/core/hooks/FloodgateService.java
index 1db30aec..67dec01d 100644
--- a/core/src/main/java/com/github/games647/fastlogin/core/hooks/FloodgateService.java
+++ b/core/src/main/java/com/github/games647/fastlogin/core/hooks/FloodgateService.java
@@ -131,12 +131,12 @@ public class FloodgateService {
* iterates over every online FloodgatePlayer and checks if the requested
* username can be found
*
- * @param username the name of the player
+ * @param prefixedUsername the name of the player with the prefix appended
* @return FloodgatePlayer if found, null otherwise
*/
- public FloodgatePlayer getFloodgatePlayer(String username) {
+ public FloodgatePlayer getFloodgatePlayer(String prefixedUsername) {
for (FloodgatePlayer floodgatePlayer : FloodgateApi.getInstance().getPlayers()) {
- if (floodgatePlayer.getUsername().equals(username)) {
+ if (floodgatePlayer.getCorrectUsername().equals(prefixedUsername)) {
return floodgatePlayer;
}
}
From 9978fe69d525f899e5b827ad5bd1328770e6343a Mon Sep 17 00:00:00 2001
From: Smart123s <28480228+Smart123s@users.noreply.github.com>
Date: Sat, 23 Oct 2021 13:30:03 +0200
Subject: [PATCH 2/2] Fix Floodgate detection for buggy ProtocolLib
---
.../fastlogin/core/hooks/FloodgateService.java | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/core/src/main/java/com/github/games647/fastlogin/core/hooks/FloodgateService.java b/core/src/main/java/com/github/games647/fastlogin/core/hooks/FloodgateService.java
index 67dec01d..7677c1b5 100644
--- a/core/src/main/java/com/github/games647/fastlogin/core/hooks/FloodgateService.java
+++ b/core/src/main/java/com/github/games647/fastlogin/core/hooks/FloodgateService.java
@@ -130,11 +130,23 @@ public class FloodgateService {
* The FloodgateApi does not support querying players by name, so this function
* iterates over every online FloodgatePlayer and checks if the requested
* username can be found
+ *
+ * Falls back to non-prefixed name checks, if ProtocolLib is installed
*
* @param prefixedUsername the name of the player with the prefix appended
* @return FloodgatePlayer if found, null otherwise
*/
public FloodgatePlayer getFloodgatePlayer(String prefixedUsername) {
+ //prefixes are broken with ProtocolLib, so fall back to name checks without prefixes
+ //this should be removed if #493 gets fixed
+ if (core.getPlugin().isPluginInstalled("ProtocolLib")) {
+ for (FloodgatePlayer floodgatePlayer : FloodgateApi.getInstance().getPlayers()) {
+ if (floodgatePlayer.getUsername().equals(prefixedUsername)) {
+ return floodgatePlayer;
+ }
+ }
+ return null;
+ }
for (FloodgatePlayer floodgatePlayer : FloodgateApi.getInstance().getPlayers()) {
if (floodgatePlayer.getCorrectUsername().equals(prefixedUsername)) {
return floodgatePlayer;