67 lines
1.6 KiB
Java
67 lines
1.6 KiB
Java
package eu.univento.teamvento.plot;
|
|
|
|
import eu.univento.core.api.Config;
|
|
import eu.univento.core.api.player.CustomPlayer;
|
|
import eu.univento.teamvento.TeamVento;
|
|
import lombok.AllArgsConstructor;
|
|
import org.bukkit.Bukkit;
|
|
import org.bukkit.Location;
|
|
import org.bukkit.Material;
|
|
import org.bukkit.inventory.ItemStack;
|
|
|
|
/**
|
|
* @author joethei
|
|
* @version 1.0
|
|
*/
|
|
|
|
interface PlotAction {
|
|
|
|
void execute();
|
|
|
|
|
|
class Create implements PlotAction{
|
|
|
|
Create(CustomPlayer player) {
|
|
this.player = player;
|
|
}
|
|
|
|
CustomPlayer player;
|
|
|
|
@Override
|
|
public void execute() {
|
|
Plot plot = PlotManager.getPlotPosition(player);
|
|
PlotManager.addPlotToDatabase(plot);
|
|
PlotManager.generatePlot(plot);
|
|
assert plot != null;
|
|
Location loc = plot.getSpawn();
|
|
player.teleport(new Location(Bukkit.getWorld("plots"), loc.getX(), loc.getY(), loc.getZ(), 89.0F, 6.0F));
|
|
player.sendHologram(new ItemStack(Material.GRASS), Config.readLocation("Build.Locs.Holo"), "§eZu deinem Plot teleportieren", "|", "|", "▼");
|
|
|
|
}
|
|
}
|
|
class Reset implements PlotAction {
|
|
|
|
Reset(Plot plot) {
|
|
this.plot = plot;
|
|
}
|
|
|
|
Plot plot;
|
|
|
|
@Override
|
|
public void execute() {
|
|
PlotManager.clearPlot(plot);
|
|
Bukkit.getScheduler().scheduleSyncDelayedTask(TeamVento.getInstance(), () -> PlotManager.generatePlot(plot), 13 * 20L);
|
|
}
|
|
}
|
|
|
|
@AllArgsConstructor
|
|
class SetFloor implements PlotAction{
|
|
|
|
Plot plot;
|
|
|
|
@Override
|
|
public void execute() {
|
|
|
|
}
|
|
}
|
|
} |