当前位置: 首页>>代码示例>>Java>>正文


Java GamePreInitializationEvent类代码示例

本文整理汇总了Java中org.spongepowered.api.event.game.state.GamePreInitializationEvent的典型用法代码示例。如果您正苦于以下问题:Java GamePreInitializationEvent类的具体用法?Java GamePreInitializationEvent怎么用?Java GamePreInitializationEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GamePreInitializationEvent类属于org.spongepowered.api.event.game.state包,在下文中一共展示了GamePreInitializationEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onGamePreInit

import org.spongepowered.api.event.game.state.GamePreInitializationEvent; //导入依赖的package包/类
@Listener
public void onGamePreInit(GamePreInitializationEvent event) {
    // Register the generator types
    this.game.getRegistry().register(GeneratorType.class, new OverworldGeneratorType(
            this.container.getId(), "overworld", "Porygen Overworld"));
    this.game.getRegistry().register(GeneratorType.class, new NetherGeneratorType(
            this.container.getId(), "nether", "Porygen Nether"));
    this.game.getRegistry().register(GeneratorType.class, new TheEndGeneratorType(
            this.container.getId(), "the_end", "Porygen The End"));

    // TODO
    // These will just be the same as overworld, but with some custom settings
    this.game.getRegistry().register(GeneratorType.class, new OverworldGeneratorType(
            this.container.getId(), "amplified", "Porygen Amplified Overworld"));
    this.game.getRegistry().register(GeneratorType.class, new OverworldGeneratorType(
            this.container.getId(), "large_biomes", "Porygen Large Biomes Overworld"));

    // The default-world-gen.json is lantern related, a way to register the porygen
    // generator types as the default ones. The lantern default ones are flat generator,
    // this plugin is required for awesomeness.
}
 
开发者ID:LanternPowered,项目名称:Porygen,代码行数:22,代码来源:PorygenPlugin.java

示例2: onPreInit

import org.spongepowered.api.event.game.state.GamePreInitializationEvent; //导入依赖的package包/类
@Listener
public void onPreInit(GamePreInitializationEvent event) {
    try {
        this.container = DiscoveryModuleContainer.builder()
                .setPackageToScan("io.github.nucleuspowered.phonon.modules") // All modules will be in here.
                .setLoggerProxy(new PhononLoggerProxy(this.logger))
                .setConstructor(new PhononModuleConstructor(this)) // How modules are constructed
                .setConfigurationLoader(loader)
                .setOnEnable(this::updateInjector) // Before the enable phase, update the Guice injector.
                .setNoMergeIfPresent(true)
                .build(true);
    } catch (Exception e) {
        e.printStackTrace();
        onError();
    }
}
 
开发者ID:NucleusPowered,项目名称:Phonon,代码行数:17,代码来源:Phonon.java

示例3: onPreInit

import org.spongepowered.api.event.game.state.GamePreInitializationEvent; //导入依赖的package包/类
@Listener //During this state, the plugin gets ready for initialization. Logger and config
public void onPreInit(GamePreInitializationEvent preInitEvent) {
    logger.info("Setting up config");

    rootNode = configManager.createEmptyNode();
    try {
        configMapper = ObjectMapper.forClass(ColorConsoleConfig.class).bindToNew();

        rootNode = configManager.load();
        configMapper.populate(rootNode);

        //add and save missing values
        configMapper.serialize(rootNode);
        configManager.save(rootNode);
    } catch (IOException | ObjectMappingException ioEx) {
        logger.error("Cannot save default config", ioEx);
        return;
    }

    installLogFormat();
}
 
开发者ID:games647,项目名称:ColorConsole,代码行数:22,代码来源:ColorConsoleSponge.java

示例4: onPreInitialization

import org.spongepowered.api.event.game.state.GamePreInitializationEvent; //导入依赖的package包/类
@Listener
public void onPreInitialization(GamePreInitializationEvent event) {
	instance = this;
	locale = Config.getInstance().loadLocale();
	logger.info(TranslationHelper.s("string.console.preinit", locale, PluginInfo.VERSION));
	if (!Files.exists(path)) {
		logger.info(TranslationHelper.s("string.console.createConfigDir", locale));
		try {
			Files.createDirectories(path);
			logger.info(TranslationHelper.s("string.console.createdConfigDir", locale, getConfigPath()));
		} catch (Exception e) {
			logger.error(TranslationHelper.s("string.console.errorConfigDir", locale, e.getMessage()));
		}
	}
	Config.getInstance().load();
	PlayerList.getInstance().load();
	logger.info(TranslationHelper.s("string.console.preinitComplete", locale));
}
 
