From 717cfa8baf6483122bbb64dc6d60f30fe46c4187 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 16 May 2025 18:00:23 +0200 Subject: [PATCH] Prevent usage of Flashback channels for restricted players Added new channel handlers to block Flashback mod channels for users without appropriate permissions. Ensures restricted players using these channels are disconnected with a specific warning message. This enhances control over mod usage and maintains server integrity. --- .../velocitycore/listeners/PluginMessage.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/VelocityCore/src/de/steamwar/velocitycore/listeners/PluginMessage.java b/VelocityCore/src/de/steamwar/velocitycore/listeners/PluginMessage.java index 7ef0be27..33e431fb 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/listeners/PluginMessage.java +++ b/VelocityCore/src/de/steamwar/velocitycore/listeners/PluginMessage.java @@ -33,6 +33,8 @@ import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier; import com.velocitypowered.proxy.protocol.ProtocolUtils; import de.steamwar.messages.Chatter; import de.steamwar.network.packets.NetworkPacket; +import de.steamwar.sql.SteamwarUser; +import de.steamwar.sql.UserPerm; import de.steamwar.velocitycore.VelocityCore; import de.steamwar.velocitycore.commands.TeamCommand; import de.steamwar.velocitycore.mods.*; @@ -360,6 +362,23 @@ public class PluginMessage extends BasicListener { )) channelRegisterHandlers.put(channel, player -> Chatter.disconnect(player).prefixless("MOD_YELLOW_SING", "minimap")); + for(String channel : Arrays.asList( + "flashback:remote_food_data", + "flashback:remote_set_slot", + "flashback:force_client_tick", + "flashback:accurate_entity_position", + "flashback:instantly_lerp", + "flashback:remote_experience", + "flashback:clear_particles", + "flashback:remote_select_hotbar_slot", // https://github.com/Moulberry/Flashback/tree/master/src/main/java/com/moulberry/flashback/packet + "flashback:clear_entities" // https://github.com/Moulberry/Flashback + )) + channelRegisterHandlers.put(channel, player -> { + if (!SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.RESTRICTED_MODS)) { + Chatter.disconnect(player).prefixless("MOD_YELLOW_SING", "flashback"); + } + }); + for(String channel : Arrays.asList("bedrockify:cauldron_particles", "bedrockify:eat-particles")) //https://github.com/juancarloscp52/BedrockIfy (Bedrock features on Java, banned for reach-around block placement) channelRegisterHandlers.put(channel, player -> Chatter.disconnect(player).prefixless("MOD_YELLOW_SING", "bedrockify"));