mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 09:26:08 +03:00
54 lines
2.1 KiB
Diff
54 lines
2.1 KiB
Diff
--- ../src-base/minecraft/net/minecraft/command/CommandHandler.java
|
|
+++ ../src-work/minecraft/net/minecraft/command/CommandHandler.java
|
|
@@ -3,6 +3,10 @@
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Maps;
|
|
import com.google.common.collect.Sets;
|
|
+
|
|
+import luohuayu.CatServer.command.CraftSimpleCommandMap;
|
|
+import luohuayu.CatServer.command.ModCustomCommand;
|
|
+
|
|
import java.util.Collections;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
@@ -14,6 +18,8 @@
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.util.text.TextComponentTranslation;
|
|
import net.minecraft.util.text.TextFormatting;
|
|
+import net.minecraftforge.fml.common.FMLCommonHandler;
|
|
+
|
|
import org.apache.logging.log4j.LogManager;
|
|
import org.apache.logging.log4j.Logger;
|
|
|
|
@@ -33,7 +39,7 @@
|
|
}
|
|
|
|
String[] astring = rawCommand.split(" ");
|
|
- String s = astring[0];
|
|
+ String s = astring[0].toLowerCase();
|
|
astring = dropFirstString(astring);
|
|
ICommand icommand = (ICommand)this.commandMap.get(s);
|
|
int i = this.getUsernameIndex(icommand, astring);
|
|
@@ -131,9 +137,21 @@
|
|
|
|
public ICommand registerCommand(ICommand command)
|
|
{
|
|
+ return registerCommand(command, command.getClass().getName());
|
|
+ }
|
|
+
|
|
+ public ICommand registerCommand(ICommand command, String permissionNode)
|
|
+ {
|
|
this.commandMap.put(command.getCommandName(), command);
|
|
this.commandSet.add(command);
|
|
|
|
+ // register vanilla commands with Bukkit to support permissions.
|
|
+ CraftSimpleCommandMap cbCommandMap = FMLCommonHandler.instance().getMinecraftServerInstance().server.getCraftCommandMap();
|
|
+ ModCustomCommand customCommand = new ModCustomCommand(command);
|
|
+ customCommand.setPermission(permissionNode);
|
|
+ if (command.getCommandAliases() != null) customCommand.setAliases(command.getCommandAliases());
|
|
+ cbCommandMap.register(command.getCommandName(), customCommand);
|
|
+
|
|
for (String s : command.getCommandAliases())
|
|
{
|
|
ICommand icommand = (ICommand)this.commandMap.get(s);
|