开发者ID:TehTotalPwnage,项目名称:PvPToggle,代码行数:19,代码来源:PvPToggle.java

示例5: onLoad

import org.spongepowered.api.event.game.state.GamePreInitializationEvent; //导入依赖的package包/类
@Listener
public void onLoad(GamePreInitializationEvent event) {
    placeholderManager = new SpongePlaceholderManager();
    Arrays.stream(SpongePlaceholder.values()).forEach(placeholder -> {
        placeholderManager.registerMapping(PlaceholderPlugin.this, placeholder.getPlaceholder(), placeholder.getMappingFunction());
        Arrays.stream(placeholder.getAliases()).forEach(alias -> placeholderManager.registerMapping(PlaceholderPlugin.this, alias, placeholder.getMappingFunction()));
    });
    injector = injector.createChildInjector(new AbstractModule() {
        @Override
        protected void configure() {
            bind(SpongePlaceholderManager.class).toInstance(placeholderManager);
            bind(PlaceholderManager.class).toInstance(placeholderManager);
        }
    });
    // TODO: Share Injector instance without creating singleton.
}
 
开发者ID:csh,项目名称:placeholders,代码行数:17,代码来源:PlaceholderPlugin.java

示例6: onPreInitialize

import org.spongepowered.api.event.game.state.GamePreInitializationEvent; //导入依赖的package包/类
@Listener
public void onPreInitialize(GamePreInitializationEvent event) {
    instance = this;
    // Register the custom data
    Sponge.getDataManager().registerBuilder(JobData.class, new JobDataManipulatorBuilder());
    Sponge.getDataManager().registerBuilder(SignJobData.class, new SignJobDataManipulatorBuilder());
    // Initialze basic plugin managers needed for further initialization
    if (new File(configDir.toString()).isAbsolute()) {
        fileManager = FileManager.createInstance(this, configDir.toString());
    } else {
        fileManager = FileManager.createInstance(this, "./" + configDir.toString());
    }

    messageStorage = MessageStorage.createInstance(this, configDir.toString());
    messageStorage.defaultMessages("jobslitemessages");
}
 
开发者ID:Flibio,项目名称:JobsLite,代码行数:17,代码来源:JobsLite.java

示例7: onEnable

import org.spongepowered.api.event.game.state.GamePreInitializationEvent; //导入依赖的package包/类
@Listener
public void onEnable(GamePreInitializationEvent event)
{
    this.logger = mm.getLoggerFor(Travel.class);
    i18n.getCompositor().registerFormatter(new TpPointFormatter(i18n));

    this.homeManager = new HomeManager(this, i18n, reflector.load(HomeConfig.class, mm.getPathFor(Travel.class).resolve("homes.yml").toFile()));
    this.cm.getProviders().register(this, new HomeCompleter(homeManager), Home.class);
    this.em.registerListener(Travel.class, this.homeManager);
    this.warpManager = new WarpManager(reflector.load(WarpConfig.class, mm.getPathFor(Travel.class).resolve("warps.yml").toFile()));
    this.cm.getProviders().register(this, new WarpCompleter(warpManager), Warp.class);

    cm.addCommand(new HomeCommand(cm, this, selector, i18n));
    cm.addCommand(new WarpCommand(cm, this, i18n));

    cm.getProviders().getExceptionHandler().addHandler(new TravelExceptionHandler(i18n));
}
 
开发者ID:CubeEngine,项目名称:modules-main,代码行数:18,代码来源:Travel.java

示例8: onSetup

import org.spongepowered.api.event.game.state.GamePreInitializationEvent; //导入依赖的package包/类
@Listener
public void onSetup(GamePreInitializationEvent event)
{
    cm.getProviders().getExceptionHandler().addHandler(new RolesExceptionHandler(i18n));
    this.permLogger = factory.getLog(LogFactory.class, "Permissions");
    ThreadFactory threadFactory = mm.getThreadFactory(Roles.class);
    this.permLogger.addTarget(
            new AsyncFileTarget.Builder(LoggingUtil.getLogFile(fm, "Permissions").toPath(),
                    LoggingUtil.getFileFormat(false, true)
            ).setAppend(true).setCycler(LoggingUtil.getCycler()).setThreadFactory(threadFactory).build());

    Optional<PermissionService> previous = Sponge.getServiceManager().provide(PermissionService.class);
    Sponge.getServiceManager().setProvider(plugin.getInstance().get(), PermissionService.class, service);
    if (previous.isPresent())
    {
        if (!previous.get().getClass().getName().equals(RolesPermissionService.class.getName()))
        {
            this.service.getLog().info("Replaced existing Permission Service: {}", previous.get().getClass().getName());
        }
    }
}
 
