Format code

This commit is contained in:
2026-05-16 23:08:09 +02:00
parent 81dd8045f2
commit d110df924e
562 changed files with 11025 additions and 10059 deletions
@@ -30,54 +30,57 @@ import org.bukkit.scheduler.BukkitTask;
public class SpawnPlatformCreator {
private final Player player;
private final Location spawn;
private final BukkitTask task;
private final Player player;
private final Location spawn;
private final BukkitTask task;
private Block currentBlock;
private int ticks;
private Block currentBlock;
private int ticks;
public SpawnPlatformCreator(Player player){
this.player = player;
MWTeam team = MissileWars.getTeam(player);
if(team == null)
this.spawn = Config.BlueSpawn;
else
this.spawn = team.getSpawn();
ticks = Config.PlatformTime;
currentBlock = null;
task = Bukkit.getScheduler().runTaskTimer(MissileWars.getPlugin(), this::createPlatform, 0, 1);
}
public SpawnPlatformCreator(Player player) {
this.player = player;
MWTeam team = MissileWars.getTeam(player);
if (team == null) {
this.spawn = Config.BlueSpawn;
} else {
this.spawn = team.getSpawn();
}
ticks = Config.PlatformTime;
currentBlock = null;
task = Bukkit.getScheduler().runTaskTimer(MissileWars.getPlugin(), this::createPlatform, 0, 1);
}
private void createPlatform(){
Location playerLoc = player.getLocation();
playerLoc.setY(spawn.getY() - 1);
private void createPlatform() {
Location playerLoc = player.getLocation();
playerLoc.setY(spawn.getY() - 1);
if(currentBlock == null || !currentBlock.getLocation().equals(playerLoc)){
if(currentBlock != null){
if(currentBlock.getType() == Material.OBSIDIAN)
currentBlock.setType(Material.AIR);
currentBlock = null;
}
if (currentBlock == null || !currentBlock.getLocation().equals(playerLoc)) {
if (currentBlock != null) {
if (currentBlock.getType() == Material.OBSIDIAN)
currentBlock.setType(Material.AIR);
currentBlock = null;
}
Block newBlock = playerLoc.getBlock();
if(newBlock.getType() == Material.AIR){
newBlock.setType(Material.OBSIDIAN);
currentBlock = newBlock;
}
}
Block newBlock = playerLoc.getBlock();
if (newBlock.getType() == Material.AIR) {
newBlock.setType(Material.OBSIDIAN);
currentBlock = newBlock;
}
}
if(currentBlock != null && player.getLocation().getY() - 1 < currentBlock.getY())
player.teleport(playerLoc.add(0, 1, 0));
if (currentBlock != null && player.getLocation().getY() - 1 < currentBlock.getY()) {
player.teleport(playerLoc.add(0, 1, 0));
}
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("Spawnplattform§8: §c§l" + String.format("%.2f", ticks / 20f) + "§8s"));
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("Spawnplattform§8: §c§l" + String.format("%.2f", ticks / 20f) + "§8s"));
if(ticks == 0){
if(currentBlock != null && currentBlock.getType() == Material.OBSIDIAN)
currentBlock.setType(Material.AIR);
if (ticks == 0) {
if (currentBlock != null && currentBlock.getType() == Material.OBSIDIAN) {
currentBlock.setType(Material.AIR);
}
task.cancel();
}
ticks--;
}
task.cancel();
}
ticks--;
}
}