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

项目: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());
}
项目:TiM    文件:TModifiers.java   
@EventHandler
public void serverStart(FMLServerStartedEvent event)
{
    ((ServerCommandManager) MinecraftServer.getServer().getCommandManager()).registerCommand(new CommandTModifiers());

    if(!jsonFile.exists())
        try {
            jsonFile.createNewFile();
            PrintStream out = new PrintStream(new FileOutputStream(jsonFile));
            writeDefaultJSON(out);
            out.close();
        } catch (IOException e) {
            Logger.getLogger(NAME).log(Level.WARNING, "Could not create json file - " + e);
        }

    reloadModifiers();

    //      for(ItemModifier mod : ModifyBuilder.instance.itemModifiers)
    //          System.out.println(mod.getClass());

    new Thread(){
        public void run(){
            ItemUpdate.checkForUpdate();
        }
    }.start();
}
项目:TiM    文件:TModifiers.java   
@EventHandler
public void serverStart(FMLServerStartedEvent event)
{
    ((ServerCommandManager) MinecraftServer.getServer().getCommandManager()).registerCommand(new CommandTModifiers());

    if(!jsonFile.exists())
        try {
            jsonFile.createNewFile();
            PrintStream out = new PrintStream(new FileOutputStream(jsonFile));
            writeDefaultJSON(out);
            out.close();
        } catch (IOException e) {
            Logger.getLogger(NAME).log(Level.WARNING, "Could not create json file - " + e);
        }

    reloadModifiers();

    //      for(ItemModifier mod : ModifyBuilder.instance.itemModifiers)
    //          System.out.println(mod.getClass());

    new Thread(){
        public void run(){
            ItemUpdate.checkForUpdate();
        }
    }.start();
}
项目:morecommands    文件:CommonProxy.java   
/**
 * Registers all server commands
 * 
 * @return Whether the server commands were registered successfully
 */
