mirror of
https://github.com/YouHaveTrouble/CommandWhitelist.git
synced 2026-05-11 22:16:57 +00:00
placeholder for executed command for bukkit and waterfall version
This commit is contained in:
+8
-2
@@ -6,7 +6,9 @@ import eu.endermite.commandwhitelist.common.ConfigCache;
|
||||
import eu.endermite.commandwhitelist.common.commands.CWCommand;
|
||||
import eu.endermite.commandwhitelist.waterfall.CommandWhitelistWaterfall;
|
||||
import net.kyori.adventure.platform.bungeecord.BungeeAudiences;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.event.ChatEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
|
||||
@@ -15,7 +17,7 @@ import java.util.HashSet;
|
||||
public class BungeeChatEventListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onChatEvent(net.md_5.bungee.api.event.ChatEvent event) {
|
||||
public void onChatEvent(ChatEvent event) {
|
||||
if (event.isCancelled()) return;
|
||||
if (!(event.getSender() instanceof ProxiedPlayer)) return;
|
||||
if (!event.isProxyCommand()) return;
|
||||
@@ -32,7 +34,11 @@ public class BungeeChatEventListener implements Listener {
|
||||
HashSet<String> commands = CommandWhitelistWaterfall.getCommands(player);
|
||||
if (!commands.contains(label)) {
|
||||
event.setCancelled(true);
|
||||
CommandWhitelistWaterfall.getAudiences().player(player).sendMessage(CWCommand.miniMessage.deserialize(configCache.prefix + CommandWhitelistWaterfall.getCommandDeniedMessage(label)));
|
||||
Component message = CWCommand.getParsedErrorMessage(
|
||||
command,
|
||||
configCache.prefix + CommandWhitelistWaterfall.getCommandDeniedMessage(label)
|
||||
);
|
||||
audiences.player(player).sendMessage(message);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user