Skip to content

Commit 849c359

Browse files
committed
Revert ProtocolLib Floodgate Workarounds
1 parent c28c634 commit 849c359

1 file changed

Lines changed: 0 additions & 48 deletions

File tree

bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/ProtocolLibListener.java

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
import com.github.games647.fastlogin.core.antibot.AntiBotService.Action;
4848
import com.mojang.datafixers.util.Either;
4949
import io.netty.channel.Channel;
50-
import io.netty.channel.ChannelHandler;
5150
import io.netty.util.AttributeKey;
5251
import org.bukkit.entity.Player;
5352
import org.geysermc.floodgate.api.player.FloodgatePlayer;
@@ -117,14 +116,6 @@ public void onPacketReceiving(PacketEvent packetEvent) {
117116
plugin.getLog().info("New incoming packet {} from {}", packetType, sender.getName());
118117
try {
119118
if (packetType == START) {
120-
if (plugin.getFloodgateService() != null) {
121-
boolean success = processFloodgateTasks(packetEvent);
122-
if (!success) {
123-
// don't continue execution if the player was kicked by Floodgate
124-
return;
125-
}
126-
}
127-
128119
PacketContainer packet = packetEvent.getPacket();
129120

130121
InetSocketAddress address = sender.getAddress();
@@ -308,43 +299,4 @@ private static Channel getChannel(Player player) {
308299
return FuzzyReflection.getFieldValue(injector, Channel.class, true);
309300
}
310301

311-
/**
312-
* Reimplementation of the tasks injected Floodgate in ProtocolLib that are not run due to a bug
313-
* @see <a href="https://github.com/GeyserMC/Floodgate/issues/143">Issue Floodgate#143</a>
314-
* @see <a href="https://github.com/GeyserMC/Floodgate/blob/5d5713ed9e9eeab0f4abdaa9cf5cd8619dc1909b/spigot/src/main/java/org/geysermc/floodgate/addon/data/SpigotDataHandler.java#L121-L175">Floodgate/SpigotDataHandler</a>
315-
* @param packetEvent the PacketEvent that won't be processed by Floodgate
316-
* @return false if the player was kicked
317-
*/
318-
private boolean processFloodgateTasks(PacketEvent packetEvent) {
319-
PacketContainer packet = packetEvent.getPacket();
320-
Player player = packetEvent.getPlayer();
321-
FloodgatePlayer floodgatePlayer = getFloodgatePlayer(player);
322-
if (floodgatePlayer == null) {
323-
return true;
324-
}
325-
326-
// kick the player, if necessary
327-
Channel channel = getChannel(packetEvent.getPlayer());
328-
AttributeKey<String> kickMessageAttribute = AttributeKey.valueOf("floodgate-kick-message");
329-
String kickMessage = channel.attr(kickMessageAttribute).get();
330-
if (kickMessage != null) {
331-
player.kickPlayer(kickMessage);
332-
return false;
333-
}
334-
335-
// add prefix
336-
String username = floodgatePlayer.getCorrectUsername();
337-
if (packet.getGameProfiles().size() > 0) {
338-
packet.getGameProfiles().write(0,
339-
new WrappedGameProfile(floodgatePlayer.getCorrectUniqueId(), username));
340-
} else {
341-
packet.getStrings().write(0, username);
342-
}
343-
344-
// remove real Floodgate data handler
345-
ChannelHandler floodgateHandler = channel.pipeline().get("floodgate_data_handler");
346-
channel.pipeline().remove(floodgateHandler);
347-
348-
return true;
349-
}
350302
}

0 commit comments

Comments
 (0)