|
21 | 21 | {
|
22 | 22 | CommandEvent event = new CommandEvent(icommand, p_71556_1_, astring);
|
23 | 23 | if (MinecraftForge.EVENT_BUS.post(event))
|
24 |
| -@@ -134,11 +139,30 @@ |
| 24 | +@@ -134,9 +139,28 @@ |
25 | 25 |
|
26 | 26 | public ICommand registerCommand(ICommand p_71560_1_)
|
27 | 27 | {
|
28 |
| -- List list = p_71560_1_.getCommandAliases(); |
29 |
| -- this.commandMap.put(p_71560_1_.getCommandName(), p_71560_1_); |
30 |
| -- this.commandSet.add(p_71560_1_); |
31 | 28 | + // Cauldron start - register commands with permission nodes, defaulting to class name
|
32 | 29 | + return registerCommand(p_71560_1_, p_71560_1_.getClass().getName());
|
33 | 30 | + }
|
34 |
| - |
| 31 | ++ |
35 | 32 | + public ICommand registerCommand(String permissionGroup, ICommand par1ICommand)
|
36 | 33 | + {
|
37 | 34 | + return registerCommand(par1ICommand, permissionGroup + "." + par1ICommand.getCommandName());
|
38 | 35 | + }
|
39 | 36 | +
|
40 |
| -+ public ICommand registerCommand(ICommand par1ICommand, String permissionNode) |
| 37 | ++ public ICommand registerCommand(ICommand p_71560_1_, String permissionNode) |
41 | 38 | + {
|
42 |
| -+ List list = par1ICommand.getCommandAliases(); |
43 |
| -+ this.commandMap.put(par1ICommand.getCommandName(), par1ICommand); |
44 |
| -+ this.commandSet.add(par1ICommand); |
| 39 | + List list = p_71560_1_.getCommandAliases(); |
| 40 | + this.commandMap.put(p_71560_1_.getCommandName(), p_71560_1_); |
| 41 | + this.commandSet.add(p_71560_1_); |
45 | 42 | + // register vanilla commands with Bukkit to support permissions.
|
46 | 43 | + CraftSimpleCommandMap commandMap = FMLCommonHandler.instance().getMinecraftServerInstance().server.getCraftCommandMap();
|
47 |
| -+ ModCustomCommand customCommand = new ModCustomCommand(par1ICommand.getCommandName()); |
| 44 | ++ ModCustomCommand customCommand = new ModCustomCommand(p_71560_1_.getCommandName()); |
48 | 45 | + customCommand.setPermission(permissionNode);
|
49 |
| - if (list != null) |
50 |
| -+ customCommand.setAliases(list); |
51 |
| -+ commandMap.register(par1ICommand.getCommandName(), customCommand); |
52 |
| -+ LogManager.getLogger().info("Registered command " + par1ICommand.getCommandName() + " with permission node " + permissionNode); |
53 |
| -+ |
54 | 46 | + if (list != null)
|
55 |
| - { |
56 |
| - Iterator iterator = list.iterator(); |
57 |
| - |
58 |
| -@@ -149,13 +173,14 @@ |
| 47 | ++ customCommand.setAliases(list); |
| 48 | ++ commandMap.register(p_71560_1_.getCommandName(), customCommand); |
| 49 | ++ LogManager.getLogger().info("Registered command " + p_71560_1_.getCommandName() + " with permission node " + permissionNode); |
59 | 50 |
|
60 |
| - if (icommand1 == null || !icommand1.getCommandName().equals(s)) |
61 |
| - { |
62 |
| -- this.commandMap.put(s, p_71560_1_); |
63 |
| -+ this.commandMap.put(s, par1ICommand); |
64 |
| - } |
65 |
| - } |
66 |
| - } |
| 51 | + if (list != null) |
| 52 | + { |
| 53 | +@@ -156,6 +180,7 @@ |
67 | 54 |
|
68 |
| -- return p_71560_1_; |
69 |
| -+ return par1ICommand; |
| 55 | + return p_71560_1_; |
70 | 56 | }
|
71 | 57 | + // Cauldron end
|
72 | 58 |
|
|
0 commit comments