SteamWar/BauSystem2.0
Archiviert
12
0

Add CuboidColorization filter option #167

Zusammengeführt
YoyoNow hat 10 Commits von KillcheckerImprovements nach master 2023-03-15 21:13:53 +01:00 zusammengeführt
2 geänderte Dateien mit 15 neuen und 1 gelöschten Zeilen
Nur Änderungen aus Commit d4727d5ed9 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -48,9 +48,10 @@ public class KillcheckerCommand extends SWCommand implements Listener {
}
@Register(value = "enable", description = "KILLCHECKER_HELP_ENABLE")
public void genericCommand(Player player) {
public void genericCommand(Player player, @OptionalValue("ALL_CUBOIDS") ColorizedCuboidsOnly colorizedCuboidsOnly) {
Region region = Region.getRegion(player.getLocation());
KillcheckerVisualizer killcheckerVisualizer = visualizers.computeIfAbsent(region, KillcheckerVisualizer::new);
killcheckerVisualizer.setOnlyColorizedBlocks(colorizedCuboidsOnly == ColorizedCuboidsOnly.ONLY_COLORIZED_CUBOIDS);
killcheckerVisualizer.recalc();
killcheckerVisualizer.show(player);
BauSystem.MESSAGE.send("KILLCHECKER_ENABLE", player);
@ -99,4 +100,9 @@ public class KillcheckerCommand extends SWCommand implements Listener {
recalc(event.getBlock());
}, 1);
}
public enum ColorizedCuboidsOnly {
ONLY_COLORIZED_CUBOIDS,
ALL_CUBOIDS
}
}

Datei anzeigen

@ -27,6 +27,7 @@ import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.entity.REntity;
import de.steamwar.entity.REntityServer;
import de.steamwar.entity.RFallingBlockEntity;
import lombok.Setter;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.World;
@ -55,6 +56,9 @@ public class KillcheckerVisualizer {
private REntityServer rEntityServer = new REntityServer();
@Setter
private boolean onlyColorizedBlocks = false;
private Map<Point, Integer> killCount = new HashMap<>();
private Map<Point, REntity> rEntities = new HashMap<>();
@ -67,6 +71,10 @@ public class KillcheckerVisualizer {
if (points.contains(new Point(x, y, z))) continue;
Block block = WORLD.getBlockAt(x, y, z);
if (block.getType().isAir()) continue;
if (onlyColorizedBlocks) {
String name = block.getType().name();
if (!name.endsWith("_WOOL") && name.endsWith("_STAINED_GLASS") && !name.endsWith("_CONCRETE") && !name.endsWith("_TERRACOTTA")) continue;
}
Cuboid cuboid = create(block.getType(), x, y, z);
cuboids.add(cuboid);
for (int dx = (int) cuboid.getX(); dx <= cuboid.getDx(); dx++) {