Search in sources :

Example 1 with Game

use of com.voxelgameslib.voxelgameslib.game.Game in project VoxelGamesLibv2 by VoxelGamesLib.

the class GameCommands method gameStart.

@Subcommand("start")
@CommandCompletion("@gamemodes")
@Syntax("<mode> - the mode you want to start")
@CommandPermission("%premium")
public void gameStart(@Nonnull User sender, @Nonnull GameMode mode) {
    if (handleGameLeaving(sender))
        return;
    Game game = gameHandler.startGame(mode);
    if (game.getActivePhase().isRunning()) {
        game.join(sender);
        Lang.msg(sender, LangKey.GAME_GAME_STARTED);
        if (config.announceNewGame) {
            // TODO figure out which command to enter
            Lang.broadcast(LangKey.GAME_ANNOUNCE_GAME_STARTED, "/game joinuuid " + game.getUuid().toString(), sender.getDisplayName(), mode.getName());
        }
    } else {
        Lang.msg(sender, LangKey.GAME_COULD_NOT_START);
    }
}
Also used : Game(com.voxelgameslib.voxelgameslib.game.Game) Subcommand(co.aikar.commands.annotation.Subcommand) CommandCompletion(co.aikar.commands.annotation.CommandCompletion) Syntax(co.aikar.commands.annotation.Syntax) CommandPermission(co.aikar.commands.annotation.CommandPermission)

Example 2 with Game

use of com.voxelgameslib.voxelgameslib.game.Game in project VoxelGamesLibv2 by VoxelGamesLib.

the class GameCommands method gameList.

@Subcommand("list")
@CommandPermission("%user")
public void gameList(@Nonnull User sender) {
    Lang.msg(sender, LangKey.GAME_GAMELIST_HEADER);
    for (Game game : gameHandler.getGames()) {
        Lang.msg(sender, LangKey.GAME_GAMELIST_ENTRY, game.getUuid().toString().split("-")[0], game.getGameMode().getName(), game.getActivePhase().getName(), game.getPlayers().size(), game.getSpectators().size());
    }
    Lang.msg(sender, LangKey.GAME_GAMELIST_FOOTER);
}
Also used : Game(com.voxelgameslib.voxelgameslib.game.Game) Subcommand(co.aikar.commands.annotation.Subcommand) CommandPermission(co.aikar.commands.annotation.CommandPermission)

Example 3 with Game

use of com.voxelgameslib.voxelgameslib.game.Game in project VoxelGamesLibv2 by VoxelGamesLib.

the class Ability method unregister.

public void unregister(boolean removeTickable) {
    HandlerList.unregisterAll(this);
    List<Game> games = injector.getInstance(GameHandler.class).getGames(affected.getUuid(), false);
    if (games.size() == 1) {
        Game game = games.get(0);
        if (removeTickable) {
            game.getActivePhase().removeTickable(identifier);
        }
    }
}
Also used : Game(com.voxelgameslib.voxelgameslib.game.Game) GameHandler(com.voxelgameslib.voxelgameslib.game.GameHandler)

Aggregations

Game (com.voxelgameslib.voxelgameslib.game.Game)3 CommandPermission (co.aikar.commands.annotation.CommandPermission)2 Subcommand (co.aikar.commands.annotation.Subcommand)2 CommandCompletion (co.aikar.commands.annotation.CommandCompletion)1 Syntax (co.aikar.commands.annotation.Syntax)1 GameHandler (com.voxelgameslib.voxelgameslib.game.GameHandler)1