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


Java GameStartedServerEvent类代码示例

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


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

示例1: gameStarted

import org.spongepowered.api.event.game.state.GameStartedServerEvent; //导入依赖的package包/类
@Listener
public void gameStarted(GameStartedServerEvent event){

    if(forceStop) {
        return;
    }

    HuskyCommandManager huskyCommandManager = new HuskyCommandManager();

    scheduler = Sponge.getScheduler();
    //genericCause = Cause.of(EventContext.);
    Sponge.getCommandManager().register(this, huskyCommandManager.getCrateSpec(), "hc","huskycrates");
    Sponge.getCommandManager().register(this, huskyCommandManager.getHuskySpec(), "husky");
    metrics.addCustomChart(new Metrics.SimplePie("huskyui_version", () -> HuskyUI.PLUGIN_VERSION));
    logger.info("Crates has been started.");
}
 
开发者ID:codeHusky,项目名称:HuskyCrates-Sponge,代码行数:17,代码来源:HuskyCrates.java

示例2: onServerStart

import org.spongepowered.api.event.game.state.GameStartedServerEvent; //导入依赖的package包/类
@Listener
public void onServerStart(GameStartedServerEvent event) {
	instance = this;
	
	ConfigBuilder.configPath = Paths.get(configDir.toString(), "config.json");
	
	RText.impl(new RTextSponge());
	RColour.impl(new RColourSponge());
	Travellers.impl(new SpongeTravellers());
	
	CommandSpec camCommandSpec = CommandSpec.builder()
			.arguments(GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("cmd"))))
			.executor(new SpongeCommandManager())
			.build();

	Sponge.getCommandManager().register(this, camCommandSpec, "cam", "camerastudio");
}
 
开发者ID:redstone,项目名称:RCameraStudio,代码行数:18,代码来源:RCameraStudioSponge.java

示例3: onStartedServer

import org.spongepowered.api.event.game.state.GameStartedServerEvent; //导入依赖的package包/类
@Listener
public void onStartedServer(GameStartedServerEvent event)
{
    try
    {
        this.logger.info("Start loading config ...");
        this.loadConfig();
        if (this.doCheckUpdate)
        {
            new Thread(this::checkUpdate).start();
        }
        this.saveConfig();
        this.logger.info("Loading config complete.");
    }
    catch (IOException e)
    {
        throw Throwables.propagate(e);
    }
}
 
开发者ID:ustc-zzzz,项目名称:VirtualChest,代码行数:20,代码来源:VirtualChestPlugin.java

示例4: onServerStart

import org.spongepowered.api.event.game.state.GameStartedServerEvent; //导入依赖的package包/类
@Listener
public void onServerStart(GameStartedServerEvent event) {
    parentDirectory = defaultConfig.getParentFile();

    try {
        loadZones();
    } catch (IOException e) {
        e.printStackTrace();
    }

    // Commands
    game.getCommandManager().register(this, SafeGuardCommands.getCommand(), "sg", "safeguard");

    // Listeners
    game.getEventManager().registerListeners(this, new ChangeBlockListener());
    game.getEventManager().registerListeners(this, new DamageEntityListener());
    game.getEventManager().registerListeners(this, new DropItemListener());
    game.getEventManager().registerListeners(this, new ExplosionListener());
    game.getEventManager().registerListeners(this, new InteractBlockListener());
    game.getEventManager().registerListeners(this, new InteractEntityListener());
    game.getEventManager().registerListeners(this, new MoveEntityListener());
    game.getEventManager().registerListeners(this, new SpawnEntityListener());

    logger.info("SafeGuard started. Your haven is safe.");
}
 
开发者ID:prism,项目名称:SafeGuard,代码行数:26,代码来源:SafeGuard.java

示例5: onServerSTarted