private void registerServerCommands(MinecraftServer server) throws Exception {
    List<Class<? extends StandardCommand>> serverCommands = this.mod.getServerCommandClasses();
    if (serverCommands == null) throw new RuntimeException("Server Command Classes not loaded");
    ServerCommandManager commandManager = (ServerCommandManager) server.getCommandManager(); 

    for (Class<? extends StandardCommand> cmdClass : serverCommands) {
        try {
            StandardCommand cmd = cmdClass.newInstance();

            if (cmd instanceof MultipleCommands) {
                Constructor<? extends StandardCommand> ctr = cmdClass.getConstructor(int.class);

                for (int i = 0; i < ((MultipleCommands) cmd).getCommandNames().length; i++)
                    if (this.mod.isCommandEnabled(((MultipleCommands) cmd).getCommandNames()[i]))
                        commandManager.registerCommand(new ServerCommand(ServerCommand.upcast(ctr.newInstance(i))));
            }
            else if (this.mod.isCommandEnabled(cmd.getCommandName()))
                commandManager.registerCommand(new ServerCommand(ServerCommand.upcast(cmd)));
        }
        catch (Exception ex) {
            this.mod.getLogger().warn("Skipping Server Command " + cmdClass.getName() + " due to the following exception during loading", ex);
        }
    }
}
项目: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();
    }
}
项目:Cauldron    文件:MinecraftServer.java   
public MinecraftServer(File p_i45281_1_, Proxy p_i45281_2_)
{
    this.field_152366_X = new PlayerProfileCache(this, field_152367_a);
    mcServer = this;
    this.serverProxy = p_i45281_2_;
    this.anvilFile = p_i45281_1_;
    this.field_147144_o = new NetworkSystem(this);
    this.commandManager = new ServerCommandManager();
    this.anvilConverterForAnvilFile = new AnvilSaveConverter(p_i45281_1_);
    this.field_152364_T = new YggdrasilAuthenticationService(p_i45281_2_, UUID.randomUUID().toString());
    this.field_147143_S = this.field_152364_T.createMinecraftSessionService();
    this.field_152365_W = this.field_152364_T.createProfileRepository();
    this.primaryThread = new Thread(this, "Server thread"); // CraftBukkit
    this.cauldronConfig = new CauldronConfig("cauldron.yml", "cauldron");
    this.tileEntityConfig = new TileEntityConfig("tileentities.yml", "cauldron_te");
}
项目:RuneCraftery    文件:MinecraftServer.java   
public MinecraftServer(File par1File)
{
    this.serverProxy = Proxy.NO_PROXY;
    this.field_143008_E = 0;
    this.sentPacketCountArray = new long[100];
    this.sentPacketSizeArray = new long[100];
    this.receivedPacketCountArray = new long[100];
    this.receivedPacketSizeArray = new long[100];
    this.tickTimeArray = new long[100];
    this.texturePack = "";
    mcServer = this;
    this.anvilFile = par1File;
    this.commandManager = new ServerCommandManager();
    this.anvilConverterForAnvilFile = new AnvilSaveConverter(par1File);
    this.registerDispenseBehaviors();
}
项目:GriefGuardian    文件:GriefGuardian.java   
@EventHandler
public void onServerStarting(FMLServerStartedEvent event){
    ServerCommandManager mgr = (ServerCommandManager) MinecraftServer.getServer().getCommandManager();
    mgr.registerCommand(new ClaimCommand());
    mgr.registerCommand(new DeleteClaim());
    mgr.registerCommand(new ModifyACL());
    mgr.registerCommand(new ShowClaims());
    mgr.registerCommand(new HideClaims());
    mgr.registerCommand(new TransferClaim());
    mgr.registerCommand(new Execute());
    mgr.registerCommand(new AdminInvisibility());
    mgr.registerCommand(new AdminMode());

    mgr.registerCommand(new TempBan());
    mgr.registerCommand(new PermaBan());
    mgr.registerCommand(new UnBan());

    mgr.registerCommand(new OpenInventory());
    mgr.registerCommand(new Warp());
}
项目:BetterNutritionMod    文件:MinecraftServer.java   
public MinecraftServer(File par1File)
{
    this.serverProxy = Proxy.NO_PROXY;
    this.field_143008_E = 0;
    this.sentPacketCountArray = new long[100];
    this.sentPacketSizeArray = new long[100];
    this.receivedPacketCountArray = new long[100];
    this.receivedPacketSizeArray = new long[100];
    this.tickTimeArray = new long[100];
    this.texturePack = "";
    mcServer = this;
    this.anvilFile = par1File;
    this.commandManager = new ServerCommandManager();
    this.anvilConverterForAnvilFile = new AnvilSaveConverter(par1File);
    this.registerDispenseBehaviors();
}
项目:minecraft-hue    文件:HueMod.java   
/**
 * Save the instance of the command manager and initialize the commands.
 *
 * @param event The server starting event that was fired.
 */
