Java 类net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent 实例源码

项目:morecommands    文件:PatchServerCommandManager.java   
@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;
    }
}
项目:morecommands    文件:PatchEntityPlayerSP.java   
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;
}
项目:FirstAid    文件:FirstAid.java   
@Mod.EventHandler
public void beforeServerStart(FMLServerAboutToStartEvent event) {
    ICommandManager manager = event.getServer().getCommandManager();
    if (manager instanceof CommandHandler) {
        ((CommandHandler) manager).registerCommand(new DebugDamageCommand());
    }
}
项目:Mods    文件:TF2weapons.java   
@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());*/
}
项目:justenoughdimensions    文件:JustEnoughDimensions.java   
@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();
}
项目:morecommands    文件:PatchEntityPlayerMP.java   
@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;
    }
}
项目:morecommands    文件:PatchEntityPlayerSP.java   
@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");
}
项目:paintedbiomes    文件:PaintedBiomes.java   
@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();
}
项目:enderutilities    文件:EnderUtilities.java   
@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);
}
项目:Hats    文件:Hats.java   
@Mod.EventHandler
public void serverStarting(FMLServerAboutToStartEvent event)
{
    SessionState.serverHasMod = 1;
    SessionState.currentKing = "";

    proxy.initCommands(event.getServer());
}
项目:UniversalRemote    文件:UniversalRemote.java   
@EventHandler
public void serverAboutToStart(FMLServerAboutToStartEvent event)
{
    proxy.serverAboutToStart(event);
}
项目:UniversalRemote    文件:ClientProxy.java   
@Override
public void serverAboutToStart(FMLServerAboutToStartEvent event) {
    // inject server
    ServerInjector.InjectIntegrated(FMLCommonHandler.instance().getMinecraftServerInstance());
}
项目:UniversalRemote    文件:ServerProxy.java   
@Override
public void serverAboutToStart(FMLServerAboutToStartEvent event) {
    // inject server
    ServerInjector.InjectDedicated(FMLCommonHandler.instance().getMinecraftServerInstance());
}
项目:signal-catcher    文件:SignalCatcher.java   
@Mod.EventHandler
public void serverSet(FMLServerAboutToStartEvent event) {
    server = event.getServer();
}
项目:DynamicSurroundings    文件:DSurround.java   
@EventHandler
public void serverAboutToStart(@Nonnull final FMLServerAboutToStartEvent event) {
    proxy.serverAboutToStart(event);
}
项目:DynamicSurroundings    文件:Proxy.java   
public void serverAboutToStart(@Nonnull final FMLServerAboutToStartEvent event) {
    ServiceManager.initialize();
}
项目:Toms-Mod    文件:CoreInit.java   
@EventHandler
public static void onServerAboutToStart(FMLServerAboutToStartEvent event) {
    TomsModUtils.setServer(event.getServer());
}
项目:orecontrol    文件:OreControl.java   
@Mod.EventHandler
public void onServerAboutToStart(FMLServerAboutToStartEvent event)
{
    Configs.readConfigs(configDir);
}
项目:morecommands    文件:PatchEntityPlayerMP.java   
@Override
public Collection<Class<? extends FMLStateEvent>> stateEventClasses() {
    return Sets.<Class<? extends FMLStateEvent>>newHashSet(FMLServerAboutToStartEvent.class);
}
项目:morecommands    文件:PatchServerCommandManager.java   
@Override
public Collection<Class<? extends FMLStateEvent>> stateEventClasses() {
    return Sets.<Class<? extends FMLStateEvent>>newHashSet(FMLServerAboutToStartEvent.class);
}
项目:morecommands    文件:PatchEntityPlayerSP.java   
@Override
public <T extends FMLStateEvent> boolean needsToBeApplied(T event) {
    return event instanceof FMLServerAboutToStartEvent ? !((FMLServerAboutToStartEvent) event).getServer().isDedicatedServer() : true;
}
项目:morecommands    文件:PatchEntityPlayerSP.java   
@Override
public Collection<Class<? extends FMLStateEvent>> stateEventClasses() {
    return Sets.<Class<? extends FMLStateEvent>>newHashSet(FMLPostInitializationEvent.class, FMLServerAboutToStartEvent.class);
}
项目:morecommands    文件:CommonProxy.java   
/**
 * Called from the main mod class to do stuff before the server starts
 */
protected void serverStart(FMLServerAboutToStartEvent event) {
    this.handler.onStateEvent(event);
    ensureChatChannelsLoaded();
}
项目:Hard-Science    文件:HardScience.java   
@EventHandler
 public void serverAboutToStart(FMLServerAboutToStartEvent event) 
{
    proxy.serverAboutToStart(event);
 }
项目:simpleretrogen    文件:WorldRetrogen.java   
@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);
            }
        }
    }
}
项目:Minecraft-Turn-Based-Battle-Mod    文件:ModMain.java   
@EventHandler
public void getServerInstance(FMLServerAboutToStartEvent event){
    bss.setServerInstance(event.getServer());
}
项目:EnderIO    文件:EnderIO.java   
@EventHandler
public static void onServerStart(FMLServerAboutToStartEvent event) {
  ServerChannelRegister.instance.reset();
}
项目:Hard-Science    文件:CommonProxy.java   
public void serverAboutToStart(FMLServerAboutToStartEvent event)
{

}
项目:UniversalRemote    文件:ISidedProxy.java   
void serverAboutToStart(FMLServerAboutToStartEvent event);