当前位置: 首页>>代码示例>>Java>>正文


Java ICommandManager.executeCommand方法代码示例

本文整理汇总了Java中net.minecraft.command.ICommandManager.executeCommand方法的典型用法代码示例。如果您正苦于以下问题:Java ICommandManager.executeCommand方法的具体用法?Java ICommandManager.executeCommand怎么用?Java ICommandManager.executeCommand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.command.ICommandManager的用法示例。


在下文中一共展示了ICommandManager.executeCommand方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doAction

import net.minecraft.command.ICommandManager; //导入方法依赖的package包/类
@Override
public void doAction(World world, IStructure structure, Point3i worldPos) {
  if(commands.isEmpty()) {
    return;
  }
  MinecraftServer minecraftserver = MinecraftServer.getServer();
  if(minecraftserver != null) {           
    Point3i wp = getWorldPosition(structure, worldPos);            
    InnerSender sender = new InnerSender(world, structure, wp);      
    ICommandManager icommandmanager = minecraftserver.getCommandManager();
    
    boolean origValue = minecraftserver.worldServers[0].getGameRules().getGameRuleBooleanValue("commandBlockOutput");      
    minecraftserver.worldServers[0].getGameRules().setOrCreateGameRule("commandBlockOutput", "false");
    
    for(String cmd : commands) {
      icommandmanager.executeCommand(sender, cmd);
    }     
    
    minecraftserver.worldServers[0].getGameRules().setOrCreateGameRule("commandBlockOutput", origValue + "");
  }
}
 
开发者ID:SleepyTrousers,项目名称:Structures,代码行数:22,代码来源:ExecuteCommandAction.java

示例2: func_145755_a

