Java Code Examples for net.minecraftforge.fml.common.event.FMLServerStartingEvent

The following are top voted examples for showing how to use net.minecraftforge.fml.common.event.FMLServerStartingEvent. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: World-Border   File: WorldBorder.java   View source code 6 votes vote down vote up
@Mod.EventHandler
@SideOnly(Side.SERVER)
public void serverStart(FMLServerStartingEvent event)
{
    if (INSTANCE == null) INSTANCE = this;
    if (SERVER   == null) SERVER   = event.getServer();
    if (COMMAND  == null) COMMAND  = new WBCommand();

    // Load (or create new) config files
    Config.load(false);

    // our one real command, though it does also have aliases "wb" and "worldborder"
    event.registerServerCommand(COMMAND);

    if ( Config.preventBlockPlace() )
        enableBlockPlaceListener(true);

    if ( Config.preventMobSpawn() )
        enableMobSpawnListener(true);

    if ( Config.getDenyEnderpearl() )
        enableEnderPearlListener(true);

    DynMapFeatures.registerListener();
}
 
Example 2
Project: Toms-Mod   File: CoreInit.java   View source code 6 votes vote down vote up
@EventHandler
public static void onServerStart(FMLServerStartingEvent event) {
	log.info("Server Start");
	proxy.serverStart();
	Transformers.injectNewFillCmd(event.getServer());
	if (isMapEnabled) {
		event.registerServerCommand(new CommandWaypoint(false));
		event.registerServerCommand(new CommandWaypoint(true));
		Minimap.init(new File(TomsModUtils.getSavedFile(), Reference.worldDirConfigName));
	}
	if (Config.enableResearchSystem)
		event.registerServerCommand(new CommandResearch());
	GlobalFields.EnderMemoryObj = new Object[][][][]{{new Object[65536][2]}, TomsModUtils.fillObject(65536)};
	if (isCCLoaded)
		GlobalFields.EnderMemoryIComputerAccess.clear();
	WorldHandler.onServerStart(new File(TomsModUtils.getSavedFile(), "chunkData"));
	PlayerHandler.onServerStart(new File(TomsModUtils.getSavedFile(), "playerData"));
	Config.printWarnings();
	log.info("Loading Completed");
}
 
Example 3
Project: Progression   File: Progression.java   View source code 6 votes vote down vote up
@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();
    }
}
 
Example 4
Project: HCoreLib   File: CommandHandler.java   View source code 6 votes vote down vote up
/**
 * Method for handling main registering call from FMLServerStartingEvent.
 *
 * @see FMLServerStartingEvent
 *
 * @param event FMLServerStartingEvent.
 */
public void registerCommands(FMLServerStartingEvent event) {
    timeLapse.resetStartTime();
    HCoreLibMain.logHelper.info("Registering commands...");

    if (event != null) {

        for (String commandName : commandMap.keySet()) {
            event.registerServerCommand(commandMap.get(commandName));
            HCoreLibMain.logHelper.info("Command:", commandName, "was registered!");
        }

        HCoreLibMain.logHelper.info("Finished registering commands successfully! (",
                timeLapse.getEffectiveTimeSince(), "ms ).");
    }

    else HCoreLibMain.logHelper.severe("Error registering commands... FMLServerStartingEvent is null!");

    regComplete = true;
}
 
Example 5
Project: customgen   File: Customgen.java   View source code 6 votes vote down vote up
@EventHandler
public void serverStart(FMLServerStartingEvent event){
	
	if(ForgeGenerator.getInstance() == null) {
		new ForgeGenerator();
	}

	/* when playing singleplayer this lets us update Gens by restarting the world
	 * instead of restarting the game */
	GenManager genManager;
	//if(GenManager.getInstance() == null) {
		genManager = new GenManager();
	/*} else {
		genManager = GenManager.getInstance();
	}*/
       Gen[] gens = FileHandler.parseAllGens();
       if(gens != null) {
       	for (int i = 0; i < gens.length; i++) {
   			genManager.addGen(gens[i]);
   		}
       }
       
}
 
