2016-04-30 07:38:37 +02:00
|
|
|
package eu.univento.teamvento.commands;
|
|
|
|
|
2016-08-03 00:28:53 +02:00
|
|
|
import eu.univento.commons.player.Rank;
|
2016-04-30 07:38:37 +02:00
|
|
|
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;
|
2016-09-17 12:10:01 +02:00
|
|
|
import net.md_5.bungee.api.chat.ClickEvent;
|
|
|
|
import net.md_5.bungee.api.chat.ComponentBuilder;
|
|
|
|
import net.md_5.bungee.api.chat.HoverEvent;
|
|
|
|
import net.md_5.bungee.api.chat.TextComponent;
|
2016-04-30 07:38:37 +02:00
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author joethei
|
|
|
|
* @version 0.1
|
|
|
|
*/
|
|
|
|
public class WorldList extends AutoCommand<TeamVento> {
|
|
|
|
|
|
|
|
public WorldList(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());
|
2016-08-03 00:28:53 +02:00
|
|
|
if(p.getDatabasePlayer().isAllowed(Rank.Supporter)) {
|
2016-04-30 07:38:37 +02:00
|
|
|
p.sendMessage("§cAll worlds");
|
2016-07-09 13:19:56 +02:00
|
|
|
for(String world : TeamVento.getCfg().getKeys(true)) {
|
2016-09-17 12:10:01 +02:00
|
|
|
TextComponent text = new TextComponent("§a- " + world);
|
|
|
|
text.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/wtp " + world));
|
|
|
|
text.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("In die Welt").create()));
|
|
|
|
p.spigot().sendMessage(text);
|
2016-04-30 07:38:37 +02:00
|
|
|
}
|
|
|
|
}else{
|
|
|
|
p.sendMessage(p.getMessages().NO_PERMS());
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
sender.sendMessage(Messages.Console.NOT_A_PLAYER);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public List<String> tabComplete(CommandSender sender, String label, String[] args) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|