import net.minecraft.command.ICommandManager; //导入方法依赖的package包/类
public void func_145755_a(World p_145755_1_)
{
    if (p_145755_1_.isClient)
    {
        this.field_145764_b = 0;
    }

    MinecraftServer var2 = MinecraftServer.getServer();

    if (var2 != null && var2.isCommandBlockEnabled())
    {
        ICommandManager var3 = var2.getCommandManager();
        this.field_145764_b = var3.executeCommand(this, this.field_145763_e);
    }
    else
    {
        this.field_145764_b = 0;
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:20,代码来源:CommandBlockLogic.java

示例3: runCommand

import net.minecraft.command.ICommandManager; //导入方法依赖的package包/类
@SuppressWarnings("unused")
public int runCommand(String... args) {
    if (FMLCommonHandler.instance().getMinecraftServerInstance() != null &&
            FMLCommonHandler.instance().getMinecraftServerInstance().isCallingFromMinecraftThread()) {
        if (reduxEngine.globalObjectExists("entity") && reduxEngine.getJavaObject("entity", Entity.class) instanceof Entity) {
            lastEntity = (Entity) reduxEngine.getJavaObject("entity", Entity.class);
        } else {
            lastEntity = null;
        }
        if (reduxEngine.globalObjectExists("world") && reduxEngine.getJavaObject("world", World.class) instanceof World) {
            lastWorld = (World) reduxEngine.getJavaObject("world", World.class);
        } else {
            lastWorld = null;
        }
        if (reduxEngine.globalObjectExists("pos") && reduxEngine.getJavaObject("pos", BlockPos.class) instanceof BlockPos) {
            lastBlockPos = (BlockPos) reduxEngine.getJavaObject("pos", BlockPos.class);
        } else {
            lastBlockPos = null;
        }
        ICommandManager manager = FMLCommonHandler.instance().getMinecraftServerInstance().getCommandManager();
        manager.executeCommand(this, StringUtils.join(args));
    }
    return 0;
}
 
开发者ID:Quiddity-Modding,项目名称:Redux,代码行数:25,代码来源:ReduxAPI.java

示例4: handleCommandExecution

import net.minecraft.command.ICommandManager; //导入方法依赖的package包/类
private int handleCommandExecution(ICommandManager commandManager, CommandBlockLogic commandBlockLogic, String commandStored) {
    final String[] args = commandStored.split(" ");
    String commandName = args[0];
    if (commandName.startsWith("/")) {
        commandName = commandName.substring(1);
    }

    CommandBlockCommandHook commandHook = (CommandBlockCommandHook) new CommandBlockCommandHook(
            (net.canarymod.api.CommandBlockLogic) commandBlockLogic, args).call();

    if (!commandHook.isCanceled()
            && (Configuration.getServerConfig().isCommandBlockOpped()
            || ((net.canarymod.api.CommandBlockLogic) commandBlockLogic).hasPermission("canary.command." + commandName))) {
        int result = commandManager.executeCommand(commandBlockLogic, commandStored);
        if (result == 0) {
            // Minecraft found no command, now its our turn
            Canary.getServer().consoleCommand(commandStored, (net.canarymod.api.CommandBlockLogic) commandBlockLogic);
        }
        return result;
    }

    return 0;
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:24,代码来源:MixinCommandBlockLogic.java

示例5: func_145755_a

import net.minecraft.command.ICommandManager; //导入方法依赖的package包/类
public void func_145755_a(World p_145755_1_)
{
    if (p_145755_1_.isRemote)
    {
        this.field_145764_b = 0;
    }

    MinecraftServer minecraftserver = MinecraftServer.getServer();

    if (minecraftserver != null && minecraftserver.isCommandBlockEnabled())
    {
        ICommandManager icommandmanager = minecraftserver.getCommandManager();
        this.field_145764_b = icommandmanager.executeCommand(this, this.field_145763_e);
    }
    else
    {
        this.field_145764_b = 0;
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:20,代码来源:CommandBlockLogic.java

示例6: executeCommandOnPowered

import net.minecraft.command.ICommandManager; //导入方法依赖的package包/类
/**
 * Execute the command, called when the command block is powered.
 */
public int executeCommandOnPowered(World par1World)
{
    if (par1World.isRemote)
    {
        return 0;
    }
    else
    {
        MinecraftServer minecraftserver = MinecraftServer.getServer();

        if (minecraftserver != null && minecraftserver.isCommandBlockEnabled())
        {
            ICommandManager icommandmanager = minecraftserver.getCommandManager();
            return icommandmanager.executeCommand(this, this.command);
        }
        else
        {
            return 0;
        }
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:25,代码来源:TileEntityCommandBlock.java

示例7: apply

import net.minecraft.command.ICommandManager; //导入方法依赖的package包/类
@Override
public void apply(EntityActor actor)
{
    if (!this.command.isEmpty())
    {
        MinecraftServer server = actor.worldObj.getMinecraftServer();

        if (server != null)
        {
            ICommandManager manager = server.commandManager;

            manager.executeCommand(new CommandSender(actor), this.command);
        }
    }
}
 
开发者ID:mchorse,项目名称:blockbuster,代码行数:16,代码来源:CommandAction.java

示例8: execute

import net.minecraft.command.ICommandManager; //导入方法依赖的package包/类
public void execute(MinecraftServer minecraftserver) {
    ICommandManager icommandmanager = minecraftserver.getCommandManager();
    int value = icommandmanager.executeCommand(minecraftserver, "/schematicaGenerate " + schematic + " " + Integer.toString(x) + " " + Integer.toString(y) + " "+ Integer.toString(z));
    if (value < 1) {
        FMLLog.getLogger().error("Schematica failed to generate the cheat area- code "+value);
        return;
    }
}
 
开发者ID:CannibalVox,项目名称:PurplePanic,代码行数:9,代码来源:PanicPatch.java

示例9: SendJsonRaw

import net.minecraft.command.ICommandManager; //导入方法依赖的package包/类
/**
 * Send variable number of JSON Objects to a player.
 * Note: It is recommended to use SendJsonFormatted() if you want to format a text
 * This function will just glue all elements together!
 * 
 * @param pPlayer
 * @param pChatObjects
 */
public static void SendJsonRaw( EntityPlayer pPlayer, JSONChatText... pChatObjects )
{
  MinecraftServer tMCServer = MinecraftServer.getServer();
  ICommandManager tCmdMngr = tMCServer.getCommandManager();

  if( tMCServer != null )
  {
    String tConstructedJSON = "";
    if( pChatObjects.length > 1 )
    {
      boolean tFirst = true;
      tConstructedJSON = "[";
      for( JSONChatText pChatObject : pChatObjects )
      {
        if( tFirst )
          tFirst = false;
        else
          tConstructedJSON += ", ";

        tConstructedJSON += pChatObject.getConstructed();
      }
      tConstructedJSON += "]";
    }
    else
      tConstructedJSON = pChatObjects[0].getConstructed();

    tCmdMngr.executeCommand( tMCServer, "tellraw " + pPlayer.getCommandSenderName() + " " + tConstructedJSON );
  }
}
 
开发者ID:GTNewHorizons,项目名称:Yamcl,代码行数:38,代码来源:PlayerChatHelper.java

示例10: trigger

import net.minecraft.command.ICommandManager; //导入方法依赖的package包/类
public void trigger(World worldIn)
{
    if (worldIn.isRemote)
    {
        this.successCount = 0;
    }

    MinecraftServer minecraftserver = MinecraftServer.getServer();

    if (minecraftserver != null && minecraftserver.isAnvilFileSet() && minecraftserver.isCommandBlockEnabled())
    {
        ICommandManager icommandmanager = minecraftserver.getCommandManager();

        try
        {
            this.lastOutput = null;
            this.successCount = icommandmanager.executeCommand(this, this.commandStored);
        }
        catch (Throwable throwable)
        {
            CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Executing command block");
            CrashReportCategory crashreportcategory = crashreport.makeCategory("Command to be executed");
            crashreportcategory.addCrashSectionCallable("Command", new Callable<String>()
            {
                public String call() throws Exception
                {
                    return CommandBlockLogic.this.getCommand();
                }
            });
            crashreportcategory.addCrashSectionCallable("Name", new Callable<String>()
            {
                public String call() throws Exception
                {
                    return CommandBlockLogic.this.getName();
                }
            });
            throw new ReportedException(crashreport);
        }
    }
    else
    {
        this.successCount = 0;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:45,代码来源:CommandBlockLogic.java

示例11: trigger

import net.minecraft.command.ICommandManager; //导入方法依赖的package包/类
public void trigger(World worldIn)
{
    if (worldIn.isRemote)
    {
        this.successCount = 0;
    }
    else if ("Searge".equalsIgnoreCase(this.commandStored))
    {
        this.lastOutput = new TextComponentString("#itzlipofutzli");
        this.successCount = 1;
    }
    else
    {
        MinecraftServer minecraftserver = this.getServer();

        if (minecraftserver != null && minecraftserver.isAnvilFileSet() && minecraftserver.isCommandBlockEnabled())
        {
            ICommandManager icommandmanager = minecraftserver.getCommandManager();

            try
            {
                this.lastOutput = null;
                this.successCount = icommandmanager.executeCommand(this, this.commandStored);
            }
            catch (Throwable throwable)
            {
                CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Executing command block");
                CrashReportCategory crashreportcategory = crashreport.makeCategory("Command to be executed");
                crashreportcategory.setDetail("Command", new ICrashReportDetail<String>()
                {
                    public String call() throws Exception
                    {
                        return CommandBlockBaseLogic.this.getCommand();
                    }
                });
                crashreportcategory.setDetail("Name", new ICrashReportDetail<String>()
                {
                    public String call() throws Exception
                    {
                        return CommandBlockBaseLogic.this.getName();
                    }
                });
                throw new ReportedException(crashreport);
            }
        }
        else
        {
            this.successCount = 0;
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:52,代码来源:CommandBlockBaseLogic.java

示例12: execute

import net.minecraft.command.ICommandManager; //导入方法依赖的package包/类
@Override
public String execute(CommandSender sender, String[] params) throws CommandException {
	if (params.length > 1 && sender.getServer() instanceof IntegratedServer && 
							((IntegratedServer) sender.getServer()).getPublic()) {
		EntityPlayer player = null;
		Object playerEntity;
		Iterator players = sender.getServer().getPlayerList().getPlayers().iterator();
		
		while (players.hasNext()) {
			playerEntity = players.next();
			
			if (playerEntity instanceof EntityPlayer) {
				if (((EntityPlayer) playerEntity).getName().equalsIgnoreCase(params[0])) {
					player = (EntityPlayer) playerEntity;
					break;
				}
			}
		}
		
		if (player == null) throw new CommandException("command.sudo.playerNotFound", sender);
		
		ICommandManager manager = sender.getServer().getCommandManager();
		String command = params[1];
		String parameters = "";
		
		if (params.length > 2) {
			int index = 0;
			
			for (String param : params) {
				if (index > 1) {parameters += " " + param;}
				index++;
			}
		}
		
		manager.executeCommand((new CommandSender(player)).getMinecraftISender(), command + parameters);
		sender.sendLangfileMessage("command.sudo.executed", command + parameters, player.getName());
	}
	else if (!(sender.getServer() instanceof IntegratedServer)) throw new CommandException("command.sudo.notInLAN", sender);
	else if (!((IntegratedServer) sender.getServer()).getPublic()) throw new CommandException("command.sudo.notInLAN", sender);
	else throw new CommandException("command.sudo.invalidArgs", sender);
	
	return null;
}
 
开发者ID:MrNobody98,项目名称:morecommands,代码行数:44,代码来源:CommandSudo.java


注:本文中的net.minecraft.command.ICommandManager.executeCommand方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。