Example 6
Project: HardVox   File: HardVox.java   View source code 5 votes vote down vote up
@EventHandler
public void serverStarting(FMLServerStartingEvent event) {
    Iterator<CommandModule> modules = Iterators.forArray(
            new RegionCommands(),
            new OperationCommands(),
            new SessionCommands());
    modules.forEachRemaining(m -> m.addCommands(event::registerServerCommand));
}
 
Example 7
Project: minecraft-hue   File: HueMod.java   View source code 5 votes vote down vote up
/**
 * 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();
}
 
Example 8
Project: CreeperHostGui   File: CreeperHostServer.java   View source code 5 votes vote down vote up
@Mod.EventHandler
public void serverStarting(FMLServerStartingEvent event)
{
    if (!CreeperHost.instance.active)
        return;
    event.registerServerCommand(new CommandInvite());
    event.registerServerCommand(new CommandPregen());
    deserializePreload(new File(getSaveFolder(), "pregenData.json"));
}
 
Example 9
Project: craftsman   File: Main.java   View source code 5 votes vote down vote up
@EventHandler
public void init(FMLServerStartingEvent event) {
    event.registerServerCommand(new Pyramid());
    event.registerServerCommand(new Stairs());
    event.registerServerCommand(new Maze());

    event.registerServerCommand(new Turtle());
    event.registerServerCommand(new Cube());
    event.registerServerCommand(new Frame());
    event.registerServerCommand(new Line());
    event.registerServerCommand(new Circle());
    event.registerServerCommand(new FillCircle());
    event.registerServerCommand(new Sphere());
    event.registerServerCommand(new Face());
}
 
Example 10
Project: VanillaExtras   File: ModCore.java   View source code 5 votes vote down vote up
@EventHandler
public void serverStarting(FMLServerStartingEvent event) {
	PacketHandler.NETWORKINSTANCE.registerMessage(PacketGetWorker.Handler.class, PacketGetWorker.class,
			PacketHandler.nextID(), Side.SERVER);
	PacketHandler.NETWORKINSTANCE.registerMessage(PacketReturnWorker.Handler.class, PacketReturnWorker.class,
			PacketHandler.nextID(), Side.CLIENT);
	event.registerServerCommand(new MainCmd());
	event.registerServerCommand(new GamemodeCmd());
}
 
Example 11
Project: chunk-logger   File: ChunkLogger.java   View source code 5 votes vote down vote up
@Mod.EventHandler
public void serverStart(FMLServerStartingEvent event) {
	event.registerServerCommand(new GetPlayersInChunk());
	event.registerServerCommand(new GetPlayersInChunks());
	if (Loader.isModLoaded("ftbu")) {
		event.registerServerCommand(new GetPlayersInClaimedChunks());
	}
}
 
Example 12
Project: Teleporting-XP   File: TeleportingXP.java   View source code 5 votes vote down vote up
@EventHandler
public void serverStarting(FMLServerStartingEvent event)
{
	World world = FMLCommonHandler.instance().getMinecraftServerInstance().getEntityWorld();
	
	world.getGameRules().setOrCreateGameRule("teleportXP", "false");
}
 
Example 13
Project: minecraft-territorialdealings   File: Main.java   View source code 5 votes vote down vote up
@EventHandler
  public void serverLoad(FMLServerStartingEvent event)
  {
this.worldFolder = event.getServer().getFolderName();	// Hand me that world name

SaveHandler.loadFactionsFromFile();
  }
 
Example 14
Project: minecraft-territorialdealings   File: Main.java   View source code 5 votes vote down vote up
@EventHandler
  public void serverLoad(FMLServerStartingEvent event)
  {
this.worldDir = event.getServer().getFolderName();	// Hand me that world name

_SaveData save = SaveHandler.loadFactionsFromFile(Main.configDir, Main.worldDir);

if (save == null)
{
	save = new _SaveData();	// Init
}

TerritoryHandler.setSaveData(save);
  }
 
Example 15
Project: LittleThings-old   File: CommonProxy.java   View source code 5 votes vote down vote up
public void serverStarting(FMLServerStartingEvent e)
{
    e.registerServerCommand(new CommandHead());
    e.registerServerCommand(new CommandSurvivalShortcut());
    e.registerServerCommand(new CommandCreativeShortcut());
    e.registerServerCommand(new CommandAdventureShortcut());
    e.registerServerCommand(new CommandSpectatorShortcut());
    e.registerServerCommand(new CommandSkull());
    e.registerServerCommand(new CommandDimTeleport());
}
 
Example 16
Project: Simple-Dimensions   File: SimpleDimensions.java   View source code 5 votes vote down vote up
@EventHandler
public void serverStarting(FMLServerStartingEvent event)
{
	event.registerServerCommand(new CommandSimpleDimensions());
	event.registerServerCommand(new CommandWeatherD());
	event.registerServerCommand(new CommandTimeD());
	event.registerServerCommand(new CommandTeleportD());

	DimensionHandler.getInstance().loadDimensions();
}
 
Example 17
Project: wizards-of-lua   File: WizardsOfLua.java   View source code 5 votes vote down vote up
@EventHandler
public void serverLoad(FMLServerStartingEvent event) {
  server = event.getServer();
  gameProfiles = new GameProfiles(server);
  event.registerServerCommand(new WolCommand());
  event.registerServerCommand(new LuaCommand());
  ChunkLoaderTicketSupport.enableTicketSupport(instance);
}
 
Example 18
Project: metamorph   File: Metamorph.java   View source code 5 votes vote down vote up
@EventHandler
public void serverStarting(FMLServerStartingEvent event)
{
    /* Setting up the blacklist */

    MorphManager.INSTANCE.setActiveBlacklist(MorphUtils.reloadBlacklist());
    MorphManager.INSTANCE.setActiveSettings(MorphUtils.reloadMorphSettings());

    /* Register commands */
    event.registerServerCommand(new CommandMorph());
    event.registerServerCommand(new CommandAcquireMorph());
    event.registerServerCommand(new CommandMetamorph());
}
 
Example 19
Project: TombManyGraves   File: ModCommands.java   View source code 5 votes vote down vote up
public static void initCommands(FMLServerStartingEvent event)
{
    event.registerServerCommand(new CommandFriend());
    event.registerServerCommand(new CommandFriendList());
    event.registerServerCommand(new CommandRemoveFriend());
    event.registerServerCommand(new CommandClearFriendList());
    event.registerServerCommand(new CommandRestoreInventory());
    event.registerServerCommand(new CommandDropInventory());
    event.registerServerCommand(new CommandGetDeathList());
    event.registerServerCommand(new CommandLoot());
}
 
Example 20
Project: TombManyGraves-NOT-FOR-1.9.4-   File: ModCommands.java   View source code 5 votes vote down vote up
public static void initCommands(FMLServerStartingEvent event)
{
    event.registerServerCommand(new CommandFriend());
    event.registerServerCommand(new CommandFriendList());
    event.registerServerCommand(new CommandRemoveFriend());
    event.registerServerCommand(new CommandClearFriendList());
    event.registerServerCommand(new CommandRestoreInventory());
    event.registerServerCommand(new CommandDropInventory());
}
 
Example 21
Project: ShearMadness   File: ShearMadnessMod.java   View source code 5 votes vote down vote up
@EventHandler
public void onServerStarting(FMLServerStartingEvent event) {
    List<CommandBase> childCommands = Lists.newArrayList();

    MinecraftForge.EVENT_BUS.post(new RegisterShearMadnessCommandEvent(childCommands));

    event.registerServerCommand(new ShearMadnessCommand(childCommands));
}
 
Example 22
Project: Gravestone-mod-Extended   File: ExtendedCommands.java   View source code 5 votes vote down vote up
public static ExtendedCommands getInstance(FMLServerStartingEvent event) {
    if (instance == null) {
        return new ExtendedCommands(event);
    } else {
        return instance;
    }
}
 
Example 23
Project: ExtraTweaker   File: ExtraTweaker.java   View source code 5 votes vote down vote up
@EventHandler
public void onServerStart(FMLServerStartingEvent event) {
    registerCommands(event.getServer());
    if (mtAvailable) {
        registerLoggers();
    }
}
 