开发者ID:CubeEngine,项目名称:modules-main,代码行数:22,代码来源:Roles.java

示例9: onPreInit

import org.spongepowered.api.event.game.state.GamePreInitializationEvent; //导入依赖的package包/类
@Listener
public void onPreInit(GamePreInitializationEvent event)
{
    DataRegistration<LockerData, ImmutableLockerData> dr =
            DataRegistration.<LockerData, ImmutableLockerData>builder()
                    .dataClass(LockerData.class).immutableClass(ImmutableLockerData.class)
                    .builder(new LockerDataBuilder()).manipulatorId("locker")
                    .dataName("CubeEngine Locker Data")
                    .buildAndRegister(plugin);

    LockerData.LOCK_ID.getQuery();

    Sponge.getDataManager().registerLegacyManipulatorIds(LockerData.class.getName(), dr);


    ConverterManager cManager = reflector.getDefaultConverterManager();
    cManager.registerConverter(new BlockLockerConfigConverter(logger, mm), BlockLockConfig.class);
    cManager.registerConverter(new EntityLockerConfigConverter(logger, entityMatcher), EntityLockConfig.class);

    cm.getProviders().register(this, new PlayerAccess.PlayerAccessParser(), PlayerAccess.class);

    this.config = fm.loadConfig(this, LockerConfig.class);
}
 
开发者ID:CubeEngine,项目名称:modules-main,代码行数:24,代码来源:Locker.java

示例10: onEnable

import org.spongepowered.api.event.game.state.GamePreInitializationEvent; //导入依赖的package包/类
@Listener
public void onEnable(GamePreInitializationEvent event)
{
    this.modulePath = mm.getPathFor(Kits.class);
    this.plugin = mm.getPlugin(Kits.class).get();
    DataRegistration<KitData, ImmutableKitData> dr = DataRegistration.<KitData, ImmutableKitData>builder()
            .dataClass(KitData.class).immutableClass(ImmutableKitData.class)
            .builder(new KitDataBuilder()).manipulatorId("kits")
            .dataName("CubeEngine Kits Data")
            .buildAndRegister(plugin);
    Sponge.getDataManager().registerLegacyManipulatorIds(KitData.class.getName(), dr);
    KitData.TIME.getQuery();

    this.kitManager = new KitManager(this, reflector, sm);
    this.kitManager.loadKits();
    em.registerListener(Kits.class, kitManager);
    cm.getProviders().register(this, new KitParser(kitManager), Kit.class);

    KitCommand cmd = new KitCommand(this, i18n, igf, cm);
    cm.addCommand(cmd);
    cmd.addCommand(new KitEditCommand(cm, i18n, kitManager));
}
 
开发者ID:CubeEngine,项目名称:modules-extra,代码行数:23,代码来源:Kits.java

示例11: onPreInit

import org.spongepowered.api.event.game.state.GamePreInitializationEvent; //导入依赖的package包/类
@Listener
public void onPreInit(GamePreInitializationEvent event)
{
    try
    {
        setLoggerLevel("org.mongodb.driver.connection", "WARN");
        setLoggerLevel("org.mongodb.driver.management", "WARN");
        setLoggerLevel("org.mongodb.driver.cluster", "WARN");
        setLoggerLevel("org.mongodb.driver.protocol.insert", "WARN");
        setLoggerLevel("org.mongodb.driver.protocol.query", "WARN");
        setLoggerLevel("org.mongodb.driver.protocol.update", "WARN");
        setLoggerLevel("org.mongodb.driver.protocol.command", "WARN");
        setLoggerLevel("org.mongodb.driver.management", "ERROR");
        getDatabase();
        releaseClient();
    }
    catch (RuntimeException e)
    {
        throw new IllegalStateException("Failed to connect to the your MongoDB instance!", e);
    }
}
 
