Java 类net.minecraft.command.ICommandManager 实例源码

项目:Overlord    文件:Overlord.java   
@Mod.EventHandler
public void serverStart(FMLServerStartingEvent event) {
    MinecraftServer server = event.getServer();
    ICommandManager command = server.getCommandManager();

    ServerCommandManager serverCommand = (ServerCommandManager) command;

    serverCommand.registerCommand(new CommandAlly());
    serverCommand.registerCommand(new CommandAllyAccept());
    serverCommand.registerCommand(new CommandAllyList());
    serverCommand.registerCommand(new CommandAllyReject());
    serverCommand.registerCommand(new CommandAllyRemove());
    serverCommand.registerCommand(new CommandEnemy());
    serverCommand.registerCommand(new CommandEnemyList());
    serverCommand.registerCommand(new CommandEnemyRemove());
}
项目:Structures    文件:ExecuteCommandAction.java   
@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 + "");
  }
}
项目:Resilience-Client-Source    文件:CommandBlockLogic.java   
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;
    }
}
项目:Redux    文件:ReduxAPI.java   
@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;
}
项目:Progression    文件:Progression.java   
@EventHandler
public void onServerStarting(FMLServerStartingEvent event) {
    ICommandManager manager = event.getServer().getCommandManager();
    if (manager instanceof ServerCommandManager) {
        ((ServerCommandManager) manager).registerCommand(CommandManager.INSTANCE);
    }

    if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
        Progression.logger.log(Level.INFO, "How did a client get in the server start?");
        return;
    }


    //Remap all relevant data, Loads in the server data
    RemappingHandler.reloadServerData(JSONLoader.getServerTabData(RemappingHandler.getHostName()), false);

    World world = FMLCommonHandler.instance().getMinecraftServerInstance().worldServers[0];
    data = (PlayerSavedData) world.loadItemData(PlayerSavedData.class, MODNAME);
    if (data == null) {
        createWorldData();
    }
}
项目:NeptuneMod    文件:MixinCommandBlockLogic.java   
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;
}
项目:Cauldron    文件:CommandBlockLogic.java   
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;
    }
}
项目:RuneCraftery    文件:TileEntityCommandBlock.java   
/**
 * 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;
        }
    }
}
项目:BetterNutritionMod    文件:TileEntityCommandBlock.java   
/**
 * 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;
        }
    }
}
项目:FirstAid    文件:FirstAid.java   
@Mod.EventHandler
public void beforeServerStart(FMLServerAboutToStartEvent event) {
    ICommandManager manager = event.getServer().getCommandManager();
    if (manager instanceof CommandHandler) {
        ((CommandHandler) manager).registerCommand(new DebugDamageCommand());
    }
}
项目:Rival-Rebels-Mod    文件:RivalRebels.java   
@EventHandler
public void serverStarting(FMLServerStartingEvent event)
{
    ICommandManager commandManager = MinecraftServer.getServer().getCommandManager();
    ServerCommandManager serverCommandManager = ((ServerCommandManager) commandManager);
    addCommands(serverCommandManager);
}
项目:blockbuster    文件:CommandAction.java   
@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);
        }
    }
}
项目:Hammer-Mod    文件:HammerMod.java   
@EventHandler
public void serverStart(FMLServerStartingEvent event)
{
     MinecraftServer server = MinecraftServer.getServer();
     // Get's the current server instance

     ICommandManager command = server.getCommandManager();
     ServerCommandManager manager = (ServerCommandManager) command;

     //manager.registerCommand(new CommandModInfo());
     manager.registerCommand(new CommandChangelog());
     manager.registerCommand(new CommandAbilities());
}
项目:BetterChat    文件:BetterChat.java   
@Mod.EventHandler
public void serverStart(FMLServerStartingEvent e)
{
    MinecraftServer server = getServer();
    ICommandManager iCommandManager = server.getCommandManager();
    ServerCommandManager serverCommandManager = (ServerCommandManager)iCommandManager;

    serverCommandManager.registerCommand(new CommandHandler());
}
项目:PopularMMOS-EpicProportions-Mod    文件:EpicProportionsMod.java   
@EventHandler
public void serverStart(FMLServerStartingEvent event)
{
    //Thread.currentThread().setName("EpicProportionsMod");
     MinecraftServer server = MinecraftServer.getServer();
     // Get's the current server instance

     ICommandManager command = server.getCommandManager();
     ServerCommandManager manager = (ServerCommandManager) command;

     manager.registerCommand(new CommandModInfo());
     manager.registerCommand(new CommandChangelog());
}
项目:EnderPay    文件:EnderPay.java   
private void registerCommands(FMLServerStartingEvent event) {
    MinecraftServer server = event.getServer();
    ICommandManager command = server.getCommandManager();
    ServerCommandManager manager = (ServerCommandManager) command;
    manager.registerCommand(new CommandWallet());
    manager.registerCommand(new CommandBalance());
    manager.registerCommand(new CommandPay());
}
项目:TaleCraft    文件:TaleCraft.java   
@Mod.EventHandler
public void serverStarting(FMLServerStartingEvent event){
    MinecraftServer server = event.getServer();

    ICommandManager cmdmng = server.getCommandManager();
    if (cmdmng instanceof ServerCommandManager && cmdmng instanceof CommandHandler) {
        CommandHandler cmdhnd = (CommandHandler) cmdmng;
        TaleCraftCommands.register(cmdhnd);
    }

    // By calling this method, we create the ServerMirror for the given server.
    ServerHandler.getServerMirror(server);
}
项目:vintagetg    文件:VintageTG.java   
@EventHandler
public void onServerStart(FMLServerStartingEvent evt) {
    MinecraftServer server = MinecraftServer.getServer();
    ICommandManager command = server.getCommandManager();
    ServerCommandManager manager = (ServerCommandManager) command;
    manager.registerCommand(new VintageCraftCommands());
}
项目:UniversalCoins    文件:UniversalCoins.java   
@EventHandler
public void serverStart(FMLServerStartingEvent event) {
    ICommandManager command = event.getServer().getCommandManager();
    ServerCommandManager manager = (ServerCommandManager) command;
    manager.registerCommand(new UCCommand());
    manager.registerCommand(new UCBalance());
    manager.registerCommand(new UCRebalance());
    manager.registerCommand(new UCGive());
    manager.registerCommand(new UCSend());
}
项目:PurplePanic    文件:PanicPatch.java   
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;
    }
}
项目:Wars-Mod    文件:WarsMod.java   
@EventHandler
public void serverStart(FMLServerStartingEvent event) {
    MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
    ICommandManager command = server.getCommandManager();

    ServerCommandManager serverCommand = (ServerCommandManager) command;

    serverCommand.registerCommand(new CommandKills());
    serverCommand.registerCommand(new CommandShowKills());
    serverCommand.registerCommand(new CommandSetBase());
    serverCommand.registerCommand(new CommandEditMode());
}
项目:Yamcl    文件:PlayerChatHelper.java   
/**
 * 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 );
  }
}
项目:NeptuneMod    文件:MixinCommandBlockLogic.java   
/**
 * @author jamierocks - 3rd September 2016
 * @reason Support Canary commands
 */
