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.
This commit is contained in:
2025-05-16 18:00:23 +02:00
parent 260656ad35
commit 717cfa8baf
@@ -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"));