Lobby/src/eu/univento/lobby/commands/Setloc.java

58 lines
1.5 KiB
Java

package eu.univento.lobby.commands;
import java.util.List;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import eu.univento.core.api.AutoCommand;
import eu.univento.core.api.Config;
import eu.univento.core.api.CustomPlayer;
import eu.univento.core.api.Messages;
import eu.univento.core.api.Perms.Ranks;
import eu.univento.lobby.Lobby;
/**
* sets teleport locations
* @author joethei
* @version 1.0
*/
public class Setloc extends AutoCommand<Lobby>{
/**
* @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());
if(p.isAllowed(Ranks.Admin)) {
if(args.length == 1) {
Config.write("Lobby.Locs." + args[0], p.getLocation());
p.sendMessage("§aLocation gesetzt");
System.out.println("Location gesetzt " + args[0]);
}else {
p.sendMessage("§6Nutze /setloc <Spielmodus>");
}
}else {
p.sendMessage(Messages.NO_PERMS);
}
}else {
sender.sendMessage(Messages.NOT_A_PLAYER);
}
return false;
}
@Override
public List<String> tabComplete(CommandSender sender, String label, String[] args) {
return null;
}
}