This commit is contained in:
2024-08-12 17:38:49 +02:00
commit df7049a9ce
9 changed files with 452 additions and 0 deletions
@@ -0,0 +1,48 @@
package org.twipnetwork.hidePlugins;
import org.bukkit.ChatColor;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.Arrays;
import java.util.List;
public final class HidePlugins extends JavaPlugin implements Listener {
public static HidePlugins plugin;
private List<String> disabledCmds;
private String blockMsg;
@Override
public void onEnable() {
plugin = this;
saveDefaultConfig();
FileConfiguration config = getConfig();
blockMsg = ChatColor.translateAlternateColorCodes('&', config.getString("blockMsg", "&cYou are not allowed to use this command."));
disabledCmds = Arrays.asList(
"/pl", "/bukkit:pl", "/plugins", "/bukkit:plugins", "/ver", "/bukkit:ver", "/version", "/bukkit:version",
"/?", "/bukkit:?", "/help", "/bukkit:help", "/about", "/bukkit:about", "/icanhasbukkit", "/bukkit:icanhasbukkit"
);
this.getServer().getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onDisabledCommandExecution(PlayerCommandPreprocessEvent event) {
if (!event.getPlayer().hasPermission("hide_plugins.bypass")) {
String message = event.getMessage();
String[] array = message.split(" ");
if (disabledCmds.contains(array[0].toLowerCase())) {
event.getPlayer().sendMessage(blockMsg);
event.setCancelled(true);
}
}
}
}
+3
View File
@@ -0,0 +1,3 @@
# This message will be shown when a player tries to execute a blocked command.
# You can use color codes with '&' (e.g., &c for red).
blockMsg: "&cYou are not allowed to use this command."
+6
View File
@@ -0,0 +1,6 @@
name: HidePlugins
version: '1.0-1.21'
main: org.twipnetwork.hidePlugins.HidePlugins
api-version: '1.21'
authors: [ Akis ]
description: Hides plugins from players