TeamVento/src/main/java/eu/univento/teamvento/commands/Setloc.java

58 lines
1.8 KiB
Java

package eu.univento.teamvento.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.teamvento.TeamVento;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
/**
* @author joethei
* @version 0.2
*/
public class Setloc extends AutoCommand<TeamVento>{
/**
* @param plugin main class
* @param command commons to execute
* @param description describes the commons
* @param aliases aliases of commons
*/
public Setloc(TeamVento 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("Build.Locs." + args[0], p.getLocation());
p.sendMessage("§aLocation gesetzt");
}else {
p.sendMessage("§6Nutze /setloc <Ort>");
}
}else {
p.sendMessage(msgs.NO_PERMS());
}
}else {
sender.sendMessage(Messages.Console.NOT_A_PLAYER);
}
return false;
}
@Override
public List<String> tabComplete(CommandSender sender, String label, String[] args) {
List<String> list = new ArrayList<>();
list.add("Spawn");
return list;
}
}