    001/*
    002 * Forge Mod Loader
    003 * Copyright (c) 2012-2013 cpw.
    004 * All rights reserved. This program and the accompanying materials
    005 * are made available under the terms of the GNU Lesser Public License v2.1
    006 * which accompanies this distribution, and is available at
    007 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    008 *
    009 * Contributors:
    010 *     cpw - implementation
    011 */
    012
    013package cpw.mods.fml.common.event;
    014
    015import net.minecraft.command.CommandHandler;
    016import net.minecraft.command.ICommand;
    017import net.minecraft.server.MinecraftServer;
    018import cpw.mods.fml.common.LoaderState.ModState;
    019
    020public class FMLServerStartingEvent extends FMLStateEvent
    021{
    022
    023    private MinecraftServer server;
    024
    025    public FMLServerStartingEvent(Object... data)
    026    {
    027        super(data);
    028        this.server = (MinecraftServer) data[0];
    029    }
    030    @Override
    031    public ModState getModState()
    032    {
    033        return ModState.AVAILABLE;
    034    }
    035
    036    public MinecraftServer getServer()
    037    {
    038        return server;
    039    }
    040
    041    public void registerServerCommand(ICommand command)
    042    {
    043        CommandHandler ch = (CommandHandler) getServer().getCommandManager();
    044        ch.registerCommand(command);
    045    }
    046}