import org.spongepowered.api.event.game.state.GameStartedServerEvent; //导入依赖的package包/类
@Listener
public void onServerSTarted(GameStartedServerEvent event) {
    Task.builder()
            .delay(5, TimeUnit.SECONDS)
            .interval(1, TimeUnit.SECONDS)
            .name("Disco Changer")
            .execute(() -> {
                // DISCO DISCO TIME
                ImmutableList<Aspect> aspects = ImmutableList.copyOf(Sponge.getRegistry().getAllOf(Aspect.class));
                for (Map.Entry<UUID, UUID> entry : this.auraMap.entrySet()) {
                    Optional<World> world = Sponge.getServer().getWorld(entry.getKey());
                    world.ifPresent(spongeWorld -> {
                        Optional<Entity> aura = spongeWorld.getEntity(entry.getValue());
                        aura.ifPresent(auraNode -> {
                            AuraNodeData nodeData = ((AuraNode) auraNode).auraNodeData();
                            Aspect value = aspects.get(RANDOM.nextInt(aspects.size()));
                            nodeData.set(ThaumicKeys.AURA_NODE_ASPECT, value);
                            nodeData.set(ThaumicKeys.AURA_NODE_SIZE, RANDOM.nextInt(400));
                            auraNode.offer(nodeData);
                        });
                    });
                }

            })
            .submit(this);
}
 
开发者ID:gabizou,项目名称:ThaumicSponge,代码行数:27,代码来源:ThaumicSpongeMod.java

示例6: onServerStarting

import org.spongepowered.api.event.game.state.GameStartedServerEvent; //导入依赖的package包/类
@Listener
public void onServerStarting(GameStartedServerEvent event) {

    // Delay loading shops so mods can register items
    shopManager = configManager.loadShops();
    shopTypeManager = configManager.loadShopTypes();
    shopRentManager = ShopRentManager.getInstance();
    shopRentManager.init(this, configManager.loadShopRent());

    // Register Commands
    CommandRegister.registerCommands(this);

    Task.builder()
            .async()
            .execute(() -> {
                logger.info("Saving Shops to DB");
                configManager.saveShops();
                configManager.saveShopRent();
            })
            .interval(5, TimeUnit.MINUTES)
            .name("PlayerShop Save Task")
            .submit(this);

}
 
开发者ID:Zerthick,项目名称:PlayerShopsRPG,代码行数:25,代码来源:PlayerShopsRPG.java

示例7: onStarted

import org.spongepowered.api.event.game.state.GameStartedServerEvent; //导入依赖的package包/类
@Listener
public void onStarted(GameStartedServerEvent event) {
    WorldScanner scanner = new WorldScanner();
    int count = 0;
    while (count < config().desiredSeeds) {
        Optional<Long> seed = scanner.scanWorld();
        if (seed.isPresent()) {
            try {
                if (!seedStore.exists()) {
                    Files.createFile(seedStore.toPath());
                }
                try (FileWriter writer = new FileWriter(seedStore, true)) {
                    writer.write(seed.get() + "\n");
                }
            } catch (IOException ex) {
                throw new RuntimeException("Failed to write seeds to disk", ex);
            }
            count++;
            logger().info("Stored seed (current count: " + count + ")");
        }
    }
}
 
开发者ID:BlockJamMC,项目名称:OceanMan,代码行数:23,代码来源:OceanManPlugin.java

示例8: onServerStart

import org.spongepowered.api.event.game.state.GameStartedServerEvent; //导入依赖的package包/类
@Listener
public void onServerStart(GameStartedServerEvent event) {
    parentDirectory = defaultConfig.getParentFile();

    // Configuration
    config = new Configuration(defaultConfig, configManager);
    loadConfig();

    // Storage
    storageAdapter = new H2StorageAdapter();

    // Commands
    game.getCommandManager().register(this, KeysCommands.getCommand(), "keys");
    game.getCommandManager().register(this, LockCommand.getCommand(), "lock");
    game.getCommandManager().register(this, UnlockCommand.getCommand(), "unlock");

    // Listeners
    game.getEventManager().registerListeners(this, new ChangeBlockListener());
    game.getEventManager().registerListeners(this, new ExplosionListener());
    game.getEventManager().registerListeners(this, new InteractBlockListener());

    logger.info("Keys started. Calling in the key master. There is only zuul.");
}
 