@EventHandler
public void serverStarting(FMLServerStartingEvent event) {
    MinecraftServer server = event.getServer();
    HueManager hueManager = HueManager.getInstance();
    hueManager.setMinecraftServer(server);
    this.listener.setWorld(server.getEntityWorld());
    this.commandManager = (ServerCommandManager) server.getCommandManager();
    this.initCommands();
}
项目:Rival-Rebels-Mod    文件:RivalRebels.java   
@EventHandler
public void serverStarting(FMLServerStartingEvent event)
{
    ICommandManager commandManager = MinecraftServer.getServer().getCommandManager();
    ServerCommandManager serverCommandManager = ((ServerCommandManager) commandManager);
    addCommands(serverCommandManager);
}
项目:Rival-Rebels-Mod    文件:RivalRebels.java   
public void addCommands(ServerCommandManager manager)
{
    manager.registerCommand(new CommandResetGame());
    manager.registerCommand(new CommandPassword());
    manager.registerCommand(new CommandKillme());
    manager.registerCommand(new CommandPlaySound());
    manager.registerCommand(new CommandStopRounds());
    manager.registerCommand(new CommandContinueRound());
    manager.registerCommand(new CommandInspect());
    manager.registerCommand(new CommandMotD());
    manager.registerCommand(new CommandKillAll());
    manager.registerCommand(new CommandRobot());
    manager.registerCommand(new CommandConfig());
    manager.registerCommand(new CommandHotPotato());
}
项目: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);
}
项目:LookingGlass    文件:LookingGlass.java   
@EventHandler
public void serverStart(FMLServerStartingEvent event) {
    MinecraftServer mcserver = event.getServer();
    // Register commands
    ((ServerCommandManager) mcserver.getCommandManager()).registerCommand(new CommandCreateView());
    // Start up the packet dispatcher we use for throttled data to client.
    ServerPacketDispatcher.getInstance().start(); //Note: This might need to be preceded by a force init of the ServerPacketDispatcher.  Doesn't seem to currently have any issues, though.
}
项目: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());
}
项目:morecommands    文件:CommandCommand.java   
@Override
public String execute(CommandSender sender, String[] params) throws CommandException {
    if (params.length > 1) {
        if (params[0].equalsIgnoreCase("enable")) {
            ICommand enable = this.disabledCommands.get(params[1]);

            if (enable != null) {
                ((ServerCommandManager) sender.getServer().getCommandManager()).registerCommand(enable);
                this.disabledCommands.remove(params[1]);
                sender.sendLangfileMessage("command.command.enabled");
            }
            else throw new CommandException("command.command.alreadyEnabled", sender);
        }
        else if (params[0].equalsIgnoreCase("disable")) {
            if (params[1].equals(this.getCommandName())) throw new CommandException("command.command.wantedToDisable", sender);

            ICommand disable = (ICommand) ((ServerCommandManager) sender.getServer().getCommandManager()).getCommands().get(params[1]);

            if (disable != null) {
                this.disabledCommands.put(disable.getName(), disable);
                ((ServerCommandManager) sender.getServer().getCommandManager()).getCommands().remove(params[1]);
                sender.sendLangfileMessage("command.command.disabled");
            }
            else throw new CommandException("command.command.alreadyDisabled", sender);
        }
        else throw new CommandException("command.generic.invalidUsage", sender, this.getCommandName());
    }
    else throw new CommandException("command.generic.invalidUsage", sender, this.getCommandName());

    return null;
}
项目:bfsr    文件:BFSR.java   
@EventHandler
public void serverLoad(FMLServerStartingEvent event) {
    ServerCommandManager manager = (ServerCommandManager) event.getServer().getCommandManager();
    manager.registerCommand(new BfsrSpawnCommand());
    manager.registerCommand(new BfsrGotoNurseryCommand());
    manager.registerCommand(new BfsrRegenTutorialDimension());
    manager.registerCommand(new BfsrTeleportCommand());
}
项目: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());
}
项目:Resilience-Client-Source    文件:MinecraftServer.java   
public MinecraftServer(File p_i45281_1_, Proxy p_i45281_2_)
{
    mcServer = this;
    this.serverProxy = p_i45281_2_;
    this.anvilFile = p_i45281_1_;
    this.field_147144_o = new NetworkSystem(this);
    this.commandManager = new ServerCommandManager();
    this.anvilConverterForAnvilFile = new AnvilSaveConverter(p_i45281_1_);
    this.field_147143_S = (new YggdrasilAuthenticationService(p_i45281_2_, UUID.randomUUID().toString())).createMinecraftSessionService();
}
项目:SpongeBukkit    文件:BukkitCommandMap.java   
public BukkitCommandMap(BukkitServer server)
{
    super(server);
    this.server = server;
    manager = (ServerCommandManager) server.getVanillaServer().commandManager;

    for(Object[] args: delayedRegisters)
    {
        registerInForge((Boolean)args[0], (String)args[1], (String)args[2], (Command)args[3]);
    }
    delayedRegisters = null;
}
项目: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());
}
项目:ZeroQuest    文件:ZeroQuest.java   
@EventHandler //TODO
public void serverStart(FMLServerStartingEvent event)        
{   
    Log.info("-----SERVER CONTENT LOAD INITATING-----");
    Log.info("Loading Commands...");     
    MinecraftServer server = MinecraftServer.getServer();
    ServerCommandManager cmdman = (ServerCommandManager) server.getCommandManager(); 
    cmdman.registerCommand(new CommandZeroQuest());
    Log.info("Commands Loaded Successfully!");  
    Log.info("-----SERVER CONTENT LOAD FINSHED-----");

}
项目:mcplus_mods    文件:_API.java   
@EventHandler
public void onServerStart(FMLServerStartingEvent parEvent)
{
    ServerCommandManager manager = CommandHandler.getCommandManager();

    Iterator<CommandBase> iter = CommandHandler.INSTANCE.iterator();
    while(iter.hasNext())
    {
        CommandBase command = iter.next();
        manager.registerCommand(command);
    }

    CommandHandler.lock();
}
项目:Cauldron    文件:MinecraftServer.java   
public MinecraftServer(File p_i45281_1_, Proxy p_i45281_2_)
{
    this.field_152366_X = new PlayerProfileCache(this, field_152367_a);
    mcServer = this;
    this.serverProxy = p_i45281_2_;
    this.anvilFile = p_i45281_1_;
    this.field_147144_o = new NetworkSystem(this);
    this.commandManager = new ServerCommandManager();
    this.anvilConverterForAnvilFile = new AnvilSaveConverter(p_i45281_1_);
    this.field_152364_T = new YggdrasilAuthenticationService(p_i45281_2_, UUID.randomUUID().toString());
    this.field_147143_S = this.field_152364_T.createMinecraftSessionService();
    this.field_152365_W = this.field_152364_T.createProfileRepository();
}
项目:N-API    文件:CommandRegistry.java   
/**
 * Registers the command so you don't have to edit the base file. Is somewhat complex as
 * the register method isn't static.
 * @param command The command to register.
 */
public static void registerModCommand(ICommand command)
{
    //The check here stops an NPE.
    if (MCData.isServerSide())
    {
        ((ServerCommandManager) MinecraftServer.getServer().getCommandManager()).registerCommand(command);
    }
}
项目: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);
}
项目:NBTEdit    文件:NBTEdit.java   
@EventHandler
public void serverStarting(FMLServerStartingEvent event) {
    MinecraftServer server= event.getServer();
    ServerCommandManager serverCommandManager = (ServerCommandManager) server.getCommandManager();
    serverCommandManager.registerCommand(new CommandNBTEdit());
    logger.fine("Server Starting -- Added \"/nbtedit\" command");
}
项目:RuneCraftery    文件:MinecraftServer.java   
public MinecraftServer(File p_i1498_1_) {
   this.field_110456_c = Proxy.NO_PROXY;
   this.field_143008_E = 0;
   this.field_71300_f = new long[100];
   this.field_71301_g = new long[100];
   this.field_71313_h = new long[100];
   this.field_71314_i = new long[100];
   this.field_71311_j = new long[100];
   this.field_71297_P = "";
   field_71309_l = this;
   this.field_71308_o = p_i1498_1_;
   this.field_71321_q = new ServerCommandManager();
   this.field_71310_m = new AnvilSaveConverter(p_i1498_1_);
   this.func_82355_al();
}
项目:Mini-Bosses    文件:MiniBosses.java   
@EventHandler
public void onServerStart(FMLServerStartingEvent event) {
    MinecraftServer server = event.getServer();
    ServerCommandManager manager = (ServerCommandManager)server.getCommandManager();

    manager.registerCommand(new CommandMiniBosses());
}
项目:BetterNutritionMod    文件:MyMod.java   
@EventHandler
public void serverStart(FMLServerStartingEvent event)
{
    commandManager = (ServerCommandManager) MinecraftServer.getServer().getCommandManager();
    commandManager.registerCommand(new BNCNutrition());

}
项目:MineChess    文件:MineChess.java   
@EventHandler
public void onServerStart(FMLServerStartingEvent event){
    ServerCommandManager comManager = (ServerCommandManager)MinecraftServer.getServer().getCommandManager();
    comManager.registerCommand(new CommandAIDepth());
    comManager.registerCommand(new CommandKillPiece());
    comManager.registerCommand(new CommandDraw());
}
项目: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());
}
项目:secri    文件:Maeme.java   
@ServerStarting
public void onServerStart(FMLServerStartingEvent event) {
    if (MinecraftServer.getServer().getCommandManager() instanceof ServerCommandManager) {
        ((ServerCommandManager) MinecraftServer.getServer().getCommandManager()).registerCommand(new CommandSpawn());
        ((ServerCommandManager) MinecraftServer.getServer().getCommandManager()).registerCommand(new CommandStruc());
        ((ServerCommandManager) MinecraftServer.getServer().getCommandManager()).registerCommand(new CommandFreeze());
        ((ServerCommandManager) MinecraftServer.getServer().getCommandManager()).registerCommand(new CommandHeal());
    }
}