當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。