开发者ID:prism,项目名称:Keys,代码行数:24,代码来源:Keys.java

示例9: onStarted

import org.spongepowered.api.event.game.state.GameStartedServerEvent; //导入依赖的package包/类
@Listener
public void onStarted(GameStartedServerEvent event) {
    if (!PluginInfo.isIsLoaded()) {
        ConsoleSource source = Sponge.getServer().getConsole();

        Lists.newArrayList(
                Text.of(TextColors.RED, "----------------------------------"),
                Text.of(TextColors.RED, "- NUCLEUS MIXINS WERE NOT LOADED -"),
                Text.of(TextColors.RED, "----------------------------------"),
                Text.of(TextColors.RED, " "),
                Text.of(TextColors.RED, "The Nucleus Mixins are not being applied, and so /invsee and pregen enhancements will not work."),
                Text.of(TextColors.RED, "This is usually because you have not put Nucleus Mixins in your ", TextColors.YELLOW, "mods", TextColors.RED,
                        " directory. Nucleus Mixins is a MOD and **must** go in the mods folder."),
                Text.of(TextColors.RED, "Please put the mixins in ", TextColors.YELLOW, "/mods ", TextColors.RED, " - not ", TextColors.YELLOW,
                        "/plugins", TextColors.RED, " or any other directory - and restart your server.")).forEach(source::sendMessage);
    }
}
 
开发者ID:NucleusPowered,项目名称:NucleusMixins,代码行数:18,代码来源:NucleusMixinSpongePlugin.java

示例10: onGameStarted

import org.spongepowered.api.event.game.state.GameStartedServerEvent; //导入依赖的package包/类
@Listener
//Scoreboards are loaded when the world is loaded so load it here
public void onGameStarted(GameStartedServerEvent gameStartedServerEvent) {
    Optional<Scoreboard> serverScoreboard = Sponge.getServer().getServerScoreboard();
    if (serverScoreboard.isPresent()) {
        Scoreboard globalScoreboard = serverScoreboard.get();
        if (configuration.getConfig().isNametagHealth()) {
            globalScoreboard.getObjective(PomData.ARTIFACT_ID).ifPresent(globalScoreboard::removeObjective);

            Objective objective = Objective.builder()
                    .name(PomData.ARTIFACT_ID)
                    .displayName(Text.of(TextColors.DARK_RED, "Health"))
                    .criterion(Criteria.DUMMY)
                    .objectiveDisplayMode(ObjectiveDisplayModes.INTEGER)
                    .build();
            globalScoreboard.addObjective(objective);
            globalScoreboard.updateDisplaySlot(objective, DisplaySlots.BELOW_NAME);
        }
    } else {
        logger.warn("Global scoreboard couldn't be loaded");
    }
}
 
开发者ID:games647,项目名称:HealthName,代码行数:23,代码来源:HealthName.java

示例11: onServerStarted

import org.spongepowered.api.event.game.state.GameStartedServerEvent; //导入依赖的package包/类
@Listener
public void onServerStarted(GameStartedServerEvent event) throws FileNotFoundException, SQLException {
    // register commands
    cmdManager = new SpongeCommandManager(this);
    cmdManager.registerCommands();
    game.getEventManager().registerListeners(this, new PlayerListener(this));

    if (!dataDir.exists() && !dataDir.mkdirs())
        throw new FileNotFoundException("Failed to make War data folder at " + dataDir.getPath());
    config = new WarConfig(new File(dataDir, "war.sl3"));
    validator = new ZoneValidator(config);
    for (String zoneName : config.getZones()) {
        logger.info("Loading zone " + zoneName + "...");
        Warzone zone = new Warzone(zoneName, this);
        zones.put(zoneName, zone);
    }
}
 
开发者ID:cmastudios,项目名称:war-sponge,代码行数:18,代码来源:WarPlugin.java

