50 lines
1.6 KiB
Java
50 lines
1.6 KiB
Java
|
package eu.univento.teamvento.commands;
|
||
|
|
||
|
import eu.univento.core.api.AutoCommand;
|
||
|
import eu.univento.core.api.languages.Messages;
|
||
|
import eu.univento.core.api.player.CustomPlayer;
|
||
|
import eu.univento.teamvento.TeamVento;
|
||
|
import eu.univento.teamvento.utils.ResourcePack;
|
||
|
import org.bukkit.command.CommandSender;
|
||
|
import org.bukkit.entity.Player;
|
||
|
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.List;
|
||
|
|
||
|
/**
|
||
|
* @author joethei
|
||
|
* @version 0.1
|
||
|
* created on 01.07.2016
|
||
|
*/
|
||
|
public class Pack extends AutoCommand<TeamVento>{
|
||
|
|
||
|
public Pack(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((Player) sender);
|
||
|
if(args.length == 1) {
|
||
|
if(ResourcePack.valueOf(args[0]) != null) {
|
||
|
p.setResourcePack(ResourcePack.valueOf(args[0]).getUrl());
|
||
|
}else p.sendMessage("§cDieses Pack ist nicht erhätlich");
|
||
|
}else{
|
||
|
p.sendMessage("§cDa stimmt was mit den Argumenten nicht");
|
||
|
}
|
||
|
}else{
|
||
|
sender.sendMessage(Messages.Console.NOT_A_PLAYER);
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public List<String> tabComplete(CommandSender sender, String label, String[] args) {
|
||
|
ArrayList<String> list = new ArrayList<>();
|
||
|
for(ResourcePack pack : ResourcePack.values()) {
|
||
|
list.add(pack.name());
|
||
|
}
|
||
|
return list;
|
||
|
}
|
||
|
}
|