|
47 | 47 | import com.github.games647.fastlogin.core.antibot.AntiBotService.Action; |
48 | 48 | import com.mojang.datafixers.util.Either; |
49 | 49 | import io.netty.channel.Channel; |
50 | | -import io.netty.channel.ChannelHandler; |
51 | 50 | import io.netty.util.AttributeKey; |
52 | 51 | import org.bukkit.entity.Player; |
53 | 52 | import org.geysermc.floodgate.api.player.FloodgatePlayer; |
@@ -117,14 +116,6 @@ public void onPacketReceiving(PacketEvent packetEvent) { |
117 | 116 | plugin.getLog().info("New incoming packet {} from {}", packetType, sender.getName()); |
118 | 117 | try { |
119 | 118 | 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 | | - |
128 | 119 | PacketContainer packet = packetEvent.getPacket(); |
129 | 120 |
|
130 | 121 | InetSocketAddress address = sender.getAddress(); |
@@ -308,43 +299,4 @@ private static Channel getChannel(Player player) { |
308 | 299 | return FuzzyReflection.getFieldValue(injector, Channel.class, true); |
309 | 300 | } |
310 | 301 |
|
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 | | - } |
350 | 302 | } |
0 commit comments