Add Cuboid for killchecker Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
22b3da59e8
Commit
4b3b8691b5
@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.killchecker;
|
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.Point;
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||||
@ -43,20 +43,20 @@ import java.util.Set;
|
|||||||
|
|
||||||
public class KillcheckerVisualizer {
|
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 World WORLD = Bukkit.getWorlds().get(0);
|
||||||
|
|
||||||
private static final double SURROUND = 4;
|
private static final double SURROUND = 4;
|
||||||
|
|
||||||
private Point minPoint;
|
private final Point minPoint;
|
||||||
private Point maxPoint;
|
private final Point maxPoint;
|
||||||
|
|
||||||
private int yArea;
|
private final int yArea;
|
||||||
private int zArea;
|
private final int zArea;
|
||||||
private int xArea;
|
private final int xArea;
|
||||||
|
|
||||||
private Set<Player> players = new HashSet<>();
|
private final Set<Player> players = new HashSet<>();
|
||||||
private Set<Player> areaPlayers = new HashSet<>();
|
private final Set<Player> areaPlayers = new HashSet<>();
|
||||||
|
|
||||||
public KillcheckerVisualizer(Region region) {
|
public KillcheckerVisualizer(Region region) {
|
||||||
this.minPoint = region.getMinPoint(RegionType.BUILD, RegionExtensionType.NORMAL);
|
this.minPoint = region.getMinPoint(RegionType.BUILD, RegionExtensionType.NORMAL);
|
||||||
@ -67,13 +67,13 @@ public class KillcheckerVisualizer {
|
|||||||
xArea = (maxPoint.getY() - minPoint.getY()) * (maxPoint.getZ() - minPoint.getZ());
|
xArea = (maxPoint.getY() - minPoint.getY()) * (maxPoint.getZ() - minPoint.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
private REntityServer outline = new REntityServer();
|
private final REntityServer outline = new REntityServer();
|
||||||
private REntityServer inner = new REntityServer();
|
private final REntityServer inner = new REntityServer();
|
||||||
|
|
||||||
private Map<Point, Integer> killCount = new HashMap<>();
|
private final Map<Point, Integer> killCount = new HashMap<>();
|
||||||
private Set<Point> outlinePointsCache = new HashSet<>();
|
private final Set<Point> outlinePointsCache = new HashSet<>();
|
||||||
private Map<Point, REntity> rEntities = new HashMap<>();
|
private final Map<Point, REntity> rEntities = new HashMap<>();
|
||||||
private Map<Player, BossBar> bossBars = new HashMap<>();
|
private final Map<Player, BossBar> bossBars = new HashMap<>();
|
||||||
|
|
||||||
private double percent = 0;
|
private double percent = 0;
|
||||||
private int kills = 0;
|
private int kills = 0;
|
||||||
@ -272,7 +272,7 @@ public class KillcheckerVisualizer {
|
|||||||
if (killCount.get(point) == count && outlinePoints.contains(point) == outlinePointsCacheLast.contains(point)) return;
|
if (killCount.get(point) == count && outlinePoints.contains(point) == outlinePointsCacheLast.contains(point)) return;
|
||||||
rEntities.get(point).die();
|
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);
|
entity.setNoGravity(true);
|
||||||
rEntities.put(point, entity);
|
rEntities.put(point, entity);
|
||||||
if (outlinePoints.contains(point)) outlinePointsCache.add(point);
|
if (outlinePoints.contains(point)) outlinePointsCache.add(point);
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren