Search in sources :

Example 1 with ArenaSelection

use of com.gmail.stefvanschiedev.buildinggame.utils.guis.ArenaSelection in project buildinggame by stefvanschie.

the class CommandManager method onJoin.

/**
 * Called whenever a player wants to join an arena
 *
 * @param player the player
 * @param arena the arena to join
 * @since 5.8.0
 */
@Subcommand("join")
@Description("Join an arena")
@CommandPermission("bg.join")
@CommandCompletion("@arenas")
public void onJoin(Player player, @Optional Arena arena) {
    YamlConfiguration messages = SettingsManager.getInstance().getMessages();
    if (arena == null) {
        for (Arena a : ArenaManager.getInstance().getArenas()) {
            if (!a.canJoin()) {
                continue;
            }
            new ArenaSelection().show(player);
            return;
        }
        MessageManager.getInstance().send(player, messages.getStringList("join.no-arena"));
        return;
    }
    arena.join(player);
}
Also used : ArenaSelection(com.gmail.stefvanschiedev.buildinggame.utils.guis.ArenaSelection) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) Arena(com.gmail.stefvanschiedev.buildinggame.utils.arena.Arena)

Aggregations

Arena (com.gmail.stefvanschiedev.buildinggame.utils.arena.Arena)1 ArenaSelection (com.gmail.stefvanschiedev.buildinggame.utils.guis.ArenaSelection)1 YamlConfiguration (org.bukkit.configuration.file.YamlConfiguration)1