Example 24
Project: DexUtils   File: DexUtils.java   View source code 5 votes vote down vote up
@EventHandler
public void serverLoad(FMLServerStartingEvent event) {
	waypointDB = new MexDB(DimensionManager.getCurrentSaveRootDirectory()
			.getPath() + File.separator + Reference.MODID, "waypoint");
	waypointDB.autopush(true);
	
	//event.registerServerCommand(new HomeCommand("dex", "'setspawn', "));
	event.registerServerCommand(new HomeCommand("home",	"'set <name>', 'del <name>'"));
	event.registerServerCommand(new HomeCommand("spawn", "<world>"));
}
 
Example 25
Project: blockbuster   File: Blockbuster.java   View source code 5 votes vote down vote up
@EventHandler
public void serverStarting(FMLServerStartingEvent event)
{
    String path = DimensionManager.getCurrentSaveRootDirectory() + "/blockbuster/models";

    proxy.models.pack = proxy.getPack();
    proxy.models.pack.addFolder(path);
    proxy.loadModels(proxy.models.pack);

    event.registerServerCommand(new CommandAction());
    event.registerServerCommand(new CommandDirector());
    event.registerServerCommand(new CommandRecord());
    event.registerServerCommand(new CommandRecordSound());
}
 
Example 26
Project: MobHunter   File: MobHunter.java   View source code 5 votes vote down vote up
@Mod.EventHandler
public void serverStarting(FMLServerStartingEvent event)
{
    //Register commands
    event.registerServerCommand(new CommandQuest());
    event.registerServerCommand(new CommandHunterRank());
    event.registerServerCommand(new CommandMonsters());
}
 
Example 27
Project: TFICore   File: TFICommands.java   View source code 5 votes vote down vote up
public static void init(FMLServerStartingEvent event) {
    LogHelper.finfo("Adding Commands");
    //Can be disabled
    if(Configs.rainVoting){event.registerServerCommand(new CommandRainVote());}

    //Can't be disabled
    event.registerServerCommand(new CommandWorldInfo());
}
 
Example 28
Project: TMT-Refraction   File: CommonProxy.java   View source code 5 votes vote down vote up
public void serverStarting(FMLServerStartingEvent event) {
	String clname = Utils.HANDLER.getClass().getName();
	String expect = RefractionInternalHandler.class.getName();
	if (!clname.equals(expect)) {
		new IllegalAccessError("The Refraction API internal method handler has been overriden. "
				+ "This will cause the intended behavior of Refraction to be different than expected. "
				+ "It's marked \"Do not Override\", anyway. Whoever the hell overrode it needs to go "
				+ " back to primary school and learn to read. (Expected classname: " + expect + ", Actual classname: " + clname + ")").printStackTrace();
		FMLCommonHandler.instance().exitJava(1, true);
	}
}
 
Example 29
Project: EnderPay   File: EnderPay.java   View source code 5 votes vote down vote up
@Mod.EventHandler
@SuppressWarnings("unused")
public void onServerStart(FMLServerStartingEvent event) {
    Account.clear();

    minecraftServer = event.getServer();
    File file = getWorldDir(minecraftServer.getEntityWorld());
    if (file == null) return;

    Account.setLocation(new File(file, "EnderPay-accounts"));

    registerCommands(event);
}
 
Example 30
Project: EnderPay   File: EnderPay.java   View source code 5 votes vote down vote up
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());
}
 
Example 31
Project: Factorization   File: DocumentationModule.java   View source code 5 votes vote down vote up
@Mod.EventHandler
public void serverStarts(FMLServerStartingEvent event) {
    if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
        if (Core.dev_environ || Boolean.getBoolean("fz.registerDocCommands")) {
            event.registerServerCommand(new FzdocSerialize());
            event.registerServerCommand(new ExportHtml());
        }
    }
}
 
Example 32
Project: TaleCraft   File: TaleCraft.java   View source code 5 votes vote down vote up
@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);
}
 
Example 33
Project: vintagetg   File: VintageTG.java   View source code 5 votes vote down vote up
@EventHandler
public void onServerStart(FMLServerStartingEvent evt) {
	MinecraftServer server = MinecraftServer.getServer();
	ICommandManager command = server.getCommandManager();
	ServerCommandManager manager = (ServerCommandManager) command;
	manager.registerCommand(new VintageCraftCommands());
}
 
