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 b2bc397c..bf47eec9 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 @@ -30,7 +30,6 @@ import com.github.games647.fastlogin.bukkit.command.CrackedCommand; import com.github.games647.fastlogin.bukkit.command.PremiumCommand; import com.github.games647.fastlogin.bukkit.listener.ConnectionListener; import com.github.games647.fastlogin.bukkit.listener.PaperCacheListener; -import com.github.games647.fastlogin.bukkit.listener.protocollib.ManualNameChange; import com.github.games647.fastlogin.bukkit.listener.protocollib.ProtocolLibListener; import com.github.games647.fastlogin.bukkit.listener.protocollib.SkinApplyListener; import com.github.games647.fastlogin.bukkit.listener.protocolsupport.ProtocolSupportListener; @@ -119,10 +118,6 @@ public class FastLoginBukkit extends JavaPlugin implements PlatformPlugin - * This is used as a workaround, because Floodgate fails to inject - * the prefixes when it's used together with ProtocolLib and FastLogin. - *
- * For more information visit: ... - */ -public class ManualNameChange extends PacketAdapter { - - private final FloodgateService floodgate; - - public ManualNameChange(FastLoginBukkit plugin, FloodgateService floodgate) { - super(params() - .plugin(plugin) - .types(START)); - - this.plugin = plugin; - this.floodgate = floodgate; - } - - public static void register(FastLoginBukkit plugin, FloodgateService floodgate) { - // they will be created with a static builder, because otherwise it will throw a NoClassDefFoundError - ProtocolLibrary.getProtocolManager() - .getAsynchronousManager() - .registerAsyncHandler(new ManualNameChange(plugin, floodgate)) - .start(); - } - - @Override - public void onPacketReceiving(PacketEvent packetEvent) { - PacketContainer packet = packetEvent.getPacket(); - String username = readUsername(packet); - - if (floodgate.getBedrockPlayer(username) == null) { - //not a Floodgate player, no need to add a prefix - return; - } - - packet.setMeta("original_name", username); - String prefixedName = FloodgateApi.getInstance().getPlayerPrefix() + username; - setUsername(packet, prefixedName); - } - - private void setUsername(PacketContainer packet, String name) { - if (packet.getGameProfiles().size() > 0) { - WrappedGameProfile updatedProfile = new WrappedGameProfile(UUID.randomUUID(), name); - packet.getGameProfiles().write(0, updatedProfile); - } else { - packet.getStrings().write(0, name); - } - } - - private String readUsername(PacketContainer packet) { - if (packet.getGameProfiles().size() > 0) { - return packet.getGameProfiles().read(0).getName(); - } else { - return packet.getStrings().read(0); - } - } -} diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/ProtocolLibListener.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/ProtocolLibListener.java index 5c345e6c..bdc64021 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/ProtocolLibListener.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/ProtocolLibListener.java @@ -219,11 +219,6 @@ public class ProtocolLibListener extends PacketAdapter { //remove old data every time on a new login in order to keep the session only for one person plugin.removeSession(player.getAddress()); - if (packetEvent.getPacket().getMeta("original_name").isPresent()) { - //username has been injected by ManualNameChange.java - username = (String) packetEvent.getPacket().getMeta("original_name").get(); - } - PacketContainer packet = packetEvent.getPacket(); val profileKey = packet.getOptionals(BukkitConverters.getWrappedPublicKeyDataConverter()) .optionRead(0); diff --git a/core/src/main/resources/config.yml b/core/src/main/resources/config.yml index 8ac92822..5132bb2b 100644 --- a/core/src/main/resources/config.yml +++ b/core/src/main/resources/config.yml @@ -236,8 +236,6 @@ autoLoginFloodgate: false # # To prevent conflicts from two different players having the same name, it is highly recommended using a # 'username-prefix' in floodgate/config.yml -# Note: 'username-prefix' is currently broken when used with FastLogin and ProtocolLib. -# A solution to this is to enable 'floodgatePrefixWorkaround' below. # # Possible values: # false: Kick Bedrock players, if they are using an existing Premium Java account's name @@ -264,14 +262,6 @@ allowFloodgateNameConflict: false # Enabling this might lead to people gaining unauthorized access to other's accounts! autoRegisterFloodgate: false -# Make FastLogin inject the Floodgate name prefixes, instead of Floodgate. -# This can fix prefixes, if you are using Floodgate alongside ProtocolLib. -# If either of those plugins are not installed, this option will have no effect. -# For more information visit: https://github.com/games647/FastLogin/issues/493 -# !!!!!!!! WARNING: FLOODGATE SUPPORT IS AN EXPERIMENTAL FEATURE !!!!!!!! -# Enabling this might lead to people gaining unauthorized access to other's accounts! -floodgatePrefixWorkaround: false - # This option resembles the vanilla configuration option 'enforce-secure-profile' in the 'server.properties' file. # It verifies if the incoming cryptographic key in the login request from the player is signed by Mojang. This key # is necessary for servers where you or other in-game players want to verify that a chat message sent and signed by