@Overwrite
public void trigger(net.minecraft.world.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;
            // Neptune - Canary commands
            this.successCount = this.handleCommandExecution(icommandmanager, (CommandBlockLogic) (Object) this, this.commandStored);
            // Neptune - end
        } catch (Throwable throwable) {
            CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Executing command block");
            CrashReportCategory crashreportcategory = crashreport.makeCategory("Command to be executed");
            crashreportcategory.addCrashSectionCallable("Command", this::getCommand);
            crashreportcategory.addCrashSectionCallable("Name", this::getName);
            throw new ReportedException(crashreport);
        }
    } else {
        this.successCount = 0;
    }
}
项目:fortressmod    文件:FortressMod.java   
@EventHandler
public void serverStart(FMLServerStartingEvent event) {
     MinecraftServer server = MinecraftServer.getServer();

     ICommandManager command = server.getCommandManager();
     ServerCommandManager manager = (ServerCommandManager) command;
     StuckCommand stuckCommand = new StuckCommand();
     FMLCommonHandler.instance().bus().register(stuckCommand); //listen for ticks
     manager.registerCommand(stuckCommand);
}
项目:Runecraft-2    文件:Runecraft2.java   
@EventHandler
  public void serverStart(FMLServerStartingEvent event)
  {
MinecraftServer server = MinecraftServer.getServer();
ICommandManager command = server.getCommandManager();
ServerCommandManager manager = (ServerCommandManager) command;
manager.registerCommand(new HomeTeleportCMD());
manager.registerCommand(new SkillsCMD());
manager.registerCommand(new SuppressExpMessagesCMD());
manager.registerCommand(new Runecraft2Help());
  }