示例12: onServerStarted

import org.spongepowered.api.event.game.state.GameStartedServerEvent; //导入依赖的package包/类
@Listener
public void onServerStarted(GameStartedServerEvent event) {
	if (!enabled)
		return;

	// Register commands
	registerCommands();

	// Validate LoadedRegions
	ticketManager.validateLoadedRegions();
}
 
开发者ID:DevOnTheRocks,项目名称:StickyChunk,代码行数:12,代码来源:StickyChunk.java

示例13: onServerStart

import org.spongepowered.api.event.game.state.GameStartedServerEvent; //导入依赖的package包/类
@Override
@Listener
public void onServerStart(GameStartedServerEvent event) { //加载插件
    instance = this;
    super.onServerStart(event);
    getLogger().info("正在加载...");
    ConfigManager.init();
    McrmbPluginInfo.initMcrmbCore();
    registerCommand();
    Sponge.getEventManager().registerListeners(this, new PlayerJoinListener());
    if (Sponge.getPluginManager().isLoaded("placeholderapi")) {
        PlaceholderExpansion.register();
        getLogger().info("检测到PlaceholderAPI, 已注册变量%mcrmb%");
    } else {
        getLogger().info("未检测到PlaceholderAPI");
    }
    getLogger().info("加载完成!");
    CardTypesManager.init();

    Task.builder().delayTicks(0).intervalTicks(400).name("check-sid-and-key").execute(task -> {
        if (McrmbPluginInfo.config.key == null || McrmbPluginInfo.config.sid == null) {
            Text waring = Text.of("§c§l当前服务器未设置SID和KEY, 请输入/b setup <sid> <key>进行设置.\n§c§l您可以前往 MCRMB后台->服务器管理 查看服务器的SID和KEY");
            Sponge.getServer().getConsole().sendMessage(waring);
            for (Player player : Sponge.getServer().getOnlinePlayers()) {
                if (player.hasPermission("mcrmb.admin")) {
                    player.sendMessage(waring);
                }
            }
        } else {
            task.cancel();
        }
    }).submit(this);
}
 
开发者ID:txgs888,项目名称:McrmbCore_Sponge,代码行数:34,代码来源:McrmbCoreMain.java

示例14: onServerStart

import org.spongepowered.api.event.game.state.GameStartedServerEvent; //导入依赖的package包/类
@Listener
public void onServerStart(GameStartedServerEvent event) {
    this.plugin = Sponge.getPluginManager().getPlugin(McrmbPluginInfo.ID).get();
    this.logger = plugin.getLogger();
    getPath().toFile().mkdirs();

}
 
开发者ID:txgs888,项目名称:McrmbCore_Sponge,代码行数:8,代码来源:JavaPlugin.java

示例15: onServerStart

import org.spongepowered.api.event.game.state.GameStartedServerEvent; //导入依赖的package包/类
@Listener
   public void onServerStart(GameStartedServerEvent event) {		
	//reload
	CommandSpec setline = CommandSpec.builder()
		    .description(Text.of("Use to reload messages from file."))
		    .permission("pam.cmd.reload")
		    .arguments(GenericArguments.string(Text.of("reload")))
		    .executor((src, args) -> { {
					if (args.<String>getOne("reload").get().equals("reload")){
						//reload config
						initConfig();
						//reload messages
						initMessages();
						src.sendMessage(toText("&a[PixelAutoMessages] Messages reloaded!"));
						return CommandResult.success();	
					}
					throw new CommandException(toText("[PixelAutoMessages] Use /pam reload to reload the messages"));
				}			    	
		    })
		    .build();
	Sponge.getCommandManager().register(this, setline, "pam");
	
	//init config
	initConfig();
	//init messages
	initMessages();
	
	//done
	logger.info(toColor("&aPixelAutoMessages enabled!&r"));
}
 
开发者ID:FabioZumbi12,项目名称:Sponge-PixelAutoMessage,代码行数:31,代码来源:PixelAutoMessages.java


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