mirror of
https://github.com/barkeser2002/Tenet.git
synced 2026-09-25 15:46:15 +03:00
61 lines
2.5 KiB
Diff
61 lines
2.5 KiB
Diff
--- ../src-base/minecraft/net/minecraft/command/CommandHandler.java
|
|
+++ ../src-work/minecraft/net/minecraft/command/CommandHandler.java
|
|
@@ -16,6 +16,11 @@
|
|
|
|
import net.minecraftforge.common.MinecraftForge;
|
|
import net.minecraftforge.event.CommandEvent;
|
|
+// Cauldron start
|
|
+import org.bukkit.craftbukkit.command.CraftSimpleCommandMap;
|
|
+import org.bukkit.craftbukkit.command.ModCustomCommand;
|
|
+import cpw.mods.fml.common.FMLCommonHandler;
|
|
+// Cauldron end
|
|
|
|
public class CommandHandler implements ICommandManager
|
|
{
|
|
@@ -48,7 +53,7 @@
|
|
throw new CommandNotFoundException();
|
|
}
|
|
|
|
- if (icommand.canCommandSenderUseCommand(p_71556_1_))
|
|
+ if (true || icommand.canCommandSenderUseCommand(p_71556_1_)) // Cauldron start - disable check for permissions since we handle it on Bukkit side
|
|
{
|
|
CommandEvent event = new CommandEvent(icommand, p_71556_1_, astring);
|
|
if (MinecraftForge.EVENT_BUS.post(event))
|
|
@@ -134,9 +139,28 @@
|
|
|
|
public ICommand registerCommand(ICommand p_71560_1_)
|
|
{
|
|
+ // Cauldron start - register commands with permission nodes, defaulting to class name
|
|
+ return registerCommand(p_71560_1_, p_71560_1_.getClass().getName());
|
|
+ }
|
|
+
|
|
+ public ICommand registerCommand(String permissionGroup, ICommand par1ICommand)
|
|
+ {
|
|
+ return registerCommand(par1ICommand, permissionGroup + "." + par1ICommand.getCommandName());
|
|
+ }
|
|
+
|
|
+ public ICommand registerCommand(ICommand p_71560_1_, String permissionNode)
|
|
+ {
|
|
List list = p_71560_1_.getCommandAliases();
|
|
this.commandMap.put(p_71560_1_.getCommandName(), p_71560_1_);
|
|
this.commandSet.add(p_71560_1_);
|
|
+ // register vanilla commands with Bukkit to support permissions.
|
|
+ CraftSimpleCommandMap commandMap = FMLCommonHandler.instance().getMinecraftServerInstance().server.getCraftCommandMap();
|
|
+ ModCustomCommand customCommand = new ModCustomCommand(p_71560_1_.getCommandName());
|
|
+ customCommand.setPermission(permissionNode);
|
|
+ if (list != null)
|
|
+ customCommand.setAliases(list);
|
|
+ commandMap.register(p_71560_1_.getCommandName(), customCommand);
|
|
+ LogManager.getLogger().info("Registered command " + p_71560_1_.getCommandName() + " with permission node " + permissionNode);
|
|
|
|
if (list != null)
|
|
{
|
|
@@ -156,6 +180,7 @@
|
|
|
|
return p_71560_1_;
|
|
}
|
|
+ // Cauldron end
|
|
|
|
private static String[] dropFirstString(String[] p_71559_0_)
|
|
{
|