@Override public <T extends FMLStateEvent> boolean applyStateEventPatch(T e) { FMLServerAboutToStartEvent event = (FMLServerAboutToStartEvent) e; Field commandManager = ReflectionHelper.getField(ObfuscatedField.MinecraftServer_commandManager); if (commandManager != null) { try { commandManager.set(event.getServer(), new ServerCommandManager(event.getServer(), event.getServer().getCommandManager())); PatchManager.instance().getGlobalAppliedPatches().setPatchSuccessfullyApplied(this.displayName, true); return true; } catch (Exception ex) { PatchManager.instance().getGlobalAppliedPatches().setPatchSuccessfullyApplied(this.displayName, false); return false; } } else { PatchManager.instance().getGlobalAppliedPatches().setPatchSuccessfullyApplied(this.displayName, false); return false; } }
private boolean applyServerStartPatches(FMLServerAboutToStartEvent event) { boolean success = networkManagers == null ? false : ReflectionHelper.set(ObfuscatedField.NetworkSystem_networkManagers, networkManagers, event.getServer().getNetworkSystem(), Collections.<NetworkManager>synchronizedList(new ArrayList<NetworkManager>() { private static final long serialVersionUID = 498247631553542876L; @Override public boolean add(NetworkManager manager) { PatchEntityPlayerSP.this.onNetworkManagerAdd(manager); return super.add(manager); } })); PatchManager.instance().getGlobalAppliedPatches().setPatchSuccessfullyApplied(this.displayName, success); return success; }
@Mod.EventHandler public void beforeServerStart(FMLServerAboutToStartEvent event) { ICommandManager manager = event.getServer().getCommandManager(); if (manager instanceof CommandHandler) { ((CommandHandler) manager).registerCommand(new DebugDamageCommand()); } }
@Mod.EventHandler public void serverPreInit(FMLServerAboutToStartEvent event) { // System.out.println("Starting server"); if (!event.getServer().isDedicatedServer()) for (WeaponData weapon : MapList.nameToData.values()) ClientProxy.RegisterWeaponData(weapon); /*if(event.getSide()==Side.SERVER) AchievementPage.registerAchievementPage(new TF2Achievements());*/ }
@Mod.EventHandler public void onServerAboutToStart(FMLServerAboutToStartEvent event) { File worldDir = new File(((AnvilSaveConverter) event.getServer().getActiveAnvilConverter()).savesDirectory, event.getServer().getFolderName()); DimensionConfig.instance().readDimensionConfig(worldDir); // This needs to be here so that we are able to override existing dimensions before // they get loaded during server start. // But on the other hand we don't want to register the rest of the dimensions yet, // otherwise they would be considered 'static dimensions' and get loaded on server start. DimensionConfig.instance().registerOverriddenDimensions(); }
@Override public <T extends FMLStateEvent> boolean applyStateEventPatch(T e) { FMLServerAboutToStartEvent event = (FMLServerAboutToStartEvent) e; try { Constructor<PlayerList> ctor; if (event.getServer().isDedicatedServer()) ctor = (Constructor<PlayerList>) (Constructor<?>) DedicatedPlayerList.class.getDeclaredConstructor(DedicatedServer.class); else ctor = (Constructor<PlayerList>) (Constructor<?>) IntegratedPlayerList.class.getDeclaredConstructor(IntegratedServer.class); ctor.setAccessible(true); if (event.getServer().isDedicatedServer()) event.getServer().setPlayerList(ctor.newInstance((DedicatedServer) event.getServer())); else event.getServer().setPlayerList(ctor.newInstance((IntegratedServer) event.getServer())); PatchManager.instance().getGlobalAppliedPatches().setPatchSuccessfullyApplied(this.displayName, true); return true; } catch (Exception ex) { PatchManager.instance().getGlobalAppliedPatches().setPatchSuccessfullyApplied(this.displayName, false); return false; } }
@Override public boolean applyStateEventPatch(FMLStateEvent event) { if (event instanceof FMLPostInitializationEvent) return applyPostInitPatches((FMLPostInitializationEvent) event); else if (event instanceof FMLServerAboutToStartEvent) return applyServerStartPatches((FMLServerAboutToStartEvent) event); else throw new IllegalArgumentException("Invalid Event"); }
@Mod.EventHandler public void serverAboutToStart(FMLServerAboutToStartEvent event) { // (Re-)Load the config when the server is about to start. // This means that in single player you can just save and exit to main menu, // make changes to the config and then load a world and have the new configs be used. Configs.reload(); }
@Mod.EventHandler public void onServerAboutToStartEvent(FMLServerAboutToStartEvent event) { // Register data fixers ModFixs dataFixer = proxy.getDataFixer(); TileEntityID renames = new TileEntityID(); dataFixer.registerFix(FixTypes.BLOCK_ENTITY, renames); dataFixer.registerFix(FixTypes.ITEM_INSTANCE, renames); }
@Mod.EventHandler public void serverStarting(FMLServerAboutToStartEvent event) { SessionState.serverHasMod = 1; SessionState.currentKing = ""; proxy.initCommands(event.getServer()); }
@EventHandler public void serverAboutToStart(FMLServerAboutToStartEvent event) { proxy.serverAboutToStart(event); }
@Override public void serverAboutToStart(FMLServerAboutToStartEvent event) { // inject server ServerInjector.InjectIntegrated(FMLCommonHandler.instance().getMinecraftServerInstance()); }
@Override public void serverAboutToStart(FMLServerAboutToStartEvent event) { // inject server ServerInjector.InjectDedicated(FMLCommonHandler.instance().getMinecraftServerInstance()); }
@Mod.EventHandler public void serverSet(FMLServerAboutToStartEvent event) { server = event.getServer(); }
@EventHandler public void serverAboutToStart(@Nonnull final FMLServerAboutToStartEvent event) { proxy.serverAboutToStart(event); }
public void serverAboutToStart(@Nonnull final FMLServerAboutToStartEvent event) { ServiceManager.initialize(); }
@EventHandler public static void onServerAboutToStart(FMLServerAboutToStartEvent event) { TomsModUtils.setServer(event.getServer()); }
@Mod.EventHandler public void onServerAboutToStart(FMLServerAboutToStartEvent event) { Configs.readConfigs(configDir); }
@Override public Collection<Class<? extends FMLStateEvent>> stateEventClasses() { return Sets.<Class<? extends FMLStateEvent>>newHashSet(FMLServerAboutToStartEvent.class); }
@Override public <T extends FMLStateEvent> boolean needsToBeApplied(T event) { return event instanceof FMLServerAboutToStartEvent ? !((FMLServerAboutToStartEvent) event).getServer().isDedicatedServer() : true; }
@Override public Collection<Class<? extends FMLStateEvent>> stateEventClasses() { return Sets.<Class<? extends FMLStateEvent>>newHashSet(FMLPostInitializationEvent.class, FMLServerAboutToStartEvent.class); }
/** * Called from the main mod class to do stuff before the server starts */ protected void serverStart(FMLServerAboutToStartEvent event) { this.handler.onStateEvent(event); ensureChatChannelsLoaded(); }
@EventHandler public void serverAboutToStart(FMLServerAboutToStartEvent evt) { this.pendingWork = new MapMaker().weakKeys().makeMap(); this.completedWork = new MapMaker().weakKeys().makeMap(); this.completedWorkLocks = new MapMaker().weakKeys().makeMap(); Set<IWorldGenerator> worldGens = ObfuscationReflectionHelper.getPrivateValue(GameRegistry.class, null, "worldGenerators"); Map<IWorldGenerator,Integer> worldGenIdx = ObfuscationReflectionHelper.getPrivateValue(GameRegistry.class, null, "worldGeneratorIndex"); for (String retro : ImmutableSet.copyOf(retros.keySet())) { if (!delegates.containsKey(retro)) { FMLLog.info("Substituting worldgenerator %s with delegate", retro); for (Iterator<IWorldGenerator> iterator = worldGens.iterator(); iterator.hasNext();) { IWorldGenerator wg = iterator.next(); if (wg.getClass().getName().equals(retro)) { iterator.remove(); TargetWorldWrapper tww = new TargetWorldWrapper(); tww.delegate = wg; tww.tag = retro; worldGens.add(tww); Integer idx = worldGenIdx.remove(wg); worldGenIdx.put(tww, idx); FMLLog.info("Successfully substituted %s with delegate", retro); delegates.put(retro, tww); break; } } if (!delegates.containsKey(retro)) { FMLLog.warning("WorldRetrogen was not able to locate world generator class %s, it will be skipped, found %s", retro, worldGens); retros.remove(retro); } } } }
@EventHandler public void getServerInstance(FMLServerAboutToStartEvent event){ bss.setServerInstance(event.getServer()); }
@EventHandler public static void onServerStart(FMLServerAboutToStartEvent event) { ServerChannelRegister.instance.reset(); }
public void serverAboutToStart(FMLServerAboutToStartEvent event) { }
void serverAboutToStart(FMLServerAboutToStartEvent event);