Add DesignEndStone or DesignEndStoneCommand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Add Line for BauScoreboard to show XRay and TechHider Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
b494f0bf3a
Commit
a767a942fb
@ -37,6 +37,9 @@ SCOREBOARD_TPS_FROZEN = §e Frozen
|
|||||||
|
|
||||||
SCOREBOARD_TRACE_TICKS = Ticks
|
SCOREBOARD_TRACE_TICKS = Ticks
|
||||||
|
|
||||||
|
SCOREBOARD_TECHHIDER = TechHider
|
||||||
|
SCOREBOARD_XRAY = XRay
|
||||||
|
|
||||||
# Flags
|
# Flags
|
||||||
FLAG_COLOR = Color
|
FLAG_COLOR = Color
|
||||||
FLAG_TNT = TNT
|
FLAG_TNT = TNT
|
||||||
@ -159,6 +162,10 @@ COUNTINGWAND_MESSAGE_LCLICK = §7Second position at: §8[§7{0}§8, §7{1}§8,
|
|||||||
COUNTINGWAND_MESSAGE_VOLUME = §e{0}
|
COUNTINGWAND_MESSAGE_VOLUME = §e{0}
|
||||||
COUNTINGWAND_MESSAGE_DIMENSION = §e{0}§8, §e{1}§8, §e{2}
|
COUNTINGWAND_MESSAGE_DIMENSION = §e{0}§8, §e{1}§8, §e{2}
|
||||||
|
|
||||||
|
# Design Endstone
|
||||||
|
DESIGN_ENDSTONE_COMMAND_HELP = §8/§edesign endstone §8- §7Show where Endstone is
|
||||||
|
DESIGN_ENDSTONE_REGION_ERROR = §cThis region has no build area
|
||||||
|
|
||||||
# Detonator
|
# Detonator
|
||||||
DETONATOR_LOC_REMOVE = §e{0} removed
|
DETONATOR_LOC_REMOVE = §e{0} removed
|
||||||
DETONATOR_LOC_ADD = §e{0} added
|
DETONATOR_LOC_ADD = §e{0} added
|
||||||
|
@ -157,6 +157,10 @@ COUNTINGWAND_MESSAGE_LCLICK = §7Zweite Position bei: §8[§7{0}§8, §7{1}§8,
|
|||||||
COUNTINGWAND_MESSAGE_VOLUME = §e{0}
|
COUNTINGWAND_MESSAGE_VOLUME = §e{0}
|
||||||
COUNTINGWAND_MESSAGE_DIMENSION = §e{0}§8, §e{1}§8, §e{2}
|
COUNTINGWAND_MESSAGE_DIMENSION = §e{0}§8, §e{1}§8, §e{2}
|
||||||
|
|
||||||
|
# Design Endstone
|
||||||
|
DESIGN_ENDSTONE_COMMAND_HELP = §8/§edesign endstone §8- §7Zeige wo Endstone ist
|
||||||
|
DESIGN_ENDSTONE_REGION_ERROR = §cDiese Region hat keinen Baubereich
|
||||||
|
|
||||||
# Detonator
|
# Detonator
|
||||||
DETONATOR_LOC_REMOVE = §e{0} entfernt
|
DETONATOR_LOC_REMOVE = §e{0} entfernt
|
||||||
DETONATOR_LOC_ADD = §e{0} hinzugefügt
|
DETONATOR_LOC_ADD = §e{0} hinzugefügt
|
||||||
|
@ -0,0 +1,105 @@
|
|||||||
|
/*
|
||||||
|
* 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.design.endstone;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.region.Region;
|
||||||
|
import de.steamwar.entity.REntity;
|
||||||
|
import de.steamwar.entity.REntityServer;
|
||||||
|
import de.steamwar.entity.RFallingBlockEntity;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class DesignEndStone {
|
||||||
|
|
||||||
|
private static final World WORLD = Bukkit.getWorlds().get(0);
|
||||||
|
|
||||||
|
private int minX, minY, minZ, maxX, maxY, maxZ;
|
||||||
|
private REntityServer entityServer = new REntityServer();
|
||||||
|
private List<REntity> entities = new ArrayList<>();
|
||||||
|
private Set<Location> locations = new HashSet<>();
|
||||||
|
private List<Player> players = new ArrayList<>();
|
||||||
|
|
||||||
|
public DesignEndStone(Region region) {
|
||||||
|
this.minX = region.getMinPointBuild().getX();
|
||||||
|
this.minY = region.getMinPointBuild().getY();
|
||||||
|
this.minZ = region.getMinPointBuild().getZ();
|
||||||
|
this.maxX = region.getMaxPointBuild().getX();
|
||||||
|
this.maxY = region.getMaxPointBuild().getY();
|
||||||
|
this.maxZ = region.getMaxPointBuild().getZ();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void calc() {
|
||||||
|
entities.forEach(REntity::die);
|
||||||
|
entities.clear();
|
||||||
|
locations.clear();
|
||||||
|
|
||||||
|
calc(minX, minY, minZ, maxX, maxY, minZ, 0, 0, 1, maxZ - minZ);
|
||||||
|
calc(minX, minY, maxZ, maxX, maxY, maxZ, 0, 0, -1, maxZ - minZ);
|
||||||
|
calc(minX, minY, minZ, minX, maxY, maxZ, 1, 0, 0, maxX - minX);
|
||||||
|
calc(maxX, minY, minZ, maxX, maxY, maxZ, -1, 0, 0, maxX - minX);
|
||||||
|
// calc(minX, minY, minZ, maxX, minY, maxZ, 0, 1, 0, maxY - minY);
|
||||||
|
calc(minX, maxY, minZ, maxX, maxY, maxZ, 0, -1, 0, maxY - minY);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void calc(int minX, int minY, int minZ, int maxX, int maxY, int maxZ, int dirX, int dirY, int dirZ, int steps) {
|
||||||
|
for (int x = minX; x <= maxX; x++) {
|
||||||
|
for (int y = minY; y <= maxY; y++) {
|
||||||
|
for (int z = minZ; z <= maxZ; z++) {
|
||||||
|
for (int step = 0; step < steps; step++) {
|
||||||
|
int cx = x + step * dirX;
|
||||||
|
int cy = y + step * dirY;
|
||||||
|
int cz = z + step * dirZ;
|
||||||
|
Material material = WORLD.getBlockAt(cx, cy, cz).getType();
|
||||||
|
if (material == Material.END_STONE || material == Material.END_STONE_BRICKS || material == Material.END_STONE_BRICK_SLAB || material == Material.END_STONE_BRICK_STAIRS || material == Material.END_STONE_BRICK_WALL) {
|
||||||
|
Location location = new Location(WORLD, cx + 0.5, cy, cz + 0.5);
|
||||||
|
if (locations.contains(location)) break;
|
||||||
|
RFallingBlockEntity entity = new RFallingBlockEntity(entityServer, location, Material.END_STONE);
|
||||||
|
entity.setNoGravity(true);
|
||||||
|
entity.setGlowing(true);
|
||||||
|
entities.add(entity);
|
||||||
|
break;
|
||||||
|
} else if (!material.isAir()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void toggle(Player player) {
|
||||||
|
if (players.contains(player)) {
|
||||||
|
players.remove(player);
|
||||||
|
entityServer.removePlayer(player);
|
||||||
|
} else {
|
||||||
|
players.add(player);
|
||||||
|
entityServer.addPlayer(player);
|
||||||
|
calc();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* 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.design.endstone;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.BauSystem;
|
||||||
|
import de.steamwar.bausystem.region.Region;
|
||||||
|
import de.steamwar.bausystem.region.utils.RegionType;
|
||||||
|
import de.steamwar.command.SWCommand;
|
||||||
|
import de.steamwar.linkage.Linked;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Linked
|
||||||
|
public class DesignEndStoneCommand extends SWCommand {
|
||||||
|
|
||||||
|
public DesignEndStoneCommand() {
|
||||||
|
super("designendstone");
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<Region, DesignEndStone> designEndStoneMap = new HashMap<>();
|
||||||
|
|
||||||
|
@Register(description = "DESIGN_ENDSTONE_COMMAND_HELP")
|
||||||
|
public void genericCommand(Player player) {
|
||||||
|
Region region = Region.getRegion(player.getLocation());
|
||||||
|
if (!region.hasType(RegionType.BUILD)) {
|
||||||
|
BauSystem.MESSAGE.send("DESIGN_ENDSTONE_REGION_ERROR", player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
designEndStoneMap.computeIfAbsent(region, DesignEndStone::new).toggle(player);
|
||||||
|
}
|
||||||
|
}
|
@ -50,6 +50,16 @@ public class TechHiderCommand extends SWCommand implements Listener {
|
|||||||
private Map<Region, Optional<TechHider>> techHiders = new HashMap<>();
|
private Map<Region, Optional<TechHider>> techHiders = new HashMap<>();
|
||||||
private Map<Region, Set<Player>> hidden = new HashMap<>();
|
private Map<Region, Set<Player>> hidden = new HashMap<>();
|
||||||
|
|
||||||
|
private static TechHiderCommand INSTANCE;
|
||||||
|
|
||||||
|
{
|
||||||
|
INSTANCE = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isHidden(Region region, Player player) {
|
||||||
|
return INSTANCE.hidden.getOrDefault(region, Collections.emptySet()).contains(player);
|
||||||
|
}
|
||||||
|
|
||||||
@LinkedInstance
|
@LinkedInstance
|
||||||
public XrayCommand xrayCommand;
|
public XrayCommand xrayCommand;
|
||||||
|
|
||||||
|
@ -3,10 +3,12 @@ package de.steamwar.bausystem.features.world;
|
|||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.features.loader.Loader;
|
import de.steamwar.bausystem.features.loader.Loader;
|
||||||
import de.steamwar.bausystem.features.script.CustomScriptManager;
|
import de.steamwar.bausystem.features.script.CustomScriptManager;
|
||||||
|
import de.steamwar.bausystem.features.techhider.TechHiderCommand;
|
||||||
import de.steamwar.bausystem.features.tpslimit.FreezeUtils;
|
import de.steamwar.bausystem.features.tpslimit.FreezeUtils;
|
||||||
import de.steamwar.bausystem.features.tpslimit.TPSLimitUtils;
|
import de.steamwar.bausystem.features.tpslimit.TPSLimitUtils;
|
||||||
import de.steamwar.bausystem.features.tpslimit.TPSWarpUtils;
|
import de.steamwar.bausystem.features.tpslimit.TPSWarpUtils;
|
||||||
import de.steamwar.bausystem.features.tracer.record.Recorder;
|
import de.steamwar.bausystem.features.tracer.record.Recorder;
|
||||||
|
import de.steamwar.bausystem.features.xray.XrayCommand;
|
||||||
import de.steamwar.bausystem.region.GlobalRegion;
|
import de.steamwar.bausystem.region.GlobalRegion;
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.bausystem.region.flags.Flag;
|
import de.steamwar.bausystem.region.flags.Flag;
|
||||||
@ -15,6 +17,7 @@ import de.steamwar.linkage.Linked;
|
|||||||
import de.steamwar.linkage.LinkedInstance;
|
import de.steamwar.linkage.LinkedInstance;
|
||||||
import de.steamwar.scoreboard.SWScoreboard;
|
import de.steamwar.scoreboard.SWScoreboard;
|
||||||
import de.steamwar.scoreboard.ScoreboardCallback;
|
import de.steamwar.scoreboard.ScoreboardCallback;
|
||||||
|
import de.steamwar.techhider.TechHider;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -86,6 +89,11 @@ public class BauScoreboard implements Listener {
|
|||||||
}
|
}
|
||||||
strings.add(colorCode + BauSystem.MESSAGE.parse(flag.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.get(flag).getChatValue(), p).replace("§e", colorCode));
|
strings.add(colorCode + BauSystem.MESSAGE.parse(flag.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.get(flag).getChatValue(), p).replace("§e", colorCode));
|
||||||
}
|
}
|
||||||
|
if (TechHiderCommand.isHidden(region, p)) {
|
||||||
|
strings.add(colorCode + BauSystem.MESSAGE.parse("SCOREBOARD_TECHHIDER", p));
|
||||||
|
} else if (XrayCommand.isHidden(region, p)) {
|
||||||
|
strings.add(colorCode + BauSystem.MESSAGE.parse("SCOREBOARD_XRAY", p));
|
||||||
|
}
|
||||||
|
|
||||||
strings.add("§3");
|
strings.add("§3");
|
||||||
String traceScore = recorder.get(region).scoreboard(p);
|
String traceScore = recorder.get(region).scoreboard(p);
|
||||||
|
@ -57,6 +57,16 @@ public class XrayCommand extends SWCommand implements Listener {
|
|||||||
private Map<Region, Set<Material>> xrayedBlocks = new HashMap<>();
|
private Map<Region, Set<Material>> xrayedBlocks = new HashMap<>();
|
||||||
private Map<Region, Set<Player>> hidden = new HashMap<>();
|
private Map<Region, Set<Player>> hidden = new HashMap<>();
|
||||||
|
|
||||||
|
private static XrayCommand INSTANCE;
|
||||||
|
|
||||||
|
{
|
||||||
|
INSTANCE = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isHidden(Region region, Player player) {
|
||||||
|
return INSTANCE.hidden.getOrDefault(region, Collections.emptySet()).contains(player);
|
||||||
|
}
|
||||||
|
|
||||||
@LinkedInstance
|
@LinkedInstance
|
||||||
public TechHiderCommand techHiderCommand;
|
public TechHiderCommand techHiderCommand;
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren