Format code

This commit is contained in:
2026-05-17 10:12:22 +02:00
parent 5125453406
commit eceb58b28c
25 changed files with 113 additions and 56 deletions
@@ -38,8 +38,9 @@ public class HotbarKit extends Kit {
public static final HotbarKit SPECTATOR_KIT = new HotbarKit();
static {
for (int i = 0; i < 9; i++)
for (int i = 0; i < 9; i++) {
SPECTATOR_KIT.setItem(i, "JOIN_REQUEST", new ItemBuilder(Material.PAPER).build(), GUI::joinRequest);
}
}
protected static final int HOTBAR_SIZE = 9;
@@ -166,8 +166,9 @@ public class PacketProcessor implements Listener {
task = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), this::process, 1, 1);
Bukkit.getPluginManager().registerEvents(this, FightSystem.getPlugin());
for (Player player : Bukkit.getOnlinePlayers())
for (Player player : Bukkit.getOnlinePlayers()) {
entityServer.addPlayer(player);
}
}
private void addREntity(int entityId, REntity entity) {
@@ -118,10 +118,12 @@ public class FightStatistics {
int fightId = create(gameMode, Config.world.getName(), starttime, remainingTime,
blueLeader, redLeader, blueSchem, redSchem, win, windescription);
for (FightPlayer fp : Fight.getBlueTeam().getPlayers())
for (FightPlayer fp : Fight.getBlueTeam().getPlayers()) {
savePlayerStats(fp, fightId);
for (FightPlayer fp : Fight.getRedTeam().getPlayers())
}
for (FightPlayer fp : Fight.getRedTeam().getPlayers()) {
savePlayerStats(fp, fightId);
}
if (ArenaMode.Event.contains(Config.mode)) {
Config.EventKampf.setFight(fightId);
@@ -71,8 +71,9 @@ public class Hull {
.filter(v -> v.sqLength() == 1 || v.x * primaryDirection.x + v.y * primaryDirection.y + v.z * primaryDirection.z == 1) // Not pointing away from primary direction
.toArray(IntVector[]::new);
for (IntVector direction : directions)
for (IntVector direction : directions) {
visibilityDirections.put(direction, new BitSet(region.volume()));
}
}
public boolean blockPrecise(Player player, int chunkX, int chunkY, int chunkZ) {
@@ -89,15 +90,17 @@ public class Hull {
public void addPlayer(Player player) {
if (players.add(player)) {
for (Entity entity : entities)
for (Entity entity : entities) {
BlockIdWrapper.impl.untrackEntity(player, entity);
}
}
}
public void removePlayer(Player player, boolean activeRemoval) {
if (players.remove(player) && activeRemoval) {
for (Entity entity : entities)
for (Entity entity : entities) {
BlockIdWrapper.impl.trackEntity(player, entity);
}
// techhider triggers block change sending
}
}
@@ -106,13 +109,15 @@ public class Hull {
Location location = entity.getLocation();
if (region.inRegion(location) && !visibility.get(new IntVector(location).toId(region))) {
if (entities.add(entity)) {
for (Player player : players)
for (Player player : players) {
BlockIdWrapper.impl.untrackEntity(player, entity);
}
}
} else {
if (entities.remove(entity)) {
for (Player player : players)
for (Player player : players) {
BlockIdWrapper.impl.trackEntity(player, entity);
}
}
}
}
@@ -138,8 +143,9 @@ public class Hull {
visibility.clear();
occluding.clear();
uncoveredSurface.clear();
for (BitSet directionalVisibility : visibilityDirections.values())
for (BitSet directionalVisibility : visibilityDirections.values()) {
directionalVisibility.clear();
}
long start = System.currentTimeMillis();
region.forEach((x, y, z) -> {
@@ -239,8 +245,9 @@ public class Hull {
if (occluding.get(id)) return;
uncoverBlocks(uncovered, block.add(direction), direction, directionalVisibility, branchDirections);
for (IntVector branchDirection : branchDirections)
for (IntVector branchDirection : branchDirections) {
uncoverBlocks(uncovered, block.add(branchDirection), branchDirection, visibilityDirections.get(branchDirection), NO_BRANCHES);
}
}
@@ -130,8 +130,9 @@ public class HullHider implements Listener {
}
private void removePlayer(Player player, boolean activeRemoval) {
for (Hull hull : hulls)
for (Hull hull : hulls) {
hull.removePlayer(player, activeRemoval);
}
}
@@ -174,34 +175,40 @@ public class HullHider implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onSpawn(EntitySpawnEvent e) {
for (Hull hull : hulls)
for (Hull hull : hulls) {
hull.checkEntity(e.getEntity());
}
}
private void onTick() {
Recording.iterateOverEntities(Objects::nonNull, entity -> {
for (Hull hull : hulls)
for (Hull hull : hulls) {
hull.checkEntity(entity);
}
});
for (Hull hull : hulls)
for (Hull hull : hulls) {
hull.sendUncoveredBlocks();
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onDeath(EntityDeathEvent e) {
for (Hull hull : hulls)
for (Hull hull : hulls) {
hull.removeEntity(e.getEntity());
}
}
public void updateREntity(REntity e) {
for (Hull hull : hulls)
for (Hull hull : hulls) {
hull.checkREntity(e);
}
}
public void despawnREntity(REntity e) {
for (Hull hull : hulls)
for (Hull hull : hulls) {
hull.removeREntity(e);
}
}
@@ -98,9 +98,11 @@ public class Region {
}
public void forEachChunk(ObjIntConsumer<Integer> executor) {
for (int x = getMinChunkX(); x <= getMaxChunkX(); x++)
for (int z = getMinChunkZ(); z <= getMaxChunkZ(); z++)
for (int x = getMinChunkX(); x <= getMaxChunkX(); x++) {
for (int z = getMinChunkZ(); z <= getMaxChunkZ(); z++) {
executor.accept(x, z);
}
}
}
public void forEach(TriConsumer<Integer, Integer, Integer> executor) {