Example 34
Project: UniversalCoins   File: UniversalCoins.java   View source code 5 votes vote down vote up
@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());
}
 
Example 35
Project: morecommands   File: CommonProxy.java   View source code 5 votes vote down vote up
/**
 * Called from the main mod class to handle the server start
 */
protected void serverInit(FMLServerStartingEvent event) {
	this.handler.onStateEvent(event);
	
	try {
		this.registerServerCommands(event.getServer());
		this.mod.getLogger().info("Server Commands successfully registered");
	}
	catch (Exception ex) {this.mod.getLogger().warn("Failed to register Server Command", ex);}
	
	if (MoreCommandsConfig.retryHandshake)
		PacketHandlerServer.startHandshakeRetryThread();
}
 
Example 36
Project: Kingdom-Keys-Re-Coded   File: KingdomKeys.java   View source code 5 votes vote down vote up
@EventHandler
public void serverStart (FMLServerStartingEvent e) {
    e.registerServerCommand(new CommandLearnRecipe());
    e.registerServerCommand(new CommandGiveMunny());
    e.registerServerCommand(new CommandCheatMode());
    e.registerServerCommand(new CommandRemoveKeychain());
    e.registerServerCommand(new CommandResetLevel());
    e.registerServerCommand(new CommandLevelUp());
    e.registerServerCommand(new CommandDriveLevel());
    e.registerServerCommand(new CommandShowHud());
    e.registerServerCommand(new CommandDimension());
    e.registerServerCommand(new CommandOpenKeychains());

    logger.info("Commands loaded");
}
 
Example 37
Project: MoreDimensions   File: MoreDimensions.java   View source code 5 votes vote down vote up
@EventHandler
public void serverLoad(FMLServerStartingEvent event)
{
	LapisWorld.serverLoad(event);
	LapisDimension.serverLoad(event);
	CoalWorld.serverLoad(event);
	CoalDimension.serverLoad(event);
	RedstoneWorld.serverLoad(event);
	RedstoneDimension.serverLoad(event);
	IronWorld.serverLoad(event);
	IronDimension.serverLoad(event);
	GoldWorld.serverLoad(event);
	GoldDimension.serverLoad(event);
	EmeraldWorld.serverLoad(event);
	EmeraldDimension.serverLoad(event);
	DiamondWorld.serverLoad(event);
	DiamondDimension.serverLoad(event);
	WoodWorld.serverLoad(event);
	WoodDimension.serverLoad(event);
	VoidWorld.serverLoad(event);
	VoidDimension.serverLoad(event);
	SnowWorld.serverLoad(event);
	SnowDimension.serverLoad(event);
	QuartzWorld.serverLoad(event);
	QuartzDimension.serverLoad(event);
	GlassWorld.serverLoad(event);
	GlassDimension.serverLoad(event);
	ObsidianWorld.serverLoad(event);
	LapisIgniter.serverLoad(event);
	CoalIgniter.serverLoad(event);
	RedstoneIgniter.serverLoad(event);
	IronIgniter.serverLoad(event);
	GoldIgniter.serverLoad(event);
	DiamondIgniter.serverLoad(event);
	EmeraldIgniter.serverLoad(event);
	WoodIgniter.serverLoad(event);
	VoidIgniter.serverLoad(event);
	ObsidianDimension.serverLoad(event);
	ObsidianIgniter.serverLoad(event);
}
 
Example 38
Project: Bookshelf   File: Bookshelf.java   View source code 5 votes vote down vote up
@EventHandler
public void serverStarting (FMLServerStartingEvent event) {

    for (final ICommand command : BookshelfRegistry.getCommands()) {

        event.registerServerCommand(command);
    }
}
 
Example 39
Project: Wars-Mod   File: WarsMod.java   View source code 5 votes vote down vote up
@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());
}
 
Example 40
Project: Skills   File: Skillz.java   View source code 5 votes vote down vote up
@EventHandler
		public void serverStart(FMLServerStartingEvent event)
		{
			//MinecraftServer server = MinecraftServer.getServer();
			//ICommandManager command = server.getCommandManager();
			//ServerCommandManager manager = (ServerCommandManager) command;
			
//			manager.registerCommand(new CommandPhysics());

		}