From 4b3b8691b5495fe0067eb410de8024a475a4eec1 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 8 Mar 2023 21:02:32 +0100 Subject: [PATCH] Finalize everything Add Cuboid for killchecker Signed-off-by: yoyosource --- .../features/killchecker/Cuboid.java | 34 +++++++++++++++++++ .../killchecker/KillcheckerVisualizer.java | 32 ++++++++--------- 2 files changed, 50 insertions(+), 16 deletions(-) create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/Cuboid.java diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/Cuboid.java b/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/Cuboid.java new file mode 100644 index 00000000..08632a9c --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/Cuboid.java @@ -0,0 +1,34 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2023 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.killchecker; + +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class Cuboid { + private double x; + private double y; + private double z; + private double dx; + private double dy; + private double dz; +} \ No newline at end of file diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/KillcheckerVisualizer.java b/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/KillcheckerVisualizer.java index b66dff69..2edf614d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/KillcheckerVisualizer.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/KillcheckerVisualizer.java @@ -19,7 +19,7 @@ package de.steamwar.bausystem.features.killchecker; -import de.steamwar.bausystem.features.slaves.laufbau.Cuboid; +import de.steamwar.bausystem.features.killchecker.Cuboid; import de.steamwar.bausystem.region.Point; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.utils.RegionExtensionType; @@ -43,20 +43,20 @@ import java.util.Set; public class KillcheckerVisualizer { - private static final Material[] materials = new Material[] {Material.YELLOW_STAINED_GLASS, Material.ORANGE_STAINED_GLASS, Material.RED_STAINED_GLASS, Material.PURPLE_STAINED_GLASS, Material.BLACK_STAINED_GLASS}; + private static final Material[] MATERIALS = new Material[] {Material.YELLOW_STAINED_GLASS, Material.ORANGE_STAINED_GLASS, Material.RED_STAINED_GLASS, Material.PURPLE_STAINED_GLASS, Material.BLACK_STAINED_GLASS}; private static final World WORLD = Bukkit.getWorlds().get(0); private static final double SURROUND = 4; - private Point minPoint; - private Point maxPoint; + private final Point minPoint; + private final Point maxPoint; - private int yArea; - private int zArea; - private int xArea; + private final int yArea; + private final int zArea; + private final int xArea; - private Set players = new HashSet<>(); - private Set areaPlayers = new HashSet<>(); + private final Set players = new HashSet<>(); + private final Set areaPlayers = new HashSet<>(); public KillcheckerVisualizer(Region region) { this.minPoint = region.getMinPoint(RegionType.BUILD, RegionExtensionType.NORMAL); @@ -67,13 +67,13 @@ public class KillcheckerVisualizer { xArea = (maxPoint.getY() - minPoint.getY()) * (maxPoint.getZ() - minPoint.getZ()); } - private REntityServer outline = new REntityServer(); - private REntityServer inner = new REntityServer(); + private final REntityServer outline = new REntityServer(); + private final REntityServer inner = new REntityServer(); - private Map killCount = new HashMap<>(); - private Set outlinePointsCache = new HashSet<>(); - private Map rEntities = new HashMap<>(); - private Map bossBars = new HashMap<>(); + private final Map killCount = new HashMap<>(); + private final Set outlinePointsCache = new HashSet<>(); + private final Map rEntities = new HashMap<>(); + private final Map bossBars = new HashMap<>(); private double percent = 0; private int kills = 0; @@ -272,7 +272,7 @@ public class KillcheckerVisualizer { if (killCount.get(point) == count && outlinePoints.contains(point) == outlinePointsCacheLast.contains(point)) return; rEntities.get(point).die(); } - RFallingBlockEntity entity = new RFallingBlockEntity(outlinePoints.contains(point) ? outline : inner, point.toLocation(WORLD, 0.5, 0, 0.5), materials[Math.min(count - 1, materials.length) - 1]); + RFallingBlockEntity entity = new RFallingBlockEntity(outlinePoints.contains(point) ? outline : inner, point.toLocation(WORLD, 0.5, 0, 0.5), MATERIALS[Math.min(count - 1, MATERIALS.length) - 1]); entity.setNoGravity(true); rEntities.put(point, entity); if (outlinePoints.contains(point)) outlinePointsCache.add(point);