Update styling
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2023-08-19 12:43:30 +02:00
Ursprung c55d18f02f
Commit a1acde76fd
9 geänderte Dateien mit 28 neuen und 22 gelöschten Zeilen

Datei anzeigen

@ -58,6 +58,7 @@ public class WorldConfig {
public static final TowerGeneratorConfig TOWER_GENERATOR_CONFIG; public static final TowerGeneratorConfig TOWER_GENERATOR_CONFIG;
public static final List<WinCondition> WINCONDITIONS = new ArrayList<>(); public static final List<WinCondition> WINCONDITIONS = new ArrayList<>();
static { static {
WINCONDITIONS.add(new LastRemainingWincondition()); WINCONDITIONS.add(new LastRemainingWincondition());
WINCONDITIONS.add(new LastOutsideWincondition()); WINCONDITIONS.add(new LastOutsideWincondition());
@ -65,7 +66,7 @@ public class WorldConfig {
} }
private static Location parseLocation(ConfigurationSection section) { private static Location parseLocation(ConfigurationSection section) {
Location loc = new Location( Location loc = new Location(
Bukkit.getWorlds().get(0), Bukkit.getWorlds().get(0),
section.getDouble("x"), section.getDouble("x"),
section.getDouble("y"), section.getDouble("y"),

Datei anzeigen

@ -38,9 +38,13 @@ public abstract class Countdown extends GameStateToggleListener {
super(enabledStates); super(enabledStates);
} }
int defaultTime() {return 0;} int defaultTime() {
return 0;
}
void timerEnd() {} void timerEnd() {}
boolean timerShouldCancel() {return true;} boolean timerShouldCancel() {
return true;
}
void run() {} void run() {}
void timerStart() {} void timerStart() {}
void timerReset() {} void timerReset() {}

Datei anzeigen

@ -32,7 +32,7 @@ public class EndCountdown extends Countdown {
private final LobbyCountdown lobbyCountdown; private final LobbyCountdown lobbyCountdown;
private static boolean RESETS = Objects.requireNonNull(Bukkit.getWorlds().get(0).getWorldFolder().list((dir, name) -> name.equals("backup"))).length > 0; private static final boolean RESETS = Objects.requireNonNull(Bukkit.getWorlds().get(0).getWorldFolder().list((dir, name) -> name.equals("backup"))).length > 0;
public EndCountdown(LobbyCountdown lobbyCountdown) { public EndCountdown(LobbyCountdown lobbyCountdown) {
super(EnumSet.of(GameStates.ENDING)); super(EnumSet.of(GameStates.ENDING));

Datei anzeigen

@ -137,33 +137,33 @@ public class TowerRunGame {
}); });
} }
private static double posToChunk(int pos){ private static double posToChunk(int pos) {
return pos / 16.0; return pos / 16.0;
} }
private static int getMinChunkX(){ private static int getMinChunkX() {
return (int) Math.floor(posToChunk(WorldConfig.MAP_MIN_X)); return (int) Math.floor(posToChunk(WorldConfig.MAP_MIN_X));
} }
private static int getMaxChunkX(){ private static int getMaxChunkX() {
return (int) Math.ceil(posToChunk(WorldConfig.MAP_MAX_X)); return (int) Math.ceil(posToChunk(WorldConfig.MAP_MAX_X));
} }
private static int getMinChunkZ(){ private static int getMinChunkZ() {
return (int) Math.floor(posToChunk(WorldConfig.MAP_MIN_Z)); return (int) Math.floor(posToChunk(WorldConfig.MAP_MIN_Z));
} }
private static int getMaxChunkZ(){ private static int getMaxChunkZ() {
return (int) Math.ceil(posToChunk(WorldConfig.MAP_MAX_Z)); return (int) Math.ceil(posToChunk(WorldConfig.MAP_MAX_Z));
} }
private static void forEachChunk(ObjIntConsumer<Integer> executor) { private static void forEachChunk(ObjIntConsumer<Integer> executor) {
for(int x = getMinChunkX(); x <= getMaxChunkX(); x++) for (int x = getMinChunkX(); x <= getMaxChunkX(); x++)
for(int z = getMinChunkZ(); z <= getMaxChunkZ(); z++) for (int z = getMinChunkZ(); z <= getMaxChunkZ(); z++)
executor.accept(x, z); executor.accept(x, z);
} }
private static void resetWorld(){ private static void resetWorld() {
world.getEntities().stream().filter(entity -> entity.getType() != EntityType.PLAYER).forEach(Entity::remove); world.getEntities().stream().filter(entity -> entity.getType() != EntityType.PLAYER).forEach(Entity::remove);
World backup = new WorldCreator(world.getName() + "/backup").createWorld(); World backup = new WorldCreator(world.getName() + "/backup").createWorld();
@ -178,7 +178,7 @@ public class TowerRunGame {
System.arraycopy(backupChunk.d(), 0, chunk.d(), 0, chunk.d().length); System.arraycopy(backupChunk.d(), 0, chunk.d(), 0, chunk.d().length);
for(Player p : Bukkit.getOnlinePlayers()) for (Player p : Bukkit.getOnlinePlayers())
CraftbukkitWrapper.impl.sendChunk(p, x, z); CraftbukkitWrapper.impl.sendChunk(p, x, z);
} }
} }

Datei anzeigen

@ -31,8 +31,8 @@ public class TowerGenerator {
private static final Random random = new Random(); private static final Random random = new Random();
private final WorldConfig.TowerGeneratorConfig config; private final WorldConfig.TowerGeneratorConfig config;
private List<SchematicNode> allSchematics; private final List<SchematicNode> allSchematics;
private Clipboard roof; private final Clipboard roof;
@Getter @Getter
private int height; private int height;

Datei anzeigen

@ -48,7 +48,7 @@ import java.util.*;
public class IngameListener extends GameStateBukkitListener { public class IngameListener extends GameStateBukkitListener {
private int time = 0; private int time = 0;
private Map<Integer, List<Block>> blocksToMelt = new HashMap<>(); private final Map<Integer, List<Block>> blocksToMelt = new HashMap<>();
private BukkitRunnable runnable; private BukkitRunnable runnable;
public IngameListener() { public IngameListener() {
@ -123,7 +123,7 @@ public class IngameListener extends GameStateBukkitListener {
@EventHandler @EventHandler
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) { public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
if(event.getDamager().getType() == EntityType.PLAYER) { if (event.getDamager().getType() == EntityType.PLAYER) {
event.setCancelled(true); event.setCancelled(true);
} }
} }

Datei anzeigen

@ -57,7 +57,7 @@ public class LobbyListener extends GameStateBukkitListener {
if (TowerRun.getTowerGenerator() != null) { if (TowerRun.getTowerGenerator() != null) {
return; return;
} }
if(event.getTo().getY() < WorldConfig.SPAWN.getY() - 10) { if (event.getTo().getY() < WorldConfig.SPAWN.getY() - 10) {
event.getPlayer().teleport(WorldConfig.SPAWN); event.getPlayer().teleport(WorldConfig.SPAWN);
} }
} }

Datei anzeigen

@ -28,12 +28,13 @@ public abstract class GameStateToggleListener extends GameStateListener {
protected GameStateToggleListener(EnumSet<GameStates> enabledStates) { protected GameStateToggleListener(EnumSet<GameStates> enabledStates) {
super(); super();
this.enabledStates = enabledStates; this.enabledStates = enabledStates;
if(enabledStates.contains(GameState.getCurrentState())) { if (enabledStates.contains(GameState.getCurrentState())) {
enable(); enable();
} }
} }
public abstract void enable(); public abstract void enable();
public abstract void disable(); public abstract void disable();
@Override @Override

Datei anzeigen

@ -26,7 +26,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.PlayerDeathEvent;
public class LastOutsideWincondition extends OutsideWincondition{ public class LastOutsideWincondition extends OutsideWincondition {
public LastOutsideWincondition() { public LastOutsideWincondition() {
super("LAST_OUTSIDE"); super("LAST_OUTSIDE");
} }
@ -42,8 +42,8 @@ public class LastOutsideWincondition extends OutsideWincondition{
@EventHandler(priority = EventPriority.LOW) @EventHandler(priority = EventPriority.LOW)
public void onPlayerDeath(PlayerDeathEvent event) { public void onPlayerDeath(PlayerDeathEvent event) {
if(TowerRunGame.PLAYERS_ALIVE.isEmpty()) { if (TowerRunGame.PLAYERS_ALIVE.isEmpty()) {
if(TowerRunGame.PLAYERS_ESCAPED.isEmpty()) { if (TowerRunGame.PLAYERS_ESCAPED.isEmpty()) {
TowerRunGame.tie(); TowerRunGame.tie();
return; return;
} }