开发者ID:CubeEngine,项目名称:modules-extra,代码行数:22,代码来源:Bigdata.java

示例12: onGamePreInitialization

import org.spongepowered.api.event.game.state.GamePreInitializationEvent; //导入依赖的package包/类
@Listener
public void onGamePreInitialization(@Nonnull final GamePreInitializationEvent event) {
    final String configName = this.config.getFile().getFileName().toString();
    final ConfigProfile profile = AmicusCore.getInstance().getConfigProfile(
            ConfigProfile.PROFILE.get(this.config)
    );

    if (profile == null) {
        this.game.getEventManager().unregisterPluginListeners(this);
    }

    this.profile = Optional.ofNullable(profile);
    this.displayProfileStatus();
}
 
开发者ID:FerusTech,项目名称:Amicus,代码行数:15,代码来源:AmicusPlugin.java

示例13: onGamePreInitialization

import org.spongepowered.api.event.game.state.GamePreInitializationEvent; //导入依赖的package包/类
@Listener(order = Order.EARLY)
public void onGamePreInitialization(@Nonnull final GamePreInitializationEvent event) {
    if (this.configProfilesFile == null) {
        LOGGER.error("Failed to properly load configuration profiles.", new IllegalStateException());
        return;
    }

    this.configProfiles.clear();
    for (final Map.Entry<Object, ? extends ConfigurationNode> entry : this.configProfilesFile.getNode().getChildrenMap().entrySet()) {
        if (!entry.getValue().hasMapChildren()) {
            continue;
        }

        final String key = "" + entry.getKey();
        final ConfigurationNode config = entry.getValue();

        final ConfigProfile profile = ConfigProfile.parse(key, config);
        if (profile == null) {
            continue;
        }

        LOGGER.info("Found \"{}\" profile, using \"{}\".", key,
                profile.getStorage().getStorageType().toString());

        this.configProfiles.put(key, profile);
    }

    if (!this.hasConfigProfile("default")) {
        LOGGER.warn("Couldn't find a \"default\" configuration profile.");
    }
}
 
开发者ID:FerusTech,项目名称:Amicus,代码行数:32,代码来源:AmicusCore.java

示例14: gameInit

import org.spongepowered.api.event.game.state.GamePreInitializationEvent; //导入依赖的package包/类
@Listener
public void gameInit(GamePreInitializationEvent event){
    logger = LoggerFactory.getLogger(pC.getName());
    instance = this;
    huskyAPI = new HuskyAPI();
    forceStopIDs.clear();
    for(PluginContainer pc: Sponge.getPluginManager().getPlugins()){
        if(pc.getId().equalsIgnoreCase("inventorytweaks")||pc.getId().equalsIgnoreCase("inventorysorter")||pc.getId().equalsIgnoreCase("mousetweaks")){
            forceStopIDs.add(pc.getName() + "(" + pc.getId() + ")");
            logger.error("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
            logger.error("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
            logger.error(pc.getName() + " is loaded! This plugin or mod is on a blacklist for HuskyCrates, and as a result, HuskyCrates is not starting. ");
            logger.error("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
            logger.error("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
            forceStop = true;

        }
    }
    if(forceStop)
        return;

    CommentedConfigurationNode conf = null;
    try {
        conf = crateConfig.load();
        if(!conf.getNode("lang").isVirtual()) {
            langData = new LangData(conf.getNode("lang"));
        }else
            logger.info("Using default lang settings.");

    } catch (Exception e) {
        crateUtilities.exceptionHandler(e);
    }


    //logger.info("Let's not init VCrates here anymore. ://)");


}
 
开发者ID:codeHusky,项目名称:HuskyCrates-Sponge,代码行数:39,代码来源:HuskyCrates.java

示例15: onGamePreInit

import org.spongepowered.api.event.game.state.GamePreInitializationEvent; //导入依赖的package包/类
@Listener
public void onGamePreInit(@Nullable final GamePreInitializationEvent event) {
    this.logger.info("Plugin Initializing...");
    virtualtool = this;
    Tools.ConvertBPS(this);
    Tools.Backpack_unlockall(this);
}
 
开发者ID:poqdavid,项目名称:VirtualTool,代码行数:8,代码来源:VirtualTool.java


注:本文中的org.spongepowered.api.event.game.state.GamePreInitializationEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。