1
0
forked from xjboss/KCauldronX

修复Rcon发送命令可能报错的问题

This commit is contained in:
聪聪 2017-06-27 14:15:35 +08:00
parent 8b33262701
commit 42e2581b53

View File

@ -5,12 +5,14 @@ import static org.bukkit.util.Java15Compat.Arrays_copyOfRange;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import net.minecraft.command.ICommandSender; import net.minecraft.command.ICommandSender;
import net.minecraft.network.rcon.RConConsoleSource;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandException; import org.bukkit.command.CommandException;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender; import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.command.RemoteConsoleCommandSender;
import org.bukkit.command.SimpleCommandMap; import org.bukkit.command.SimpleCommandMap;
import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.entity.CraftPlayer;
@ -50,6 +52,9 @@ public class CraftSimpleCommandMap extends SimpleCommandMap {
{ {
FMLCommonHandler.instance().getMinecraftServerInstance().getCommandManager().executeCommand(this.vanillaConsoleSender, commandLine); FMLCommonHandler.instance().getMinecraftServerInstance().getCommandManager().executeCommand(this.vanillaConsoleSender, commandLine);
} }
else if (sender instanceof RemoteConsoleCommandSender){
FMLCommonHandler.instance().getMinecraftServerInstance().getCommandManager().executeCommand(RConConsoleSource.instance, commandLine);
}
else FMLCommonHandler.instance().getMinecraftServerInstance().getCommandManager().executeCommand(((CraftPlayer)sender).getHandle(), commandLine); else FMLCommonHandler.instance().getMinecraftServerInstance().getCommandManager().executeCommand(((CraftPlayer)sender).getHandle(), commandLine);
} }
else { else {