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


Java GameStartingServerEvent类代码示例

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


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

示例1: onServerStart

import org.spongepowered.api.event.game.state.GameStartingServerEvent; //导入依赖的package包/类
@Listener
public void onServerStart(GameStartingServerEvent event) {
    Sponge.getCommandManager().register(this, CommandSpec.builder()
            .description(Text.of("Gets info on the user."))
            .arguments(flags()
                    .permissionFlag("whois.all", ALL, "-all")
                    .permissionFlag("whois.address", IP, "-ip")
                    .flag(FIRST, "-firstjoined")
                    .flag(LAST, "-lastjoined")
                    .flag(WORLD, "-world")
                    .flag(COORDINATES, "-coords")
                    .flag(GAMEMODE, "-gamemode")
                    .flag(BAN, "-ban")
                    .buildWith(optional(user(KEY_USER))))
            .permission("whois.command")
            .executor(this::whois)
            .build(), "whois");

}
 
开发者ID:killjoy1221,项目名称:WhoIs,代码行数:20,代码来源:Whois.java

示例2: onServerStarted

import org.spongepowered.api.event.game.state.GameStartingServerEvent; //导入依赖的package包/类
@Subscribe
public void onServerStarted(GameStartingServerEvent event) throws IOException {
    channel = game.getChannelRegistrar().createRawChannel(this, CHANNEL);

    if (!defaultConfig.exists()) {
        InputStream in = getClass().getResourceAsStream("/config.conf");
        FileOutputStream out = new FileOutputStream(defaultConfig);
        out.getChannel().transferFrom(Channels.newChannel(in), 0, Long.MAX_VALUE);
        out.close();
        in.close();
    }

    ConfigurationNode config = HoconConfigurationLoader.builder().setFile(defaultConfig).build().load();
    global.putAll(loadRestrictions(config));
    ConfigurationNode worlds = config.getNode("worlds");
    if (!worlds.isVirtual()) {
        for (ConfigurationNode world : worlds.getChildrenList()) {
            Map<String, Object> worldRestrictions = new HashMap<>(global);
            worldRestrictions.putAll(loadRestrictions(world));
            this.worlds.put(world.getKey().toString(), worldRestrictions);
        }
    }
}
 
开发者ID:ReplayMod,项目名称:replay-restrictions,代码行数:24,代码来源:SpongePlugin.java

示例3: onServerInitialize

import org.spongepowered.api.event.game.state.GameStartingServerEvent; //导入依赖的package包/类
@Listener
public void onServerInitialize(GameStartingServerEvent event) {
    logger.info("Ultimate Spleef is enabling!");
    access = this;

    minigame = Minigame.create("UltimateSpleef", this).get();
    messageStorage = MessageStorage.createInstance(this);
    messageStorage.defaultMessages("messages");

    CommandLoader.registerCommands(this, TextSerializers.FORMATTING_CODE.serialize(messageStorage.getMessage("command.invalidsource")),
            new SpleefCommand(),
            new CreateCommand()
            );

    for (ArenaData arenaData : minigame.getArenaManager().loadArenaData()) {
        Optional<UArena> uarena = UArena.createArena(arenaData.getName(), arenaData);
        if (uarena.isPresent())
            minigame.getArenaManager().addArena(uarena.get());
    }

    if (!minigame.getEconomyManager().foundEconomy()) {
        logger.warn("Could not find an economy plugin! Players will not be rewarded!");
    }
}
 
开发者ID:FlibioStudio,项目名称:Ultimate-Spleef,代码行数:25,代码来源:UltimateSpleef.java

示例4: onServerStarting

import org.spongepowered.api.event.game.state.GameStartingServerEvent; //导入依赖的package包/类
@Listener
public void onServerStarting(GameStartingServerEvent event) {
    // https://docs.spongepowered.org/stable/en/plugin/lifecycle.html
    // "The server instance exists, and worlds are loaded"

    webSocketServerThread = new WebSocketServerThread(settings);

    /* TODO: factor out bukkit
    webSocketServerThread.blockBridge = new BlockBridge(webSocketServerThread, settings);
    webSocketServerThread.playersBridge = new PlayersBridge(webSocketServerThread, settings);
    webSocketServerThread.webPlayerBridge = new WebPlayerBridge(webSocketServerThread, settings);
    */

    /* TODO: write for sponge
    // Register our events
    PluginManager pm = getServer().getPluginManager();

    pm.registerEvents(new BlockListener(webSocketServerThread.blockBridge), plugin);
    pm.registerEvents(new PlayersListener(webSocketServerThread.playersBridge), plugin);
    pm.registerEvents(new EntityListener(webSocketServerThread.webPlayerBridge), plugin);

    // Register our commands
    getCommand("websandbox").setExecutor(new WsCommand(webSocketServerThread, settings.usePermissions));
    */

    // Run the websocket server
    webSocketServerThread.start();
}
 
