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

项目:nailed    文件:CommandPlugin.java   
@EventHandler
public void registerCommands(RegisterCommandsEvent event){
    event.registerCommandClass(this);
    event.subcommand("team").registerCommandClass(new TeamCommand());
    event.subcommand("nailed").registerCommandClass(new NailedCommand());
    event.subcommand("reload").registerCommandClass(new ReloadCommand());
    event.subcommand("game").registerCommandClass(new GameCommand());
    event.subcommand("map").registerCommandClass(new MapCommand());

    event.registerCallable(new VanillaCommand(new CommandHelp()), "help");
    event.registerCallable(new VanillaCommand(new CommandGive()), "give");
    event.registerCallable(new VanillaCommand(new CommandTestForBlock()), "testforblock");
    event.registerCallable(new VanillaCommand(new CommandTestFor()), "testfor");
    event.registerCallable(new VanillaCommand(new CommandSetBlock()), "setblock");
    event.registerCallable(new VanillaCommand(new CommandEffect()), "effect");
    event.registerCallable(new VanillaCommand(new CommandTeleport()), "tp");
    event.registerCallable(new VanillaCommand(new CommandExecuteAt()), "execute");
}
项目:HelpFixer    文件:HelpFixer.java   
@Mod.EventHandler
public void onServerStarting(final FMLServerStartingEvent event) {
    event.registerServerCommand(new CommandHelp() {

        @SuppressWarnings("ConstantConditions")
        @Override
        protected List<ICommand> getSortedPossibleCommands(final ICommandSender sender, final MinecraftServer server) {
            final List<ICommand> list = server.getCommandManager().getPossibleCommands(sender);
            final Iterator<ICommand> iterator = list.iterator();

            while (iterator.hasNext()) {
                final ICommand command = iterator.next();

                try {
                    if (command.getName() == null) {
                        log.warn("Identified command with null name, Ignoring: {}", command.getClass().getName());
                        iterator.remove();
                    } else if (command.getUsage(sender) == null) {
                        log.warn("Identified command with null usage, Ignoring: {}", command.getClass().getName());
                        iterator.remove();
                    }
                } catch (Exception e) {
                    log.warn("Failed to test command '{}'", command, e);
                }
            }

            list.sort(Comparator.comparing(ICommand::getName));
            return list;
        }

    });
}
项目:ServerTools-CORE    文件:CommandManager.java   
private void overrideHelp(final CommandHandler commandHandler) {
    if (Loader.isModLoaded("HelpFixer")) {
        log.trace("HelpFixer detected. Not overriding /help");
    } else {
        log.trace("Overriding /help");
        commandHandler.registerCommand(new CommandHelp() {

            @Override
            protected List<ICommand> getSortedPossibleCommands(final ICommandSender sender) {
                final List<ICommand> list = MinecraftServer.getServer().getCommandManager().getPossibleCommands(sender);
                final Iterator<ICommand> iterator = list.iterator();
                while (iterator.hasNext()) {
                    ICommand command = iterator.next();
                    if (command.getCommandName() == null) {
                        log.warn("Identified command with a null name: {}", command.getClass());
                        iterator.remove();
                    } else if (command.getCommandUsage(sender) == null) {
                        log.warn("Identified command with null usage: {}", command.getClass());
                        iterator.remove();
                    }
                }

                Collections.sort(list, (o1, o2) -> o1.getCommandName().compareTo(o2.getCommandName()));
                return list;
            }
        });
    }
}
项目:RuneCraftery    文件:ServerCommandManager.java   
public ServerCommandManager() {
   this.func_71560_a(new CommandTime());
   this.func_71560_a(new CommandGameMode());
   this.func_71560_a(new CommandDifficulty());
   this.func_71560_a(new CommandDefaultGameMode());
   this.func_71560_a(new CommandKill());
   this.func_71560_a(new CommandToggleDownfall());
   this.func_71560_a(new CommandWeather());
   this.func_71560_a(new CommandXP());
   this.func_71560_a(new CommandServerTp());
   this.func_71560_a(new CommandGive());
   this.func_71560_a(new CommandEffect());
   this.func_71560_a(new CommandEnchant());
   this.func_71560_a(new CommandServerEmote());
   this.func_71560_a(new CommandShowSeed());
   this.func_71560_a(new CommandHelp());
   this.func_71560_a(new CommandDebug());
   this.func_71560_a(new CommandServerMessage());
   this.func_71560_a(new CommandServerSay());
   this.func_71560_a(new CommandSetSpawnpoint());
   this.func_71560_a(new CommandGameRule());
   this.func_71560_a(new CommandClearInventory());
   this.func_71560_a(new ServerCommandTestFor());
   this.func_71560_a(new CommandSpreadPlayers());
   this.func_71560_a(new CommandPlaySound());
   this.func_71560_a(new ServerCommandScoreboard());
   if(MinecraftServer.func_71276_C().func_71262_S()) {
      this.func_71560_a(new CommandServerOp());
      this.func_71560_a(new CommandServerDeop());
      this.func_71560_a(new CommandServerStop());
      this.func_71560_a(new CommandServerSaveAll());
      this.func_71560_a(new CommandServerSaveOff());
      this.func_71560_a(new CommandServerSaveOn());
      this.func_71560_a(new CommandServerBanIp());
      this.func_71560_a(new CommandServerPardonIp());
      this.func_71560_a(new CommandServerBan());
      this.func_71560_a(new CommandServerBanlist());
      this.func_71560_a(new CommandServerPardon());
      this.func_71560_a(new CommandServerKick());
      this.func_71560_a(new CommandServerList());
      this.func_71560_a(new CommandServerWhitelist());
      this.func_71560_a(new CommandSetPlayerTimeout());
   } else {
      this.func_71560_a(new CommandServerPublishLocal());
   }

   CommandBase.func_71529_a(this);
}