SkullCommand #172
@ -37,6 +37,9 @@ SCOREBOARD_TPS_FROZEN = §e Frozen
|
||||
|
||||
SCOREBOARD_TRACE_TICKS = Ticks
|
||||
|
||||
SCOREBOARD_TECHHIDER = TechHider
|
||||
SCOREBOARD_XRAY = XRay
|
||||
|
||||
# Flags
|
||||
FLAG_COLOR = Color
|
||||
FLAG_TNT = TNT
|
||||
@ -159,6 +162,12 @@ COUNTINGWAND_MESSAGE_LCLICK = §7Second position at: §8[§7{0}§8, §7{1}§8,
|
||||
COUNTINGWAND_MESSAGE_VOLUME = §e{0}
|
||||
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
|
||||
DESIGN_ENDSTONE_ENABLE = §aEndstone is activated
|
||||
DESIGN_ENDSTONE_DISABLE = §cEndstone is deactivated
|
||||
|
||||
# Detonator
|
||||
DETONATOR_LOC_REMOVE = §e{0} removed
|
||||
DETONATOR_LOC_ADD = §e{0} added
|
||||
|
@ -157,6 +157,12 @@ COUNTINGWAND_MESSAGE_LCLICK = §7Zweite Position bei: §8[§7{0}§8, §7{1}§8,
|
||||
COUNTINGWAND_MESSAGE_VOLUME = §e{0}
|
||||
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
|
||||
DESIGN_ENDSTONE_ENABLE = §aEndstone ist aktiviert
|
||||
DESIGN_ENDSTONE_DISABLE = §cEndstone ist deaktiviert
|
||||
|
||||
# Detonator
|
||||
DETONATOR_LOC_REMOVE = §e{0} entfernt
|
||||
DETONATOR_LOC_ADD = §e{0} hinzugefügt
|
||||
|
@ -0,0 +1,109 @@
|
||||
/*
|
||||
* 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.entity.REntity;
|
||||
import de.steamwar.entity.REntityServer;
|
||||
import de.steamwar.entity.RFallingBlockEntity;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
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.RED_STAINED_GLASS);
|
||||
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);
|
||||
BauSystem.MESSAGE.send("DESIGN_ENDSTONE_DISABLE", player, ChatMessageType.ACTION_BAR);
|
||||
} else {
|
||||
players.add(player);
|
||||
entityServer.addPlayer(player);
|
||||
calc();
|
||||
BauSystem.MESSAGE.send("DESIGN_ENDSTONE_ENABLE", player, ChatMessageType.ACTION_BAR);
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -167,7 +167,30 @@ public class TNTSimulator {
|
||||
if (elements.size() == 1) {
|
||||
TNTElementGUI.open(player, (TNTElement) elements.get(0), null);
|
||||
} else {
|
||||
TNTSimulatorGui.open(player, null, null, () -> elements, null);
|
||||
List<TNTGroup> tntGroups = tntElementList.stream().filter(TNTGroup.class::isInstance).map(TNTGroup.class::cast).collect(Collectors.toList());
|
||||
List<SimulatorElement> newElementList = new ArrayList<>();
|
||||
for (TNTGroup tntGroup : tntGroups) {
|
||||
if (new HashSet<>(elements).containsAll(tntGroup.getElements())) {
|
||||
newElementList.add(tntGroup);
|
||||
elements.removeAll(tntGroup.getElements());
|
||||
}
|
||||
}
|
||||
newElementList.addAll(elements);
|
||||
if (newElementList.size() == 1) {
|
||||
SimulatorElement element = newElementList.get(0);
|
||||
if (element instanceof TNTGroup) {
|
||||
TNTGroup tntGroup = (TNTGroup) element;
|
||||
TNTSimulatorGui.open(player, null, tntGroup, () -> {
|
||||
List<SimulatorElement> elementList = new ArrayList<>();
|
||||
elementList.addAll(tntGroup.getElements());
|
||||
return elementList;
|
||||
}, null);
|
||||
} else {
|
||||
TNTElementGUI.open(player, (TNTElement) elements.get(0), null);
|
||||
}
|
||||
} else {
|
||||
TNTSimulatorGui.open(player, null, null, () -> newElementList, null);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -50,6 +50,16 @@ public class TechHiderCommand extends SWCommand implements Listener {
|
||||
private Map<Region, Optional<TechHider>> techHiders = 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
|
||||
public XrayCommand xrayCommand;
|
||||
|
||||
|
@ -209,11 +209,10 @@ public class TraceCommand extends SWCommand {
|
||||
|
||||
@AllArgsConstructor
|
||||
private enum ShowModeType {
|
||||
ENTITY((player, showModeParameter) -> new EntityShowMode(player, showModeParameter, 10), new ShowModeParameterType[]{}),
|
||||
RAW((player, showModeParameter) -> new EntityShowMode(player, showModeParameter, -1), new ShowModeParameterType[]{});
|
||||
ENTITY((player, showModeParameter) -> new EntityShowMode(player, showModeParameter, 10)),
|
||||
RAW((player, showModeParameter) -> new EntityShowMode(player, showModeParameter, -1));
|
||||
|
||||
private BiFunction<Player, ShowModeParameter, ShowMode<TNTPosition>> showModeBiFunction;
|
||||
private ShowModeParameterType[] removedTypes;
|
||||
}
|
||||
|
||||
@ClassMapper(value = ShowModeParameterType.class, local = true)
|
||||
@ -235,9 +234,6 @@ public class TraceCommand extends SWCommand {
|
||||
@Override
|
||||
public List<String> tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
Set<ShowModeParameterType> showModeParameterTypeSet = new HashSet<>();
|
||||
previousArguments.getAll(ShowModeType.class).forEach(showModeType -> {
|
||||
showModeParameterTypeSet.addAll(Arrays.asList(showModeType.removedTypes));
|
||||
});
|
||||
Arrays.stream(previousArguments.userArgs).map(showModeParameterTypesMap::get).forEach(showModeParameterTypeSet::add);
|
||||
showModeParameterTypeSet.remove(null);
|
||||
|
||||
|
@ -70,10 +70,9 @@ public abstract class AutoTraceRecorder implements TraceRecorder {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Record postClear() {
|
||||
public void postClear() {
|
||||
recordMap.clear();
|
||||
record = recordSupplier.get();
|
||||
return record;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -147,11 +147,7 @@ public class Recorder implements Listener {
|
||||
}
|
||||
|
||||
public void postClear(Region region) {
|
||||
TraceRecorder traceRecorder = get(region);
|
||||
Record record = traceRecorder.postClear();
|
||||
if (record != null) {
|
||||
StoredRecords.add(region, record);
|
||||
}
|
||||
get(region).postClear();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -46,9 +46,8 @@ public class SimpleTraceRecorder implements TraceRecorder, ActiveTracer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Record postClear() {
|
||||
public void postClear() {
|
||||
recordMap.clear();
|
||||
return record;
|
||||
}
|
||||
|
||||
private Record.TNTRecord getRecord(TNTPrimed tntPrimed) {
|
||||
|
@ -30,8 +30,7 @@ public interface TraceRecorder {
|
||||
String scoreboard(Player player);
|
||||
default void recordSupplier(Supplier<Record> recordSupplier) {
|
||||
}
|
||||
default Record postClear() {
|
||||
return null;
|
||||
default void postClear() {
|
||||
}
|
||||
void spawn(TNTPrimed tntPrimed);
|
||||
void tick(TNTPrimed tntPrimed);
|
||||
|
@ -3,10 +3,12 @@ package de.steamwar.bausystem.features.world;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.features.loader.Loader;
|
||||
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.TPSLimitUtils;
|
||||
import de.steamwar.bausystem.features.tpslimit.TPSWarpUtils;
|
||||
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.Region;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
@ -15,6 +17,7 @@ import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.LinkedInstance;
|
||||
import de.steamwar.scoreboard.SWScoreboard;
|
||||
import de.steamwar.scoreboard.ScoreboardCallback;
|
||||
import de.steamwar.techhider.TechHider;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
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));
|
||||
}
|
||||
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");
|
||||
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<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
|
||||
public TechHiderCommand techHiderCommand;
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren