Search in sources :

Example 1 with Subcommand

use of co.aikar.commands.annotation.Subcommand 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 Subcommand

use of co.aikar.commands.annotation.Subcommand 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 Subcommand

use of co.aikar.commands.annotation.Subcommand in project VoxelGamesLibv2 by VoxelGamesLib.

the class WorldCreator method center.

@Subcommand("center")
@CommandPermission("%admin")
public void center(@Nonnull User sender) {
    if (step != 2) {
        Lang.msg(sender, LangKey.WORLD_CREATOR_WRONG_STEP, step, 2);
        return;
    }
    center = new Vector3D(sender.getPlayer().getLocation().getX(), sender.getPlayer().getLocation().getY(), sender.getPlayer().getLocation().getZ());
    Lang.msg(sender, LangKey.WORLD_CREATOR_ENTER_RADIUS, "/worldcreator radius ");
    step = 3;
}
Also used : Vector3D(com.voxelgameslib.voxelgameslib.map.Vector3D) Subcommand(co.aikar.commands.annotation.Subcommand) CommandPermission(co.aikar.commands.annotation.CommandPermission)

Example 4 with Subcommand

use of co.aikar.commands.annotation.Subcommand in project VoxelGamesLibv2 by VoxelGamesLib.

the class WorldCreator method author.

@Subcommand("author")
@CommandPermission("%admin")
public void author(@Nonnull User sender, @Nonnull String author) {
    if (step != 5) {
        Lang.msg(sender, LangKey.WORLD_CREATOR_WRONG_STEP, step, 5);
        return;
    }
    this.author = author;
    Lang.msg(sender, LangKey.WORLD_CREATOR_AUTHOR_SET, author);
    for (GameMode mode : gameHandler.getGameModes()) {
        sender.sendMessage(TextComponent.of(mode.getName() + " ").color(TextColor.YELLOW).clickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/worldcreator gamemode " + mode.getName())));
    }
    Lang.msg(sender, LangKey.WORLD_CREATOR_DONE_QUERY, "/worldcreator gamemode done");
    step = 6;
}
Also used : GameMode(com.voxelgameslib.voxelgameslib.game.GameMode) ClickEvent(net.kyori.text.event.ClickEvent) Subcommand(co.aikar.commands.annotation.Subcommand) CommandPermission(co.aikar.commands.annotation.CommandPermission)

Example 5 with Subcommand

use of co.aikar.commands.annotation.Subcommand in project VoxelGamesLibv2 by VoxelGamesLib.

the class WorldModifyCommands method center.

@Subcommand("center")
@CommandPermission("%admin")
public void center(@Nonnull User user, @Nullable @co.aikar.commands.annotation.Optional String set) {
    if (!check(user))
        return;
    // view
    if (set == null) {
        Lang.msg(user, LangKey.WORLD_MODIFY_CENTER_VIEW, map.getCenter());
    } else // edit
    {
        map.setCenter(new Vector3D(user.getPlayer().getLocation().getX(), user.getPlayer().getLocation().getY(), user.getPlayer().getLocation().getZ()));
        Lang.msg(user, LangKey.WORLD_MODIFY_CENTER_EDIT, map.getCenter());
    }
}
Also used : Vector3D(com.voxelgameslib.voxelgameslib.map.Vector3D) Subcommand(co.aikar.commands.annotation.Subcommand) CommandPermission(co.aikar.commands.annotation.CommandPermission)

Aggregations

CommandPermission (co.aikar.commands.annotation.CommandPermission)17 Subcommand (co.aikar.commands.annotation.Subcommand)17 Syntax (co.aikar.commands.annotation.Syntax)6 Description (co.aikar.commands.annotation.Description)5 CommandCompletion (co.aikar.commands.annotation.CommandCompletion)4 Map (com.voxelgameslib.voxelgameslib.map.Map)4 ItemStack (org.bukkit.inventory.ItemStack)4 Vector3D (com.voxelgameslib.voxelgameslib.map.Vector3D)3 StatInstance (com.voxelgameslib.voxelgameslib.stats.StatInstance)3 ItemBuilder (com.voxelgameslib.voxelgameslib.utils.ItemBuilder)3 VoxelGameLibException (com.voxelgameslib.voxelgameslib.exception.VoxelGameLibException)2 MapFeature (com.voxelgameslib.voxelgameslib.feature.features.MapFeature)2 SpawnFeature (com.voxelgameslib.voxelgameslib.feature.features.SpawnFeature)2 Game (com.voxelgameslib.voxelgameslib.game.Game)2 SkullMeta (org.bukkit.inventory.meta.SkullMeta)2 Skin (org.mineskin.data.Skin)2 WorldException (com.voxelgameslib.voxelgameslib.exception.WorldException)1 GameMode (com.voxelgameslib.voxelgameslib.game.GameMode)1 MarkerDefinition (com.voxelgameslib.voxelgameslib.map.MarkerDefinition)1 File (java.io.File)1