Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.etheria.lobby.commands;
- import it.xquickglare.quicklib.command.Command;
- import it.xquickglare.quicklib.command.CommandSenderType;
- import it.xquickglare.quicklib.utils.Message;
- import net.etheria.core.Etheria;
- import net.etheria.lobby.EtheriaLobby;
- import net.etheria.lobby.utils.BungeecordUtils;
- import net.etheria.lobby.utils.Config;
- import org.bukkit.ChatColor;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import java.util.Collections;
- import static net.etheria.lobby.utils.Config.getConfig;
- public class SelectNation extends Command {
- private final EtheriaLobby plugin = EtheriaLobby.getInstance();
- public SelectNation() {
- super("selectnation",
- "etherialobby.selectnation",
- Message.format(getConfig().getConfiguration().getString("noPermission"), '&'),
- "",
- "",
- new CommandSenderType[] { CommandSenderType.PLAYER },
- true,
- 0,
- Collections.emptyList()
- );
- }
- @Override
- public void onCommand(CommandSender sender, String[] args) {
- Player player = (Player)sender;
- if(args.length == 0)
- return;
- try {
- int nation = Integer.parseInt(args[0]);
- if(nation >= 4 || nation < 0)
- return;
- if(plugin.getSelector().hasSelectedNation(player))
- return;
- if(!plugin.getSelector().canJoin(nation)) {
- player.sendMessage(ChatColor.RED + "Non puoi entrare in questa nazione, scegline un altra.");
- return;
- }
- if (Etheria.getInstance().getNationsManager().getNation(nation).getCapital().isConquisted()) {
- player.sendMessage(ChatColor.RED + "Non puoi entrare in questa nazione perché è stata già conquistata. Scegline un altra.");
- return;
- }
- if(plugin.getSelector().selectNation(player, nation)) {
- player.chat("/queue nations");
- player.teleport(getConfig().getConfiguration().getLocation("lobbyLocation"));
- Config.getConfig().getConfiguration().getMessage("queueNation").send(sender);
- }
- } catch (NumberFormatException ignored) {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement