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

58 lines
2.2 KiB
Java

/*
* Copyright (c) 2018 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
package eu.univento.teamvento.commands;
import eu.univento.commons.player.rank.Rank;
import eu.univento.commons.player.uuid.NameFetcher;
import eu.univento.core.api.AutoCommand;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.teamvento.TeamVento;
import eu.univento.teamvento.plot.Plot;
import eu.univento.teamvento.plot.PlotManager;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.List;
public class PlotInfo extends AutoCommand<TeamVento>{
public PlotInfo(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(p.getDatabasePlayer().isAllowed(Rank.SrBuilder)) {
if(PlotManager.isPlot(p.getLocation())) {
Plot plot = PlotManager.getPlotByLocation(p.getLocation());
assert plot != null;
PlotManager.getCreatedDate(plot.getOwner()).whenComplete((instant, throwable) -> {
p.sendMessage("§eName: " + plot.getName());
p.sendMessage("§eErsteller: " + NameFetcher.getRequest(plot.getOwner()));
p.sendMessage("§eErstellt am: " + instant.toString());
p.sendMessage("§eKontakt: " + plot.getContact());
p.sendMessage("§eBiom: " + plot.getBiome().name());
p.sendMessage("§eZeit: " + plot.getTime().name());
p.sendMessage("§eWetter: " + plot.getWeather().name());
});
}else{
p.sendMessage("§cHier ist leider kein Plot");
}
}else{
}
}else{
}
return true;
}
@Override
public List<String> tabComplete(CommandSender sender, String label, String[] args) {
return null;
}
}