项目:vintagecraft    文件:VintageCraft.java   
@EventHandler
public void onServerStart(FMLServerStartingEvent evt) {
    MinecraftServer server = MinecraftServer.getServer();
    ICommandManager command = server.getCommandManager();
    ServerCommandManager manager = (ServerCommandManager) command;
    manager.registerCommand(new ServerCommandsVC());
}
项目:Narutocraft-PL_Mod    文件:NCFMLEventHandler.java   
/**
 * Register commands on Server Start
 * 
 * @param event
 *            "unused"
 */
@EventHandler
public void serverStart(FMLServerStartingEvent event) {
    MinecraftServer server = MinecraftServer.getServer();
    ICommandManager command = server.getCommandManager();
    ServerCommandManager manager = (ServerCommandManager) command;
    NCCommandHandler commandHandler = new NCCommandHandler(manager);
    commandHandler.registerCommands(false);
}
项目:RuneCraftery    文件:TileEntityCommandBlock.java   
public int func_82351_a(World p_82351_1_) {
   if(p_82351_1_.field_72995_K) {
      return 0;
   } else {
      MinecraftServer var2 = MinecraftServer.func_71276_C();
      if(var2 != null && var2.func_82356_Z()) {
         ICommandManager var3 = var2.func_71187_D();
         return var3.func_71556_a(this, this.field_82354_a);
      } else {
         return 0;
      }
   }
}
项目:Hats    文件:ProxyCommon.java   
public void initCommands(MinecraftServer server)
{
    ICommandManager manager = server.getCommandManager();
    if(manager instanceof CommandHandler)
    {
        CommandHandler handler = (CommandHandler)manager;
        handler.registerCommand(new CommandHats());
    }
}
项目:Morph    文件:CommonProxy.java   
public void initCommands(MinecraftServer server)
{
    ICommandManager manager = server.getCommandManager();
    if(manager instanceof CommandHandler)
    {
        CommandHandler handler = (CommandHandler)manager;
        handler.registerCommand(new CommandMorph());
    }
}
项目:minecraft-roguelike    文件:Roguelike.java   
@EventHandler
public void serverStart(FMLServerStartingEvent event){
    MinecraftServer server = event.getServer();
    ICommandManager command = server.getCommandManager();
    ServerCommandManager serverCommand = ((ServerCommandManager) command);
    serverCommand.registerCommand(new CommandRoguelike());
}
项目:DecompiledMinecraft    文件:MinecraftServer.java   
public ICommandManager getCommandManager()
{
    return this.commandManager;
}
项目:DecompiledMinecraft    文件:CommandBlockLogic.java   
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;
    }
}
项目:DecompiledMinecraft    文件:MinecraftServer.java   
public ICommandManager getCommandManager()
{
    return this.commandManager;
}
项目:DecompiledMinecraft    文件:CommandBlockLogic.java   
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;
    }
}
项目:BaseClient    文件:MinecraftServer.java   
public ICommandManager getCommandManager()
{
    return this.commandManager;
}
项目:BaseClient    文件:CommandBlockLogic.java   
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;
    }
}
项目:BaseClient    文件:MinecraftServer.java   
public ICommandManager getCommandManager()
{
    return this.commandManager;
}
项目:BaseClient    文件:CommandBlockLogic.java   
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;
    }
}
项目:Backmemed    文件:MinecraftServer.java   
public ICommandManager getCommandManager()
{
    return this.commandManager;
}