package eu.univento.lobby.commands; import eu.univento.commons.player.rank.Rank; import eu.univento.core.api.AutoCommand; import eu.univento.core.api.Config; import eu.univento.core.api.player.CustomPlayer; import eu.univento.lobby.Lobby; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import java.util.ArrayList; import java.util.List; /** * sets teleport locations * @author joethei * @version 1.0 */ public class Setloc extends AutoCommand{ /** * @param plugin main class * @param command command to execute * @param description describes the command * @param aliases aliases of command */ public Setloc(Lobby plugin, String command, String description, String... aliases) { super(plugin, command, description, aliases); } @Override public boolean execute(CommandSender sender, String label, String[] args) { if(sender instanceof Player) { CustomPlayer p = CustomPlayer.getPlayer(sender.getName()); //Messages msgs = new Messages(p); if(p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) { if(args.length == 1) { Config.write("Lobby.Locs." + args[0], p.getLocation()); //p.sendMessage(msgs.PREFIX() + msgs.Lobby_SET_LOCATION()); }else { //p.sendMessage(msgs.PREFIX() + msgs.Lobby_SET_LOCATION_USAGE()); } }else { //p.sendMessage(msgs.NO_PERMS()); } }else { //sender.sendMessage(Messages.Console.NOT_A_PLAYER); } return false; } @Override public List tabComplete(CommandSender sender, String label, String[] args) { ArrayList list = new ArrayList<>(); list.add("Spawn"); list.add("Maya"); list.add("WoolGet"); list.add("PremiumHub"); return list; } }