69 lines
1.7 KiB
Java
69 lines
1.7 KiB
Java
|
package eu.univento.teamvento.utils;
|
||
|
|
||
|
import eu.univento.core.api.Config;
|
||
|
import eu.univento.core.api.Hologram;
|
||
|
import eu.univento.core.api.player.CustomPlayer;
|
||
|
import eu.univento.teamvento.TeamVento;
|
||
|
import eu.univento.teamvento.listener.JoinQuit;
|
||
|
import lombok.AllArgsConstructor;
|
||
|
import org.bukkit.Bukkit;
|
||
|
import org.bukkit.Location;
|
||
|
|
||
|
/**
|
||
|
* @author joethei
|
||
|
* @version 0.1
|
||
|
*/
|
||
|
|
||
|
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));
|
||
|
JoinQuit.holograms.get(player).hidePlayer(player);
|
||
|
Hologram holo = new Hologram(new String[]{"§eZu deinem Plot teleportieren", "|", "|", "▼"}, Config.readLocation("Build.Locs.Holo"));
|
||
|
holo.showPlayer(player);
|
||
|
|
||
|
}
|
||
|
}
|
||
|
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() {
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|