package eu.univento.free4all.commands; import eu.univento.commons.player.Rank; import eu.univento.core.api.AutoCommand; import eu.univento.core.api.Config; import eu.univento.core.api.languages.Messages; import eu.univento.core.api.player.CustomPlayer; import eu.univento.free4all.Free4All; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import java.util.List; /** * @author joethei * @version 1.0 */ public class Setloc extends AutoCommand{ public Setloc(Free4All 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); assert p != null; if(p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) { if(args.length == 1) { Config.write("FFA.Spawn." + 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) { return null; } }