开发者ID:satoshinm,项目名称:WebSandboxMC,代码行数:29,代码来源:WebSandboxSpongePlugin.java

示例5: onStartingServer

import org.spongepowered.api.event.game.state.GameStartingServerEvent; //导入依赖的package包/类
@Listener
public void onStartingServer(GameStartingServerEvent event)
{
    this.virtualChestCommandManager.init();
    this.economyManager.init();
    this.permissionManager.init();
    this.virtualChestActions.init();
    this.placeholderManager.init();
}
 
开发者ID:ustc-zzzz,项目名称:VirtualChest,代码行数:10,代码来源:VirtualChestPlugin.java

示例6: onServerStart

import org.spongepowered.api.event.game.state.GameStartingServerEvent; //导入依赖的package包/类
@Listener
public void onServerStart(GameStartingServerEvent event) {
    this.abilityManager = new AbilityManager(this);
    this.sequenceManager = new SequenceManager(this.abilityManager, this);

    this.abilityService = new AbilityService(this, this.abilityManager);
    this.sequenceService = new SequenceService(this, this.sequenceManager);
    this.userService = new UserService(this);

    this.services.add(this.abilityService);
    this.services.add(this.sequenceService);
    this.services.add(this.userService);
    this.services.forEach(Service::start);
}
 
开发者ID:AbilityAPI,项目名称:AbilityAPI,代码行数:15,代码来源:AbilityAPI.java

示例7: onServerStarting

import org.spongepowered.api.event.game.state.GameStartingServerEvent; //导入依赖的package包/类
@Listener
public void onServerStarting(GameStartingServerEvent event)
{
    GlobalCommands globalCommands = new GlobalCommands(this);
    CommandSpec map = CommandSpec.builder()
        .description(Text.of("All commands related to the chunk protection"))
        .executor(globalCommands::map)
        .build();

    CommandSpec claim = CommandSpec.builder()
            .description(Text.of("Claims the chunk that you are standing"))
            .executor(globalCommands::claim)
            .build();

    CommandSpec chunk = CommandSpec.builder()
            .description(Text.of("Commands related to chunk protection"))
            .child(map, "map")
            .child(claim, "claim")
            .build();

    CommandSpec mychunk = CommandSpec.builder()
            .description(Text.of("All mychunk commands"))
            .child(chunk, "chunk", "c")
            .build();

    Sponge.getCommandManager().register(this, chunk, "chunk");
    Sponge.getCommandManager().register(this, mychunk, "mychunk");
}
 
开发者ID:GameModsBR,项目名称:MyChunks,代码行数:29,代码来源:MyChunks.java

示例8: onPluginLoaded

import org.spongepowered.api.event.game.state.GameStartingServerEvent; //导入依赖的package包/类
@Listener
public void onPluginLoaded(GameStartingServerEvent event) {
	logger.info("I'm loaded! ;)");

	CommandSpec myCommandSpec = CommandSpec.builder()
		    .description(Text.of("Hello World Command"))
		    .executor(new HelloWorldCommand())
		    .build();
	commandMapping = game.getCommandManager().register(plugin, myCommandSpec, "hello");
}
 
开发者ID:vorburger,项目名称:HoTea,代码行数:11,代码来源:HotSpongePlugin.java

示例9: onServerStarting

import org.spongepowered.api.event.game.state.GameStartingServerEvent; //导入依赖的package包/类
@Listener
public void onServerStarting(GameStartingServerEvent event) {
	logger.info("hello ServerStartingEvent from MyFirstSpongePlugIn!");

	// https://docs.spongepowered.org/en/plugin/basics/commands/creating.html
	// https://github.com/SpongePowered/Cookbook/blob/master/Plugin/WorldEditingTest/src/main/java/org/spongepowered/cookbook/plugin/WorldEditingTest.java
	WorldTeleportCommand worldTeleportCommand = new WorldTeleportCommand();
	CommandCallable tpwCommandSpec = worldTeleportCommand.getCommandSpec(game);
	// TODO put this into a superclass / @Inject helper of WorldTeleportCommand..
	commandMapping = game.getCommandManager().register(plugin, tpwCommandSpec , "tpw" ,"tpworld");
	if (!commandMapping.isPresent()) {
		logger.error("/tpw Command could not be registered!! :-(");
	}
}
 
开发者ID:vorburger,项目名称:SwissKnightMinecraft,代码行数:15,代码来源:MyFirstSpongePlugIn.java

示例10: onServerStarting

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

	commandRegistry.register(CommandSpec.builder().description(Text.of("repeat command N times")).arguments(
			// GenericArguments.playerOrSource(Text.of("player"), game)
			GenericArguments.integer(Text.of("n")),
			GenericArguments.allOf(GenericArguments.string(Text.of("commandToRepeat")))
			).executor(CommandExecutorAdapter.adapt((src, args) -> {
				// Player player = (Player) src; // TODO if instanceof
				Integer n = args.<Integer>getOne("n").get();
				Collection<String> commandsToRepeat = args.<String>getAll("commandToRepeat");
				this.x(src, n, commandsToRepeat.toArray(new String[0]));
			})).build(), "x");

	commandRegistry.register(CommandSpec.builder().description(Text.of("list all / register new / delete Alias command")).arguments(
			// GenericArguments.playerOrSource(Text.of("player"), game)
			GenericArguments.optional(GenericArguments.string(Text.of("cmd"))),
			GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("commandsToAlias")))
			).executor(CommandExecutorAdapter.adapt((src, args) -> {
				// Player player = (Player) src; // TODO if instanceof
				Optional<String> name = args.<String>getOne("cmd");
				Optional<String> commandsToAlias = args.<String>getOne("commandsToAlias");
				this.alias(src, name, commandsToAlias);
			})).build(), "def", "alias");

}
 
开发者ID:vorburger,项目名称:SwissKnightMinecraft,代码行数:28,代码来源:AliasPlugin.java

示例11: onServerStarting

import org.spongepowered.api.event.game.state.GameStartingServerEvent; //导入依赖的package包/类
@Override
@Listener
public final void onServerStarting(GameStartingServerEvent event) {
	super.onServerStarting(event);
	commandManager.register(plugin, this);
	onServerStarting();
}
 
开发者ID:vorburger,项目名称:SwissKnightMinecraft,代码行数:8,代码来源:AbstractPluginWithCommands.java

示例12: onServerStarting

import org.spongepowered.api.event.game.state.GameStartingServerEvent; //导入依赖的package包/类
@Listener
	public void onServerStarting(GameStartingServerEvent event) {
		logger.info("hello ServerStartingEvent from MyFirstSpongePlugIn!");

		CommandSpec commandSpec = CommandSpec.builder()
				.arguments(optional(seq(player(Text.of("player")))))
			    .description(Text.of("Question!"))
//			    .permission("ch.vorburger.minecraft.learning.question")
			    .executor(new QuestionCommand())
			    .build();
		commandMapping = Sponge.getCommandManager().register(plugin, commandSpec , "question");
		if (!commandMapping.isPresent()) {
			logger.error("Command could not be registered!! :-(");
		}
	}
 
开发者ID:vorburger,项目名称:SwissKnightMinecraft,代码行数:16,代码来源:LearningPlugin.java

示例13: onServerStarting

import org.spongepowered.api.event.game.state.GameStartingServerEvent; //导入依赖的package包/类
/**
 * Runs when the server is starting.
 *
 * @param event The event
 */
@Listener
public void onServerStarting(GameStartingServerEvent event) {
    if (isLoaded) {
        // Once the server is starting, reset the text colour map.
        HammerTextToTextColorCoverter.init();
    }
}
 
开发者ID:dualspiral,项目名称:Hammer,代码行数:13,代码来源:HammerSponge.java

示例14: onServerStarting

import org.spongepowered.api.event.game.state.GameStartingServerEvent; //导入依赖的package包/类
@Listener
public void onServerStarting(GameStartingServerEvent event) {
    this.logger.info("Loading...");
    this.cmdManager = new CommandManager(game, this);
    this.logger.info("Loaded!");
}
 
开发者ID:poqdavid,项目名称:VirtualTool,代码行数:7,代码来源:VirtualTool.java

示例15: init

import org.spongepowered.api.event.game.state.GameStartingServerEvent; //导入依赖的package包/类
@Listener
public void init(GameStartingServerEvent event) {
    // Loads the config
    BlockerManager.loadConfig(new File(configDir, "config.json"), new File(configDir, "doha-database.json"));
}
 
开发者ID:Guichaguri,项目名称:BOHA,代码行数:6,代码来源:BlockerSponge.java


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