From 5de070c90e1a482d94e20e67dfb094b3730b2169 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 22 Oct 2023 12:07:52 +0200 Subject: [PATCH 001/111] Update Tracer --- BauSystem_Main/src/BauSystem.properties | 5 +-- BauSystem_Main/src/BauSystem_de.properties | 2 - .../features/simulator/TNTSimulator.java | 2 +- .../laufbau/states/ProcessingTracesState.java | 2 +- .../features/tracer/TNTPosition.java | 20 ++++++++-- .../features/tracer/TraceCommand.java | 35 ++++++----------- .../record/AutoExplodeTraceRecorder.java | 38 ------------------ .../record/AutoIgniteTraceRecorder.java | 5 --- .../tracer/record/AutoTraceRecorder.java | 39 ++++++------------- .../features/tracer/record/Recorder.java | 5 +-- .../tracer/record/SingleTraceRecorder.java | 13 ------- .../features/tracer/record/TraceRecorder.java | 2 - .../features/tracer/show/EntityShowMode.java | 31 ++++++++++++--- .../features/tracer/show/Record.java | 10 +++-- .../tracer/show/ShowModeParameter.java | 10 +++++ .../tracer/show/ShowModeParameterType.java | 6 ++- 16 files changed, 89 insertions(+), 136 deletions(-) delete mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/AutoExplodeTraceRecorder.java diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index 0037825c..20b50b0b 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -489,9 +489,7 @@ TPSLIMIT_FROZEN = §eTPS frozen TRACE_RECORD=§aon TRACE_HAS_TRACES=§ehas Traces TRACE_IDLE_SINGLE=§esingle -TRACE_IDLE_AUTO_EXPLODE=§eauto §8(§7explode§8) -TRACE_IDLE_AUTO_IGNITE=§eauto §8(§7ignite§8) -TRACE_MESSAGE_AUTO_IDLE_EXPLODE = §aAuto-Tracer explode started +TRACE_IDLE_AUTO_IGNITE=§eauto TRACE_MESSAGE_AUTO_IDLE_IGNITE = §aAuto-Tracer ignite started TRACE_MESSAGE_AUTO_DELETE_INVALID = §cAuto delete cannot be used currently TRACE_MESSAGE_AUTO_DELETE_ALWAYS = §7Last Shot will §ealways §7be deleted @@ -506,7 +504,6 @@ TRACE_MESSAGE_STOP = §cTNT-Tracer stopped TRACE_MESSAGE_DELETE = §cAll TNT-positions deleted TRACE_MESSAGE_SHOW = §aAll TNT-positions shown TRACE_MESSAGE_HIDE = §cAll TNT-positions hidden -TRACE_MESSAGE_CLICK_ISOLATE = §eClick to §aisolate§8/§cunisolate TRACE_MESSAGE_DISALLOWED = §cYou are not allowed to use the TNT-Tracer here TRACE_MESSAGE_SHOW_AT = §aTNT-positions shown with {0} at {1} TRACE_MESSAGE_SHOW_FROM = §aAll TNT-positions shown with {0} from {1} diff --git a/BauSystem_Main/src/BauSystem_de.properties b/BauSystem_Main/src/BauSystem_de.properties index e5da397d..af268de5 100644 --- a/BauSystem_Main/src/BauSystem_de.properties +++ b/BauSystem_Main/src/BauSystem_de.properties @@ -460,7 +460,6 @@ TRACE_HAS_TRACES=§ehat Traces TRACE_IDLE_SINGLE=§esingle TRACE_IDLE_AUTO_EXPLODE=§eauto §8(§7explode§8) TRACE_IDLE_AUTO_IGNITE=§eauto §8(§7ignite§8) -TRACE_MESSAGE_AUTO_IDLE_EXPLODE = §aAuto-Tracer explode gestartet TRACE_MESSAGE_AUTO_IDLE_IGNITE = §aAuto-Tracer ignite gestartet TRACE_MESSAGE_AUTO_DELETE_INVALID = §cAuto delete kann aktuell nicht genutzt werden TRACE_MESSAGE_AUTO_DELETE_ALWAYS = §7Der letzte Schuss wird §eimmer§7 gelöscht @@ -475,7 +474,6 @@ TRACE_MESSAGE_STOP = §cTNT-Tracer gestoppt TRACE_MESSAGE_DELETE = §cAlle TNT-Positionen gelöscht TRACE_MESSAGE_SHOW = §aAlle TNT-Positionen angezeigt TRACE_MESSAGE_HIDE = §cAlle TNT-Positionen ausgeblendet -TRACE_MESSAGE_CLICK_ISOLATE = §eKlicken zum §aisolieren§8/§causblenden TRACE_MESSAGE_DISALLOWED = §cDu darfst hier nicht den TNT-Tracer nutzen TRACE_MESSAGE_SHOW_AT = §aTNT-positions angezeigt mit {0} bei {1} TRACE_MESSAGE_SHOW_FROM = §aAll TNT-positions angezeigt mit {0} von {1} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulator.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulator.java index d1a71b95..a3076b9c 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulator.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulator.java @@ -225,7 +225,7 @@ public class TNTSimulator { } }); if (needsAutoTrace.get()) { - Recorder.INSTANCE.set(region, new SingleTraceRecorder(region)); + Recorder.INSTANCE.set(region, new SingleTraceRecorder()); } AtomicInteger maxTick = new AtomicInteger(0); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java index c34e5024..320efaaa 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java @@ -86,7 +86,7 @@ public class ProcessingTracesState implements LaufbauState { } else { Vector movement = location.clone().subtract(previousLocation); toExpand.add(new Cuboid(previousLocation.getX() - 0.49, Math.min(previousLocation.getY(), location.getY()), previousLocation.getZ() - 0.49, 0.98, Math.abs(movement.getY()) + 0.98, 0.98)); - if (Math.abs(tntPosition.getUpdateVelocity().getX()) >= Math.abs(tntPosition.getUpdateVelocity().getZ())) { + if (tntPosition.getUpdateOrder() == TNTPosition.UpdateOrder.X) { toExpand.add(new Cuboid(Math.min(previousLocation.getX(), location.getX()) - 0.49, location.getY(), previousLocation.getZ() - 0.49, Math.abs(movement.getX()) + 0.98, 0.98, 0.98)); toExpand.add(new Cuboid(location.getX() - 0.49, location.getY(), Math.min(previousLocation.getZ(), location.getZ()) - 0.49, 0.98, 0.98, Math.abs(movement.getZ()) + 0.98)); } else { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPosition.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPosition.java index 1af2b710..cdbd6227 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPosition.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPosition.java @@ -26,6 +26,8 @@ import lombok.Setter; import org.bukkit.entity.TNTPrimed; import org.bukkit.util.Vector; +import java.lang.instrument.Instrumentation; + @Getter public class TNTPosition extends Position { @@ -34,21 +36,21 @@ public class TNTPosition extends Position { private final long timeTicks; private final Vector previousLocation; private final Vector velocity; - private final Vector updateVelocity; + private final UpdateOrder updateOrder; private final boolean source; private final boolean exploded; @Setter private boolean microMotion; - public TNTPosition(Record.TNTRecord record, TNTPrimed entity, long timeTicks, Vector previousLocation, Vector velocity, Vector updateVelocity, boolean source, boolean exploded) { + public TNTPosition(Record.TNTRecord record, TNTPrimed entity, long timeTicks, Vector previousLocation, Vector velocity, UpdateOrder updateOrder, boolean source, boolean exploded) { super(entity.getLocation().toVector()); this.record = record; this.fuseTicks = entity.getFuseTicks(); this.timeTicks = timeTicks; this.previousLocation = previousLocation; this.velocity = velocity; - this.updateVelocity = updateVelocity; + this.updateOrder = updateOrder; this.source = source; this.exploded = exploded; } @@ -59,4 +61,16 @@ public class TNTPosition extends Position { "location=" + super.getLocation() + '}'; } + + public enum UpdateOrder { + /** + * X is Bigger so comes later + */ + X, + + /** + * Z is Bigger so comes later + */ + Z + } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index 366cc7a3..b05ec3d7 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -23,8 +23,11 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.features.tracer.record.*; import de.steamwar.bausystem.features.tracer.show.*; +import de.steamwar.bausystem.region.GlobalRegion; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.shared.ShowMode; +import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar; +import de.steamwar.bausystem.utils.bossbar.BossBarService; import de.steamwar.command.PreviousArguments; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeMapper; @@ -32,6 +35,8 @@ import de.steamwar.command.TypeValidator; import de.steamwar.linkage.Linked; import de.steamwar.linkage.LinkedInstance; import lombok.AllArgsConstructor; +import org.bukkit.Bukkit; +import org.bukkit.boss.BossBar; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -60,7 +65,7 @@ public class TraceCommand extends SWCommand { @Register(value = {"single"}, description = "TRACE_COMMAND_HELP_SINGLE") public void singleCommand(@Validator Player p) { Region region = Region.getRegion(p.getLocation()); - recorder.set(region, new SingleTraceRecorder(region)); + recorder.set(region, new SingleTraceRecorder()); BauSystem.MESSAGE.send("TRACE_MESSAGE_SINGLE", p); } @@ -73,20 +78,10 @@ public class TraceCommand extends SWCommand { @Register(value = {"auto"}, description = "TRACE_COMMAND_HELP_AUTO") @Register({"toggleauto"}) - public void autoCommand(@Validator Player p, @OptionalValue("-explode") @StaticValue({"-explode", "-ignite"}) String type) { + public void autoCommand(@Validator Player p) { Region region = Region.getRegion(p.getLocation()); - switch (type) { - case "-explode": - recorder.set(region, new AutoExplodeTraceRecorder()); - BauSystem.MESSAGE.send("TRACE_MESSAGE_AUTO_IDLE_EXPLODE", p); - break; - case "-ignite": - recorder.set(region, new AutoIgniteTraceRecorder()); - BauSystem.MESSAGE.send("TRACE_MESSAGE_AUTO_IDLE_IGNITE", p); - break; - default: - break; - } + recorder.set(region, new AutoIgniteTraceRecorder()); + BauSystem.MESSAGE.send("TRACE_MESSAGE_AUTO_IDLE_IGNITE", p); } @Register(value = {"autoremove"}, description = "TRACE_COMMAND_HELP_AUTO_REMOVE") @@ -165,7 +160,7 @@ public class TraceCommand extends SWCommand { // /trace show at 0 // /trace show raw -auto at 0 @Register(value = {"show"}, description = "TRACE_COMMAND_HELP_SHOW") - public void showCommand(@Validator Player p, @OptionalValue("entity") ShowModeType showModeType, ShowModeParameterType... showModeParameterTypes) { + public void showCommand(@Validator Player p, ShowModeParameterType... showModeParameterTypes) { Region region = Region.getRegion(p.getLocation()); ShowModeParameter showModeParameter = new ShowModeParameter(); if (region.getWaterLevel() != 0) { // Enable Water by default for regions with WaterLevel e.g. WarShip @@ -178,7 +173,7 @@ public class TraceCommand extends SWCommand { showModeParameterType.getShowModeParameterConsumer().accept(showModeParameter); } } - TraceShowManager.show(p, showModeType.showModeBiFunction.apply(p, showModeParameter)); + TraceShowManager.show(p, new EntityShowMode(p, showModeParameter, 32)); BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW", p); } @@ -196,14 +191,6 @@ public class TraceCommand extends SWCommand { BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE", p); } - @AllArgsConstructor - private enum ShowModeType { - ENTITY((player, showModeParameter) -> new EntityShowMode(player, showModeParameter, 16)), - RAW((player, showModeParameter) -> new EntityShowMode(player, showModeParameter, -1)); - - private BiFunction> showModeBiFunction; - } - @ClassMapper(value = ShowModeParameterType.class, local = true) public TypeMapper showModeParameterTypesTypeMapper() { Map> showModeParameterTypeListMap = new EnumMap<>(ShowModeParameterType.class); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/AutoExplodeTraceRecorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/AutoExplodeTraceRecorder.java deleted file mode 100644 index 6ff44728..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/AutoExplodeTraceRecorder.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2022 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.tracer.record; - -public class AutoExplodeTraceRecorder extends AutoTraceRecorder { - - @Override - protected String getInactivityMessage() { - return "TRACE_IDLE_AUTO_EXPLODE"; - } - - @Override - protected boolean shouldStartRecording(StartType startType) { - return startType == StartType.EXPLODE; - } - - @Override - protected String getScriptState() { - return "IDLE_AUTO_EXPLODE"; - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/AutoIgniteTraceRecorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/AutoIgniteTraceRecorder.java index 932634bb..9eb2f0b8 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/AutoIgniteTraceRecorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/AutoIgniteTraceRecorder.java @@ -26,11 +26,6 @@ public class AutoIgniteTraceRecorder extends AutoTraceRecorder implements Active return "TRACE_IDLE_AUTO_IGNITE"; } - @Override - protected boolean shouldStartRecording(StartType startType) { - return startType == StartType.IGNITE; - } - @Override protected String getScriptState() { return "IDLE_AUTO_IGNITE"; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/AutoTraceRecorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/AutoTraceRecorder.java index ab326abc..ba947f31 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/AutoTraceRecorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/AutoTraceRecorder.java @@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.tracer.record; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.tpslimit.TPSUtils; +import de.steamwar.bausystem.features.tracer.TNTPosition; import de.steamwar.bausystem.features.tracer.show.Record; import de.steamwar.bausystem.features.tracer.show.StoredRecords; import de.steamwar.bausystem.features.tracer.show.TraceShowManager; @@ -38,12 +39,11 @@ public abstract class AutoTraceRecorder implements TraceRecorder { protected boolean recording = false; private long startTime = TPSUtils.currentRealTick.get(); - private long lastExplosion = 0; private final Map recordMap = new HashMap<>(); private Record record; - private Region region; + protected Region region; private Supplier recordSupplier; @Setter @@ -56,7 +56,6 @@ public abstract class AutoTraceRecorder implements TraceRecorder { } protected abstract String getInactivityMessage(); - protected abstract boolean shouldStartRecording(StartType startType); protected void stoppedRecording() { } @@ -74,7 +73,6 @@ public abstract class AutoTraceRecorder implements TraceRecorder { StoredRecords.remove(region, lastRecord); TraceShowManager.reshow(region); } - lastExplosion = 0; startTime = TPSUtils.currentRealTick.get(); record = recordSupplier.get(); recording = true; @@ -94,12 +92,10 @@ public abstract class AutoTraceRecorder implements TraceRecorder { @Override public final void spawn(TNTPrimed tntPrimed) { - if (!recording && shouldStartRecording(StartType.IGNITE)) { + if (!recording) { startRecording(); } - if (recording) { - getRecord(tntPrimed).source(tntPrimed); - } + getRecord(tntPrimed).source(tntPrimed); } @Override @@ -111,35 +107,22 @@ public abstract class AutoTraceRecorder implements TraceRecorder { @Override public final void explode(TNTPrimed tntPrimed, boolean inBuildRegion, boolean inTestblockRegion) { - if (!recording && shouldStartRecording(StartType.EXPLODE)) { - startRecording(); - } if (recording) { Record.TNTRecord tntRecord = getRecord(tntPrimed); if (inBuildRegion) tntRecord.setInBuildArea(true); if (inTestblockRegion) tntRecord.setInTestblockArea(true); tntRecord.explode(tntPrimed); - } - lastExplosion = 0; - } + recordMap.remove(tntPrimed); - @Override - public final void tick() { - lastExplosion++; - if (recording && lastExplosion > 80) { - recording = false; - recordMap.clear(); - lastRecord = record; - record = null; - stoppedRecording(); + if (recordMap.isEmpty() || recordMap.keySet().stream().allMatch(TNTPrimed::isDead)) { + recording = false; + lastRecord = record; + record = null; + stoppedRecording(); + } } } - protected enum StartType { - IGNITE, - EXPLODE - } - protected abstract String getScriptState(); @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/Recorder.java index 1bd04377..5c89155a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/Recorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/Recorder.java @@ -35,7 +35,6 @@ import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntitySpawnEvent; -import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.stream.Collectors; @@ -99,7 +98,7 @@ public class Recorder implements Listener { }); tntTraceRecorderMap.forEach((tntPrimed, rg) -> { if (rg == region) { - traceRecorder.spawn(tntPrimed); + traceRecorder.tick(tntPrimed); } }); } @@ -129,7 +128,6 @@ public class Recorder implements Listener { .filter(e -> !e.isValid()) .collect(Collectors.toList()) .forEach(tntTraceRecorderMap::remove); - new ArrayList<>(regionTraceRecorderMap.values()).forEach(TraceRecorder::tick); }, 1, 1); } @@ -151,6 +149,5 @@ public class Recorder implements Listener { boolean inTestblockRegion = event.blockList().stream().anyMatch(block -> region.inRegion(block.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.EXTENSION)); traceRecorder.explode((TNTPrimed) entity, inBuildRegion, inTestblockRegion); tntTraceRecorderMap.remove(entity); - tick(); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/SingleTraceRecorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/SingleTraceRecorder.java index 6eae0b06..7f878869 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/SingleTraceRecorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/SingleTraceRecorder.java @@ -19,26 +19,13 @@ package de.steamwar.bausystem.features.tracer.record; -import de.steamwar.bausystem.region.Region; - public class SingleTraceRecorder extends AutoTraceRecorder { - private Region region; - - public SingleTraceRecorder(Region region) { - this.region = region; - } - @Override protected String getInactivityMessage() { return "TRACE_IDLE_SINGLE"; } - @Override - protected boolean shouldStartRecording(StartType startType) { - return startType == StartType.EXPLODE; - } - @Override protected void stoppedRecording() { Recorder.INSTANCE.remove(region); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/TraceRecorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/TraceRecorder.java index c667f4e0..ee1ca2e1 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/TraceRecorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/TraceRecorder.java @@ -36,8 +36,6 @@ public interface TraceRecorder { void spawn(TNTPrimed tntPrimed); void tick(TNTPrimed tntPrimed); void explode(TNTPrimed tntPrimed, boolean inBuildRegion, boolean inTestblockRegion); - default void tick() { - } String scriptState(); long scriptTime(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/EntityShowMode.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/EntityShowMode.java index dfa05ac4..ce45434a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/EntityShowMode.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/EntityShowMode.java @@ -34,6 +34,7 @@ import org.bukkit.util.Vector; import java.util.*; import java.util.function.BiConsumer; +import java.util.stream.Collectors; import java.util.stream.Stream; public class EntityShowMode implements ShowMode { @@ -75,7 +76,6 @@ public class EntityShowMode implements ShowMode { BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_X", player, tntPosition.getVelocity().getX() + ""); BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_Y", player, tntPosition.getVelocity().getY() + ""); BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_Z", player, tntPosition.getVelocity().getZ() + ""); - BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_ISOLATE", player, BauSystem.MESSAGE.parse("TRACE_MESSAGE_CLICK_ISOLATE", player), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/trace isolate " + tntPosition.getRecord().getId())); }); entityServer.addPlayer(player); } @@ -219,10 +219,31 @@ public class EntityShowMode implements ShowMode { entity = createEntity(position, positionType); } count++; + + int nameShows = 0; + if (showModeParameter.isFuse()) nameShows++; + if (showModeParameter.isCount()) nameShows++; + if (showModeParameter.isEntityId()) nameShows++; + if (showModeParameter.isCalculationOrder()) nameShows++; + + List toShow = new ArrayList<>(); if (showModeParameter.isFuse()) { - entity.setDisplayName(fuseTicks + ""); - } else if (showModeParameter.isCount()) { - entity.setDisplayName(new HashSet<>(records).size() + ""); + toShow.add((nameShows > 1 ? "F:" : "") + fuseTicks); + } + if (showModeParameter.isCount()) { + toShow.add((nameShows > 1 ? "C:" : "") + new HashSet<>(records).size()); + } + if (showModeParameter.isEntityId()) { + toShow.add((nameShows > 1 ? "I:" : "") + record.getEntityId()); + } + /* + if (showModeParameter.isCalculationOrder()) { + toShow.add((nameShows > 1 ? "O:" : "") + record.getEntityId()); + } + */ + + if (!toShow.isEmpty()) { + entity.setDisplayName(String.join(" ", toShow)); } } @@ -251,7 +272,7 @@ public class EntityShowMode implements ShowMode { } if (interpolateXZ) { - Vector updatePointXZ = Math.abs(position.getUpdateVelocity().getX()) >= Math.abs(position.getUpdateVelocity().getZ()) + Vector updatePointXZ = position.getUpdateOrder() == TNTPosition.UpdateOrder.X ? position.getLocation().clone().setZ(position.getPreviousLocation().getZ()) : position.getLocation().clone().setX(position.getPreviousLocation().getX()); if (!position.getLocation().equals(updatePointXZ)) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/Record.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/Record.java index fce2d789..ac8d4e02 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/Record.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/Record.java @@ -31,7 +31,6 @@ import org.bukkit.util.Vector; import java.util.ArrayList; import java.util.List; -import java.util.UUID; @RequiredArgsConstructor public class Record { @@ -81,7 +80,7 @@ public class Record { public static class TNTRecord { @Getter - private final UUID id = UUID.randomUUID(); + private int entityId; private Record record; @@ -89,7 +88,7 @@ public class Record { private final Region region; @Getter - private final List positions = new ArrayList<>(82); + private final List positions = new ArrayList<>(); @Getter @Setter @@ -121,13 +120,16 @@ public class Record { } private void add(TNTPrimed tntPrimed, boolean source, boolean exploded) { + entityId = tntPrimed.getEntityId(); + TNTPosition position; if (positions.isEmpty()) { position = new TNTPosition(this, tntPrimed, TPSUtils.currentTick.get() - record.startTicks, null, tntPrimed.getVelocity(), null, source, exploded); } else { TNTPosition tntPosition = positions.get(positions.size() - 1); Vector lastVelocity = tntPrimed.getLocation().toVector().clone().subtract(tntPosition.getLocation()); - position = new TNTPosition(this, tntPrimed, TPSUtils.currentTick.get() - record.startTicks, positions.get(positions.size() - 1).getLocation(), tntPrimed.getVelocity(), lastVelocity, source, exploded); + TNTPosition.UpdateOrder updateOrder = Math.abs(lastVelocity.getX()) >= Math.abs(lastVelocity.getZ()) ? TNTPosition.UpdateOrder.X : TNTPosition.UpdateOrder.Z; + position = new TNTPosition(this, tntPrimed, TPSUtils.currentTick.get() - record.startTicks, positions.get(positions.size() - 1).getLocation(), tntPrimed.getVelocity(), updateOrder, source, exploded); } positions.add(position); TraceShowManager.show(region, position); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/ShowModeParameter.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/ShowModeParameter.java index 1da942eb..72089326 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/ShowModeParameter.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/ShowModeParameter.java @@ -34,6 +34,8 @@ public class ShowModeParameter { private boolean testblockDestroyOnly = false; private boolean microMotion = false; private boolean microMotionLocation = false; + private boolean entityId = false; + private boolean calculationOrder = false; public void enableWater() { this.water = true; @@ -82,4 +84,12 @@ public class ShowModeParameter { public void enableMicroMotionLocation() { this.microMotionLocation = true; } + + public void enableEntityId() { + entityId = true; + } + + public void enableCalculationOrder() { + calculationOrder = true; + } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/ShowModeParameterType.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/ShowModeParameterType.java index 51e1e9a5..763df5d4 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/ShowModeParameterType.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/ShowModeParameterType.java @@ -38,12 +38,14 @@ public enum ShowModeParameterType { }, Arrays.asList("-advanced", "-a"), "INTERPOLATE_Y", "INTERPOLATE_XZ"), SOURCE(ShowModeParameter::enableSourceOnly, Arrays.asList("-source", "-sourceonly", "-ignite"), "FUSE", "ADVANCED", "INTERPOLATE_Y", "INTERPOLATE_XZ", "WATER"), EXPLODE(ShowModeParameter::enableExplodeOnly, Arrays.asList("-explode", "-explodeonly"), "FUSE", "ADVANCED", "INTERPOLATE_Y", "INTERPOLATE_XZ", "WATER"), - FUSE(ShowModeParameter::enableFuse, Arrays.asList("-fuse", "-f"), "EXPLODE", "SOURCE", "COUNT"), - COUNT(ShowModeParameter::enableCount, Arrays.asList("-count", "-c"), "FUSE"), + FUSE(ShowModeParameter::enableFuse, Arrays.asList("-fuse", "-f"), "EXPLODE", "SOURCE"), + COUNT(ShowModeParameter::enableCount, Arrays.asList("-count", "-c")), BUILD_DESTROY_ONLY(ShowModeParameter::enableBuildDestroyOnly, Arrays.asList("-builddestroy", "-builddestoryonly"), "WATER", "TESTBLOCK_DESTROY_ONLY"), TESTBLOCK_DESTROY_ONLY(ShowModeParameter::enableTestblockDestroyOnly, Arrays.asList("-testblockdestroy", "-testblockdestroyonly"), "WATER", "BUILD_DESTROY_ONLY"), MICROMOTION(ShowModeParameter::enableMicroMotion, Arrays.asList("-micromotion", "-micro", "-m")), MICROMOTION_LOCATION(ShowModeParameter::enableMicroMotionLocation, Arrays.asList("-micromotionloc", "-microloc", "-mloc", "-micromotionlocation", "-microlocation", "-mlocation")), + ENTITY_ID(ShowModeParameter::enableEntityId, Arrays.asList("-entityid", "-id")), + // CALCULATION_ORDER(ShowModeParameter::enableCalculationOrder, Arrays.asList("-calc", "-calcorder", "-calculation", "-calculationorder")), ; @Getter -- 2.39.5 From 27a542590c6141a0479a2d2f343eefb154d40aa7 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Mon, 6 Nov 2023 00:11:03 +0100 Subject: [PATCH 002/111] Started Trace Refactoring Laid out basic class structure --- .../src/de/steamwar/bausystem/BauSystem.java | 6 ++ .../bausystem/features/tracer2/Recorder.java | 84 +++++++++++++++++++ .../bausystem/features/tracer2/TNTRecord.java | 23 +++++ .../bausystem/features/tracer2/Trace.java | 35 ++++++++ .../features/tracer2/TraceCommand.java | 23 +++++ .../features/tracer2/TraceManager.java | 56 +++++++++++++ 6 files changed, 227 insertions(+) create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TNTRecord.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceCommand.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java index 88a46ddc..5bf3fb98 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java @@ -22,6 +22,7 @@ package de.steamwar.bausystem; import com.comphenix.tinyprotocol.TinyProtocol; import de.steamwar.bausystem.configplayer.Config; import de.steamwar.bausystem.features.tpslimit.TPSFreezeUtils; +import de.steamwar.bausystem.features.tracer2.TraceManager; import de.steamwar.bausystem.features.world.RamUsage; import de.steamwar.bausystem.linkage.LinkageUtils; import de.steamwar.bausystem.region.loader.PrototypeLoader; @@ -50,6 +51,11 @@ public class BauSystem extends JavaPlugin implements Listener { // This should be treated as final! public static Message MESSAGE; + /* + * Plugin wide availeble data + */ + public static final TraceManager TRACES = new TraceManager(); + @Getter private static BauSystem instance; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java new file mode 100644 index 00000000..fa00cab0 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java @@ -0,0 +1,84 @@ +/* + * 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.tracer2; + +import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.region.Region; +import de.steamwar.linkage.Linked; +import org.bukkit.entity.TNTPrimed; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.TNTPrimeEvent; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.entity.EntitySpawnEvent; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +@Linked +public class Recorder { + private final Map activeTraces = new HashMap<>(); + private final Map> trackedTNT = new HashMap<>(); + + /** Starts a recording at the given region + * + * @param region region to be recorded + */ + public void startRecording(Region region){ + Trace trace = new Trace(region); + activeTraces.put(region, trace); + BauSystem.TRACES.add(trace); + } + + /** Stops the recording at the given region + * + * @param region region to stop recording + */ + public void stopRecording(Region region){ + activeTraces.remove(region); + } + + /** Internal methode to record all tracked TNT Entities + * + */ + private void record(){ + + } + + /** Eventhandler for TNTs beeing spawn. + * Registers newly spawn to be traced if reqired + * @param event + */ + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void onTNTPrimed(EntitySpawnEvent event){ + + } + + /** Event for TNTs exploding + * Unregisters TNTs from beeing traced on explode + * @param event + */ + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void onTNTExplode(EntityExplodeEvent event){ + + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TNTRecord.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TNTRecord.java new file mode 100644 index 00000000..01b8642a --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TNTRecord.java @@ -0,0 +1,23 @@ +/* + * 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.tracer2; + +public class TNTRecord { +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java new file mode 100644 index 00000000..fc32864c --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java @@ -0,0 +1,35 @@ +/* + * 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.tracer2; + +import de.steamwar.bausystem.region.Region; + +import java.util.HashSet; +import java.util.Set; + +public class Trace { + private final Region region; + private final Set records = new HashSet<>(); + + public Trace (Region region){ + this.region = region; + } + +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceCommand.java new file mode 100644 index 00000000..1fdfaf2f --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceCommand.java @@ -0,0 +1,23 @@ +/* + * 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.tracer2; + +public class TraceCommand { +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java new file mode 100644 index 00000000..bcce47be --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java @@ -0,0 +1,56 @@ +/* + * 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.tracer2; + +import java.util.HashMap; +import java.util.Map; + +public class TraceManager { + private final Map traces = new HashMap<>(); + private int currOpenId = 0; + + /** Adds a new trace to the global record + * + * @param trace Trace to be added + * @return id of the newly added trace + */ + public int add(Trace trace){ + int id = currOpenId; + traces.put(id, trace); + currOpenId++; + return id; + } + + /** Removes the trace with the given id + * + * @param id Id of the trace to be removed + */ + public void remove(int id){ + traces.remove(id); + } + + /** Clears all traces + * + */ + public void clear(){ + traces.clear(); + currOpenId = 1; + } +} -- 2.39.5 From b8867451136f6d2dabd131a3214bb7a571c204e0 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Mon, 6 Nov 2023 00:45:32 +0100 Subject: [PATCH 003/111] Finished data class for a tnt record --- .../bausystem/features/tracer2/Recorder.java | 12 +++++ .../bausystem/features/tracer2/TNTRecord.java | 44 +++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java index fa00cab0..520b1234 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java @@ -36,9 +36,21 @@ import java.util.Set; @Linked public class Recorder { + /** + * Map for all traces beeing activly recorded + */ private final Map activeTraces = new HashMap<>(); + + /** + * Map for all tnts being traced, by region + */ private final Map> trackedTNT = new HashMap<>(); + /** + * Maps a tracked tnt entity to the last record taken of it + */ + private final Map lastRecordMap = new HashMap<>(); + /** Starts a recording at the given region * * @param region region to be recorded diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TNTRecord.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TNTRecord.java index 01b8642a..84adc3de 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TNTRecord.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TNTRecord.java @@ -19,5 +19,49 @@ package de.steamwar.bausystem.features.tracer2; +import lombok.Getter; +import org.bukkit.Location; +import org.bukkit.entity.TNTPrimed; +import org.bukkit.util.Vector; + +@Getter public class TNTRecord { + /** + * Whether this is a record of a tnt explosion or an entity + */ + private final boolean explosion; + + /** + * Tick offset, from this record being taken to the start of the trace + */ + private final int ticksSinceStart; + + /** + * Fuse ticks of the recorded tnt (0 if this is an explosion) + */ + private final int fuse; + + /** + * Location of the recorded tnt + */ + private final Location location; + + /** + * Velocity of the recorded tnt + */ + private final Vector velocity; + + /** + * Reference to the last record having been taken of the tnt represented by this record + */ + private final TNTRecord previous; + + public TNTRecord(TNTPrimed tnt, boolean explosion, int ticksSinceStart, TNTRecord previous){ + this.explosion = explosion; + this.ticksSinceStart = ticksSinceStart; + fuse = tnt.getFuseTicks(); + location = tnt.getLocation(); + velocity = tnt.getVelocity(); + this.previous = previous; + } } -- 2.39.5 From 32fb859764725cf042c35bac599893bb24e25cfa Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Mon, 6 Nov 2023 00:56:02 +0100 Subject: [PATCH 004/111] Finished data part of Trace class --- .../steamwar/bausystem/features/tracer2/Trace.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java index fc32864c..aec31127 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java @@ -25,11 +25,25 @@ import java.util.HashSet; import java.util.Set; public class Trace { + /** + * Region this trace has been recorded in + */ private final Region region; + + /** + * Records of TNTs, making up the trace + */ private final Set records = new HashSet<>(); public Trace (Region region){ this.region = region; } + /** Methode to add a record to the trace + * + * @param record record to add + */ + protected void add (TNTRecord record){ + records.add(record); + } } -- 2.39.5 From 84150aadd2ee675e8c0a6a736d806d3c9ab1e23f Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Mon, 6 Nov 2023 01:20:59 +0100 Subject: [PATCH 005/111] Added getters to TraceManager --- .../bausystem/features/tracer2/Trace.java | 2 + .../features/tracer2/TraceManager.java | 44 +++++++++++++++++-- 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java index aec31127..69bda8ec 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java @@ -20,6 +20,7 @@ package de.steamwar.bausystem.features.tracer2; import de.steamwar.bausystem.region.Region; +import lombok.Getter; import java.util.HashSet; import java.util.Set; @@ -28,6 +29,7 @@ public class Trace { /** * Region this trace has been recorded in */ + @Getter private final Region region; /** diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java index bcce47be..47f8778d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java @@ -19,11 +19,20 @@ package de.steamwar.bausystem.features.tracer2; -import java.util.HashMap; -import java.util.Map; +import de.steamwar.bausystem.region.Region; + +import java.util.*; +import java.util.stream.Collectors; public class TraceManager { + /** + * Map of all current traces + */ private final Map traces = new HashMap<>(); + + /** + * Utility variable to keep track of the next open trace id + */ private int currOpenId = 0; /** Adds a new trace to the global record @@ -31,7 +40,7 @@ public class TraceManager { * @param trace Trace to be added * @return id of the newly added trace */ - public int add(Trace trace){ + protected int add(Trace trace){ int id = currOpenId; traces.put(id, trace); currOpenId++; @@ -53,4 +62,33 @@ public class TraceManager { traces.clear(); currOpenId = 1; } + + /** Methode to get all traces in a certain region + * + * @param region Region to look for traces in + * @return All traces recorded in the given Region + */ + public Set get(Region region){ + return traces.values() + .stream() + .filter((Trace trace) -> trace.getRegion() == region) + .collect(Collectors.toSet()); + } + + /** Methode to get the trace with specific id + * + * @param id id of the trace + * @return the trace with given id or null if no trace with id is found + */ + public Trace get(int id){ + return traces.getOrDefault(id, null); + } + + /** Methode to get all traces + * + * @return fresh set of all current traces + */ + public Set getAll(){ + return new HashSet<>(traces.values()); + } } -- 2.39.5 From 979428d49363780d67b8bc50178f17499161db19 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Mon, 6 Nov 2023 02:05:17 +0100 Subject: [PATCH 006/111] Added methods to record tnt to Recorder --- .../bausystem/features/tracer2/Recorder.java | 46 +++++++++++++++---- .../bausystem/features/tracer2/TNTRecord.java | 4 +- .../bausystem/features/tracer2/Trace.java | 7 +++ 3 files changed, 47 insertions(+), 10 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java index 520b1234..45f697a6 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java @@ -20,22 +20,21 @@ package de.steamwar.bausystem.features.tracer2; import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.features.tpslimit.TPSUtils; import de.steamwar.bausystem.region.Region; import de.steamwar.linkage.Linked; import org.bukkit.entity.TNTPrimed; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; import org.bukkit.event.block.TNTPrimeEvent; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntitySpawnEvent; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; +import java.util.*; @Linked -public class Recorder { +public class Recorder implements Listener { /** * Map for all traces beeing activly recorded */ @@ -67,22 +66,50 @@ public class Recorder { */ public void stopRecording(Region region){ activeTraces.remove(region); + for(TNTPrimed tnt : trackedTNT.getOrDefault(region, Collections.emptySet())) lastRecordMap.remove(tnt); + trackedTNT.put(region, new HashSet<>()); } /** Internal methode to record all tracked TNT Entities * */ private void record(){ + for(Region region : activeTraces.keySet()){ + Trace trace = activeTraces.get(region); + for(TNTPrimed tnt : trackedTNT.getOrDefault(region, Collections.emptySet())){ + TNTRecord record = new TNTRecord(tnt, false, TPSUtils.currentTick.get() - trace.getStartTime(), lastRecordMap.getOrDefault(tnt, null)); + lastRecordMap.put(tnt, record); + trace.add(record); + } + } + } + /** Internal methode to record exploded tnt + * + * @param tntPrimed tnt exploding + */ + private void record(TNTPrimed tntPrimed){ + Region region = Region.getRegion(tntPrimed.getLocation()); + Trace trace = activeTraces.get(region); + + TNTRecord record = new TNTRecord(tntPrimed, true, TPSUtils.currentTick.get() - trace.getStartTime(), lastRecordMap.getOrDefault(tntPrimed, null)); + trace.add(record); } /** Eventhandler for TNTs beeing spawn. - * Registers newly spawn to be traced if reqired + * Registers newly spawned TNT to be traced if reqired * @param event */ @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) - public void onTNTPrimed(EntitySpawnEvent event){ + public void onTNTSpawn(EntitySpawnEvent event){ + if(!(event.getEntity() instanceof TNTPrimed)) return; + Region region = Region.getRegion(event.getLocation()); + if(activeTraces.keySet().contains(region)){ + //Check whether set for tracking already exists. Creating it if necessary + if(!trackedTNT.keySet().contains(region)) trackedTNT.put(region, new HashSet<>()); + trackedTNT.get(region).add((TNTPrimed) event.getEntity()); + } } /** Event for TNTs exploding @@ -91,6 +118,9 @@ public class Recorder { */ @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onTNTExplode(EntityExplodeEvent event){ - + if(!(event.getEntity() instanceof TNTPrimed)) return; + Region region = Region.getRegion(event.getLocation()); + trackedTNT.get(region).remove((TNTPrimed) event.getEntity()); + record((TNTPrimed) event.getEntity()); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TNTRecord.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TNTRecord.java index 84adc3de..32f29c7f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TNTRecord.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TNTRecord.java @@ -34,7 +34,7 @@ public class TNTRecord { /** * Tick offset, from this record being taken to the start of the trace */ - private final int ticksSinceStart; + private final long ticksSinceStart; /** * Fuse ticks of the recorded tnt (0 if this is an explosion) @@ -56,7 +56,7 @@ public class TNTRecord { */ private final TNTRecord previous; - public TNTRecord(TNTPrimed tnt, boolean explosion, int ticksSinceStart, TNTRecord previous){ + public TNTRecord(TNTPrimed tnt, boolean explosion, long ticksSinceStart, TNTRecord previous){ this.explosion = explosion; this.ticksSinceStart = ticksSinceStart; fuse = tnt.getFuseTicks(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java index 69bda8ec..a821b473 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java @@ -19,6 +19,7 @@ package de.steamwar.bausystem.features.tracer2; +import de.steamwar.bausystem.features.tpslimit.TPSUtils; import de.steamwar.bausystem.region.Region; import lombok.Getter; @@ -32,6 +33,12 @@ public class Trace { @Getter private final Region region; + /** + * Tick the recording started at + */ + @Getter + private final long startTime = TPSUtils.currentTick.get(); + /** * Records of TNTs, making up the trace */ -- 2.39.5 From b58e418ea4e54b255a51f5e15136cc94e52a8565 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Fri, 10 Nov 2023 15:49:12 +0100 Subject: [PATCH 007/111] Changed Data Structure for TNTRecords and TNT tracking, to record update order properly --- .../bausystem/features/tracer2/Recorder.java | 18 ++++++++++++------ .../bausystem/features/tracer2/Trace.java | 4 +++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java index 45f697a6..3fcd4998 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java @@ -43,13 +43,19 @@ public class Recorder implements Listener { /** * Map for all tnts being traced, by region */ - private final Map> trackedTNT = new HashMap<>(); + private final Map> trackedTNT = new HashMap<>(); /** * Maps a tracked tnt entity to the last record taken of it */ private final Map lastRecordMap = new HashMap<>(); + public Recorder(){ + BauSystem.runTaskTimer(BauSystem.getInstance(), () ->{ + record(); + }, 0, 1); + } + /** Starts a recording at the given region * * @param region region to be recorded @@ -66,8 +72,8 @@ public class Recorder implements Listener { */ public void stopRecording(Region region){ activeTraces.remove(region); - for(TNTPrimed tnt : trackedTNT.getOrDefault(region, Collections.emptySet())) lastRecordMap.remove(tnt); - trackedTNT.put(region, new HashSet<>()); + for(TNTPrimed tnt : trackedTNT.getOrDefault(region, Collections.emptyList())) lastRecordMap.remove(tnt); + trackedTNT.put(region, new ArrayList<>()); } /** Internal methode to record all tracked TNT Entities @@ -76,7 +82,7 @@ public class Recorder implements Listener { private void record(){ for(Region region : activeTraces.keySet()){ Trace trace = activeTraces.get(region); - for(TNTPrimed tnt : trackedTNT.getOrDefault(region, Collections.emptySet())){ + for(TNTPrimed tnt : trackedTNT.getOrDefault(region, Collections.emptyList())){ TNTRecord record = new TNTRecord(tnt, false, TPSUtils.currentTick.get() - trace.getStartTime(), lastRecordMap.getOrDefault(tnt, null)); lastRecordMap.put(tnt, record); trace.add(record); @@ -104,9 +110,9 @@ public class Recorder implements Listener { public void onTNTSpawn(EntitySpawnEvent event){ if(!(event.getEntity() instanceof TNTPrimed)) return; Region region = Region.getRegion(event.getLocation()); - if(activeTraces.keySet().contains(region)){ + if(activeTraces.containsKey(region)){ //Check whether set for tracking already exists. Creating it if necessary - if(!trackedTNT.keySet().contains(region)) trackedTNT.put(region, new HashSet<>()); + if(!trackedTNT.containsKey(region)) trackedTNT.put(region, new ArrayList<>()); trackedTNT.get(region).add((TNTPrimed) event.getEntity()); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java index a821b473..4301c051 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java @@ -23,7 +23,9 @@ import de.steamwar.bausystem.features.tpslimit.TPSUtils; import de.steamwar.bausystem.region.Region; import lombok.Getter; +import java.util.ArrayList; import java.util.HashSet; +import java.util.List; import java.util.Set; public class Trace { @@ -42,7 +44,7 @@ public class Trace { /** * Records of TNTs, making up the trace */ - private final Set records = new HashSet<>(); + private final List records = new ArrayList<>(); public Trace (Region region){ this.region = region; -- 2.39.5 From f94aeeda0191fe458b08e53209ac861411eb23d4 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Sun, 26 Nov 2023 17:00:02 +0100 Subject: [PATCH 008/111] Added next link in tnt record --- .../bausystem/features/tracer2/Recorder.java | 29 ++++++++++++------- .../bausystem/features/tracer2/TNTRecord.java | 14 +++++++++ .../features/tracer2/TraceCommand.java | 17 ++++++++++- .../features/tracer2/TraceManager.java | 12 +++++++- 4 files changed, 60 insertions(+), 12 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java index 3fcd4998..387d753b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java @@ -45,6 +45,11 @@ public class Recorder implements Listener { */ private final Map> trackedTNT = new HashMap<>(); + /** Map from TNT to Region the TNT spawned in + * + */ + private final Map tntSpawnRegion = new HashMap<>(); + /** * Maps a tracked tnt entity to the last record taken of it */ @@ -83,9 +88,7 @@ public class Recorder implements Listener { for(Region region : activeTraces.keySet()){ Trace trace = activeTraces.get(region); for(TNTPrimed tnt : trackedTNT.getOrDefault(region, Collections.emptyList())){ - TNTRecord record = new TNTRecord(tnt, false, TPSUtils.currentTick.get() - trace.getStartTime(), lastRecordMap.getOrDefault(tnt, null)); - lastRecordMap.put(tnt, record); - trace.add(record); + record(tnt, trace); } } } @@ -93,16 +96,18 @@ public class Recorder implements Listener { /** Internal methode to record exploded tnt * * @param tntPrimed tnt exploding + * @param trace trace to record the tnt for */ - private void record(TNTPrimed tntPrimed){ - Region region = Region.getRegion(tntPrimed.getLocation()); - Trace trace = activeTraces.get(region); + private void record(TNTPrimed tntPrimed, Trace trace){ + TNTRecord lastRecord = lastRecordMap.getOrDefault(tntPrimed, null); - TNTRecord record = new TNTRecord(tntPrimed, true, TPSUtils.currentTick.get() - trace.getStartTime(), lastRecordMap.getOrDefault(tntPrimed, null)); + TNTRecord record = new TNTRecord(tntPrimed, tntPrimed.getFuseTicks() == 0, TPSUtils.currentTick.get() - trace.getStartTime(), lastRecord); + if(lastRecord != null) lastRecord.setNext(record); + lastRecordMap.put(tntPrimed, record); trace.add(record); } - /** Eventhandler for TNTs beeing spawn. + /** Event for TNTs beeing spawn. * Registers newly spawned TNT to be traced if reqired * @param event */ @@ -115,6 +120,7 @@ public class Recorder implements Listener { if(!trackedTNT.containsKey(region)) trackedTNT.put(region, new ArrayList<>()); trackedTNT.get(region).add((TNTPrimed) event.getEntity()); + tntSpawnRegion.put((TNTPrimed) event.getEntity(), region); } } @@ -125,8 +131,11 @@ public class Recorder implements Listener { @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onTNTExplode(EntityExplodeEvent event){ if(!(event.getEntity() instanceof TNTPrimed)) return; - Region region = Region.getRegion(event.getLocation()); + Region region = tntSpawnRegion.getOrDefault((TNTPrimed) event.getEntity(), null); + if(region == null) return; trackedTNT.get(region).remove((TNTPrimed) event.getEntity()); - record((TNTPrimed) event.getEntity()); + tntSpawnRegion.remove((TNTPrimed) event.getEntity()); + + record((TNTPrimed) event.getEntity(), activeTraces.get(region)); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TNTRecord.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TNTRecord.java index 32f29c7f..03bb4d71 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TNTRecord.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TNTRecord.java @@ -56,6 +56,11 @@ public class TNTRecord { */ private final TNTRecord previous; + /** + * Reference to the next record of the tnt represented by this record + */ + private TNTRecord next; + public TNTRecord(TNTPrimed tnt, boolean explosion, long ticksSinceStart, TNTRecord previous){ this.explosion = explosion; this.ticksSinceStart = ticksSinceStart; @@ -64,4 +69,13 @@ public class TNTRecord { velocity = tnt.getVelocity(); this.previous = previous; } + + + /** + * One call only function to set next + * @param next + */ + protected void setNext(TNTRecord next){ + if(this.next == null) this.next = next; + } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceCommand.java index 1fdfaf2f..ab82eb3e 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceCommand.java @@ -19,5 +19,20 @@ package de.steamwar.bausystem.features.tracer2; -public class TraceCommand { +import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.LinkedInstance; +import org.bukkit.entity.Player; + +@Linked +public class TraceCommand extends SWCommand { + + @LinkedInstance + public Recorder recorder; + public TraceCommand(){super("tracetest");} + + @Register + public void test(@Validator Player player){ + + } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java index 47f8778d..5d77ebba 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java @@ -20,11 +20,19 @@ package de.steamwar.bausystem.features.tracer2; import de.steamwar.bausystem.region.Region; +import de.steamwar.entity.REntityServer; +import de.steamwar.linkage.Linked; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; import java.util.*; import java.util.stream.Collectors; -public class TraceManager { +@Linked +public class TraceManager implements Listener { /** * Map of all current traces */ @@ -35,6 +43,8 @@ public class TraceManager { */ private int currOpenId = 0; + + /** Adds a new trace to the global record * * @param trace Trace to be added -- 2.39.5 From 2bf3cfbb1d0cafaa84a6ee771d5f849ba8bdaaaa Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Tue, 19 Dec 2023 16:17:14 +0100 Subject: [PATCH 009/111] Reimplemented trace rendering --- .../src/de/steamwar/bausystem/BauSystem.java | 5 -- .../bausystem/features/tracer2/Recorder.java | 28 ++++++- .../bausystem/features/tracer2/Trace.java | 76 +++++++++++++++++-- .../features/tracer2/TraceEntity.java | 42 ++++++++++ .../features/tracer2/TraceManager.java | 16 ++-- .../bausystem/features/tracer2/ViewFlag.java | 53 +++++++++++++ 6 files changed, 200 insertions(+), 20 deletions(-) create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceEntity.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/ViewFlag.java diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java index 5bf3fb98..218ae32f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java @@ -51,11 +51,6 @@ public class BauSystem extends JavaPlugin implements Listener { // This should be treated as final! public static Message MESSAGE; - /* - * Plugin wide availeble data - */ - public static final TraceManager TRACES = new TraceManager(); - @Getter private static BauSystem instance; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java index 387d753b..c53e6610 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java @@ -23,6 +23,7 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.tpslimit.TPSUtils; import de.steamwar.bausystem.region.Region; import de.steamwar.linkage.Linked; +import de.steamwar.linkage.LinkedInstance; import org.bukkit.entity.TNTPrimed; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -35,6 +36,13 @@ import java.util.*; @Linked public class Recorder implements Listener { + + /** + * Linked instance of TraceManager + */ + @LinkedInstance + TraceManager manager; + /** * Map for all traces beeing activly recorded */ @@ -68,7 +76,7 @@ public class Recorder implements Listener { public void startRecording(Region region){ Trace trace = new Trace(region); activeTraces.put(region, trace); - BauSystem.TRACES.add(trace); + manager.add(trace); } /** Stops the recording at the given region @@ -76,9 +84,16 @@ public class Recorder implements Listener { * @param region region to stop recording */ public void stopRecording(Region region){ + Trace trace = activeTraces.get(region); + trace.setRecords(Collections.unmodifiableList(trace.getRecords())); + activeTraces.remove(region); - for(TNTPrimed tnt : trackedTNT.getOrDefault(region, Collections.emptyList())) lastRecordMap.remove(tnt); + for(TNTPrimed tnt : trackedTNT.getOrDefault(region, Collections.emptyList())) + lastRecordMap.remove(tnt); + trackedTNT.put(region, new ArrayList<>()); + + } /** Internal methode to record all tracked TNT Entities @@ -102,7 +117,9 @@ public class Recorder implements Listener { TNTRecord lastRecord = lastRecordMap.getOrDefault(tntPrimed, null); TNTRecord record = new TNTRecord(tntPrimed, tntPrimed.getFuseTicks() == 0, TPSUtils.currentTick.get() - trace.getStartTime(), lastRecord); - if(lastRecord != null) lastRecord.setNext(record); + if(lastRecord != null) + lastRecord.setNext(record); + lastRecordMap.put(tntPrimed, record); trace.add(record); } @@ -114,10 +131,12 @@ public class Recorder implements Listener { @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onTNTSpawn(EntitySpawnEvent event){ if(!(event.getEntity() instanceof TNTPrimed)) return; + Region region = Region.getRegion(event.getLocation()); if(activeTraces.containsKey(region)){ //Check whether set for tracking already exists. Creating it if necessary - if(!trackedTNT.containsKey(region)) trackedTNT.put(region, new ArrayList<>()); + if(!trackedTNT.containsKey(region)) + trackedTNT.put(region, new ArrayList<>()); trackedTNT.get(region).add((TNTPrimed) event.getEntity()); tntSpawnRegion.put((TNTPrimed) event.getEntity(), region); @@ -131,6 +150,7 @@ public class Recorder implements Listener { @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onTNTExplode(EntityExplodeEvent event){ if(!(event.getEntity() instanceof TNTPrimed)) return; + Region region = tntSpawnRegion.getOrDefault((TNTPrimed) event.getEntity(), null); if(region == null) return; trackedTNT.get(region).remove((TNTPrimed) event.getEntity()); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java index 4301c051..4aa4fc7b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java @@ -21,12 +21,12 @@ package de.steamwar.bausystem.features.tracer2; import de.steamwar.bausystem.features.tpslimit.TPSUtils; import de.steamwar.bausystem.region.Region; +import de.steamwar.entity.REntityServer; import lombok.Getter; +import org.bukkit.Location; +import org.bukkit.entity.Player; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import java.util.*; public class Trace { /** @@ -44,7 +44,13 @@ public class Trace { /** * Records of TNTs, making up the trace */ - private final List records = new ArrayList<>(); + @Getter + private List records = new ArrayList<>(); + + /** + * A map of players -> REntityServers for rendering traces to a player + */ + private Map serverMap = new HashMap<>(); public Trace (Region region){ this.region = region; @@ -57,4 +63,64 @@ public class Trace { protected void add (TNTRecord record){ records.add(record); } + + /** Internal methode to make records immutable after recording is finished + * + * @param records immutable records list + */ + protected void setRecords(List records){ + this.records = records; + } + + + /** Renders this traces + * + * @param player The player the trace is rendered to + * @param flags Flags modefieing the rendering + */ + public void render(Player player, Collection flags){ + List workingRecords = records; + + //Apply filters + for(ViewFlag flag : flags) + workingRecords = flag.filter.apply(workingRecords); + + //Bundle records at unique positions + List> bundles = bundleRecords(workingRecords); + + //Render bundled records + REntityServer server = new REntityServer(); + serverMap.put(player, server); + List entities = new LinkedList<>(); + + for(List bundle : bundles) + entities.add(new TraceEntity(server, bundle.get(0).getLocation(), bundle.get(0).isExplosion(), bundle)); + + //Apply modifiers + for(ViewFlag flag : flags) + flag.modify.accept(server, entities); + } + + /** Bundles the passed TNTRecords based on whether they are at the same location + * + * @param records The TNTRecords that are supposed to be bundled + * @return A list of bundles + */ + private List> bundleRecords(List records){ + Map > entitiesRecords = new HashMap<>(); + + for(TNTRecord record : records) { + if(entitiesRecords.containsKey(record.getLocation())) + entitiesRecords.get(record.getLocation()); + else{ + List entityRecords = new ArrayList<>(); + entityRecords.add(record); + entitiesRecords.put(record.getLocation(), entityRecords); + } + } + + return new LinkedList<>(entitiesRecords.values()); + } + + } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceEntity.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceEntity.java new file mode 100644 index 00000000..0507c4f9 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceEntity.java @@ -0,0 +1,42 @@ +/* + * 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.tracer2; + +import de.steamwar.entity.REntityServer; +import de.steamwar.entity.RFallingBlockEntity; +import lombok.Getter; +import org.bukkit.Location; +import org.bukkit.Material; + +import java.util.List; + +public class TraceEntity extends RFallingBlockEntity { + + /** + * The records represented by this REntity + */ + @Getter + private final List records; + + public TraceEntity(REntityServer server, Location location, boolean isExplosion, List records) { + super(server, location, isExplosion ? Material.RED_STAINED_GLASS : Material.TNT); + this.records = records; + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java index 5d77ebba..1df3bdba 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java @@ -22,11 +22,9 @@ package de.steamwar.bausystem.features.tracer2; import de.steamwar.bausystem.region.Region; import de.steamwar.entity.REntityServer; import de.steamwar.linkage.Linked; +import org.bukkit.Location; import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; import java.util.*; import java.util.stream.Collectors; @@ -43,8 +41,6 @@ public class TraceManager implements Listener { */ private int currOpenId = 0; - - /** Adds a new trace to the global record * * @param trace Trace to be added @@ -70,7 +66,7 @@ public class TraceManager implements Listener { */ public void clear(){ traces.clear(); - currOpenId = 1; + currOpenId = 0; } /** Methode to get all traces in a certain region @@ -101,4 +97,12 @@ public class TraceManager implements Listener { public Set getAll(){ return new HashSet<>(traces.values()); } + + /** Renders the given trace records + * + * @param player The player the trace is rendered to + * @param trace the trace to render + * @param flags Flags modefieing the rendering + */ + } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/ViewFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/ViewFlag.java new file mode 100644 index 00000000..efc1979d --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/ViewFlag.java @@ -0,0 +1,53 @@ +/* + * 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.tracer2; + +import de.steamwar.entity.REntityServer; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.BiConsumer; +import java.util.function.Consumer; +import java.util.function.UnaryOperator; + +public enum ViewFlag { + EXPLOSION((List records) ->{ + List ret = new ArrayList<>(); + for(TNTRecord record : records) + if(record.isExplosion()) + ret.add(record); + return ret; + }, (REntityServer server , List entities) -> {}); + + /** + * The filtering part of the flag + */ + public final UnaryOperator> filter; + + /** + * The modifieng part of the flag + */ + public final BiConsumer> modify; + + ViewFlag(UnaryOperator> filter, BiConsumer> modify) { + this.filter = filter; + this.modify = modify; + } +} -- 2.39.5 From 41ed83dfe0eb1956ff8f674c8ec8d8c6e2971af8 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 22 Oct 2023 12:20:29 +0200 Subject: [PATCH 010/111] Add AntiCursorReCentering --- .../features/world/AntiCursorReCentering.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/world/AntiCursorReCentering.java diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/world/AntiCursorReCentering.java b/BauSystem_Main/src/de/steamwar/bausystem/features/world/AntiCursorReCentering.java new file mode 100644 index 00000000..edf23bba --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/AntiCursorReCentering.java @@ -0,0 +1,36 @@ +/* + * 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.world; + +import com.comphenix.tinyprotocol.Reflection; +import com.comphenix.tinyprotocol.TinyProtocol; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.api.Enable; + +@Linked +public class AntiCursorReCentering implements Enable { + + @Override + public void enable() { + // Fix GUI Closing causing a recentering of the Cursor + Class clazz = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutCloseWindow"); + TinyProtocol.instance.addFilter(clazz, (player, object) -> null); + } +} -- 2.39.5 From d1ff80b9dc28748135cb4409c5db178b1ee9172f Mon Sep 17 00:00:00 2001 From: yoyosource Date: Tue, 24 Oct 2023 18:12:03 +0200 Subject: [PATCH 011/111] Hotfix AntiCursorReCentering --- .../features/world/AntiCursorReCentering.java | 34 +++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/world/AntiCursorReCentering.java b/BauSystem_Main/src/de/steamwar/bausystem/features/world/AntiCursorReCentering.java index edf23bba..7cf5c4c7 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/world/AntiCursorReCentering.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/AntiCursorReCentering.java @@ -21,16 +21,44 @@ package de.steamwar.bausystem.features.world; import com.comphenix.tinyprotocol.Reflection; import com.comphenix.tinyprotocol.TinyProtocol; +import de.steamwar.bausystem.BauSystem; import de.steamwar.linkage.Linked; import de.steamwar.linkage.api.Enable; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; @Linked public class AntiCursorReCentering implements Enable { + private final Set CLOSE_PACKETS = new HashSet<>(); + private final Set CLOSE_NOW = new HashSet<>(); + @Override public void enable() { - // Fix GUI Closing causing a recentering of the Cursor - Class clazz = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutCloseWindow"); - TinyProtocol.instance.addFilter(clazz, (player, object) -> null); + Class closeWindow = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutCloseWindow"); + TinyProtocol.instance.addFilter(closeWindow, (player, object) -> { + if (CLOSE_NOW.remove(player)) { + return object; + } + CLOSE_PACKETS.add(player); + Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> { + if (CLOSE_PACKETS.remove(player)) { + CLOSE_NOW.add(player); + TinyProtocol.instance.sendPacket(player, object); + } + }, 0); + return null; + }); + + Class openWindow = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutOpenWindow"); + TinyProtocol.instance.addFilter(openWindow, (player, object) -> { + CLOSE_PACKETS.remove(player); + return object; + }); } } -- 2.39.5 From f2a957c88fcfecce6dbdbf9cb455a00f2ed1e7f6 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Tue, 24 Oct 2023 18:23:12 +0200 Subject: [PATCH 012/111] Hotfix AntiCursorReCentering --- .../features/world/AntiCursorReCentering.java | 22 +++---------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/world/AntiCursorReCentering.java b/BauSystem_Main/src/de/steamwar/bausystem/features/world/AntiCursorReCentering.java index 7cf5c4c7..ff04aa5f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/world/AntiCursorReCentering.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/AntiCursorReCentering.java @@ -25,40 +25,24 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.linkage.Linked; import de.steamwar.linkage.api.Enable; import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; +import org.bukkit.event.inventory.InventoryType; @Linked public class AntiCursorReCentering implements Enable { - private final Set CLOSE_PACKETS = new HashSet<>(); - private final Set CLOSE_NOW = new HashSet<>(); - @Override public void enable() { Class closeWindow = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutCloseWindow"); TinyProtocol.instance.addFilter(closeWindow, (player, object) -> { - if (CLOSE_NOW.remove(player)) { + if (player.getOpenInventory().getTopInventory().getType() == InventoryType.CRAFTING) { return object; } - CLOSE_PACKETS.add(player); Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> { - if (CLOSE_PACKETS.remove(player)) { - CLOSE_NOW.add(player); + if (player.getOpenInventory().getTopInventory().getType() == InventoryType.CRAFTING) { TinyProtocol.instance.sendPacket(player, object); } }, 0); return null; }); - - Class openWindow = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutOpenWindow"); - TinyProtocol.instance.addFilter(openWindow, (player, object) -> { - CLOSE_PACKETS.remove(player); - return object; - }); } } -- 2.39.5 From 67c9f66d139b7b742b221cbf1d733cb8a00b7bfa Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 25 Oct 2023 14:35:15 +0200 Subject: [PATCH 013/111] Fix AutostartListener for specific GameMode configs --- .../features/autostart/AutostartListener.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/autostart/AutostartListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/autostart/AutostartListener.java index 232962a1..7da0fea1 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/autostart/AutostartListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/autostart/AutostartListener.java @@ -31,6 +31,8 @@ import de.steamwar.linkage.Linked; import lombok.Getter; import org.bukkit.Material; import org.bukkit.block.data.type.Chest; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -39,11 +41,9 @@ import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; +import java.io.File; import java.text.SimpleDateFormat; -import java.util.Arrays; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; +import java.util.*; @Linked public class AutostartListener implements Listener { @@ -117,15 +117,24 @@ public class AutostartListener implements Listener { if (regionStartTime.isEmpty()) { return; } + event.blockList().forEach(block -> { Region region = Region.getRegion(block.getLocation()); if (!regionStartTime.containsKey(region)) return; if (!region.hasType(RegionType.TESTBLOCK)) return; if (!region.inRegion(block.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.EXTENSION)) return; long tickDiff = TPSUtils.currentRealTick.get() - regionStartTime.remove(region); + long preFightDurationInSeconds = getPreFightDurationInSeconds(region); RegionUtils.message(region, "AUTOSTART_MESSAGE_RESULT1", tickDiff); - RegionUtils.message(region, "AUTOSTART_MESSAGE_RESULT2", 30, (600 - tickDiff)); + RegionUtils.message(region, "AUTOSTART_MESSAGE_RESULT2", preFightDurationInSeconds, ((preFightDurationInSeconds * 20) - tickDiff)); RegionUtils.message(region, "AUTOSTART_MESSAGE_RESULT3"); }); } + + private int getPreFightDurationInSeconds(Region region) { + File file = region.gameModeConfig(); + if (file == null) return 30; + FileConfiguration config = YamlConfiguration.loadConfiguration(file); + return config.getInt("Times.PreFightDuration", 30); + } } -- 2.39.5 From 85512be3a82d7f1f14d822a8147aa426abb8aef5 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Tue, 19 Dec 2023 16:22:34 +0100 Subject: [PATCH 014/111] Added methode to hide trail --- .../de/steamwar/bausystem/features/tracer2/Trace.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java index 4aa4fc7b..62806ce5 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java @@ -122,5 +122,14 @@ public class Trace { return new LinkedList<>(entitiesRecords.values()); } + /** Hides this trail for the given player + * + * @param player + */ + public void hide(Player player){ + REntityServer server = serverMap.get(player); + if(server == null) return; + server.close(); + } } -- 2.39.5 From beb49cdcd1637ec9a12fbfee99756150b2e2e842 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Sat, 23 Dec 2023 17:43:34 +0100 Subject: [PATCH 015/111] Added option for bundeling to trace rendering --- .../features/tracer2/BundleFilter.java | 63 +++++++++++++++++++ .../bausystem/features/tracer2/Recorder.java | 1 - .../bausystem/features/tracer2/Trace.java | 31 +++++---- .../features/tracer2/TraceCommand.java | 6 +- .../features/tracer2/TraceManager.java | 11 ---- 5 files changed, 86 insertions(+), 26 deletions(-) create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/BundleFilter.java diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/BundleFilter.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/BundleFilter.java new file mode 100644 index 00000000..409581bc --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/BundleFilter.java @@ -0,0 +1,63 @@ +/* + * 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.tracer2; + +import java.util.Optional; +import java.util.function.BiFunction; +import java.util.function.BiPredicate; + +public enum BundleFilter { + + + LOOSE((TNTRecord a, TNTRecord b) -> { + if(a.isExplosion() != b.isExplosion()) return Optional.of(false); + if(a.getLocation().distance(b.getLocation()) <= BundleFilter.pixelSize) return Optional.of(false); + if(a.getVelocity().distance(b.getVelocity()) <= BundleFilter.pixelSize) return Optional.of(false); + return Optional.of(true); + }), + + DEFAULT((TNTRecord a, TNTRecord b) -> { + if(a.isExplosion() != b.isExplosion()) return Optional.of(false); + if(a.getTicksSinceStart() != b.getTicksSinceStart()) return Optional.empty(); + if(a.getLocation().distance(b.getLocation()) <= BundleFilter.pixelSize) return Optional.of(false); + if(a.getVelocity().distance(b.getVelocity()) <= BundleFilter.pixelSize) return Optional.of(false); + return Optional.of(true); + }), + + STRICT((TNTRecord a, TNTRecord b) -> { + if(a.isExplosion() != b.isExplosion()) return Optional.of(false); + if(!a.getLocation().equals(b.getLocation())) return Optional.of(false); + if(!a.getVelocity().equals(b.getVelocity())) return Optional.of(false); + if(a.getTicksSinceStart() != b.getTicksSinceStart()) return Optional.empty(); + return Optional.of(true); + }), + + NONE((TNTRecord a, TNTRecord b) -> { + return Optional.empty(); + }); + + public BiFunction> apply; + + private static final double pixelSize = 0.0625; + + BundleFilter(BiFunction> apply){ + this.apply = apply; + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java index c53e6610..ff1d1607 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java @@ -28,7 +28,6 @@ import org.bukkit.entity.TNTPrimed; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; -import org.bukkit.event.block.TNTPrimeEvent; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntitySpawnEvent; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java index 62806ce5..a2d13402 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java @@ -78,7 +78,7 @@ public class Trace { * @param player The player the trace is rendered to * @param flags Flags modefieing the rendering */ - public void render(Player player, Collection flags){ + public void render(Player player, Collection flags, BundleFilter bundleFilter){ List workingRecords = records; //Apply filters @@ -86,7 +86,7 @@ public class Trace { workingRecords = flag.filter.apply(workingRecords); //Bundle records at unique positions - List> bundles = bundleRecords(workingRecords); + List> bundles = bundleRecords(workingRecords, bundleFilter); //Render bundled records REntityServer server = new REntityServer(); @@ -106,20 +106,27 @@ public class Trace { * @param records The TNTRecords that are supposed to be bundled * @return A list of bundles */ - private List> bundleRecords(List records){ - Map > entitiesRecords = new HashMap<>(); + private List> bundleRecords(List records, BundleFilter filter){ + ArrayList> bundles = new ArrayList<>(); + + recordsLoop : for(TNTRecord record : records) { + for(int i = bundles.size() - 1; i >= 0; i--){ + List bundle = bundles.get(i); + + Optional filterResult = filter.apply.apply(record, bundle.get(0)); + + if(filterResult.isPresent() && filterResult.get()) + bundle.add(record); + else{ + ArrayList newBundle = new ArrayList<>(); + newBundle.add(record); + continue recordsLoop; + } - for(TNTRecord record : records) { - if(entitiesRecords.containsKey(record.getLocation())) - entitiesRecords.get(record.getLocation()); - else{ - List entityRecords = new ArrayList<>(); - entityRecords.add(record); - entitiesRecords.put(record.getLocation(), entityRecords); } } - return new LinkedList<>(entitiesRecords.values()); + return bundles; } /** Hides this trail for the given player diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceCommand.java index ab82eb3e..bd70fb12 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceCommand.java @@ -19,6 +19,7 @@ package de.steamwar.bausystem.features.tracer2; +import de.steamwar.bausystem.region.Region; import de.steamwar.command.SWCommand; import de.steamwar.linkage.Linked; import de.steamwar.linkage.LinkedInstance; @@ -31,8 +32,9 @@ public class TraceCommand extends SWCommand { public Recorder recorder; public TraceCommand(){super("tracetest");} - @Register + @Register(value = "start") public void test(@Validator Player player){ - + Region region = Region.getRegion(player.getLocation()); + } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java index 1df3bdba..f7232e84 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java @@ -20,10 +20,7 @@ package de.steamwar.bausystem.features.tracer2; import de.steamwar.bausystem.region.Region; -import de.steamwar.entity.REntityServer; import de.steamwar.linkage.Linked; -import org.bukkit.Location; -import org.bukkit.entity.Player; import org.bukkit.event.Listener; import java.util.*; @@ -97,12 +94,4 @@ public class TraceManager implements Listener { public Set getAll(){ return new HashSet<>(traces.values()); } - - /** Renders the given trace records - * - * @param player The player the trace is rendered to - * @param trace the trace to render - * @param flags Flags modefieing the rendering - */ - } -- 2.39.5 From 5c96da9acd0ef54cb537b4e17dbd03e473c441bb Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Tue, 20 Feb 2024 23:11:58 +0100 Subject: [PATCH 016/111] Fixed bugs with trace rendering Added toString --- .../features/tracer2/BundleFilter.java | 1 - .../bausystem/features/tracer2/Recorder.java | 10 +++--- .../bausystem/features/tracer2/TNTRecord.java | 11 +++++++ .../bausystem/features/tracer2/Trace.java | 31 +++++++++++++++++-- .../features/tracer2/TraceCommand.java | 26 ++++++++++++++-- .../features/tracer2/TraceEntity.java | 1 + .../features/tracer2/TraceManager.java | 2 ++ 7 files changed, 70 insertions(+), 12 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/BundleFilter.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/BundleFilter.java index 409581bc..08117732 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/BundleFilter.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/BundleFilter.java @@ -21,7 +21,6 @@ package de.steamwar.bausystem.features.tracer2; import java.util.Optional; import java.util.function.BiFunction; -import java.util.function.BiPredicate; public enum BundleFilter { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java index ff1d1607..f001325d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java @@ -40,7 +40,7 @@ public class Recorder implements Listener { * Linked instance of TraceManager */ @LinkedInstance - TraceManager manager; + public TraceManager manager; /** * Map for all traces beeing activly recorded @@ -63,19 +63,17 @@ public class Recorder implements Listener { private final Map lastRecordMap = new HashMap<>(); public Recorder(){ - BauSystem.runTaskTimer(BauSystem.getInstance(), () ->{ - record(); - }, 0, 1); + BauSystem.runTaskTimer(BauSystem.getInstance(), this::record, 0, 1); } /** Starts a recording at the given region * * @param region region to be recorded */ - public void startRecording(Region region){ + public int startRecording(Region region){ Trace trace = new Trace(region); activeTraces.put(region, trace); - manager.add(trace); + return manager.add(trace); } /** Stops the recording at the given region diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TNTRecord.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TNTRecord.java index 03bb4d71..3392a0c6 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TNTRecord.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TNTRecord.java @@ -78,4 +78,15 @@ public class TNTRecord { protected void setNext(TNTRecord next){ if(this.next == null) this.next = next; } + + @Override + public String toString() { + return "TNTRecord{" + + "explosion=" + explosion + + ", ticksSinceStart=" + ticksSinceStart + + ", fuse=" + fuse + + ", location=" + location + + ", velocity=" + velocity + + '}'; + } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java index a2d13402..77757a8d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java @@ -50,7 +50,7 @@ public class Trace { /** * A map of players -> REntityServers for rendering traces to a player */ - private Map serverMap = new HashMap<>(); + private final Map serverMap = new HashMap<>(); public Trace (Region region){ this.region = region; @@ -72,13 +72,21 @@ public class Trace { this.records = records; } - + //TODO default options + //TODO Life rendering /** Renders this traces * * @param player The player the trace is rendered to * @param flags Flags modefieing the rendering */ public void render(Player player, Collection flags, BundleFilter bundleFilter){ + if(serverMap.containsKey(player)){ + REntityServer server = serverMap.get(player); + server.close(); + serverMap.remove(player); + } + + List workingRecords = records; //Apply filters @@ -91,6 +99,7 @@ public class Trace { //Render bundled records REntityServer server = new REntityServer(); serverMap.put(player, server); + server.addPlayer(player); List entities = new LinkedList<>(); for(List bundle : bundles) @@ -107,9 +116,15 @@ public class Trace { * @return A list of bundles */ private List> bundleRecords(List records, BundleFilter filter){ - ArrayList> bundles = new ArrayList<>(); + List> bundles = new ArrayList<>(); recordsLoop : for(TNTRecord record : records) { + if(bundles.isEmpty()){ + List firstBundle = new ArrayList<>(); + firstBundle.add(record); + bundles.add(firstBundle); + } + for(int i = bundles.size() - 1; i >= 0; i--){ List bundle = bundles.get(i); @@ -120,6 +135,7 @@ public class Trace { else{ ArrayList newBundle = new ArrayList<>(); newBundle.add(record); + bundles.add(newBundle); continue recordsLoop; } @@ -139,4 +155,13 @@ public class Trace { server.close(); } + + @Override + public String toString() { + return "Trace{" + + "region=" + region + + ", startTime=" + startTime + + ", records=" + records + + '}'; + } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceCommand.java index bd70fb12..d99ed495 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceCommand.java @@ -25,16 +25,38 @@ import de.steamwar.linkage.Linked; import de.steamwar.linkage.LinkedInstance; import org.bukkit.entity.Player; +import java.util.Collections; +import java.util.HashSet; + @Linked public class TraceCommand extends SWCommand { @LinkedInstance public Recorder recorder; + + int traceId = 0; public TraceCommand(){super("tracetest");} @Register(value = "start") - public void test(@Validator Player player){ + public void test(Player player){ Region region = Region.getRegion(player.getLocation()); - + + traceId = recorder.startRecording(region); + System.out.println(traceId); + } + + @Register(value = "stop") + public void test2(Player player){ + Region region = Region.getRegion(player.getLocation()); + recorder.stopRecording(region); + Trace trace = recorder.manager.get(traceId); + if(trace != null) + System.out.println(trace.getRecords()); + } + + @Register(value = "show") + public void test3(Player player){ + Trace trace = recorder.manager.get(traceId); + trace.render(player, Collections.emptyList(), BundleFilter.DEFAULT); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceEntity.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceEntity.java index 0507c4f9..75b33357 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceEntity.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceEntity.java @@ -37,6 +37,7 @@ public class TraceEntity extends RFallingBlockEntity { public TraceEntity(REntityServer server, Location location, boolean isExplosion, List records) { super(server, location, isExplosion ? Material.RED_STAINED_GLASS : Material.TNT); + setNoGravity(true); this.records = records; } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java index f7232e84..5ffc4314 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java @@ -28,6 +28,8 @@ import java.util.stream.Collectors; @Linked public class TraceManager implements Listener { + //TODO no null returns + /** * Map of all current traces */ -- 2.39.5 From 3a3c4819f9138ca2a939d02a61b332fea9714e0c Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Tue, 20 Feb 2024 23:22:34 +0100 Subject: [PATCH 017/111] Removed null returns --- .../steamwar/bausystem/features/tracer2/TraceManager.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java index 5ffc4314..51c8df5d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java @@ -85,8 +85,11 @@ public class TraceManager implements Listener { * @param id id of the trace * @return the trace with given id or null if no trace with id is found */ - public Trace get(int id){ - return traces.getOrDefault(id, null); + public Optional get(int id){ + Trace ret = traces.get(id); + if(traces.containsKey(id)) + return Optional.of(traces.get(id)); + return Optional.empty(); } /** Methode to get all traces -- 2.39.5 From f62d9e626b4fd45ebf07d4f432e4af655e607621 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Wed, 21 Feb 2024 13:34:25 +0100 Subject: [PATCH 018/111] Added live rendering --- .../bausystem/features/tracer2/Recorder.java | 1 + .../bausystem/features/tracer2/Trace.java | 63 ++++++++++++++++--- .../features/tracer2/TraceManager.java | 2 - 3 files changed, 56 insertions(+), 10 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java index f001325d..2f958334 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java @@ -102,6 +102,7 @@ public class Recorder implements Listener { for(TNTPrimed tnt : trackedTNT.getOrDefault(region, Collections.emptyList())){ record(tnt, trace); } + trace.comitAdd(); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java index 77757a8d..4b0f1811 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java @@ -47,21 +47,49 @@ public class Trace { @Getter private List records = new ArrayList<>(); + /** + * Records to be added + */ + private List newRecords = new ArrayList<>(); + /** * A map of players -> REntityServers for rendering traces to a player */ private final Map serverMap = new HashMap<>(); + /** + * A map saving the bundle filters for rendered traces, for life rendering + */ + private final Map bundleFilterMap = new HashMap<>(); + + /** + * A map saving the view flags for rendered traces, for life rendering + */ + private final Map> viewFlagMap = new HashMap<>(); + public Trace (Region region){ this.region = region; } - /** Methode to add a record to the trace + /** Methode to add a records to add staging * - * @param record record to add + * @param records records to add */ - protected void add (TNTRecord record){ - records.add(record); + protected void add (TNTRecord records){ + newRecords.add(records); + } + + protected void comitAdd(){ + records.addAll(newRecords); + + for(Player player: serverMap.keySet()){ + REntityServer server = serverMap.get(player); + BundleFilter bundleFilter = bundleFilterMap.get(player); + Collection viewFlags = viewFlagMap.get(player); + + render(server, newRecords, viewFlags, bundleFilter); + } + newRecords.clear(); } /** Internal methode to make records immutable after recording is finished @@ -73,19 +101,41 @@ public class Trace { } //TODO default options - //TODO Life rendering /** Renders this traces * * @param player The player the trace is rendered to * @param flags Flags modefieing the rendering + * @param bundleFilter Filter to determin bundeling of records */ public void render(Player player, Collection flags, BundleFilter bundleFilter){ if(serverMap.containsKey(player)){ REntityServer server = serverMap.get(player); server.close(); + serverMap.remove(player); + viewFlagMap.remove(player); + bundleFilterMap.remove(player); } + viewFlagMap.put(player, flags); + bundleFilterMap.put(player, bundleFilter); + + REntityServer server = new REntityServer(); + server.addPlayer(player); + serverMap.put(player, server); + + render(server, records, flags, bundleFilter); + } + + /** Internal methode to render records to a REntityServer + * + * @param server Server to render to + * @param records Records to render + * @param flags Flags modefieing the rendering + * @param bundleFilter Filter to determin bundeling of records + */ + private void render (REntityServer server, List records, Collection flags, BundleFilter bundleFilter){ + if(records.size() == 0) return; List workingRecords = records; @@ -97,9 +147,6 @@ public class Trace { List> bundles = bundleRecords(workingRecords, bundleFilter); //Render bundled records - REntityServer server = new REntityServer(); - serverMap.put(player, server); - server.addPlayer(player); List entities = new LinkedList<>(); for(List bundle : bundles) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java index 51c8df5d..6a4d8e6b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java @@ -28,8 +28,6 @@ import java.util.stream.Collectors; @Linked public class TraceManager implements Listener { - //TODO no null returns - /** * Map of all current traces */ -- 2.39.5 From 1644b968860f7e370d11a8abe1643683d2e7694f Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Thu, 22 Feb 2024 20:29:10 +0100 Subject: [PATCH 019/111] Moved Classes Reimplemented basic command --- .../{tracer2 => tracer}/Recorder.java | 2 +- .../{tracer2 => tracer}/TNTRecord.java | 2 +- .../features/{tracer2 => tracer}/Trace.java | 14 +- .../features/tracer/TraceCommand.java | 274 +++++------------- .../{tracer2 => tracer}/TraceManager.java | 2 +- .../rendering}/BundleFilter.java | 6 +- .../rendering}/TraceEntity.java | 5 +- .../rendering}/ViewFlag.java | 7 +- 8 files changed, 97 insertions(+), 215 deletions(-) rename BauSystem_Main/src/de/steamwar/bausystem/features/{tracer2 => tracer}/Recorder.java (99%) rename BauSystem_Main/src/de/steamwar/bausystem/features/{tracer2 => tracer}/TNTRecord.java (98%) rename BauSystem_Main/src/de/steamwar/bausystem/features/{tracer2 => tracer}/Trace.java (92%) rename BauSystem_Main/src/de/steamwar/bausystem/features/{tracer2 => tracer}/TraceManager.java (98%) rename BauSystem_Main/src/de/steamwar/bausystem/features/{tracer2 => tracer/rendering}/BundleFilter.java (93%) rename BauSystem_Main/src/de/steamwar/bausystem/features/{tracer2 => tracer/rendering}/TraceEntity.java (89%) rename BauSystem_Main/src/de/steamwar/bausystem/features/{tracer2 => tracer/rendering}/ViewFlag.java (87%) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java similarity index 99% rename from BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java rename to BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java index 2f958334..d47dda8c 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.steamwar.bausystem.features.tracer2; +package de.steamwar.bausystem.features.tracer; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.tpslimit.TPSUtils; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TNTRecord.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java similarity index 98% rename from BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TNTRecord.java rename to BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java index 3392a0c6..5969fcc8 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TNTRecord.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.steamwar.bausystem.features.tracer2; +package de.steamwar.bausystem.features.tracer; import lombok.Getter; import org.bukkit.Location; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java similarity index 92% rename from BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java rename to BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index 4b0f1811..8c42b732 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -17,13 +17,15 @@ * along with this program. If not, see . */ -package de.steamwar.bausystem.features.tracer2; +package de.steamwar.bausystem.features.tracer; import de.steamwar.bausystem.features.tpslimit.TPSUtils; +import de.steamwar.bausystem.features.tracer.rendering.BundleFilter; +import de.steamwar.bausystem.features.tracer.rendering.TraceEntity; +import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; import de.steamwar.bausystem.region.Region; import de.steamwar.entity.REntityServer; import lombok.Getter; -import org.bukkit.Location; import org.bukkit.entity.Player; import java.util.*; @@ -65,7 +67,7 @@ public class Trace { /** * A map saving the view flags for rendered traces, for life rendering */ - private final Map> viewFlagMap = new HashMap<>(); + private final Map viewFlagMap = new HashMap<>(); public Trace (Region region){ this.region = region; @@ -85,7 +87,7 @@ public class Trace { for(Player player: serverMap.keySet()){ REntityServer server = serverMap.get(player); BundleFilter bundleFilter = bundleFilterMap.get(player); - Collection viewFlags = viewFlagMap.get(player); + ViewFlag[] viewFlags = viewFlagMap.get(player); render(server, newRecords, viewFlags, bundleFilter); } @@ -107,7 +109,7 @@ public class Trace { * @param flags Flags modefieing the rendering * @param bundleFilter Filter to determin bundeling of records */ - public void render(Player player, Collection flags, BundleFilter bundleFilter){ + public void render(Player player, ViewFlag[] flags, BundleFilter bundleFilter){ if(serverMap.containsKey(player)){ REntityServer server = serverMap.get(player); server.close(); @@ -134,7 +136,7 @@ public class Trace { * @param flags Flags modefieing the rendering * @param bundleFilter Filter to determin bundeling of records */ - private void render (REntityServer server, List records, Collection flags, BundleFilter bundleFilter){ + private void render (REntityServer server, List records, ViewFlag[] flags, BundleFilter bundleFilter){ if(records.size() == 0) return; List workingRecords = records; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index b05ec3d7..f2f05237 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -1,244 +1,120 @@ /* - * This file is a part of the SteamWar software. + * This file is a part of the SteamWar software. * - * Copyright (C) 2022 SteamWar.de-Serverteam + * 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 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. + * 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 . + * 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.tracer; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.features.tracer.record.*; -import de.steamwar.bausystem.features.tracer.show.*; -import de.steamwar.bausystem.region.GlobalRegion; +import de.steamwar.bausystem.features.tracer.rendering.BundleFilter; +import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; import de.steamwar.bausystem.region.Region; -import de.steamwar.bausystem.shared.ShowMode; -import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar; -import de.steamwar.bausystem.utils.bossbar.BossBarService; import de.steamwar.command.PreviousArguments; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeMapper; -import de.steamwar.command.TypeValidator; import de.steamwar.linkage.Linked; import de.steamwar.linkage.LinkedInstance; -import lombok.AllArgsConstructor; -import org.bukkit.Bukkit; -import org.bukkit.boss.BossBar; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import java.util.*; -import java.util.function.BiFunction; -import java.util.function.Supplier; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; import java.util.stream.Collectors; @Linked public class TraceCommand extends SWCommand { - public TraceCommand() { - super("trace", "trail"); - } - @LinkedInstance public Recorder recorder; + @LinkedInstance + public TraceManager manager; + public TraceCommand(){super("trace", "trail");} - @Register(value = {"start"}, description = "TRACE_COMMAND_HELP_START") - public void startCommand(@Validator Player p) { - Region region = Region.getRegion(p.getLocation()); - recorder.set(region, new SimpleTraceRecorder()); - BauSystem.MESSAGE.send("TRACE_MESSAGE_START", p); + @Register(value = "start", description = "TRACE_COMMAND_HELP_START") + public void start(Player player){ + Region region = Region.getRegion(player.getLocation()); + recorder.startRecording(region); + BauSystem.MESSAGE.send("TRACE_MESSAGE_START", player); } - @Register(value = {"single"}, description = "TRACE_COMMAND_HELP_SINGLE") - public void singleCommand(@Validator Player p) { - Region region = Region.getRegion(p.getLocation()); - recorder.set(region, new SingleTraceRecorder()); - BauSystem.MESSAGE.send("TRACE_MESSAGE_SINGLE", p); + @Register(value = "stop", description = "TRACE_COMMAND_HELP_STOP") + public void stop(Player player){ + Region region = Region.getRegion(player.getLocation()); + recorder.stopRecording(region); + BauSystem.MESSAGE.send("TRACE_MESSAGE_STOP", player); } - @Register(value = {"stop"}, description = "TRACE_COMMAND_HELP_STOP") - public void stopCommand(@Validator Player p) { - Region region = Region.getRegion(p.getLocation()); - recorder.remove(region); - BauSystem.MESSAGE.send("TRACE_MESSAGE_STOP", p); - } + @Register(value = "show", description = "TRACE_COMMAND_HELP_SHOW") + public void show(Player player, @OptionalValue("STRICT") BundleFilter filter, ViewFlag... flags){ + Region region = Region.getRegion(player.getLocation()); - @Register(value = {"auto"}, description = "TRACE_COMMAND_HELP_AUTO") - @Register({"toggleauto"}) - public void autoCommand(@Validator Player p) { - Region region = Region.getRegion(p.getLocation()); - recorder.set(region, new AutoIgniteTraceRecorder()); - BauSystem.MESSAGE.send("TRACE_MESSAGE_AUTO_IDLE_IGNITE", p); - } - - @Register(value = {"autoremove"}, description = "TRACE_COMMAND_HELP_AUTO_REMOVE") - @Register(value = {"autodelete"}) - public void setAutoDeleteMode(@Validator Player p, @StaticValue({"-always", "-never", "-no_build_destroy", "-build_destroy", "-no_testblock_destroy", "-testblock_destroy"}) String destroyMode) { - Region region = Region.getRegion(p.getLocation()); - TraceRecorder recorder = this.recorder.get(region); - if (!(recorder instanceof AutoTraceRecorder) || recorder instanceof SingleTraceRecorder) { - BauSystem.MESSAGE.send("TRACE_MESSAGE_AUTO_DELETE_INVALID", p); - return; - } - AutoTraceRecorder autoTraceRecorder = (AutoTraceRecorder) recorder; - switch (destroyMode) { - case "-always": - autoTraceRecorder.setTraceRecordAutoDeletion(TraceRecordAutoDeletion.ALWAYS); - break; - case "-never": - autoTraceRecorder.setTraceRecordAutoDeletion(TraceRecordAutoDeletion.NEVER); - break; - case "-no_build_destroy": - autoTraceRecorder.setTraceRecordAutoDeletion(TraceRecordAutoDeletion.NO_BUILD_DESTROY); - break; - case "-build_destroy": - autoTraceRecorder.setTraceRecordAutoDeletion(TraceRecordAutoDeletion.BUILD_DESTROY); - break; - case "-no_testblock_destroy": - autoTraceRecorder.setTraceRecordAutoDeletion(TraceRecordAutoDeletion.NO_TESTBLOCK_DESTROY); - break; - case "-testblock_destroy": - autoTraceRecorder.setTraceRecordAutoDeletion(TraceRecordAutoDeletion.TESTBLOCK_DESTROY); - break; - default: - return; - } - BauSystem.MESSAGE.send("TRACE_MESSAGE_AUTO_DELETE_" + autoTraceRecorder.getTraceRecordAutoDeletion().name(), p); - } - - @Register(value = {"show"}, description = "TRACE_COMMAND_HELP_SHOW_AT") - public void showAtCommand(@Validator Player p, @OptionalValue("time") @StaticValue({"time", "fuse"}) String type, @StaticValue("at") String __, @Min(intValue = 0) int at) { - internalSetShowFilter(p, "TRACE_MESSAGE_SHOW_AT", type, at, at); - } - - @Register(value = {"show"}, description = "TRACE_COMMAND_HELP_SHOW_FROM") - public void showFromCommand(@Validator Player p, @OptionalValue("time") @StaticValue({"time", "fuse"}) String type, @StaticValue("from") String __, @Min(intValue = 0) int from) { - if (from == 0) { - TraceShowManager.setShowFilter(p, null); - BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW", p); - return; - } - internalSetShowFilter(p, "TRACE_MESSAGE_SHOW_FROM", type, from, Integer.MAX_VALUE); - } - - @Register(value = {"show"}, description = "TRACE_COMMAND_HELP_SHOW_FROM_TO") - public void showFromToCommand(@Validator Player p, @OptionalValue("time") @StaticValue({"time", "fuse"}) String type, @StaticValue("from") String __, @Min(intValue = 0) int from, @StaticValue("to") String ___, @Min(intValue = 0) int to) { - internalSetShowFilter(p, "TRACE_MESSAGE_SHOW_FROM_TO", type, from, to); - } - - private void internalSetShowFilter(Player p, String message, String type, int from, int to) { - if (to < from) { - BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_TO_SMALLER", p); - return; - } - TraceShowManager.setShowFilter(p, tntPosition -> { - switch (type) { - case "time": - return tntPosition.getTimeTicks() >= from && tntPosition.getTimeTicks() <= to; - case "fuse": - return tntPosition.getFuseTicks() >= from && tntPosition.getFuseTicks() <= to; - default: - return true; - } - }); - BauSystem.MESSAGE.send(message, p, type, from, to); - } - - // /trace show at 0 - // /trace show raw -auto at 0 - @Register(value = {"show"}, description = "TRACE_COMMAND_HELP_SHOW") - public void showCommand(@Validator Player p, ShowModeParameterType... showModeParameterTypes) { - Region region = Region.getRegion(p.getLocation()); - ShowModeParameter showModeParameter = new ShowModeParameter(); - if (region.getWaterLevel() != 0) { // Enable Water by default for regions with WaterLevel e.g. WarShip - showModeParameter.enableWater(); - } - for (ShowModeParameterType showModeParameterType : showModeParameterTypes) { - if (showModeParameterType == ShowModeParameterType.WATER && region.getWaterLevel() != 0) { - showModeParameter.disableWater(); - } else { - showModeParameterType.getShowModeParameterConsumer().accept(showModeParameter); - } - } - TraceShowManager.show(p, new EntityShowMode(p, showModeParameter, 32)); - BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW", p); - } - - @Register(value = {"hide"}, description = "TRACE_COMMAND_HELP_HIDE") - public void hideCommand(@Validator Player p) { - TraceShowManager.hide(p); - BauSystem.MESSAGE.send("TRACE_MESSAGE_HIDE", p); - } - - @Register(value = {"delete"}, description = "TRACE_COMMAND_HELP_DELETE") - @Register({"clear"}) - public void deleteCommand(@Validator Player p) { - Region region = Region.getRegion(p.getLocation()); - StoredRecords.clear(region); - BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE", p); - } - - @ClassMapper(value = ShowModeParameterType.class, local = true) - public TypeMapper showModeParameterTypesTypeMapper() { - Map> showModeParameterTypeListMap = new EnumMap<>(ShowModeParameterType.class); - for (ShowModeParameterType value : ShowModeParameterType.values()) { - showModeParameterTypeListMap.put(value, value.getTabCompletes()); + for(Trace trace : manager.get(region)){ + trace.render(player, flags, filter); } - Map showModeParameterTypesMap = new HashMap<>(); - showModeParameterTypeListMap.forEach((k, v) -> v.forEach(s -> showModeParameterTypesMap.put(s, k))); + BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW", player); + } - return new TypeMapper() { + @ClassMapper(value = BundleFilter.class, local = true) + public TypeMapper bundleFilterClassMapper() { + return new TypeMapper() { @Override - public ShowModeParameterType map(CommandSender commandSender, PreviousArguments previousArguments, String s) { - return showModeParameterTypesMap.get(s); - } - - @Override - public List tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) { - Set showModeParameterTypeSet = new HashSet<>(); - Arrays.stream(previousArguments.userArgs).map(showModeParameterTypesMap::get).forEach(showModeParameterTypeSet::add); - showModeParameterTypeSet.remove(null); - - Set removed = showModeParameterTypeSet.stream() - .map(ShowModeParameterType::getRemoved) - .map(Supplier::get) - .flatMap(Arrays::stream) - .collect(Collectors.toSet()); - - List tabCompletes = new ArrayList<>(); - for (Map.Entry> entry : showModeParameterTypeListMap.entrySet()) { - if (removed.contains(entry.getKey()) || showModeParameterTypeSet.contains(entry.getKey())) { - continue; - } - tabCompletes.addAll(entry.getValue()); + public BundleFilter map(CommandSender commandSender, String[] previousArguments, String s) { + for(BundleFilter filter: BundleFilter.values()) { + if (s.equals(filter.toString())) + return filter; } - return tabCompletes; + return null; + } + + @Override + public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) { + if(s.length() == 0) + return new ArrayList<>(); + + return Arrays.stream(BundleFilter.values()) + .map(Enum::toString) + .collect(Collectors.toList()); + + } }; } - @ClassValidator(value = Player.class, local = true) - public TypeValidator validator() { - return (commandSender, player, messageSender) -> { - if (!Permission.hasPermission(player, Permission.WORLD)) { - messageSender.send("TRACE_MESSAGE_DISALLOWED", player); - return false; + @ClassMapper(value = ViewFlag.class, local = true) + public TypeMapper viewFlagClassMapper () { + return new TypeMapper() { + @Override + public ViewFlag map(CommandSender commandSender, String[] previousArguments, String s) { + for(ViewFlag filter: ViewFlag.values()) { + if (s.equals("--" + filter.toString().toLowerCase())) + return filter; + } + return null; + } + + @Override + public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) { + return Arrays.stream(ViewFlag.values()) + .map(Enum::toString) + .map(string -> "--" + string.toLowerCase()) + .collect(Collectors.toList()); } - return true; }; } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java similarity index 98% rename from BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java rename to BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index 6a4d8e6b..a00e6ce3 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.steamwar.bausystem.features.tracer2; +package de.steamwar.bausystem.features.tracer; import de.steamwar.bausystem.region.Region; import de.steamwar.linkage.Linked; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/BundleFilter.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java similarity index 93% rename from BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/BundleFilter.java rename to BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java index 08117732..3ce9e03e 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/BundleFilter.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java @@ -1,7 +1,7 @@ /* * This file is a part of the SteamWar software. * - * Copyright (C) 2023 SteamWar.de-Serverteam + * Copyright (C) 2024 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 @@ -17,7 +17,9 @@ * along with this program. If not, see . */ -package de.steamwar.bausystem.features.tracer2; +package de.steamwar.bausystem.features.tracer.rendering; + +import de.steamwar.bausystem.features.tracer.TNTRecord; import java.util.Optional; import java.util.function.BiFunction; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceEntity.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java similarity index 89% rename from BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceEntity.java rename to BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java index 75b33357..a930ec57 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceEntity.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java @@ -1,7 +1,7 @@ /* * This file is a part of the SteamWar software. * - * Copyright (C) 2023 SteamWar.de-Serverteam + * Copyright (C) 2024 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 @@ -17,8 +17,9 @@ * along with this program. If not, see . */ -package de.steamwar.bausystem.features.tracer2; +package de.steamwar.bausystem.features.tracer.rendering; +import de.steamwar.bausystem.features.tracer.TNTRecord; import de.steamwar.entity.REntityServer; import de.steamwar.entity.RFallingBlockEntity; import lombok.Getter; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/ViewFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java similarity index 87% rename from BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/ViewFlag.java rename to BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java index efc1979d..92726c26 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/ViewFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java @@ -1,7 +1,7 @@ /* * This file is a part of the SteamWar software. * - * Copyright (C) 2023 SteamWar.de-Serverteam + * Copyright (C) 2024 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 @@ -17,14 +17,15 @@ * along with this program. If not, see . */ -package de.steamwar.bausystem.features.tracer2; +package de.steamwar.bausystem.features.tracer.rendering; +import de.steamwar.bausystem.features.tracer.TNTRecord; +import de.steamwar.bausystem.features.tracer.rendering.TraceEntity; import de.steamwar.entity.REntityServer; import java.util.ArrayList; import java.util.List; import java.util.function.BiConsumer; -import java.util.function.Consumer; import java.util.function.UnaryOperator; public enum ViewFlag { -- 2.39.5 From c621048014ada4b03f1a6b5744a775ba4105ff04 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Thu, 29 Feb 2024 11:00:56 +0100 Subject: [PATCH 020/111] Removed old iterators --- .../tracer/record/TNTPrimedIterator15.java | 39 ---------------- .../tracer/record/TNTPrimedIterator18.java | 46 ------------------- 2 files changed, 85 deletions(-) delete mode 100644 BauSystem_15/src/de/steamwar/bausystem/features/tracer/record/TNTPrimedIterator15.java delete mode 100644 BauSystem_18/src/de/steamwar/bausystem/features/tracer/record/TNTPrimedIterator18.java diff --git a/BauSystem_15/src/de/steamwar/bausystem/features/tracer/record/TNTPrimedIterator15.java b/BauSystem_15/src/de/steamwar/bausystem/features/tracer/record/TNTPrimedIterator15.java deleted file mode 100644 index 36c53f40..00000000 --- a/BauSystem_15/src/de/steamwar/bausystem/features/tracer/record/TNTPrimedIterator15.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2022 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.tracer.record; - -import net.minecraft.server.v1_15_R1.EntityTNTPrimed; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_15_R1.CraftWorld; -import org.bukkit.entity.TNTPrimed; - -import java.util.stream.Stream; - -public class TNTPrimedIterator15 implements TNTPrimedIterator { - - private static final CraftWorld WORLD = (CraftWorld) Bukkit.getWorlds().get(0); - - @Override - public Stream iterator() { - return WORLD.getHandle().entitiesById.values().stream() - .filter(EntityTNTPrimed.class::isInstance) - .map(entity -> (TNTPrimed) entity.getBukkitEntity()); - } -} diff --git a/BauSystem_18/src/de/steamwar/bausystem/features/tracer/record/TNTPrimedIterator18.java b/BauSystem_18/src/de/steamwar/bausystem/features/tracer/record/TNTPrimedIterator18.java deleted file mode 100644 index 0df69fb9..00000000 --- a/BauSystem_18/src/de/steamwar/bausystem/features/tracer/record/TNTPrimedIterator18.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2022 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.tracer.record; - -import com.comphenix.tinyprotocol.Reflection; -import net.minecraft.server.level.WorldServer; -import net.minecraft.world.level.entity.LevelEntityGetter; -import org.bukkit.Bukkit; -import org.bukkit.entity.TNTPrimed; - -import java.util.stream.Stream; -import java.util.stream.StreamSupport; - -public class TNTPrimedIterator18 implements TNTPrimedIterator { - - private static final Reflection.MethodInvoker getWorld = Reflection.getMethod(Reflection.getClass("{obc}.CraftWorld"), "getHandle"); - private static final Reflection.MethodInvoker getWorldEntities = Reflection.getTypedMethod(WorldServer.class, null, LevelEntityGetter.class); - private static final Reflection.MethodInvoker getIterable = Reflection.getTypedMethod(LevelEntityGetter.class, null, Iterable.class); - private static final Reflection.MethodInvoker getBukkitEntity = Reflection.getTypedMethod(Reflection.getClass("{nms.world.entity}.Entity"), "getBukkitEntity", null); - - @Override - public Stream iterator() { - return StreamSupport.stream(((Iterable) getIterable.invoke(getWorldEntities.invoke(getWorld.invoke(Bukkit.getWorlds().get(0))))).spliterator(), false) - .map(getBukkitEntity::invoke) - .filter(TNTPrimed.class::isInstance) - .map(TNTPrimed.class::cast); - } -} - -- 2.39.5 From 3c22840278094ffa33e7b864457c487e9824619f Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Thu, 29 Feb 2024 11:03:59 +0100 Subject: [PATCH 021/111] Removed old trace --- .../features/tracer/TNTPosition.java | 76 ----- .../tracer/TraceScoreboardElement.java | 61 ---- .../features/tracer/TracerBauGuiItem.java | 101 ------ .../features/tracer/record/ActiveTracer.java | 23 -- .../record/AutoIgniteTraceRecorder.java | 33 -- .../tracer/record/AutoTraceRecorder.java | 137 --------- .../features/tracer/record/Recorder.java | 153 ---------- .../tracer/record/SimpleTraceRecorder.java | 86 ------ .../tracer/record/SingleTraceRecorder.java | 38 --- .../tracer/record/TNTPrimedIterator.java | 32 -- .../record/TraceRecordAutoDeletion.java | 65 ---- .../features/tracer/record/TraceRecorder.java | 42 --- .../features/tracer/show/EntityShowMode.java | 289 ------------------ .../features/tracer/show/Record.java | 138 --------- .../tracer/show/ShowModeParameter.java | 95 ------ .../tracer/show/ShowModeParameterType.java | 76 ----- .../features/tracer/show/StoredRecords.java | 70 ----- .../tracer/show/TraceShowManager.java | 142 --------- .../features/tracer2/TraceCommand.java | 62 ---- 19 files changed, 1719 deletions(-) delete mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPosition.java delete mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceScoreboardElement.java delete mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TracerBauGuiItem.java delete mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/ActiveTracer.java delete mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/AutoIgniteTraceRecorder.java delete mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/AutoTraceRecorder.java delete mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/Recorder.java delete mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/SimpleTraceRecorder.java delete mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/SingleTraceRecorder.java delete mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/TNTPrimedIterator.java delete mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/TraceRecordAutoDeletion.java delete mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/TraceRecorder.java delete mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/EntityShowMode.java delete mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/Record.java delete mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/ShowModeParameter.java delete mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/ShowModeParameterType.java delete mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/StoredRecords.java delete mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/TraceShowManager.java delete mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceCommand.java diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPosition.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPosition.java deleted file mode 100644 index cdbd6227..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPosition.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2022 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.tracer; - -import de.steamwar.bausystem.features.tracer.show.Record; -import de.steamwar.bausystem.shared.Position; -import lombok.Getter; -import lombok.Setter; -import org.bukkit.entity.TNTPrimed; -import org.bukkit.util.Vector; - -import java.lang.instrument.Instrumentation; - -@Getter -public class TNTPosition extends Position { - - private final Record.TNTRecord record; - private final int fuseTicks; - private final long timeTicks; - private final Vector previousLocation; - private final Vector velocity; - private final UpdateOrder updateOrder; - private final boolean source; - private final boolean exploded; - - @Setter - private boolean microMotion; - - public TNTPosition(Record.TNTRecord record, TNTPrimed entity, long timeTicks, Vector previousLocation, Vector velocity, UpdateOrder updateOrder, boolean source, boolean exploded) { - super(entity.getLocation().toVector()); - this.record = record; - this.fuseTicks = entity.getFuseTicks(); - this.timeTicks = timeTicks; - this.previousLocation = previousLocation; - this.velocity = velocity; - this.updateOrder = updateOrder; - this.source = source; - this.exploded = exploded; - } - - @Override - public String toString() { - return "Position{" + - "location=" + super.getLocation() + - '}'; - } - - public enum UpdateOrder { - /** - * X is Bigger so comes later - */ - X, - - /** - * Z is Bigger so comes later - */ - Z - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceScoreboardElement.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceScoreboardElement.java deleted file mode 100644 index 87ae3876..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceScoreboardElement.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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.tracer; - -import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.features.tracer.record.Recorder; -import de.steamwar.bausystem.features.tracer.show.Record; -import de.steamwar.bausystem.features.tracer.show.StoredRecords; -import de.steamwar.bausystem.region.Region; -import de.steamwar.bausystem.utils.ScoreboardElement; -import de.steamwar.linkage.Linked; -import org.bukkit.entity.Player; - -import java.util.List; - -@Linked -public class TraceScoreboardElement implements ScoreboardElement { - - @Override - public ScoreboardGroup getGroup() { - return ScoreboardGroup.OTHER; - } - - @Override - public int order() { - return 1; - } - - @Override - public String get(Region region, Player p) { - String traceScore = Recorder.INSTANCE.get(region).scoreboard(p); - if (traceScore != null) { - return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TRACE", p) + "§8: " + traceScore; - } - List records = StoredRecords.getRecords(region); - if (records.isEmpty()) { - return null; - } - if (records.stream().allMatch(record -> record.getTnt().isEmpty())) { - return null; - } - return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TRACE", p) + "§8: " + BauSystem.MESSAGE.parse("TRACE_HAS_TRACES", p); - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TracerBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TracerBauGuiItem.java deleted file mode 100644 index 5df27f45..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TracerBauGuiItem.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2022 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.tracer; - -import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.SWUtils; -import de.steamwar.bausystem.features.tracer.record.*; -import de.steamwar.bausystem.linkage.specific.BauGuiItem; -import de.steamwar.bausystem.region.Region; -import de.steamwar.inventory.SWInventory; -import de.steamwar.inventory.SWItem; -import de.steamwar.linkage.Linked; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.inventory.ItemStack; - -import java.util.Arrays; -import java.util.Collections; - -@Linked -public class TracerBauGuiItem extends BauGuiItem { - - public TracerBauGuiItem() { - super(21); - } - - @Override - public ItemStack getItem(Player player) { - Region region = Region.getRegion(player.getLocation()); - return SWUtils.setCustomModelData(new SWItem(Material.OBSERVER, BauSystem.MESSAGE.parse("TRACE_GUI_ITEM_NAME", player), Arrays.asList(BauSystem.MESSAGE.parse("TRACE_GUI_ITEM_LORE", player, Recorder.INSTANCE.get(region).scoreboard(player))), false, clickType -> { - }), 1).getItemStack(); - } - - private static void open(Player p) { - Region region = Region.getRegion(p.getLocation()); - TraceRecorder traceRecorder = Recorder.INSTANCE.get(region); - SWInventory inv = new SWInventory(p, 9, BauSystem.MESSAGE.parse("TRACE_GUI_NAME", p)); - if (traceRecorder instanceof ActiveTracer) { - if (traceRecorder instanceof AutoTraceRecorder) { - inv.setItem(1, new SWItem(Material.GRAY_DYE, BauSystem.MESSAGE.parse("TRACE_GUI_TRACE_ACTIVE_AUTO", p))); - } else { - inv.setItem(1, new SWItem(Material.GREEN_DYE, BauSystem.MESSAGE.parse("TRACE_GUI_TRACE_ACTIVE", p), clickType -> { - p.performCommand("trace stop"); - open(p); - })); - } - } else { - inv.setItem(1, new SWItem(Material.RED_DYE, BauSystem.MESSAGE.parse("TRACE_GUI_TRACE_INACTIVE", p), clickType -> { - p.performCommand("trace start"); - open(p); - })); - } - if (traceRecorder instanceof AutoTraceRecorder) { - inv.setItem(3, new SWItem(Material.ENDER_EYE, BauSystem.MESSAGE.parse("TRACE_GUI_AUTO_TRACE_ACTIVE", p), clickType -> { - p.performCommand("trace auto"); - open(p); - })); - } else { - inv.setItem(3, new SWItem(Material.FIREWORK_STAR, BauSystem.MESSAGE.parse("TRACE_GUI_AUTO_TRACE_INACTIVE", p), clickType -> { - p.performCommand("trace auto"); - open(p); - })); - } - inv.setItem(7, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("TRACE_GUI_DELETE", p), clickType -> { - p.performCommand("trace delete"); - open(p); - })); - - inv.open(); - } - - @Override - public boolean click(ClickType click, Player p) { - open(p); - return false; - } - - @Override - public Permission permission() { - return Permission.WORLD; - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/ActiveTracer.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/ActiveTracer.java deleted file mode 100644 index b0dfeeed..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/ActiveTracer.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2022 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.tracer.record; - -public interface ActiveTracer { -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/AutoIgniteTraceRecorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/AutoIgniteTraceRecorder.java deleted file mode 100644 index 9eb2f0b8..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/AutoIgniteTraceRecorder.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2022 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.tracer.record; - -public class AutoIgniteTraceRecorder extends AutoTraceRecorder implements ActiveTracer { - - @Override - protected String getInactivityMessage() { - return "TRACE_IDLE_AUTO_IGNITE"; - } - - @Override - protected String getScriptState() { - return "IDLE_AUTO_IGNITE"; - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/AutoTraceRecorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/AutoTraceRecorder.java deleted file mode 100644 index ba947f31..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/AutoTraceRecorder.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2022 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.tracer.record; - -import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.features.tpslimit.TPSUtils; -import de.steamwar.bausystem.features.tracer.TNTPosition; -import de.steamwar.bausystem.features.tracer.show.Record; -import de.steamwar.bausystem.features.tracer.show.StoredRecords; -import de.steamwar.bausystem.features.tracer.show.TraceShowManager; -import de.steamwar.bausystem.region.Region; -import lombok.Getter; -import lombok.Setter; -import org.bukkit.entity.Player; -import org.bukkit.entity.TNTPrimed; - -import java.util.HashMap; -import java.util.Map; -import java.util.function.Supplier; - -public abstract class AutoTraceRecorder implements TraceRecorder { - - protected boolean recording = false; - private long startTime = TPSUtils.currentRealTick.get(); - - private final Map recordMap = new HashMap<>(); - private Record record; - - protected Region region; - private Supplier recordSupplier; - - @Setter - @Getter - private TraceRecordAutoDeletion traceRecordAutoDeletion = TraceRecordAutoDeletion.NEVER; - private Record lastRecord; - - private Record.TNTRecord getRecord(TNTPrimed tntPrimed) { - return recordMap.computeIfAbsent(tntPrimed, __ -> record.spawn()); - } - - protected abstract String getInactivityMessage(); - protected void stoppedRecording() { - } - - @Override - public final String scoreboard(Player player) { - if (recording) { - return BauSystem.MESSAGE.parse("TRACE_RECORD", player) + " §8| §e" + (TPSUtils.currentRealTick.get() - startTime) + " §7" + BauSystem.MESSAGE.parse("SCOREBOARD_TRACE_TICKS", player); - } else { - return BauSystem.MESSAGE.parse(getInactivityMessage(), player); - } - } - - private void startRecording() { - if (lastRecord != null && traceRecordAutoDeletion.test(lastRecord)) { - StoredRecords.remove(region, lastRecord); - TraceShowManager.reshow(region); - } - startTime = TPSUtils.currentRealTick.get(); - record = recordSupplier.get(); - recording = true; - } - - @Override - public void init(Region region, Supplier recordSupplier) { - this.region = region; - this.recordSupplier = recordSupplier; - } - - @Override - public void postClear() { - recordMap.clear(); - record = recordSupplier.get(); - } - - @Override - public final void spawn(TNTPrimed tntPrimed) { - if (!recording) { - startRecording(); - } - getRecord(tntPrimed).source(tntPrimed); - } - - @Override - public final void tick(TNTPrimed tntPrimed) { - if (recording) { - getRecord(tntPrimed).location(tntPrimed); - } - } - - @Override - public final void explode(TNTPrimed tntPrimed, boolean inBuildRegion, boolean inTestblockRegion) { - if (recording) { - Record.TNTRecord tntRecord = getRecord(tntPrimed); - if (inBuildRegion) tntRecord.setInBuildArea(true); - if (inTestblockRegion) tntRecord.setInTestblockArea(true); - tntRecord.explode(tntPrimed); - recordMap.remove(tntPrimed); - - if (recordMap.isEmpty() || recordMap.keySet().stream().allMatch(TNTPrimed::isDead)) { - recording = false; - lastRecord = record; - record = null; - stoppedRecording(); - } - } - } - - protected abstract String getScriptState(); - - @Override - public String scriptState() { - return recording ? "RECORDING" : getScriptState(); - } - - @Override - public long scriptTime() { - return TPSUtils.currentRealTick.get() - startTime; - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/Recorder.java deleted file mode 100644 index 5c89155a..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/Recorder.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2022 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.tracer.record; - -import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.features.tracer.show.Record; -import de.steamwar.bausystem.features.tracer.show.StoredRecords; -import de.steamwar.bausystem.region.Region; -import de.steamwar.bausystem.region.utils.RegionExtensionType; -import de.steamwar.bausystem.region.utils.RegionType; -import de.steamwar.linkage.Linked; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; -import org.bukkit.entity.TNTPrimed; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.EntityExplodeEvent; -import org.bukkit.event.entity.EntitySpawnEvent; - -import java.util.HashMap; -import java.util.Map; -import java.util.stream.Collectors; - -@Linked -public class Recorder implements Listener { - - public static Recorder INSTANCE; - - { - INSTANCE = this; - } - - private static class DisabledTracerRecorder implements TraceRecorder { - @Override - public String scoreboard(Player player) { - return null; - } - - @Override - public void spawn(TNTPrimed tntPrimed) { - } - - @Override - public void tick(TNTPrimed tntPrimed) { - } - - @Override - public void explode(TNTPrimed tntPrimed, boolean inBuildArea, boolean inTestblockRegion) { - } - - @Override - public String scriptState() { - return "IDLE"; - } - - @Override - public long scriptTime() { - return 0; - } - } - private static final DisabledTracerRecorder DISABLED = new DisabledTracerRecorder(); - - private Map regionTraceRecorderMap = new HashMap<>(); - private Map tntTraceRecorderMap = new HashMap<>(); - - private TraceRecorder get(TNTPrimed tntPrimed) { - return get(tntTraceRecorderMap.computeIfAbsent(tntPrimed, e -> Region.getRegion(e.getLocation()))); - } - - public TraceRecorder get(Region region) { - return regionTraceRecorderMap.getOrDefault(region, DISABLED); - } - - public void set(Region region, TraceRecorder traceRecorder) { - regionTraceRecorderMap.put(region, traceRecorder); - traceRecorder.init(region, () -> { - Record record = new Record(region); - StoredRecords.add(region, record); - return record; - }); - tntTraceRecorderMap.forEach((tntPrimed, rg) -> { - if (rg == region) { - traceRecorder.tick(tntPrimed); - } - }); - } - - public void remove(Region region) { - regionTraceRecorderMap.remove(region); - } - - public void postClear(Region region) { - get(region).postClear(); - } - - @EventHandler - public void onEntitySpawn(EntitySpawnEvent event) { - Entity entity = event.getEntity(); - if (!(entity instanceof TNTPrimed)) { - return; - } - get((TNTPrimed) entity).spawn((TNTPrimed) entity); - } - - { - BauSystem.runTaskTimer(BauSystem.getInstance(), () -> { - tick(); - tntTraceRecorderMap.keySet() - .stream() - .filter(e -> !e.isValid()) - .collect(Collectors.toList()) - .forEach(tntTraceRecorderMap::remove); - }, 1, 1); - } - - private void tick() { - TNTPrimedIterator.impl.iterator().forEach(tntPrimed -> { - get(tntPrimed).tick(tntPrimed); - }); - } - - @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) - public void onEntityExplode(EntityExplodeEvent event) { - Entity entity = event.getEntity(); - if (!(entity instanceof TNTPrimed)) { - return; - } - TraceRecorder traceRecorder = get((TNTPrimed) entity); - Region region = tntTraceRecorderMap.get((TNTPrimed) entity); - boolean inBuildRegion = event.blockList().stream().anyMatch(block -> region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION)); - boolean inTestblockRegion = event.blockList().stream().anyMatch(block -> region.inRegion(block.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.EXTENSION)); - traceRecorder.explode((TNTPrimed) entity, inBuildRegion, inTestblockRegion); - tntTraceRecorderMap.remove(entity); - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/SimpleTraceRecorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/SimpleTraceRecorder.java deleted file mode 100644 index 875d25b5..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/SimpleTraceRecorder.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2022 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.tracer.record; - -import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.features.tpslimit.TPSUtils; -import de.steamwar.bausystem.features.tracer.show.Record; -import de.steamwar.bausystem.region.Region; -import org.bukkit.entity.Player; -import org.bukkit.entity.TNTPrimed; - -import java.util.HashMap; -import java.util.Map; -import java.util.function.Supplier; - -public class SimpleTraceRecorder implements TraceRecorder, ActiveTracer { - - private final long startTime = TPSUtils.currentRealTick.get(); - private final Map recordMap = new HashMap<>(); - private Record record; - - @Override - public String scoreboard(Player player) { - return BauSystem.MESSAGE.parse("TRACE_RECORD", player) + " §8| §e" + (TPSUtils.currentRealTick.get() - startTime) + " §7" + BauSystem.MESSAGE.parse("SCOREBOARD_TRACE_TICKS", player); - } - - @Override - public void init(Region region, Supplier recordSupplier) { - record = recordSupplier.get(); - } - - @Override - public void postClear() { - recordMap.clear(); - } - - private Record.TNTRecord getRecord(TNTPrimed tntPrimed) { - return recordMap.computeIfAbsent(tntPrimed, __ -> record.spawn()); - } - - @Override - public void spawn(TNTPrimed tntPrimed) { - getRecord(tntPrimed).source(tntPrimed); - } - - @Override - public void tick(TNTPrimed tntPrimed) { - getRecord(tntPrimed).location(tntPrimed); - } - - @Override - public void explode(TNTPrimed tntPrimed, boolean inBuildRegion, boolean inTestblockRegion) { - Record.TNTRecord tntRecord = getRecord(tntPrimed); - if (inBuildRegion) tntRecord.setInBuildArea(true); - if (inTestblockRegion) tntRecord.setInTestblockArea(true); - tntRecord.explode(tntPrimed); - recordMap.remove(tntPrimed); - } - - @Override - public String scriptState() { - return "RECORD"; - } - - @Override - public long scriptTime() { - return TPSUtils.currentRealTick.get() - startTime; - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/SingleTraceRecorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/SingleTraceRecorder.java deleted file mode 100644 index 7f878869..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/SingleTraceRecorder.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2022 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.tracer.record; - -public class SingleTraceRecorder extends AutoTraceRecorder { - - @Override - protected String getInactivityMessage() { - return "TRACE_IDLE_SINGLE"; - } - - @Override - protected void stoppedRecording() { - Recorder.INSTANCE.remove(region); - } - - @Override - protected String getScriptState() { - return "IDLE_SINGLE"; - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/TNTPrimedIterator.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/TNTPrimedIterator.java deleted file mode 100644 index a6f05b5e..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/TNTPrimedIterator.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2022 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.tracer.record; - -import de.steamwar.bausystem.BauSystem; -import de.steamwar.core.VersionDependent; -import org.bukkit.entity.TNTPrimed; - -import java.util.stream.Stream; - -public interface TNTPrimedIterator { - TNTPrimedIterator impl = VersionDependent.getVersionImpl(BauSystem.getInstance()); - - Stream iterator(); -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/TraceRecordAutoDeletion.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/TraceRecordAutoDeletion.java deleted file mode 100644 index a99eff0e..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/TraceRecordAutoDeletion.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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.tracer.record; - -import de.steamwar.bausystem.features.tracer.show.Record; - -public enum TraceRecordAutoDeletion { - - ALWAYS { - @Override - public boolean test(Record record) { - return true; - } - }, - NEVER { - @Override - public boolean test(Record record) { - return false; - } - }, - NO_BUILD_DESTROY { - @Override - public boolean test(Record record) { - return record.getTnt().stream().noneMatch(Record.TNTRecord::isInBuildArea); - } - }, - BUILD_DESTROY { - @Override - public boolean test(Record record) { - return record.getTnt().stream().anyMatch(Record.TNTRecord::isInBuildArea); - } - }, - NO_TESTBLOCK_DESTROY { - @Override - public boolean test(Record record) { - return record.getTnt().stream().noneMatch(Record.TNTRecord::isInTestblockArea); - } - }, - TESTBLOCK_DESTROY { - @Override - public boolean test(Record record) { - return record.getTnt().stream().anyMatch(Record.TNTRecord::isInTestblockArea); - } - }, - ; - - public abstract boolean test(Record record); -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/TraceRecorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/TraceRecorder.java deleted file mode 100644 index ee1ca2e1..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/TraceRecorder.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2022 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.tracer.record; - -import de.steamwar.bausystem.features.tracer.show.Record; -import de.steamwar.bausystem.region.Region; -import org.bukkit.entity.Player; -import org.bukkit.entity.TNTPrimed; - -import java.util.function.Supplier; - -public interface TraceRecorder { - - String scoreboard(Player player); - default void init(Region region, Supplier recordSupplier) { - } - default void postClear() { - } - void spawn(TNTPrimed tntPrimed); - void tick(TNTPrimed tntPrimed); - void explode(TNTPrimed tntPrimed, boolean inBuildRegion, boolean inTestblockRegion); - - String scriptState(); - long scriptTime(); -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/EntityShowMode.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/EntityShowMode.java deleted file mode 100644 index ce45434a..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/EntityShowMode.java +++ /dev/null @@ -1,289 +0,0 @@ -/* - * 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.tracer.show; - -import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.features.tracer.TNTPosition; -import de.steamwar.bausystem.shared.RoundedPosition; -import de.steamwar.bausystem.shared.ShowMode; -import de.steamwar.bausystem.utils.FlatteningWrapper; -import de.steamwar.entity.REntity; -import de.steamwar.entity.REntityServer; -import de.steamwar.entity.RFallingBlockEntity; -import net.md_5.bungee.api.chat.ClickEvent; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.util.Vector; - -import java.util.*; -import java.util.function.BiConsumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -public class EntityShowMode implements ShowMode { - - private final int factor; - private final Player player; - private final ShowModeParameter showModeParameter; - - private REntityServer entityServer; - - private final Map tntEntityMap = new HashMap<>(); - private final Map explodeEntityMap = new HashMap<>(); - private final Map updateEntityMap = new HashMap<>(); - - public EntityShowMode(Player player, ShowModeParameter showModeParameter, int factor) { - this.player = player; - this.showModeParameter = showModeParameter; - this.factor = factor; - } - - @Override - public void show(TNTPosition position) { - if (entityServer == null) { - entityServer = new REntityServer(); - entityServer.setCallback((player, rEntity, entityAction) -> { - if (entityAction != REntityServer.EntityAction.INTERACT) return; - TNTPosition tntPosition = Stream.concat(tntEntityMap.values().stream(), explodeEntityMap.values().stream()) - .filter(entityStack -> entityStack.entity == rEntity) - .findFirst() - .map(entityStack -> entityStack.tntPosition) - .orElse(null); - if (tntPosition == null) return; - - BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_HEADER", player); - BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_FUSE_TIME", player, tntPosition.getFuseTicks()); - BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_POSITION_X", player, tntPosition.getLocation().getX() + ""); - BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_POSITION_Y", player, tntPosition.getLocation().getY() + ""); - BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_POSITION_Z", player, tntPosition.getLocation().getZ() + ""); - BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_X", player, tntPosition.getVelocity().getX() + ""); - BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_Y", player, tntPosition.getVelocity().getY() + ""); - BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_Z", player, tntPosition.getVelocity().getZ() + ""); - }); - entityServer.addPlayer(player); - } - - if (showModeParameter.isBuildDestroyOnly() && !position.getRecord().isInBuildArea()) { - return; - } - - if (showModeParameter.isTestblockDestroyOnly() && !position.getRecord().isInTestblockArea()) { - return; - } - - if (showModeParameter.isMicroMotion() && !position.getRecord().isHasMicroMotion()) { - return; - } - - boolean exploded = position.getRecord().getPositions().stream().anyMatch(TNTPosition::isExploded); - boolean hideWater = !showModeParameter.isWater() && exploded && checkWater(position.getLocation()); - - if (showModeParameter.isExplodeOnly()) { - if (position.isExploded()) { - generatePositions(position, false, false); - } - if (!showModeParameter.isSourceOnly() && !showModeParameter.isMicroMotionLocation() && !hideWater) { - return; - } - } - - if (showModeParameter.isSourceOnly()) { - if (position.isSource()) { - generatePositions(position, false, false); - } - if (!showModeParameter.isMicroMotionLocation() && !hideWater) { - return; - } - } - - if (showModeParameter.isMicroMotionLocation()) { - if (position.isMicroMotion()) { - generatePositions(position, false, false); - } - if (!hideWater) { - return; - } - } - - - if (hideWater) { - if (position.isExploded()) { - for (TNTPosition pos : position.getRecord().getPositions()) { - generatePositions(pos, showModeParameter.isInterpolateY(), showModeParameter.isInterpolateXZ(), (positionType, vector) -> { - RoundedPosition roundedPosition = new RoundedPosition(vector, factor); - Map map; - if (positionType == PositionType.TNT) { - map = tntEntityMap; - } else if (positionType == PositionType.EXPLODE) { - map = explodeEntityMap; - } else { - map = updateEntityMap; - } - map.computeIfPresent(roundedPosition, (roundedPosition1, entityStack) -> { - if (!entityStack.remove(pos.getRecord())) { - return null; - } - return entityStack; - }); - }); - } - } - return; - } - - generatePositions(position, showModeParameter.isInterpolateY(), showModeParameter.isInterpolateXZ()); - } - - @Override - public void hide() { - tntEntityMap.clear(); - explodeEntityMap.clear(); - updateEntityMap.clear(); - if (entityServer != null) { - entityServer.close(); - entityServer = null; - } - } - - private void generatePositions(TNTPosition position, boolean interpolateY, boolean interpolateXZ) { - generatePositions(position, interpolateY, interpolateXZ, (positionType, vector) -> { - RoundedPosition roundedPosition = new RoundedPosition(vector, factor); - EntityStack entityStack; - if (positionType == PositionType.TNT) { - entityStack = tntEntityMap.computeIfAbsent(roundedPosition, i -> new EntityStack(position, vector, positionType, position.getFuseTicks())); - } else if (positionType == PositionType.EXPLODE) { - entityStack = explodeEntityMap.computeIfAbsent(roundedPosition, i -> new EntityStack(position, vector, positionType, position.getFuseTicks())); - } else { - entityStack = updateEntityMap.computeIfAbsent(roundedPosition, i -> new EntityStack(position, vector, positionType, position.getFuseTicks())); - } - entityStack.add(position.getRecord()); - }); - } - - private boolean checkWater(Vector position) { - return FlatteningWrapper.impl.inWater(player.getWorld(), position); - } - - private REntity createEntity(Vector position, PositionType positionType) { - Material material; - if (positionType == PositionType.TNT) { - material = Material.TNT; - } else if (positionType == PositionType.EXPLODE) { - material = Material.RED_STAINED_GLASS; - } else { - material = Material.WHITE_STAINED_GLASS; - } - RFallingBlockEntity entity = new RFallingBlockEntity(entityServer, position.toLocation(player.getWorld()), material); - entity.setNoGravity(true); - return entity; - } - - private class EntityStack { - - private final TNTPosition tntPosition; - private final Vector position; - private final PositionType positionType; - private final int fuseTicks; - - private REntity entity; - private int count; - private List records = new ArrayList<>(); - - public EntityStack(TNTPosition tntPosition, Vector position, PositionType positionType, int fuseTicks) { - this.tntPosition = tntPosition; - this.position = position; - this.positionType = positionType; - this.fuseTicks = fuseTicks; - } - - public void add(Record.TNTRecord record) { - records.add(record); - if (entity == null) { - entity = createEntity(position, positionType); - } - count++; - - int nameShows = 0; - if (showModeParameter.isFuse()) nameShows++; - if (showModeParameter.isCount()) nameShows++; - if (showModeParameter.isEntityId()) nameShows++; - if (showModeParameter.isCalculationOrder()) nameShows++; - - List toShow = new ArrayList<>(); - if (showModeParameter.isFuse()) { - toShow.add((nameShows > 1 ? "F:" : "") + fuseTicks); - } - if (showModeParameter.isCount()) { - toShow.add((nameShows > 1 ? "C:" : "") + new HashSet<>(records).size()); - } - if (showModeParameter.isEntityId()) { - toShow.add((nameShows > 1 ? "I:" : "") + record.getEntityId()); - } - /* - if (showModeParameter.isCalculationOrder()) { - toShow.add((nameShows > 1 ? "O:" : "") + record.getEntityId()); - } - */ - - if (!toShow.isEmpty()) { - entity.setDisplayName(String.join(" ", toShow)); - } - } - - public boolean remove(Record.TNTRecord record) { - if (entity == null) return false; - records.remove(record); - count--; - if (count == 0) { - entity.die(); - entity = null; - return false; - } - return true; - } - } - - public static void generatePositions(TNTPosition position, boolean interpolateY, boolean interpolateXZ, BiConsumer positionCallback) { - positionCallback.accept(position.isExploded() ? PositionType.EXPLODE : PositionType.TNT, position.getLocation()); - if (position.getPreviousLocation() == null) return; - - if (interpolateY) { - Vector updatePointY = position.getPreviousLocation().clone().setY(position.getLocation().getY()); - if (!position.getLocation().equals(updatePointY)) { - positionCallback.accept(PositionType.UPDATE, updatePointY); - } - } - - if (interpolateXZ) { - Vector updatePointXZ = position.getUpdateOrder() == TNTPosition.UpdateOrder.X - ? position.getLocation().clone().setZ(position.getPreviousLocation().getZ()) - : position.getLocation().clone().setX(position.getPreviousLocation().getX()); - if (!position.getLocation().equals(updatePointXZ)) { - positionCallback.accept(PositionType.UPDATE, updatePointXZ); - } - } - } - - public enum PositionType { - TNT, - EXPLODE, - UPDATE - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/Record.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/Record.java deleted file mode 100644 index ac8d4e02..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/Record.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2022 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.tracer.show; - -import de.steamwar.bausystem.features.tpslimit.TPSUtils; -import de.steamwar.bausystem.features.tracer.TNTPosition; -import de.steamwar.bausystem.region.Region; -import de.steamwar.bausystem.shared.ShowMode; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.Setter; -import org.bukkit.entity.TNTPrimed; -import org.bukkit.util.Vector; - -import java.util.ArrayList; -import java.util.List; - -@RequiredArgsConstructor -public class Record { - - @Getter - private final List tnt = new ArrayList<>(); - private final Region region; - private final long startTicks = TPSUtils.currentTick.get(); - - public int size() { - return tnt.size(); - } - - public void showAll(ShowMode traceShowMode) { - tnt.forEach(tntRecord -> tntRecord.getPositions().forEach(traceShowMode::show)); - } - - public TNTRecord spawn() { - TNTRecord record = new TNTRecord(this, region); - tnt.add(record); - return record; - } - - public void clear() { - tnt.clear(); - } - - private void checkMicroMotion(Vector explosionPosition) { - for (TNTRecord tntRecord : tnt) { - List positions = tntRecord.positions; - if (positions.isEmpty()) continue; - TNTPosition position = positions.get(positions.size() - 1); - if (position.isExploded()) continue; - if (position.getLocation().distanceSquared(explosionPosition) > 64) continue; - - Vector velocity = position.getVelocity(); - if (velocity.getY() == 0 && ((velocity.getX() != 0 && Math.abs(velocity.getX()) < 0.001) || (velocity.getZ() != 0 && Math.abs(velocity.getZ()) < 0.001))) { - if (!tntRecord.hasMicroMotion) { - positions.forEach(tntPosition -> TraceShowManager.show(region, tntPosition)); - } - tntRecord.hasMicroMotion = true; - position.setMicroMotion(true); - } - } - } - - public static class TNTRecord { - - @Getter - private int entityId; - - private Record record; - - @Getter - private final Region region; - - @Getter - private final List positions = new ArrayList<>(); - - @Getter - @Setter - private boolean inBuildArea = false; - - @Getter - @Setter - private boolean inTestblockArea = false; - - @Getter - private boolean hasMicroMotion = false; - - public TNTRecord(Record record, Region region) { - this.record = record; - this.region = region; - } - - public void source(TNTPrimed tntPrimed) { - add(tntPrimed, true, false); - } - - public void location(TNTPrimed tntPrimed) { - add(tntPrimed, false, false); - } - - public void explode(TNTPrimed tntPrimed) { - add(tntPrimed, false, true); - record.checkMicroMotion(tntPrimed.getLocation().toVector()); - } - - private void add(TNTPrimed tntPrimed, boolean source, boolean exploded) { - entityId = tntPrimed.getEntityId(); - - TNTPosition position; - if (positions.isEmpty()) { - position = new TNTPosition(this, tntPrimed, TPSUtils.currentTick.get() - record.startTicks, null, tntPrimed.getVelocity(), null, source, exploded); - } else { - TNTPosition tntPosition = positions.get(positions.size() - 1); - Vector lastVelocity = tntPrimed.getLocation().toVector().clone().subtract(tntPosition.getLocation()); - TNTPosition.UpdateOrder updateOrder = Math.abs(lastVelocity.getX()) >= Math.abs(lastVelocity.getZ()) ? TNTPosition.UpdateOrder.X : TNTPosition.UpdateOrder.Z; - position = new TNTPosition(this, tntPrimed, TPSUtils.currentTick.get() - record.startTicks, positions.get(positions.size() - 1).getLocation(), tntPrimed.getVelocity(), updateOrder, source, exploded); - } - positions.add(position); - TraceShowManager.show(region, position); - } - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/ShowModeParameter.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/ShowModeParameter.java deleted file mode 100644 index 72089326..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/ShowModeParameter.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2022 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.tracer.show; - -import lombok.Getter; - -@Getter -public class ShowModeParameter { - private boolean water = false; - private boolean interpolateY = false; - private boolean interpolateXZ = false; - private boolean sourceOnly = false; - private boolean explodeOnly = false; - private boolean fuse = false; - private boolean count = false; - private boolean buildDestroyOnly = false; - private boolean testblockDestroyOnly = false; - private boolean microMotion = false; - private boolean microMotionLocation = false; - private boolean entityId = false; - private boolean calculationOrder = false; - - public void enableWater() { - this.water = true; - } - - public void disableWater() { - this.water = false; - } - - public void enableInterpolateY() { - this.interpolateY = true; - } - - public void enableInterpolateXZ() { - this.interpolateXZ = true; - } - - public void enableSourceOnly() { - this.sourceOnly = true; - } - - public void enableExplodeOnly() { - this.explodeOnly = true; - } - - public void enableFuse() { - this.fuse = true; - } - - public void enableCount() { - this.count = true; - } - - public void enableBuildDestroyOnly() { - this.buildDestroyOnly = true; - } - - public void enableTestblockDestroyOnly() { - this.testblockDestroyOnly = true; - } - - public void enableMicroMotion() { - this.microMotion = true; - } - - public void enableMicroMotionLocation() { - this.microMotionLocation = true; - } - - public void enableEntityId() { - entityId = true; - } - - public void enableCalculationOrder() { - calculationOrder = true; - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/ShowModeParameterType.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/ShowModeParameterType.java deleted file mode 100644 index 763df5d4..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/ShowModeParameterType.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2022 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.tracer.show; - -import lombok.Getter; - -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.atomic.AtomicReference; -import java.util.function.Consumer; -import java.util.function.Supplier; - -public enum ShowModeParameterType { - - WATER(ShowModeParameter::enableWater, Arrays.asList("-water"), "EXPLODE", "SOURCE", "BUILD_DESTROY_ONLY"), - INTERPOLATE_Y(ShowModeParameter::enableInterpolateY, Arrays.asList("-interpolatey", "-interpolate-y", "-interpolate_y", "-y"), "ADVANCED"), - INTERPOLATE_XZ(ShowModeParameter::enableInterpolateXZ, Arrays.asList("-interpolatex", "-interpolate-x", "-interpolate_x", "-x", "-interpolatez", "-interpolate-z", "-interpolate_z", "-z", "-interpolatexz", "-interpolate-xz", "-interpolate_xz", "-xz"), "ADVANCED"), - ADVANCED(showModeParameter -> { - showModeParameter.enableInterpolateY(); - showModeParameter.enableInterpolateXZ(); - }, Arrays.asList("-advanced", "-a"), "INTERPOLATE_Y", "INTERPOLATE_XZ"), - SOURCE(ShowModeParameter::enableSourceOnly, Arrays.asList("-source", "-sourceonly", "-ignite"), "FUSE", "ADVANCED", "INTERPOLATE_Y", "INTERPOLATE_XZ", "WATER"), - EXPLODE(ShowModeParameter::enableExplodeOnly, Arrays.asList("-explode", "-explodeonly"), "FUSE", "ADVANCED", "INTERPOLATE_Y", "INTERPOLATE_XZ", "WATER"), - FUSE(ShowModeParameter::enableFuse, Arrays.asList("-fuse", "-f"), "EXPLODE", "SOURCE"), - COUNT(ShowModeParameter::enableCount, Arrays.asList("-count", "-c")), - BUILD_DESTROY_ONLY(ShowModeParameter::enableBuildDestroyOnly, Arrays.asList("-builddestroy", "-builddestoryonly"), "WATER", "TESTBLOCK_DESTROY_ONLY"), - TESTBLOCK_DESTROY_ONLY(ShowModeParameter::enableTestblockDestroyOnly, Arrays.asList("-testblockdestroy", "-testblockdestroyonly"), "WATER", "BUILD_DESTROY_ONLY"), - MICROMOTION(ShowModeParameter::enableMicroMotion, Arrays.asList("-micromotion", "-micro", "-m")), - MICROMOTION_LOCATION(ShowModeParameter::enableMicroMotionLocation, Arrays.asList("-micromotionloc", "-microloc", "-mloc", "-micromotionlocation", "-microlocation", "-mlocation")), - ENTITY_ID(ShowModeParameter::enableEntityId, Arrays.asList("-entityid", "-id")), - // CALCULATION_ORDER(ShowModeParameter::enableCalculationOrder, Arrays.asList("-calc", "-calcorder", "-calculation", "-calculationorder")), - ; - - @Getter - private final Consumer showModeParameterConsumer; - - @Getter - private List tabCompletes; - - @Getter - private final Supplier removed; - private AtomicReference cached = new AtomicReference<>(); - - ShowModeParameterType(Consumer showModeParameterConsumer, List tabCompletes, String... removed) { - this.showModeParameterConsumer = showModeParameterConsumer; - this.tabCompletes = tabCompletes; - this.removed = () -> { - if (cached.get() == null) { - ShowModeParameterType[] showModeParameterTypes = new ShowModeParameterType[removed.length]; - for (int i = 0; i < removed.length; i++) { - showModeParameterTypes[i] = ShowModeParameterType.valueOf(removed[i]); - } - cached.set(showModeParameterTypes); - return showModeParameterTypes; - } - return cached.get(); - }; - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/StoredRecords.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/StoredRecords.java deleted file mode 100644 index 91bc2272..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/StoredRecords.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2022 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.tracer.show; - -import de.steamwar.bausystem.features.tracer.TNTPosition; -import de.steamwar.bausystem.features.tracer.record.Recorder; -import de.steamwar.bausystem.region.Region; -import de.steamwar.bausystem.shared.ShowMode; -import lombok.experimental.UtilityClass; - -import java.util.*; -import java.util.function.Predicate; -import java.util.stream.Collectors; - -@UtilityClass -public class StoredRecords { - - private static final Map> records = new HashMap<>(); - - public static void add(Region region, Record record) { - records.computeIfAbsent(region, k -> new ArrayList<>()).add(record); - } - - public static void remove(Region region, Record record) { - records.computeIfAbsent(region, k -> new ArrayList<>()).remove(record); - } - - public static void clear(Region region) { - records.remove(region); - TraceShowManager.clear(region); - Recorder.INSTANCE.postClear(region); - } - - public static List getRecords() { - return records.values().stream() - .flatMap(Collection::stream) - .collect(Collectors.toList()); - } - - public static List getRecords(Region region) { - return records.getOrDefault(region, Collections.emptyList()); - } - - static void show(Region region, Predicate traceShowFilter, ShowMode traceShowMode) { - records.getOrDefault(region, new ArrayList<>()).forEach(record -> { - record.getTnt().forEach(tntRecord -> { - tntRecord.getPositions().stream() - .filter(traceShowFilter) - .forEach(traceShowMode::show); - }); - }); - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/TraceShowManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/TraceShowManager.java deleted file mode 100644 index 695c8115..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/TraceShowManager.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2022 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.tracer.show; - -import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.features.tracer.TNTPosition; -import de.steamwar.bausystem.region.Region; -import de.steamwar.bausystem.shared.ShowMode; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerQuitEvent; - -import java.util.HashMap; -import java.util.Map; -import java.util.function.Predicate; - -public class TraceShowManager implements Listener { - private TraceShowManager() { - } - - private static final Map>> showModes = new HashMap<>(); - private static final Map>> showFilters = new HashMap<>(); - - public static void show(Player player, ShowMode traceShowMode) { - Region region = Region.getRegion(player.getLocation()); - _hide(region, player, true); - - Map> regionalShowModes = showModes.computeIfAbsent(region, __ -> new HashMap<>()); - regionalShowModes.put(player, traceShowMode); - StoredRecords.show(region, getShowFilter(player, region), traceShowMode); - } - - public static void hide(Player player) { - Region region = Region.getRegion(player.getLocation()); - _hide(region, player, true); - - showFilters.getOrDefault(region, new HashMap<>()).remove(player); - } - - public static void setShowFilter(Player player, Predicate showFilter) { - Region region = Region.getRegion(player.getLocation()); - Map> regionShowFilters = showFilters.computeIfAbsent(region, __ -> new HashMap<>()); - if (showFilter == null) { - regionShowFilters.remove(player); - } else { - regionShowFilters.put(player, showFilter); - } - - _hide(region, player, false); - ShowMode showMode = showModes.computeIfAbsent(region, __ -> new HashMap<>()).computeIfAbsent(player, __ -> new EntityShowMode(player, new ShowModeParameter(), 16)); - StoredRecords.show(region, getShowFilter(player, region), showMode); - } - - public static void reshow(Region region) { - Map> regionalShowModes = showModes.get(region); - if (regionalShowModes == null) { - return; - } - for (Map.Entry> entry : regionalShowModes.entrySet()) { - entry.getValue().hide(); - StoredRecords.show(region, getShowFilter(entry.getKey(), region), entry.getValue()); - } - } - - private static void _hide(Region region, Player player, boolean remove) { - Map> regionalShowModes = showModes.get(region); - if (regionalShowModes == null) { - return; - } - ShowMode showMode; - if (remove) { - showMode = regionalShowModes.remove(player); - } else { - showMode = regionalShowModes.get(player); - } - if (showMode == null) { - return; - } - showMode.hide(); - } - - private static Predicate getShowFilter(Player player, Region region) { - return showFilters.getOrDefault(region, new HashMap<>()).getOrDefault(player, tntPosition -> true); - } - - /* Only to be called by record */ - static void show(Region region, TNTPosition tnt) { - Map> regionalShowModes = showModes.get(region); - if (regionalShowModes == null) { - return; - } - regionalShowModes.forEach((player, tntPositionShowMode) -> { - if (getShowFilter(player, region).test(tnt)) { - tntPositionShowMode.show(tnt); - } - }); - } - - /* Only to be called by StoredRecords */ - static void clear(Region region) { - Map> regionalShowModes = showModes.get(region); - if (regionalShowModes == null) { - return; - } - regionalShowModes.values().forEach(ShowMode::hide); - } - - /* Internal if player leaves*/ - static { - Bukkit.getPluginManager().registerEvents(new TraceShowManager(), BauSystem.getInstance()); - } - - @EventHandler - public void onLeave(PlayerQuitEvent event) { - showModes.forEach((region, playerShowModeMap) -> { - ShowMode showMode = playerShowModeMap.remove(event.getPlayer()); - if (showMode != null) showMode.hide(); - }); - showFilters.forEach((region, playerPredicateMap) -> { - playerPredicateMap.remove(event.getPlayer()); - }); - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceCommand.java deleted file mode 100644 index d99ed495..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TraceCommand.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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.tracer2; - -import de.steamwar.bausystem.region.Region; -import de.steamwar.command.SWCommand; -import de.steamwar.linkage.Linked; -import de.steamwar.linkage.LinkedInstance; -import org.bukkit.entity.Player; - -import java.util.Collections; -import java.util.HashSet; - -@Linked -public class TraceCommand extends SWCommand { - - @LinkedInstance - public Recorder recorder; - - int traceId = 0; - public TraceCommand(){super("tracetest");} - - @Register(value = "start") - public void test(Player player){ - Region region = Region.getRegion(player.getLocation()); - - traceId = recorder.startRecording(region); - System.out.println(traceId); - } - - @Register(value = "stop") - public void test2(Player player){ - Region region = Region.getRegion(player.getLocation()); - recorder.stopRecording(region); - Trace trace = recorder.manager.get(traceId); - if(trace != null) - System.out.println(trace.getRecords()); - } - - @Register(value = "show") - public void test3(Player player){ - Trace trace = recorder.manager.get(traceId); - trace.render(player, Collections.emptyList(), BundleFilter.DEFAULT); - } -} -- 2.39.5 From 40f4af2a06641f5cf6bf5345c67776917d85c2e7 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Thu, 29 Feb 2024 21:27:21 +0100 Subject: [PATCH 022/111] Started adapting laufbau --- .../laufbau/states/FilteringTracesState.java | 23 +++++++++++-------- .../laufbau/states/ProcessingTracesState.java | 21 +++++++++-------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/FilteringTracesState.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/FilteringTracesState.java index 55e4a0fa..1aafbcfd 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/FilteringTracesState.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/FilteringTracesState.java @@ -20,10 +20,12 @@ package de.steamwar.bausystem.features.slaves.laufbau.states; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.features.tracer.TNTPosition; +import de.steamwar.bausystem.features.tracer.Trace; +import de.steamwar.bausystem.features.tracer.TraceManager; import de.steamwar.bausystem.features.tracer.show.Record; import de.steamwar.bausystem.features.tracer.show.StoredRecords; import de.steamwar.bausystem.utils.FlatteningWrapper; +import de.steamwar.linkage.LinkedInstance; import lombok.Getter; import org.bukkit.Location; import org.bukkit.World; @@ -35,21 +37,24 @@ import java.util.function.BiPredicate; public class FilteringTracesState implements LaufbauState { + @LinkedInstance + TraceManager traceManager; private long start = System.currentTimeMillis(); private World world; private BiPredicate inRegionCheck; - private int totalRecord; - private List recordList; + private final int totalRecord; + + List traces; private List tntRecords = new ArrayList<>(); @Getter private List tntPositions = new ArrayList<>(); public FilteringTracesState(World world, BiPredicate inRegionCheck) { - recordList = new ArrayList<>(StoredRecords.getRecords()); - totalRecord = recordList.size(); + List traces = new ArrayList<>(traceManager.getAll()); + totalRecord = traces.size(); this.world = world; this.inRegionCheck = inRegionCheck; @@ -57,19 +62,19 @@ public class FilteringTracesState implements LaufbauState { @Override public String actionBarMessage(Player p) { - return BauSystem.MESSAGE.parse("LAUFBAU_SIMPLE_PROGRESS", p, BauSystem.MESSAGE.parse("LAUFBAU_STATE_FILTERING_TRACES", p), totalRecord - recordList.size(), totalRecord, eta(p, start, totalRecord - recordList.size(), totalRecord)); + return BauSystem.MESSAGE.parse("LAUFBAU_SIMPLE_PROGRESS", p, BauSystem.MESSAGE.parse("LAUFBAU_STATE_FILTERING_TRACES", p), totalRecord - traces.size(), totalRecord, eta(p, start, totalRecord - traces.size(), totalRecord)); } @Override public boolean hasNext() { - return !recordList.isEmpty() || !tntRecords.isEmpty(); + return !traces.isEmpty() || !tntRecords.isEmpty(); } @Override public void next() { if (tntRecords.isEmpty()) { - Record record = recordList.remove(0); - tntRecords.addAll(record.getTnt()); + Trace trace = traces.remove(0); + tntRecords.addAll(trace.getTnt()); } if (tntRecords.isEmpty()) { return; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java index 320efaaa..97970e40 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java @@ -21,9 +21,10 @@ package de.steamwar.bausystem.features.slaves.laufbau.states; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.slaves.laufbau.Cuboid; -import de.steamwar.bausystem.features.tracer.TNTPosition; +import de.steamwar.bausystem.features.tracer.TNTRecord; import de.steamwar.bausystem.region.Point; import lombok.Getter; +import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.util.Vector; @@ -35,7 +36,7 @@ public class ProcessingTracesState implements LaufbauState { private long start = System.currentTimeMillis(); private int totalCuboids; - private List tntPositionList; + private List tntPositionList; private BiPredicate inRegionCheck; private int factor; @@ -49,9 +50,9 @@ public class ProcessingTracesState implements LaufbauState { @Getter private Map> cuboidIntersectionCache = new HashMap<>(); - public ProcessingTracesState(List tntPositionList, BiPredicate inRegionCheck, int factor) { + public ProcessingTracesState(List tntPositionList, BiPredicate inRegionCheck, int factor) { this.tntPositionList = tntPositionList; - this.totalCuboids = tntPositionList.stream().mapToInt(tntPosition -> tntPosition.getPreviousLocation() == null ? 1 : 3).sum(); + this.totalCuboids = tntPositionList.stream().mapToInt(tntPosition -> tntPosition.getPrevious() == null ? 1 : 3).sum(); this.inRegionCheck = inRegionCheck; this.factor = factor; } @@ -72,21 +73,21 @@ public class ProcessingTracesState implements LaufbauState { Cuboid cuboid = toExpand.remove(0); expandCuboid(cuboid); } else { - TNTPosition tntPosition = tntPositionList.remove(0); + TNTRecord tntPosition = tntPositionList.remove(0); createCuboid(tntPosition); } } - private void createCuboid(TNTPosition tntPosition) { - Vector location = tntPosition.getLocation(); - Vector previousLocation = tntPosition.getPreviousLocation(); + private void createCuboid(TNTRecord tntPosition) { + Location location = tntPosition.getLocation(); + Location previousLocation = tntPosition.getPrevious().getLocation(); if (previousLocation == null) { toExpand.add(new Cuboid(location.getX() - 0.49, location.getY(), location.getZ() - 0.49, 0.98, 0.98, 0.98)); } else { - Vector movement = location.clone().subtract(previousLocation); + Location movement = location.clone().subtract(previousLocation); toExpand.add(new Cuboid(previousLocation.getX() - 0.49, Math.min(previousLocation.getY(), location.getY()), previousLocation.getZ() - 0.49, 0.98, Math.abs(movement.getY()) + 0.98, 0.98)); - if (tntPosition.getUpdateOrder() == TNTPosition.UpdateOrder.X) { + if (tntPosition.getVelocity().getX() >= tntPosition.getVelocity().getZ()) { toExpand.add(new Cuboid(Math.min(previousLocation.getX(), location.getX()) - 0.49, location.getY(), previousLocation.getZ() - 0.49, Math.abs(movement.getX()) + 0.98, 0.98, 0.98)); toExpand.add(new Cuboid(location.getX() - 0.49, location.getY(), Math.min(previousLocation.getZ(), location.getZ()) - 0.49, 0.98, 0.98, Math.abs(movement.getZ()) + 0.98)); } else { -- 2.39.5 From e71ccc31606d8e57e5309267cf0cae5a58eedb0a Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Fri, 1 Mar 2024 11:40:24 +0100 Subject: [PATCH 023/111] Replaced doubly linked list structure with ArrayList refrence, for tnt history --- .../bausystem/features/tracer/Recorder.java | 17 +++++----- .../bausystem/features/tracer/TNTRecord.java | 31 ++++++++++--------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java index d47dda8c..0e9e1d0a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java @@ -60,7 +60,7 @@ public class Recorder implements Listener { /** * Maps a tracked tnt entity to the last record taken of it */ - private final Map lastRecordMap = new HashMap<>(); + private final Map> historyMap = new HashMap<>(); public Recorder(){ BauSystem.runTaskTimer(BauSystem.getInstance(), this::record, 0, 1); @@ -86,11 +86,9 @@ public class Recorder implements Listener { activeTraces.remove(region); for(TNTPrimed tnt : trackedTNT.getOrDefault(region, Collections.emptyList())) - lastRecordMap.remove(tnt); + historyMap.remove(tnt); trackedTNT.put(region, new ArrayList<>()); - - } /** Internal methode to record all tracked TNT Entities @@ -112,13 +110,14 @@ public class Recorder implements Listener { * @param trace trace to record the tnt for */ private void record(TNTPrimed tntPrimed, Trace trace){ - TNTRecord lastRecord = lastRecordMap.getOrDefault(tntPrimed, null); + List history = historyMap.getOrDefault(tntPrimed, new ArrayList<>()); - TNTRecord record = new TNTRecord(tntPrimed, tntPrimed.getFuseTicks() == 0, TPSUtils.currentTick.get() - trace.getStartTime(), lastRecord); - if(lastRecord != null) - lastRecord.setNext(record); + if(historyMap.size() == 0) + historyMap.put(tntPrimed, history); + + TNTRecord record = new TNTRecord(tntPrimed, tntPrimed.getFuseTicks() == 0, TPSUtils.currentTick.get() - trace.getStartTime(), history); + history.add(record); - lastRecordMap.put(tntPrimed, record); trace.add(record); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java index 5969fcc8..2efc01e4 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java @@ -24,6 +24,9 @@ import org.bukkit.Location; import org.bukkit.entity.TNTPrimed; import org.bukkit.util.Vector; +import java.util.List; +import java.util.Optional; + @Getter public class TNTRecord { /** @@ -52,31 +55,29 @@ public class TNTRecord { private final Vector velocity; /** - * Reference to the last record having been taken of the tnt represented by this record + * List of all tnt records, that are represent the same tnt */ - private final TNTRecord previous; + private final List history; - /** - * Reference to the next record of the tnt represented by this record - */ - private TNTRecord next; - - public TNTRecord(TNTPrimed tnt, boolean explosion, long ticksSinceStart, TNTRecord previous){ + public TNTRecord(TNTPrimed tnt, boolean explosion, long ticksSinceStart, List history){ this.explosion = explosion; this.ticksSinceStart = ticksSinceStart; fuse = tnt.getFuseTicks(); location = tnt.getLocation(); velocity = tnt.getVelocity(); - this.previous = previous; + this.history = history; } + public Optional getNext(){ + int index = history.indexOf(this); - /** - * One call only function to set next - * @param next - */ - protected void setNext(TNTRecord next){ - if(this.next == null) this.next = next; + return index == history.size() - 1 ? Optional.empty() : Optional.of(history.get(index + 1)); + } + + public Optional getPrev(){ + int index = history.indexOf(this); + + return index == 0 ? Optional.empty() : Optional.of(history.get(index - 1)); } @Override -- 2.39.5 From eeb47f1d08b85e47d41b52c3432ecf227dcf1a55 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Fri, 1 Mar 2024 11:46:30 +0100 Subject: [PATCH 024/111] Added id to filter for records of same tnt --- .../steamwar/bausystem/features/tracer/Recorder.java | 12 +++++++++--- .../bausystem/features/tracer/TNTRecord.java | 10 +++++++++- .../de/steamwar/bausystem/features/tracer/Trace.java | 5 ++++- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java index 0e9e1d0a..5d20aaad 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java @@ -100,7 +100,7 @@ public class Recorder implements Listener { for(TNTPrimed tnt : trackedTNT.getOrDefault(region, Collections.emptyList())){ record(tnt, trace); } - trace.comitAdd(); + trace.commitAdd(); } } @@ -111,11 +111,17 @@ public class Recorder implements Listener { */ private void record(TNTPrimed tntPrimed, Trace trace){ List history = historyMap.getOrDefault(tntPrimed, new ArrayList<>()); + UUID tntID; - if(historyMap.size() == 0) + if(historyMap.size() == 0){ historyMap.put(tntPrimed, history); + tntID = UUID.randomUUID(); + } + else + tntID = history.get(0).getTntId(); - TNTRecord record = new TNTRecord(tntPrimed, tntPrimed.getFuseTicks() == 0, TPSUtils.currentTick.get() - trace.getStartTime(), history); + + TNTRecord record = new TNTRecord(tntID, tntPrimed, tntPrimed.getFuseTicks() == 0, TPSUtils.currentTick.get() - trace.getStartTime(), history); history.add(record); trace.add(record); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java index 2efc01e4..21327f67 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java @@ -26,9 +26,16 @@ import org.bukkit.util.Vector; import java.util.List; import java.util.Optional; +import java.util.UUID; @Getter public class TNTRecord { + + /** + * Unique number to identify records being of the same tnt + */ + private final UUID tntId; + /** * Whether this is a record of a tnt explosion or an entity */ @@ -59,7 +66,8 @@ public class TNTRecord { */ private final List history; - public TNTRecord(TNTPrimed tnt, boolean explosion, long ticksSinceStart, List history){ + public TNTRecord(UUID tntId, TNTPrimed tnt, boolean explosion, long ticksSinceStart, List history){ + this.tntId = tntId; this.explosion = explosion; this.ticksSinceStart = ticksSinceStart; fuse = tnt.getFuseTicks(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index 8c42b732..ef263188 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -81,7 +81,10 @@ public class Trace { newRecords.add(records); } - protected void comitAdd(){ + /** + * Commits the additions made to this trace and updates active renders of this trace + */ + protected void commitAdd(){ records.addAll(newRecords); for(Player player: serverMap.keySet()){ -- 2.39.5 From 48175de8d8f562b0eb6f638d362a51917d114d05 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Fri, 1 Mar 2024 22:08:34 +0100 Subject: [PATCH 025/111] Addapted laufbau for new trace api --- .../src/de/steamwar/bausystem/BauSystem.java | 1 - .../laufbau/states/FilteringTracesState.java | 29 +++++++++---------- .../laufbau/states/ProcessingTracesState.java | 5 ++-- .../bausystem/features/tracer/TNTRecord.java | 2 +- .../bausystem/features/tracer/Trace.java | 14 ++++++++- 5 files changed, 31 insertions(+), 20 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java index 218ae32f..88a46ddc 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java @@ -22,7 +22,6 @@ package de.steamwar.bausystem; import com.comphenix.tinyprotocol.TinyProtocol; import de.steamwar.bausystem.configplayer.Config; import de.steamwar.bausystem.features.tpslimit.TPSFreezeUtils; -import de.steamwar.bausystem.features.tracer2.TraceManager; import de.steamwar.bausystem.features.world.RamUsage; import de.steamwar.bausystem.linkage.LinkageUtils; import de.steamwar.bausystem.region.loader.PrototypeLoader; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/FilteringTracesState.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/FilteringTracesState.java index 1aafbcfd..3e91a85b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/FilteringTracesState.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/FilteringTracesState.java @@ -20,10 +20,9 @@ package de.steamwar.bausystem.features.slaves.laufbau.states; import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.features.tracer.TNTRecord; import de.steamwar.bausystem.features.tracer.Trace; import de.steamwar.bausystem.features.tracer.TraceManager; -import de.steamwar.bausystem.features.tracer.show.Record; -import de.steamwar.bausystem.features.tracer.show.StoredRecords; import de.steamwar.bausystem.utils.FlatteningWrapper; import de.steamwar.linkage.LinkedInstance; import lombok.Getter; @@ -47,10 +46,10 @@ public class FilteringTracesState implements LaufbauState { private final int totalRecord; List traces; - private List tntRecords = new ArrayList<>(); + private List> tntHistories = new ArrayList<>(); @Getter - private List tntPositions = new ArrayList<>(); + private List tntPositions = new ArrayList<>(); public FilteringTracesState(World world, BiPredicate inRegionCheck) { List traces = new ArrayList<>(traceManager.getAll()); @@ -67,29 +66,29 @@ public class FilteringTracesState implements LaufbauState { @Override public boolean hasNext() { - return !traces.isEmpty() || !tntRecords.isEmpty(); + return !traces.isEmpty() || !tntHistories.isEmpty(); } @Override public void next() { - if (tntRecords.isEmpty()) { + if (tntHistories.isEmpty()) { Trace trace = traces.remove(0); - tntRecords.addAll(trace.getTnt()); + tntHistories.addAll(trace.getHistories()); } - if (tntRecords.isEmpty()) { + if (tntHistories.isEmpty()) { return; } - Record.TNTRecord tntRecord = tntRecords.remove(0); - tntRecord.getPositions().forEach(tntPosition -> { - if (FlatteningWrapper.impl.inWater(world, tntPosition.getLocation())) { + List tntRecords = tntHistories.remove(0); + tntRecords.forEach(tntRecord -> { + if (FlatteningWrapper.impl.inWater(world, tntRecord.getLocation().toVector())) { return; } - if (inRegionCheck.test(tntPosition.getLocation().toLocation(world), 1)) { - tntPositions.add(tntPosition); + if (inRegionCheck.test(tntRecord.getLocation(), 1)) { + tntPositions.add(tntRecord); } - if (tntPosition.getPreviousLocation() != null && inRegionCheck.test(tntPosition.getPreviousLocation().toLocation(world), 1)) { - tntPositions.add(tntPosition); + if (tntRecord.getPrevious().isPresent() && inRegionCheck.test(tntRecord.getPrevious().get().getLocation(), 1)) { + tntPositions.add(tntRecord); } }); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java index 97970e40..b2a21dd9 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java @@ -80,11 +80,12 @@ public class ProcessingTracesState implements LaufbauState { private void createCuboid(TNTRecord tntPosition) { Location location = tntPosition.getLocation(); - Location previousLocation = tntPosition.getPrevious().getLocation(); + Optional previous = tntPosition.getPrevious(); - if (previousLocation == null) { + if (!previous.isPresent()) { toExpand.add(new Cuboid(location.getX() - 0.49, location.getY(), location.getZ() - 0.49, 0.98, 0.98, 0.98)); } else { + Location previousLocation = tntPosition.getPrevious().get().getLocation(); Location movement = location.clone().subtract(previousLocation); toExpand.add(new Cuboid(previousLocation.getX() - 0.49, Math.min(previousLocation.getY(), location.getY()), previousLocation.getZ() - 0.49, 0.98, Math.abs(movement.getY()) + 0.98, 0.98)); if (tntPosition.getVelocity().getX() >= tntPosition.getVelocity().getZ()) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java index 21327f67..02cc8974 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java @@ -82,7 +82,7 @@ public class TNTRecord { return index == history.size() - 1 ? Optional.empty() : Optional.of(history.get(index + 1)); } - public Optional getPrev(){ + public Optional getPrevious(){ int index = history.indexOf(this); return index == 0 ? Optional.empty() : Optional.of(history.get(index - 1)); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index ef263188..efd822e8 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -105,7 +105,19 @@ public class Trace { this.records = records; } - //TODO default options + /** + * + */ + public Set> getHistories() { + Set> histories = new HashSet<>(); + + for(TNTRecord record: records) { + histories.add(record.getHistory()); + } + + return histories; + } + /** Renders this traces * * @param player The player the trace is rendered to -- 2.39.5 From c03fbb65e67fe67304c58e5d6fb0990095827b1a Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Fri, 1 Mar 2024 23:06:36 +0100 Subject: [PATCH 026/111] Refactored view flag to be abstract class --- .../features/tracer/TraceCommand.java | 16 ++++++----- .../features/tracer/rendering/ViewFlag.java | 27 ++++++++++++------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index f2f05237..95954c98 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -101,18 +101,22 @@ public class TraceCommand extends SWCommand { return new TypeMapper() { @Override public ViewFlag map(CommandSender commandSender, String[] previousArguments, String s) { - for(ViewFlag filter: ViewFlag.values()) { - if (s.equals("--" + filter.toString().toLowerCase())) - return filter; + for(ViewFlag flag: ViewFlag.flags) { + if (s.equals("--" + flag.name)) + return flag; + + for(String alias: flag.aliases) + if (s.equals("--" + alias)) + return flag; } return null; } @Override public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) { - return Arrays.stream(ViewFlag.values()) - .map(Enum::toString) - .map(string -> "--" + string.toLowerCase()) + return ViewFlag.flags.stream() + .map(viewFlag -> viewFlag.name) + .map(name -> "--" + name) .collect(Collectors.toList()); } }; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java index 92726c26..04833f09 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java @@ -28,14 +28,7 @@ import java.util.List; import java.util.function.BiConsumer; import java.util.function.UnaryOperator; -public enum ViewFlag { - EXPLOSION((List records) ->{ - List ret = new ArrayList<>(); - for(TNTRecord record : records) - if(record.isExplosion()) - ret.add(record); - return ret; - }, (REntityServer server , List entities) -> {}); +public abstract class ViewFlag { /** * The filtering part of the flag @@ -47,8 +40,24 @@ public enum ViewFlag { */ public final BiConsumer> modify; - ViewFlag(UnaryOperator> filter, BiConsumer> modify) { + /** + * Name of the flag + */ + public final String name; + + /** + * Aliases of the flag + */ + public final String[] aliases; + + public static final List flags = new ArrayList<>(); + + public ViewFlag(UnaryOperator> filter, BiConsumer> modify, boolean isStatic, String name, String... aliases) { this.filter = filter; this.modify = modify; + this.name = name; + this.aliases = aliases; + if(isStatic) + flags.add(this); } } -- 2.39.5 From 1094f4a979061c273ff2fbc2851790655ef6e96d Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Fri, 1 Mar 2024 23:19:11 +0100 Subject: [PATCH 027/111] Readded Explosion Flag --- .../bausystem/features/tracer/Trace.java | 4 +- .../features/tracer/rendering/ViewFlag.java | 40 ++++++++++++++----- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index efd822e8..30b4c2b4 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -158,7 +158,7 @@ public class Trace { //Apply filters for(ViewFlag flag : flags) - workingRecords = flag.filter.apply(workingRecords); + workingRecords = flag.filter(workingRecords); //Bundle records at unique positions List> bundles = bundleRecords(workingRecords, bundleFilter); @@ -171,7 +171,7 @@ public class Trace { //Apply modifiers for(ViewFlag flag : flags) - flag.modify.accept(server, entities); + flag.modify(server, entities); } /** Bundles the passed TNTRecords based on whether they are at the same location diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java index 04833f09..d2a2c2bc 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java @@ -27,18 +27,21 @@ import java.util.ArrayList; import java.util.List; import java.util.function.BiConsumer; import java.util.function.UnaryOperator; +import java.util.stream.Collectors; public abstract class ViewFlag { - /** - * The filtering part of the flag - */ - public final UnaryOperator> filter; + public static ViewFlag EXPLOSION = new ViewFlag(true,"explosion") { + @Override + public List filter(List records) { + return records.stream() + .filter(TNTRecord::isExplosion) + .collect(Collectors.toList()); + } - /** - * The modifieng part of the flag - */ - public final BiConsumer> modify; + @Override + public void modify(REntityServer server, List entities) {} + }; /** * Name of the flag @@ -50,14 +53,29 @@ public abstract class ViewFlag { */ public final String[] aliases; + /** + * Static registry of static flags + */ public static final List flags = new ArrayList<>(); - public ViewFlag(UnaryOperator> filter, BiConsumer> modify, boolean isStatic, String name, String... aliases) { - this.filter = filter; - this.modify = modify; + public ViewFlag(boolean isStatic, String name, String... aliases) { this.name = name; this.aliases = aliases; if(isStatic) flags.add(this); } + + /** Filters the given records for a given condition + * + * @param records Records to be filtered + * @return Filtered records + */ + public abstract List filter (List records); + + /** Modifies the trace rendering + * + * @param server the server the trace is rendered on + * @param entities the entities representing tnts + */ + public abstract void modify (REntityServer server, List entities); } -- 2.39.5 From 0c37cfc3bb5ee0c84f93ab2d2472143a8f2a3552 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Fri, 1 Mar 2024 23:48:53 +0100 Subject: [PATCH 028/111] Readded auto-trace --- .../bausystem/features/tracer/Recorder.java | 34 +++++++++++++--- .../features/tracer/TraceManager.java | 40 +++++++------------ 2 files changed, 42 insertions(+), 32 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java index 5d20aaad..2a4d541f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java @@ -43,12 +43,12 @@ public class Recorder implements Listener { public TraceManager manager; /** - * Map for all traces beeing activly recorded + * Map for all traces being actively recorded */ private final Map activeTraces = new HashMap<>(); /** - * Map for all tnts being traced, by region + * Map for all TNTs being traced, by region */ private final Map> trackedTNT = new HashMap<>(); @@ -58,22 +58,39 @@ public class Recorder implements Listener { private final Map tntSpawnRegion = new HashMap<>(); /** - * Maps a tracked tnt entity to the last record taken of it + * Maps a tracked tnt entity to its entire recording history */ private final Map> historyMap = new HashMap<>(); + /** + * Regions where auto-trace is enabled + */ + private final Set autoTraceRegions = new HashSet<>(); + public Recorder(){ BauSystem.runTaskTimer(BauSystem.getInstance(), this::record, 0, 1); } + /** Toggles auto trace for the given region + * + * @param region + */ + public void toggleAutoTrace(Region region) { + if (autoTraceRegions.contains(region)) + autoTraceRegions.remove(region); + else + autoTraceRegions.add(region); + } + /** Starts a recording at the given region * * @param region region to be recorded + * @ */ - public int startRecording(Region region){ + public void startRecording(Region region){ + if(activeTraces.containsKey(region)) return; Trace trace = new Trace(region); activeTraces.put(region, trace); - return manager.add(trace); } /** Stops the recording at the given region @@ -81,7 +98,8 @@ public class Recorder implements Listener { * @param region region to stop recording */ public void stopRecording(Region region){ - Trace trace = activeTraces.get(region); + Trace trace = activeTraces.getOrDefault(region, null); + if (trace == null) return; trace.setRecords(Collections.unmodifiableList(trace.getRecords())); activeTraces.remove(region); @@ -136,6 +154,10 @@ public class Recorder implements Listener { if(!(event.getEntity() instanceof TNTPrimed)) return; Region region = Region.getRegion(event.getLocation()); + + if(autoTraceRegions.contains(region) && !activeTraces.containsKey(region)) + startRecording(region); + if(activeTraces.containsKey(region)){ //Check whether set for tracking already exists. Creating it if necessary if(!trackedTNT.containsKey(region)) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index a00e6ce3..f697bb69 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -29,33 +29,24 @@ import java.util.stream.Collectors; @Linked public class TraceManager implements Listener { /** - * Map of all current traces + * List of all current traces */ - private final Map traces = new HashMap<>(); - - /** - * Utility variable to keep track of the next open trace id - */ - private int currOpenId = 0; + private final List traces = new ArrayList<>(); /** Adds a new trace to the global record * * @param trace Trace to be added - * @return id of the newly added trace */ - protected int add(Trace trace){ - int id = currOpenId; - traces.put(id, trace); - currOpenId++; - return id; + protected void add(Trace trace){ + traces.add(trace); } /** Removes the trace with the given id * - * @param id Id of the trace to be removed + * @param index index of the trace to be removed */ - public void remove(int id){ - traces.remove(id); + public void remove(int index){ + traces.remove(index); } /** Clears all traces @@ -63,7 +54,6 @@ public class TraceManager implements Listener { */ public void clear(){ traces.clear(); - currOpenId = 0; } /** Methode to get all traces in a certain region @@ -72,21 +62,19 @@ public class TraceManager implements Listener { * @return All traces recorded in the given Region */ public Set get(Region region){ - return traces.values() - .stream() + return traces.stream() .filter((Trace trace) -> trace.getRegion() == region) .collect(Collectors.toSet()); } /** Methode to get the trace with specific id * - * @param id id of the trace + * @param index index of the trace * @return the trace with given id or null if no trace with id is found */ - public Optional get(int id){ - Trace ret = traces.get(id); - if(traces.containsKey(id)) - return Optional.of(traces.get(id)); + public Optional get(int index){ + if(index < traces.size()) + return Optional.of(traces.get(index)); return Optional.empty(); } @@ -94,7 +82,7 @@ public class TraceManager implements Listener { * * @return fresh set of all current traces */ - public Set getAll(){ - return new HashSet<>(traces.values()); + public List getAll(){ + return new ArrayList<>(traces); } } -- 2.39.5 From fccdcb2519cb033d39f0ccef892f681deb894c66 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Sat, 2 Mar 2024 21:19:52 +0100 Subject: [PATCH 029/111] Made auto-traces finish --- .../bausystem/features/tracer/Recorder.java | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java index 2a4d541f..a94109ed 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java @@ -67,8 +67,22 @@ public class Recorder implements Listener { */ private final Set autoTraceRegions = new HashSet<>(); + /** + * Counters for how long no tnt was seen in an active auto trace region + */ + private final Map noTntRecordedCounter = new HashMap<>(); + + /** + * Amount of ticks, after wich an auto-trace is stopped, if no tnt where seen + */ + private final long AUTO_TRACE_STOP_TRESHHOLD = 120; + public Recorder(){ - BauSystem.runTaskTimer(BauSystem.getInstance(), this::record, 0, 1); + BauSystem.runTaskTimer(BauSystem.getInstance(), () -> { + noTntRecordedCounter.replaceAll((region, counter) -> counter + 1); + record(); + checkForAutoTraceFinish(); + }, 0, 1); } /** Toggles auto trace for the given region @@ -82,13 +96,24 @@ public class Recorder implements Listener { autoTraceRegions.add(region); } + /** Makes checks for whether auto traces finished + * + */ + public void checkForAutoTraceFinish(){ + for(Region region: autoTraceRegions) + if(autoTraceRegions.contains(region) && noTntRecordedCounter.get(region) > AUTO_TRACE_STOP_TRESHHOLD){ + stopRecording(region); + autoTraceRegions.remove(region); + } + } + /** Starts a recording at the given region * * @param region region to be recorded - * @ */ public void startRecording(Region region){ if(activeTraces.containsKey(region)) return; + if(autoTraceRegions.contains(region)) noTntRecordedCounter.put(region, 0); Trace trace = new Trace(region); activeTraces.put(region, trace); } @@ -115,6 +140,9 @@ public class Recorder implements Listener { private void record(){ for(Region region : activeTraces.keySet()){ Trace trace = activeTraces.get(region); + if(trackedTNT.getOrDefault(region, Collections.emptyList()).size() > 0) + noTntRecordedCounter.put(region, 0); + for(TNTPrimed tnt : trackedTNT.getOrDefault(region, Collections.emptyList())){ record(tnt, trace); } -- 2.39.5 From 8aa0ee4d9db95323a1ff2865929401918f5a8054 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Sat, 2 Mar 2024 21:35:09 +0100 Subject: [PATCH 030/111] Updated simulator fo new trace api --- .../features/simulator/TNTSimulator.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulator.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulator.java index a3076b9c..ef00d521 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulator.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulator.java @@ -26,15 +26,14 @@ import de.steamwar.bausystem.features.simulator.gui.TNTSimulatorGui; import de.steamwar.bausystem.features.simulator.tnt.SimulatorElement; import de.steamwar.bausystem.features.simulator.tnt.TNTElement; import de.steamwar.bausystem.features.simulator.tnt.TNTGroup; -import de.steamwar.bausystem.features.tracer.record.Recorder; -import de.steamwar.bausystem.features.tracer.record.SingleTraceRecorder; +import de.steamwar.bausystem.features.tracer.Recorder; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.shared.Pair; import de.steamwar.bausystem.utils.RayTraceUtils; import de.steamwar.entity.REntity; import de.steamwar.entity.REntityServer; +import de.steamwar.linkage.LinkedInstance; import lombok.Getter; -import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Player; import yapion.hierarchy.types.YAPIONArray; @@ -56,6 +55,11 @@ public class TNTSimulator { private List tntElementList = new ArrayList<>(); + @LinkedInstance + public Recorder traceRecorder; + + private Region autoTraceRegion; + public TNTSimulator() { } @@ -225,7 +229,8 @@ public class TNTSimulator { } }); if (needsAutoTrace.get()) { - Recorder.INSTANCE.set(region, new SingleTraceRecorder()); + traceRecorder.startRecording(region); + autoTraceRegion = region; } AtomicInteger maxTick = new AtomicInteger(0); @@ -247,7 +252,11 @@ public class TNTSimulator { AtomicInteger currentTick = new AtomicInteger(0); BauSystem.runTaskTimer(BauSystem.getInstance(), bukkitTask -> { int tick = currentTick.get(); - if (tick > maxTick.get()) bukkitTask.cancel(); + if (tick > maxTick.get()) { + traceRecorder.stopRecording(autoTraceRegion); + autoTraceRegion = null; + bukkitTask.cancel(); + } currentTick.incrementAndGet(); List>> toSpawnInTick = toSpawn.get(tick); -- 2.39.5 From e4346a36e1528829ab372186fda177eb71a6c803 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Sat, 2 Mar 2024 21:35:51 +0100 Subject: [PATCH 031/111] Temporarily removed trace from lua api --- .../features/script/lua/libs/RegionLib.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/lua/libs/RegionLib.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/lua/libs/RegionLib.java index f6c35f9f..17c07230 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/lua/libs/RegionLib.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/lua/libs/RegionLib.java @@ -20,9 +20,6 @@ package de.steamwar.bausystem.features.script.lua.libs; import de.steamwar.bausystem.features.loader.Loader; -import de.steamwar.bausystem.features.tracer.record.ActiveTracer; -import de.steamwar.bausystem.features.tracer.record.AutoTraceRecorder; -import de.steamwar.bausystem.features.tracer.record.Recorder; import de.steamwar.bausystem.region.GlobalRegion; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.flags.Flag; @@ -71,13 +68,13 @@ public class RegionLib implements LuaLib { table.set("freeze", getter(() -> region.get().getPlain(Flag.FREEZE, FreezeMode.class) == FreezeMode.ACTIVE)); table.set("protect", getter(() -> region.get().getPlain(Flag.PROTECT, ProtectMode.class) == ProtectMode.ACTIVE)); - LuaValue traceLib = LuaValue.tableOf(); - traceLib.set("active", getter(() -> !region.get().isGlobal() && Recorder.INSTANCE.get(region.get()) instanceof ActiveTracer)); - traceLib.set("auto", getter(() -> !region.get().isGlobal() && Recorder.INSTANCE.get(region.get()) instanceof AutoTraceRecorder)); - traceLib.set("status", getter(() -> Recorder.INSTANCE.get(region.get()).scriptState())); - traceLib.set("time", getter(() -> Recorder.INSTANCE.get(region.get()).scriptTime())); + //LuaValue traceLib = LuaValue.tableOf(); + //traceLib.set("active", getter(() -> !region.get().isGlobal() && Recorder.INSTANCE.get(region.get()) instanceof ActiveTracer)); + //traceLib.set("auto", getter(() -> !region.get().isGlobal() && Recorder.INSTANCE.get(region.get()) instanceof AutoTraceRecorder)); + //traceLib.set("status", getter(() -> Recorder.INSTANCE.get(region.get()).scriptState())); + //traceLib.set("time", getter(() -> Recorder.INSTANCE.get(region.get()).scriptTime())); - table.set("trace", traceLib); + //table.set("trace", traceLib); Loader loader = Loader.getLoader(player); table.set("loader", getter(() -> loader == null ? "OFF" : loader.getStage().name())); -- 2.39.5 From ccf155d5008def64ff3efaa8439fb1c10a4dc6f9 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Sat, 2 Mar 2024 21:51:49 +0100 Subject: [PATCH 032/111] Fixed flag static init order leading to null pointer exeption --- .../steamwar/bausystem/features/tracer/TraceCommand.java | 4 ++-- .../bausystem/features/tracer/rendering/ViewFlag.java | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index 95954c98..f048e1be 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -34,6 +34,7 @@ import org.bukkit.entity.Player; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.List; import java.util.stream.Collectors; @Linked @@ -111,11 +112,10 @@ public class TraceCommand extends SWCommand { } return null; } - @Override public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) { return ViewFlag.flags.stream() - .map(viewFlag -> viewFlag.name) + .map(flag -> flag.name) .map(name -> "--" + name) .collect(Collectors.toList()); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java index d2a2c2bc..bc838b5d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java @@ -30,6 +30,10 @@ import java.util.function.UnaryOperator; import java.util.stream.Collectors; public abstract class ViewFlag { + /** + * Static registry of static flags + */ + public static final List flags = new ArrayList<>(); public static ViewFlag EXPLOSION = new ViewFlag(true,"explosion") { @Override @@ -53,11 +57,6 @@ public abstract class ViewFlag { */ public final String[] aliases; - /** - * Static registry of static flags - */ - public static final List flags = new ArrayList<>(); - public ViewFlag(boolean isStatic, String name, String... aliases) { this.name = name; this.aliases = aliases; -- 2.39.5 From 75edfc8375e3be3ec27c816506f01495198b52ab Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Sat, 2 Mar 2024 22:10:36 +0100 Subject: [PATCH 033/111] Made for easier interfacing with api by allowing to toggle show from manager --- .../bausystem/features/tracer/Trace.java | 2 + .../features/tracer/TraceCommand.java | 15 +++++--- .../features/tracer/TraceManager.java | 38 +++++++++++++++++++ 3 files changed, 49 insertions(+), 6 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index 30b4c2b4..97cff2f5 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -217,6 +217,8 @@ public class Trace { REntityServer server = serverMap.get(player); if(server == null) return; + bundleFilterMap.remove(player); + viewFlagMap.remove(player); server.close(); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index f048e1be..fd4f9eab 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -60,17 +60,20 @@ public class TraceCommand extends SWCommand { BauSystem.MESSAGE.send("TRACE_MESSAGE_STOP", player); } + @Register(value = "auto", description = "TRACE_COMMAND_HELP_SHOW") + public void auto (Player player) { + Region region = Region.getRegion(player.getLocation()); + recorder.toggleAutoTrace(region); + } + @Register(value = "show", description = "TRACE_COMMAND_HELP_SHOW") public void show(Player player, @OptionalValue("STRICT") BundleFilter filter, ViewFlag... flags){ - Region region = Region.getRegion(player.getLocation()); - - for(Trace trace : manager.get(region)){ - trace.render(player, flags, filter); - } - + manager.show(player, flags, filter); BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW", player); } + + @ClassMapper(value = BundleFilter.class, local = true) public TypeMapper bundleFilterClassMapper() { return new TypeMapper() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index f697bb69..eebcda5c 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -19,9 +19,14 @@ package de.steamwar.bausystem.features.tracer; +import de.steamwar.bausystem.features.tracer.rendering.BundleFilter; +import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; import de.steamwar.bausystem.region.Region; import de.steamwar.linkage.Linked; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerQuitEvent; import java.util.*; import java.util.stream.Collectors; @@ -33,11 +38,23 @@ public class TraceManager implements Listener { */ private final List traces = new ArrayList<>(); + /** + * A map saving the view flags used by Players + */ + private final Map viewFlagMap = new HashMap<>(); + + /** + * A map saving the bundle filter used by Players + */ + private final Map bundleFilterMap = new HashMap<>(); + /** Adds a new trace to the global record * * @param trace Trace to be added */ protected void add(Trace trace){ + for(Player player: viewFlagMap.keySet()) + trace.render(player, viewFlagMap.get(player), bundleFilterMap.get(player)); traces.add(trace); } @@ -46,6 +63,8 @@ public class TraceManager implements Listener { * @param index index of the trace to be removed */ public void remove(int index){ + for(Player player: viewFlagMap.keySet()) + traces.get(index).hide(player); traces.remove(index); } @@ -53,6 +72,9 @@ public class TraceManager implements Listener { * */ public void clear(){ + for (Player player: viewFlagMap.keySet()) + for(Trace trace: traces) + trace.hide(player); traces.clear(); } @@ -85,4 +107,20 @@ public class TraceManager implements Listener { public List getAll(){ return new ArrayList<>(traces); } + + public void show(Player player, ViewFlag[] viewFlags, BundleFilter bundleFilter) { + viewFlagMap.put(player, viewFlags); + bundleFilterMap.put(player, bundleFilter); + + for(Trace trace: traces) + trace.render(player, viewFlags, bundleFilter); + } + + public void hide(Player player){ + for(Trace trace: traces) + trace.hide(player); + + viewFlagMap.remove(player); + bundleFilterMap.remove(player); + }; } -- 2.39.5 From 335e2cc437864d8841cf35b3272fab260f593e3d Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Sat, 2 Mar 2024 22:11:46 +0100 Subject: [PATCH 034/111] Added docs --- .../bausystem/features/tracer/TraceManager.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index eebcda5c..74709433 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -108,6 +108,12 @@ public class TraceManager implements Listener { return new ArrayList<>(traces); } + /** Toggles trace show on for player + * + * @param player + * @param viewFlags + * @param bundleFilter + */ public void show(Player player, ViewFlag[] viewFlags, BundleFilter bundleFilter) { viewFlagMap.put(player, viewFlags); bundleFilterMap.put(player, bundleFilter); @@ -116,6 +122,10 @@ public class TraceManager implements Listener { trace.render(player, viewFlags, bundleFilter); } + /** Toggles trace show of for player + * + * @param player + */ public void hide(Player player){ for(Trace trace: traces) trace.hide(player); -- 2.39.5 From 6ec62d97209c09ed4c8a00f1c2be9f1734a3b431 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Sat, 2 Mar 2024 22:14:56 +0100 Subject: [PATCH 035/111] Reintroduced trace id --- .../features/tracer/TraceManager.java | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index 74709433..71f6a3ef 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -36,7 +36,7 @@ public class TraceManager implements Listener { /** * List of all current traces */ - private final List traces = new ArrayList<>(); + private final Map traces = new HashMap<>(); /** * A map saving the view flags used by Players @@ -48,6 +48,11 @@ public class TraceManager implements Listener { */ private final Map bundleFilterMap = new HashMap<>(); + /** + * Utility variable to keep track of the next open trace id; + */ + private int nextOpenId = 0; + /** Adds a new trace to the global record * * @param trace Trace to be added @@ -55,17 +60,18 @@ public class TraceManager implements Listener { protected void add(Trace trace){ for(Player player: viewFlagMap.keySet()) trace.render(player, viewFlagMap.get(player), bundleFilterMap.get(player)); - traces.add(trace); + traces.put(nextOpenId, trace); + nextOpenId++; } /** Removes the trace with the given id * - * @param index index of the trace to be removed + * @param id id of the trace to be removed */ - public void remove(int index){ + public void remove(int id){ for(Player player: viewFlagMap.keySet()) - traces.get(index).hide(player); - traces.remove(index); + traces.get(id).hide(player); + traces.remove(id); } /** Clears all traces @@ -73,9 +79,10 @@ public class TraceManager implements Listener { */ public void clear(){ for (Player player: viewFlagMap.keySet()) - for(Trace trace: traces) + for(Trace trace: traces.values()) trace.hide(player); traces.clear(); + nextOpenId = 0; } /** Methode to get all traces in a certain region @@ -84,7 +91,7 @@ public class TraceManager implements Listener { * @return All traces recorded in the given Region */ public Set get(Region region){ - return traces.stream() + return traces.values().stream() .filter((Trace trace) -> trace.getRegion() == region) .collect(Collectors.toSet()); } @@ -102,10 +109,10 @@ public class TraceManager implements Listener { /** Methode to get all traces * - * @return fresh set of all current traces + * @return fresh list of all current traces */ public List getAll(){ - return new ArrayList<>(traces); + return new ArrayList<>(traces.values()); } /** Toggles trace show on for player @@ -118,7 +125,7 @@ public class TraceManager implements Listener { viewFlagMap.put(player, viewFlags); bundleFilterMap.put(player, bundleFilter); - for(Trace trace: traces) + for(Trace trace: traces.values()) trace.render(player, viewFlags, bundleFilter); } @@ -127,7 +134,7 @@ public class TraceManager implements Listener { * @param player */ public void hide(Player player){ - for(Trace trace: traces) + for(Trace trace: traces.values()) trace.hide(player); viewFlagMap.remove(player); -- 2.39.5 From 4620e83a8273b0a083ef5955474453289c802d3e Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Sat, 2 Mar 2024 22:18:04 +0100 Subject: [PATCH 036/111] Reintroduced id return on trace recording start --- .../src/de/steamwar/bausystem/features/tracer/Recorder.java | 5 +++-- .../de/steamwar/bausystem/features/tracer/TraceManager.java | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java index a94109ed..0020b3fd 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java @@ -111,11 +111,12 @@ public class Recorder implements Listener { * * @param region region to be recorded */ - public void startRecording(Region region){ - if(activeTraces.containsKey(region)) return; + public int startRecording(Region region){ + if(activeTraces.containsKey(region)) return -1; if(autoTraceRegions.contains(region)) noTntRecordedCounter.put(region, 0); Trace trace = new Trace(region); activeTraces.put(region, trace); + return manager.add(trace); } /** Stops the recording at the given region diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index 71f6a3ef..8308b7b5 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -56,12 +56,14 @@ public class TraceManager implements Listener { /** Adds a new trace to the global record * * @param trace Trace to be added + * @return id of the created trace */ - protected void add(Trace trace){ + protected int add(Trace trace){ for(Player player: viewFlagMap.keySet()) trace.render(player, viewFlagMap.get(player), bundleFilterMap.get(player)); traces.put(nextOpenId, trace); nextOpenId++; + return nextOpenId--; } /** Removes the trace with the given id -- 2.39.5 From 1cbe6141715d24c0fab6e412ff87bd0c9e96679b Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Sun, 3 Mar 2024 22:18:31 +0100 Subject: [PATCH 037/111] Fixed nullpointer in auto trace finish check --- .../src/de/steamwar/bausystem/features/tracer/Recorder.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java index 0020b3fd..5fe0a99e 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java @@ -101,7 +101,7 @@ public class Recorder implements Listener { */ public void checkForAutoTraceFinish(){ for(Region region: autoTraceRegions) - if(autoTraceRegions.contains(region) && noTntRecordedCounter.get(region) > AUTO_TRACE_STOP_TRESHHOLD){ + if(autoTraceRegions.contains(region) && noTntRecordedCounter.get(region) != null && noTntRecordedCounter.get(region) > AUTO_TRACE_STOP_TRESHHOLD){ stopRecording(region); autoTraceRegions.remove(region); } @@ -160,7 +160,7 @@ public class Recorder implements Listener { List history = historyMap.getOrDefault(tntPrimed, new ArrayList<>()); UUID tntID; - if(historyMap.size() == 0){ + if(history.size() == 0){ historyMap.put(tntPrimed, history); tntID = UUID.randomUUID(); } @@ -169,7 +169,7 @@ public class Recorder implements Listener { TNTRecord record = new TNTRecord(tntID, tntPrimed, tntPrimed.getFuseTicks() == 0, TPSUtils.currentTick.get() - trace.getStartTime(), history); - history.add(record); + history.add(record); trace.add(record); } -- 2.39.5 From 8781da6a3d267e5a7c9c8c5d5a44b38dcb5269d6 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Fri, 8 Mar 2024 22:06:07 +0100 Subject: [PATCH 038/111] Added hide command --- .../de/steamwar/bausystem/features/tracer/TraceCommand.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index fd4f9eab..50aa92d8 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -72,6 +72,12 @@ public class TraceCommand extends SWCommand { BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW", player); } + @Register(value = "hide", description = "TRACE_COMMAND_HELP_SHOW") + public void hide(Player player){ + manager.hide(player); + BauSystem.MESSAGE.send("TRACE_MESSAGE_HIDE", player); + } + @ClassMapper(value = BundleFilter.class, local = true) -- 2.39.5 From dfd20f03b69746257b5f90fad57f8f7f1bfaf5d4 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Tue, 12 Mar 2024 15:20:38 +0100 Subject: [PATCH 039/111] Fixed auto trace --- .../bausystem/features/tracer/Recorder.java | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java index 5fe0a99e..dd2638c0 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java @@ -67,19 +67,8 @@ public class Recorder implements Listener { */ private final Set autoTraceRegions = new HashSet<>(); - /** - * Counters for how long no tnt was seen in an active auto trace region - */ - private final Map noTntRecordedCounter = new HashMap<>(); - - /** - * Amount of ticks, after wich an auto-trace is stopped, if no tnt where seen - */ - private final long AUTO_TRACE_STOP_TRESHHOLD = 120; - public Recorder(){ BauSystem.runTaskTimer(BauSystem.getInstance(), () -> { - noTntRecordedCounter.replaceAll((region, counter) -> counter + 1); record(); checkForAutoTraceFinish(); }, 0, 1); @@ -100,11 +89,11 @@ public class Recorder implements Listener { * */ public void checkForAutoTraceFinish(){ - for(Region region: autoTraceRegions) - if(autoTraceRegions.contains(region) && noTntRecordedCounter.get(region) != null && noTntRecordedCounter.get(region) > AUTO_TRACE_STOP_TRESHHOLD){ + for(Region region: autoTraceRegions) { + if (autoTraceRegions.contains(region) && trackedTNT.getOrDefault(region, Collections.emptyList()).size() == 0) { stopRecording(region); - autoTraceRegions.remove(region); } + } } /** Starts a recording at the given region @@ -113,7 +102,6 @@ public class Recorder implements Listener { */ public int startRecording(Region region){ if(activeTraces.containsKey(region)) return -1; - if(autoTraceRegions.contains(region)) noTntRecordedCounter.put(region, 0); Trace trace = new Trace(region); activeTraces.put(region, trace); return manager.add(trace); @@ -141,8 +129,6 @@ public class Recorder implements Listener { private void record(){ for(Region region : activeTraces.keySet()){ Trace trace = activeTraces.get(region); - if(trackedTNT.getOrDefault(region, Collections.emptyList()).size() > 0) - noTntRecordedCounter.put(region, 0); for(TNTPrimed tnt : trackedTNT.getOrDefault(region, Collections.emptyList())){ record(tnt, trace); -- 2.39.5 From 8a3d8a9c332e8ffaeface39ea12f07e3fe39392a Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Tue, 12 Mar 2024 20:31:20 +0100 Subject: [PATCH 040/111] Expanded Command with delete option --- .../bausystem/features/tracer/TraceCommand.java | 13 +++++++++++-- .../bausystem/features/tracer/TraceManager.java | 4 +++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index 50aa92d8..fcbb6665 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -78,7 +78,18 @@ public class TraceCommand extends SWCommand { BauSystem.MESSAGE.send("TRACE_MESSAGE_HIDE", player); } + @Register(value = "delete", description = "TRACE_COMMAND_HELP_SHOW") + public void delete(Player player){ + manager.clear(); + //BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE_ALL", player); + } + //TODO Manage non exsistent trace + @Register(value = "delete", description = "TRACE_COMMAND_HELP_SHOW") + public void delete(Player player, int id){ + manager.remove(id); + //BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE", player); + } @ClassMapper(value = BundleFilter.class, local = true) public TypeMapper bundleFilterClassMapper() { @@ -100,8 +111,6 @@ public class TraceCommand extends SWCommand { return Arrays.stream(BundleFilter.values()) .map(Enum::toString) .collect(Collectors.toList()); - - } }; } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index 8308b7b5..786fe8e5 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -70,10 +70,12 @@ public class TraceManager implements Listener { * * @param id id of the trace to be removed */ - public void remove(int id){ + public boolean remove(int id){ + if(id >= nextOpenId) return false; for(Player player: viewFlagMap.keySet()) traces.get(id).hide(player); traces.remove(id); + return true; } /** Clears all traces -- 2.39.5 From 04b49fe827d4f100e7010609b69af43d0fa6311f Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Tue, 12 Mar 2024 22:28:33 +0100 Subject: [PATCH 041/111] Added Ignite Flag Added inverse flags --- .../bausystem/features/tracer/Recorder.java | 13 +++++++++- .../bausystem/features/tracer/TNTRecord.java | 14 ++++++++++- .../bausystem/features/tracer/Trace.java | 13 +++++++++- .../features/tracer/rendering/ViewFlag.java | 24 +++++++++++++++++-- 4 files changed, 59 insertions(+), 5 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java index dd2638c0..698c06b1 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java @@ -57,6 +57,11 @@ public class Recorder implements Listener { */ private final Map tntSpawnRegion = new HashMap<>(); + /** + * Set of all active traces that no explosion has been recorded on + */ + private final Set noExplosionRecorded = new HashSet<>(); + /** * Maps a tracked tnt entity to its entire recording history */ @@ -103,6 +108,7 @@ public class Recorder implements Listener { public int startRecording(Region region){ if(activeTraces.containsKey(region)) return -1; Trace trace = new Trace(region); + noExplosionRecorded.add(trace); activeTraces.put(region, trace); return manager.add(trace); } @@ -116,6 +122,7 @@ public class Recorder implements Listener { if (trace == null) return; trace.setRecords(Collections.unmodifiableList(trace.getRecords())); + noExplosionRecorded.remove(trace); activeTraces.remove(region); for(TNTPrimed tnt : trackedTNT.getOrDefault(region, Collections.emptyList())) historyMap.remove(tnt); @@ -153,8 +160,12 @@ public class Recorder implements Listener { else tntID = history.get(0).getTntId(); + boolean isExplosion = tntPrimed.getFuseTicks() == 0; + if(isExplosion) + noExplosionRecorded.remove(trace); + boolean afterFirstExplosion = noExplosionRecorded.contains(trace); - TNTRecord record = new TNTRecord(tntID, tntPrimed, tntPrimed.getFuseTicks() == 0, TPSUtils.currentTick.get() - trace.getStartTime(), history); + TNTRecord record = new TNTRecord(tntID, tntPrimed, isExplosion, afterFirstExplosion, TPSUtils.currentTick.get() - trace.getStartTime(), history); history.add(record); trace.add(record); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java index 02cc8974..a0063704 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java @@ -41,6 +41,16 @@ public class TNTRecord { */ private final boolean explosion; + /** + * Whether this is a record of a tnt that was in water + */ + private final boolean inWater; + + /** + * Whether this record was taken after the first tnt exploded + */ + private final boolean afterFirstExplosion; + /** * Tick offset, from this record being taken to the start of the trace */ @@ -66,9 +76,11 @@ public class TNTRecord { */ private final List history; - public TNTRecord(UUID tntId, TNTPrimed tnt, boolean explosion, long ticksSinceStart, List history){ + public TNTRecord(UUID tntId, TNTPrimed tnt, boolean explosion, boolean afterFirstExplosion, long ticksSinceStart, List history){ this.tntId = tntId; this.explosion = explosion; + this.inWater = tnt.isInWater(); + this.afterFirstExplosion = afterFirstExplosion; this.ticksSinceStart = ticksSinceStart; fuse = tnt.getFuseTicks(); location = tnt.getLocation(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index 97cff2f5..705964fc 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -156,8 +156,19 @@ public class Trace { List workingRecords = records; + List flagList = new ArrayList<>(); + + //Manage inverse flags + flagList.addAll(ViewFlag.inverseFlags); + for(ViewFlag flag: flags){ + if(flagList.contains(flag)) + flagList.remove(flag); + else + flagList.add(flag); + } + //Apply filters - for(ViewFlag flag : flags) + for(ViewFlag flag : flagList) workingRecords = flag.filter(workingRecords); //Bundle records at unique positions diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java index bc838b5d..16a53943 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java @@ -24,6 +24,7 @@ import de.steamwar.bausystem.features.tracer.rendering.TraceEntity; import de.steamwar.entity.REntityServer; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; import java.util.function.BiConsumer; import java.util.function.UnaryOperator; @@ -35,7 +36,12 @@ public abstract class ViewFlag { */ public static final List flags = new ArrayList<>(); - public static ViewFlag EXPLOSION = new ViewFlag(true,"explosion") { + /** + * Inverse flags are used by trace render by default, as long as they are not explicidly added as argument + */ + public static final List inverseFlags = new ArrayList<>(); + + public static ViewFlag EXPLOSION = new ViewFlag(true, false,"explosionOnly") { @Override public List filter(List records) { return records.stream() @@ -47,6 +53,18 @@ public abstract class ViewFlag { public void modify(REntityServer server, List entities) {} }; + public static ViewFlag IGNITE = new ViewFlag(true, true, "ignite") { + @Override + public List filter(List records) { + return records.stream() + .filter(record -> !record.isAfterFirstExplosion()) + .collect(Collectors.toList()); + } + + @Override + public void modify(REntityServer server, List entities) {} + }; + /** * Name of the flag */ @@ -57,11 +75,13 @@ public abstract class ViewFlag { */ public final String[] aliases; - public ViewFlag(boolean isStatic, String name, String... aliases) { + public ViewFlag(boolean isStatic, boolean isInverse, String name, String... aliases) { this.name = name; this.aliases = aliases; if(isStatic) flags.add(this); + if(isInverse) + inverseFlags.add(this); } /** Filters the given records for a given condition -- 2.39.5 From 8a78dcbc7831b1fa702b2a3289c25755af719720 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Wed, 13 Mar 2024 23:14:27 +0100 Subject: [PATCH 042/111] Added Advanced flag --- .../features/tracer/rendering/ViewFlag.java | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java index 16a53943..da6603af 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java @@ -21,7 +21,12 @@ package de.steamwar.bausystem.features.tracer.rendering; import de.steamwar.bausystem.features.tracer.TNTRecord; import de.steamwar.bausystem.features.tracer.rendering.TraceEntity; +import de.steamwar.entity.REntity; import de.steamwar.entity.REntityServer; +import de.steamwar.entity.RFallingBlockEntity; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.util.Vector; import java.util.ArrayList; import java.util.Iterator; @@ -65,6 +70,39 @@ public abstract class ViewFlag { public void modify(REntityServer server, List entities) {} }; + public static ViewFlag ADVANCED = new ViewFlag(true, false, "advanced") { + @Override + public List filter(List records) {return records;} + + @Override + public void modify(REntityServer server, List entities) { + for(TraceEntity entity: entities) { + TNTRecord example = entity.getRecords().get(0); + + if(example.isExplosion()) continue; + + Location pos = example.getLocation(); + + Vector xVelocity = new Vector(example.getVelocity().getX(), 0, 0); + Vector yVelocity = new Vector(0, example.getVelocity().getY(), 0); + Vector zVelocity = new Vector(0, 0, example.getVelocity().getZ()); + + Vector firstVelocity = xVelocity.getX() >= zVelocity.getZ() ? xVelocity : zVelocity; + Vector secondVelocity = xVelocity.getX() <= zVelocity.getZ() ? xVelocity : zVelocity; + + pos = pos.add(yVelocity); + new RFallingBlockEntity(server, pos, Material.WHITE_STAINED_GLASS); + + pos = pos.add(firstVelocity); + new RFallingBlockEntity(server, pos, Material.WHITE_STAINED_GLASS); + + pos = pos.add(secondVelocity); + new RFallingBlockEntity(server, pos, Material.WHITE_STAINED_GLASS); + } + } + + }; + /** * Name of the flag */ -- 2.39.5 From 1282f6066c0612c89ad66822b53c1e2ae70c7cbf Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Wed, 13 Mar 2024 23:18:57 +0100 Subject: [PATCH 043/111] Added count, fuse and time flags --- .../features/tracer/rendering/ViewFlag.java | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java index da6603af..d11bacec 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java @@ -100,7 +100,42 @@ public abstract class ViewFlag { new RFallingBlockEntity(server, pos, Material.WHITE_STAINED_GLASS); } } + }; + public static ViewFlag COUNT = new ViewFlag(true, false, "count") { + @Override + public List filter(List records) { return records; } + + @Override + public void modify(REntityServer server, List entities) { + for(TraceEntity entity: entities){ + entity.setDisplayName(String.valueOf(entity.getRecords().size())); + } + } + }; + + public static ViewFlag FUSE = new ViewFlag(true, false, "fuse") { + @Override + public List filter(List records) { return records; } + + @Override + public void modify(REntityServer server, List entities) { + for(TraceEntity entity: entities){ + entity.setDisplayName(String.valueOf(entity.getRecords().get(0).getFuse())); + } + } + }; + + public static ViewFlag TIME = new ViewFlag(true, false, "time") { + @Override + public List filter(List records) { return records; } + + @Override + public void modify(REntityServer server, List entities) { + for(TraceEntity entity: entities){ + entity.setDisplayName(String.valueOf(entity.getRecords().get(0).getTicksSinceStart())); + } + } }; /** -- 2.39.5 From 827929382a9dd103e3bede9c2d68da3a6a3b618e Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Wed, 13 Mar 2024 23:59:17 +0100 Subject: [PATCH 044/111] Added source, build-destroy, testblock-destroy --- .../bausystem/features/tracer/Recorder.java | 11 +++--- .../bausystem/features/tracer/TNTRecord.java | 28 ++++++++++++++- .../features/tracer/rendering/ViewFlag.java | 36 +++++++++++++++++++ 3 files changed, 69 insertions(+), 6 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java index 698c06b1..30ff7d73 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java @@ -24,6 +24,7 @@ import de.steamwar.bausystem.features.tpslimit.TPSUtils; import de.steamwar.bausystem.region.Region; import de.steamwar.linkage.Linked; import de.steamwar.linkage.LinkedInstance; +import org.bukkit.block.Block; import org.bukkit.entity.TNTPrimed; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -138,7 +139,7 @@ public class Recorder implements Listener { Trace trace = activeTraces.get(region); for(TNTPrimed tnt : trackedTNT.getOrDefault(region, Collections.emptyList())){ - record(tnt, trace); + record(tnt, trace, Collections.emptyList()); } trace.commitAdd(); } @@ -149,7 +150,7 @@ public class Recorder implements Listener { * @param tntPrimed tnt exploding * @param trace trace to record the tnt for */ - private void record(TNTPrimed tntPrimed, Trace trace){ + private void record(TNTPrimed tntPrimed, Trace trace, List destroyedBlocks){ List history = historyMap.getOrDefault(tntPrimed, new ArrayList<>()); UUID tntID; @@ -165,7 +166,7 @@ public class Recorder implements Listener { noExplosionRecorded.remove(trace); boolean afterFirstExplosion = noExplosionRecorded.contains(trace); - TNTRecord record = new TNTRecord(tntID, tntPrimed, isExplosion, afterFirstExplosion, TPSUtils.currentTick.get() - trace.getStartTime(), history); + TNTRecord record = new TNTRecord(tntID, tntPrimed, isExplosion, afterFirstExplosion, TPSUtils.currentTick.get() - trace.getStartTime(), history, destroyedBlocks); history.add(record); trace.add(record); @@ -198,7 +199,7 @@ public class Recorder implements Listener { * Unregisters TNTs from beeing traced on explode * @param event */ - @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onTNTExplode(EntityExplodeEvent event){ if(!(event.getEntity() instanceof TNTPrimed)) return; @@ -207,6 +208,6 @@ public class Recorder implements Listener { trackedTNT.get(region).remove((TNTPrimed) event.getEntity()); tntSpawnRegion.remove((TNTPrimed) event.getEntity()); - record((TNTPrimed) event.getEntity(), activeTraces.get(region)); + record((TNTPrimed) event.getEntity(), activeTraces.get(region), event.blockList()); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java index a0063704..ee22eaeb 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java @@ -19,8 +19,12 @@ package de.steamwar.bausystem.features.tracer; +import de.steamwar.bausystem.region.Region; +import de.steamwar.bausystem.region.utils.RegionExtensionType; +import de.steamwar.bausystem.region.utils.RegionType; import lombok.Getter; import org.bukkit.Location; +import org.bukkit.block.Block; import org.bukkit.entity.TNTPrimed; import org.bukkit.util.Vector; @@ -51,6 +55,16 @@ public class TNTRecord { */ private final boolean afterFirstExplosion; + /** + * Whether this record has destroyed blocks in build area + */ + private final boolean destroyedBuildArea; + + /** + * Whether this record has destroyed blocks in testblock area + */ + private final boolean destroyedTestBlock; + /** * Tick offset, from this record being taken to the start of the trace */ @@ -76,7 +90,7 @@ public class TNTRecord { */ private final List history; - public TNTRecord(UUID tntId, TNTPrimed tnt, boolean explosion, boolean afterFirstExplosion, long ticksSinceStart, List history){ + public TNTRecord(UUID tntId, TNTPrimed tnt, boolean explosion, boolean afterFirstExplosion, long ticksSinceStart, List history, List destroyedBlocks){ this.tntId = tntId; this.explosion = explosion; this.inWater = tnt.isInWater(); @@ -86,6 +100,18 @@ public class TNTRecord { location = tnt.getLocation(); velocity = tnt.getVelocity(); this.history = history; + + boolean buildDestroy = false; + boolean testblockDestroy = false; + for(Block destroyedBlock: destroyedBlocks){ + if (Region.getRegion(destroyedBlock.getLocation()).inRegion(destroyedBlock.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION)) + buildDestroy = true; + if (Region.getRegion(destroyedBlock.getLocation()).inRegion(destroyedBlock.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.EXTENSION)) + buildDestroy = true; + } + + destroyedBuildArea = buildDestroy; + destroyedTestBlock = testblockDestroy; } public Optional getNext(){ diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java index d11bacec..0f865349 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java @@ -70,6 +70,42 @@ public abstract class ViewFlag { public void modify(REntityServer server, List entities) {} }; + public static ViewFlag SOURCE = new ViewFlag(true, false, "source") { + @Override + public List filter(List records) { + return records.stream() + .filter(record -> record.getFuse() == 80) + .collect(Collectors.toList()); + } + + @Override + public void modify(REntityServer server, List entities) {} + }; + + public static ViewFlag BUILD_DESTROY_ONLY = new ViewFlag(true, false, "build-destroy-only") { + @Override + public List filter(List records) { + return records.stream() + .filter(record -> record.getHistory().get(record.getHistory().size() - 1).isDestroyedBuildArea()) + .collect(Collectors.toList()); + } + + @Override + public void modify(REntityServer server, List entities) {} + }; + + public static ViewFlag TESTBLOCK_DESTROY_ONLY = new ViewFlag(true, false, "testblock-destroy-only") { + @Override + public List filter(List records) { + return records.stream() + .filter(record -> record.getHistory().get(record.getHistory().size() - 1).isDestroyedTestBlock()) + .collect(Collectors.toList()); + } + + @Override + public void modify(REntityServer server, List entities) {} + }; + public static ViewFlag ADVANCED = new ViewFlag(true, false, "advanced") { @Override public List filter(List records) {return records;} -- 2.39.5 From 2cd3c3527e0dac1caf451285d1dbeeb33429574e Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Thu, 14 Mar 2024 12:25:54 +0100 Subject: [PATCH 045/111] Added Micromotion view Flag --- .../features/tracer/rendering/ViewFlag.java | 41 +++++++++++++++++-- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java index 0f865349..361752fa 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java @@ -28,9 +28,7 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.util.Vector; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; +import java.util.*; import java.util.function.BiConsumer; import java.util.function.UnaryOperator; import java.util.stream.Collectors; @@ -46,7 +44,7 @@ public abstract class ViewFlag { */ public static final List inverseFlags = new ArrayList<>(); - public static ViewFlag EXPLOSION = new ViewFlag(true, false,"explosionOnly") { + public static ViewFlag EXPLOSION = new ViewFlag(true, false,"explosion") { @Override public List filter(List records) { return records.stream() @@ -106,6 +104,41 @@ public abstract class ViewFlag { public void modify(REntityServer server, List entities) {} }; + public static ViewFlag MICROMOTION = new ViewFlag(true, false, "micromotion") { + @Override + public List filter(List records) { + Set seen = new HashSet<>(); + Set toRemove = new HashSet<>(); + + for(TNTRecord uniqueRecord: records){ + if(seen.contains(uniqueRecord.getTntId())) continue; + + boolean hasMicromotion = false; + for(TNTRecord record: uniqueRecord.getHistory()){ + Vector velocity = record.getVelocity(); + if(velocity.getY() == 0 && (Math.abs(velocity.getX()) < 0.001 || Math.abs(velocity.getZ()) < 0.001)){ + hasMicromotion = true; + break; + } + } + + if(!hasMicromotion) + toRemove.add(uniqueRecord); + + seen.add(uniqueRecord.getTntId()); + } + + for(TNTRecord record: toRemove){ + records.removeAll(record.getHistory()); + } + + return records; + } + + @Override + public void modify(REntityServer server, List entities) {} + }; + public static ViewFlag ADVANCED = new ViewFlag(true, false, "advanced") { @Override public List filter(List records) {return records;} -- 2.39.5 From 45cc3abd0adaf49a8ed3bfb8bec9922f83d6a877 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Thu, 14 Mar 2024 12:31:17 +0100 Subject: [PATCH 046/111] Fixed Advanced flag having gravity --- .../bausystem/features/tracer/rendering/ViewFlag.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java index 361752fa..7798a679 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java @@ -157,16 +157,14 @@ public abstract class ViewFlag { Vector zVelocity = new Vector(0, 0, example.getVelocity().getZ()); Vector firstVelocity = xVelocity.getX() >= zVelocity.getZ() ? xVelocity : zVelocity; - Vector secondVelocity = xVelocity.getX() <= zVelocity.getZ() ? xVelocity : zVelocity; pos = pos.add(yVelocity); - new RFallingBlockEntity(server, pos, Material.WHITE_STAINED_GLASS); + RFallingBlockEntity y = new RFallingBlockEntity(server, pos, Material.WHITE_STAINED_GLASS); + y.setNoGravity(true); pos = pos.add(firstVelocity); - new RFallingBlockEntity(server, pos, Material.WHITE_STAINED_GLASS); - - pos = pos.add(secondVelocity); - new RFallingBlockEntity(server, pos, Material.WHITE_STAINED_GLASS); + RFallingBlockEntity secound = new RFallingBlockEntity(server, pos, Material.WHITE_STAINED_GLASS); + secound.setNoGravity(true); } } }; -- 2.39.5 From 5ec9fbb6e0cfc9470fd224f64dad005a9c962816 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Mon, 18 Mar 2024 22:40:41 +0100 Subject: [PATCH 047/111] Fixed Trace id assignment Fixed trace recording of source tnt --- .../src/de/steamwar/bausystem/features/tracer/Recorder.java | 1 + .../src/de/steamwar/bausystem/features/tracer/TraceCommand.java | 2 -- .../src/de/steamwar/bausystem/features/tracer/TraceManager.java | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java index 30ff7d73..cbc6c444 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java @@ -192,6 +192,7 @@ public class Recorder implements Listener { trackedTNT.get(region).add((TNTPrimed) event.getEntity()); tntSpawnRegion.put((TNTPrimed) event.getEntity(), region); + record((TNTPrimed) event.getEntity(), activeTraces.get(region), Collections.emptyList()); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index fcbb6665..51a63461 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -81,14 +81,12 @@ public class TraceCommand extends SWCommand { @Register(value = "delete", description = "TRACE_COMMAND_HELP_SHOW") public void delete(Player player){ manager.clear(); - //BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE_ALL", player); } //TODO Manage non exsistent trace @Register(value = "delete", description = "TRACE_COMMAND_HELP_SHOW") public void delete(Player player, int id){ manager.remove(id); - //BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE", player); } @ClassMapper(value = BundleFilter.class, local = true) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index 786fe8e5..ccd89e1c 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -63,7 +63,7 @@ public class TraceManager implements Listener { trace.render(player, viewFlagMap.get(player), bundleFilterMap.get(player)); traces.put(nextOpenId, trace); nextOpenId++; - return nextOpenId--; + return nextOpenId; } /** Removes the trace with the given id -- 2.39.5 From 10a63f187662b6cb468d3e0996fbb9b938c5f770 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Mon, 18 Mar 2024 22:47:16 +0100 Subject: [PATCH 048/111] Fixed build destroy and testblock destroy flags --- .../src/de/steamwar/bausystem/features/tracer/TNTRecord.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java index ee22eaeb..a7278e26 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java @@ -107,7 +107,7 @@ public class TNTRecord { if (Region.getRegion(destroyedBlock.getLocation()).inRegion(destroyedBlock.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION)) buildDestroy = true; if (Region.getRegion(destroyedBlock.getLocation()).inRegion(destroyedBlock.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.EXTENSION)) - buildDestroy = true; + testblockDestroy = true; } destroyedBuildArea = buildDestroy; -- 2.39.5 From 5a59578a66a5b5c0124de1bcdc861d934bd47e9b Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Tue, 19 Mar 2024 16:09:32 +0100 Subject: [PATCH 049/111] Changed Record id from uuid to incremental int --- .../steamwar/bausystem/features/tracer/Recorder.java | 11 +++++++++-- .../steamwar/bausystem/features/tracer/TNTRecord.java | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java index cbc6c444..116da2e7 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java @@ -68,6 +68,11 @@ public class Recorder implements Listener { */ private final Map> historyMap = new HashMap<>(); + /** + * Maps Traces to their next open unique TNTRecord id + */ + private final Map nextOpenTNTRecordIdMap = new HashMap<>(); + /** * Regions where auto-trace is enabled */ @@ -111,6 +116,7 @@ public class Recorder implements Listener { Trace trace = new Trace(region); noExplosionRecorded.add(trace); activeTraces.put(region, trace); + nextOpenTNTRecordIdMap.put(trace, 0); return manager.add(trace); } @@ -152,11 +158,12 @@ public class Recorder implements Listener { */ private void record(TNTPrimed tntPrimed, Trace trace, List destroyedBlocks){ List history = historyMap.getOrDefault(tntPrimed, new ArrayList<>()); - UUID tntID; + int tntID; if(history.size() == 0){ historyMap.put(tntPrimed, history); - tntID = UUID.randomUUID(); + tntID = nextOpenTNTRecordIdMap.get(trace); + nextOpenTNTRecordIdMap.put(trace, tntID + 1); } else tntID = history.get(0).getTntId(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java index a7278e26..a6065aaf 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java @@ -38,7 +38,7 @@ public class TNTRecord { /** * Unique number to identify records being of the same tnt */ - private final UUID tntId; + private final int tntId; /** * Whether this is a record of a tnt explosion or an entity @@ -90,7 +90,7 @@ public class TNTRecord { */ private final List history; - public TNTRecord(UUID tntId, TNTPrimed tnt, boolean explosion, boolean afterFirstExplosion, long ticksSinceStart, List history, List destroyedBlocks){ + public TNTRecord(int tntId, TNTPrimed tnt, boolean explosion, boolean afterFirstExplosion, long ticksSinceStart, List history, List destroyedBlocks){ this.tntId = tntId; this.explosion = explosion; this.inWater = tnt.isInWater(); -- 2.39.5 From a94f5747a0bd90905a6e7be4500171b721dd3490 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Thu, 21 Mar 2024 14:03:20 +0100 Subject: [PATCH 050/111] Implemented trace isolate --- .../bausystem/features/tracer/Recorder.java | 19 +++--- .../bausystem/features/tracer/Trace.java | 35 ++++++---- .../features/tracer/TraceCommand.java | 66 +++++++++++++++++-- .../features/tracer/TraceManager.java | 6 ++ .../tracer/rendering/BundleFilter.java | 2 +- .../tracer/rendering/TraceEntity.java | 22 +++++++ .../features/tracer/rendering/ViewFlag.java | 44 +++++++++---- .../rendering/dynamicFlags/IsolateFlag.java | 59 +++++++++++++++++ 8 files changed, 211 insertions(+), 42 deletions(-) create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicFlags/IsolateFlag.java diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java index 116da2e7..30f5d0d9 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java @@ -63,16 +63,16 @@ public class Recorder implements Listener { */ private final Set noExplosionRecorded = new HashSet<>(); + /** + * A map for records that have been taken in the same tick and now have to be added to the traces + */ + private final Map> recordsToAddMap = new HashMap<>(); + /** * Maps a tracked tnt entity to its entire recording history */ private final Map> historyMap = new HashMap<>(); - /** - * Maps Traces to their next open unique TNTRecord id - */ - private final Map nextOpenTNTRecordIdMap = new HashMap<>(); - /** * Regions where auto-trace is enabled */ @@ -116,7 +116,6 @@ public class Recorder implements Listener { Trace trace = new Trace(region); noExplosionRecorded.add(trace); activeTraces.put(region, trace); - nextOpenTNTRecordIdMap.put(trace, 0); return manager.add(trace); } @@ -147,7 +146,8 @@ public class Recorder implements Listener { for(TNTPrimed tnt : trackedTNT.getOrDefault(region, Collections.emptyList())){ record(tnt, trace, Collections.emptyList()); } - trace.commitAdd(); + trace.addAll(recordsToAddMap.get(trace)); + recordsToAddMap.get(trace).clear(); } } @@ -162,8 +162,7 @@ public class Recorder implements Listener { if(history.size() == 0){ historyMap.put(tntPrimed, history); - tntID = nextOpenTNTRecordIdMap.get(trace); - nextOpenTNTRecordIdMap.put(trace, tntID + 1); + tntID = trace.getAndIncrementNextOpenRecordId(); } else tntID = history.get(0).getTntId(); @@ -176,7 +175,7 @@ public class Recorder implements Listener { TNTRecord record = new TNTRecord(tntID, tntPrimed, isExplosion, afterFirstExplosion, TPSUtils.currentTick.get() - trace.getStartTime(), history, destroyedBlocks); history.add(record); - trace.add(record); + recordsToAddMap.get(trace).add(record); } /** Event for TNTs beeing spawn. diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index 705964fc..0028f6ab 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -50,9 +50,10 @@ public class Trace { private List records = new ArrayList<>(); /** - * Records to be added + * ID that should be asigned to the next record of a unique tnt */ - private List newRecords = new ArrayList<>(); + @Getter + private int nextOpenRecordId = -1; /** * A map of players -> REntityServers for rendering traces to a player @@ -73,28 +74,28 @@ public class Trace { this.region = region; } - /** Methode to add a records to add staging - * - * @param records records to add + /** + * Gets and increments the next open record id + * @return next open record id */ - protected void add (TNTRecord records){ - newRecords.add(records); + protected int getAndIncrementNextOpenRecordId(){ + nextOpenRecordId++; + return nextOpenRecordId; } /** - * Commits the additions made to this trace and updates active renders of this trace + * Adds the given records and updates potential trace renderings */ - protected void commitAdd(){ - records.addAll(newRecords); + protected void addAll(List records){ + this.records.addAll(records); for(Player player: serverMap.keySet()){ REntityServer server = serverMap.get(player); BundleFilter bundleFilter = bundleFilterMap.get(player); ViewFlag[] viewFlags = viewFlagMap.get(player); - render(server, newRecords, viewFlags, bundleFilter); + render(server, records, viewFlags, bundleFilter); } - newRecords.clear(); } /** Internal methode to make records immutable after recording is finished @@ -105,8 +106,9 @@ public class Trace { this.records = records; } - /** + /** Gets the historys of all tnts in this trace * + * @return the historys of this trace */ public Set> getHistories() { Set> histories = new HashSet<>(); @@ -233,6 +235,13 @@ public class Trace { server.close(); } + /** Returns the flags used by the given player to render the trace or null if not present + * + * @param player + * @return + */ + protected ViewFlag[] getViewFlags(Player player){return viewFlagMap.get(player);} + @Override public String toString() { return "Trace{" + diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index 51a63461..d51d7cfc 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -21,20 +21,21 @@ package de.steamwar.bausystem.features.tracer; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.tracer.rendering.BundleFilter; +import de.steamwar.bausystem.features.tracer.rendering.TraceEntity; import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; +import de.steamwar.bausystem.features.tracer.rendering.dynamicFlags.IsolateFlag; import de.steamwar.bausystem.region.Region; import de.steamwar.command.PreviousArguments; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeMapper; +import de.steamwar.command.TypeValidator; +import de.steamwar.entity.REntityServer; import de.steamwar.linkage.Linked; import de.steamwar.linkage.LinkedInstance; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; +import java.util.*; import java.util.stream.Collectors; @Linked @@ -83,12 +84,67 @@ public class TraceCommand extends SWCommand { manager.clear(); } - //TODO Manage non exsistent trace @Register(value = "delete", description = "TRACE_COMMAND_HELP_SHOW") public void delete(Player player, int id){ manager.remove(id); } + @Register(value = "isolate", description = "TRACE_COMMAND_HELP_SHOW") + public void isolate(Player player, Trace trace, @ErrorMessage("test") TNTRecord... records){ + IsolateFlag isolationFlag = null; + + ViewFlag[] viewFlags = trace.getViewFlags(player); + if(viewFlags != null) + for(ViewFlag flag: viewFlags) + if(flag.name.equals("isolate")) + isolationFlag = (IsolateFlag) flag; + + if(isolationFlag == null) + isolationFlag = new IsolateFlag(); + + for(TNTRecord record: records) + isolationFlag.toggleId(record.getTntId()); + } + + @ClassMapper(value = Trace.class, local = true) + public TypeMapper traceClassMapper(){ + return new TypeMapper() { + @Override + public Trace map(CommandSender commandSender, String[] previousArguments, String s) { + int id = Integer.parseInt(s); + + Optional trace = manager.get(id); + + return trace.orElse(null); + } + + @Override + public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) { + return manager.getAllIds().stream() + .map(id -> id.toString()) + .collect(Collectors.toList()); + } + }; + } + + @ClassMapper(value = TNTRecord.class, local = true) + public TypeMapper recordMapper() { + return new TypeMapper() { + @Override + public TNTRecord map(CommandSender commandSender, PreviousArguments previousArguments, String s) { + Trace trace = previousArguments.getFirst(Trace.class).orElse(null); + if(trace == null) return null; + + int id = Integer.parseInt(s); + + return trace.getRecords().stream() + .filter(record -> record.getTntId() == id) + .findFirst() + .orElse(null); + } + }; + } + @ClassMapper(value = BundleFilter.class, local = true) public TypeMapper bundleFilterClassMapper() { return new TypeMapper() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index ccd89e1c..c000c0b1 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -72,6 +72,7 @@ public class TraceManager implements Listener { */ public boolean remove(int id){ if(id >= nextOpenId) return false; + if(traces.get(id) == null) return false; for(Player player: viewFlagMap.keySet()) traces.get(id).hide(player); traces.remove(id); @@ -119,6 +120,11 @@ public class TraceManager implements Listener { return new ArrayList<>(traces.values()); } + /** + * @return all ids of active traces + */ + public Set getAllIds(){return traces.keySet();} + /** Toggles trace show on for player * * @param player diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java index 3ce9e03e..e511c923 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java @@ -26,7 +26,7 @@ import java.util.function.BiFunction; public enum BundleFilter { - + //TODO chagne optional to true flase null LOOSE((TNTRecord a, TNTRecord b) -> { if(a.isExplosion() != b.isExplosion()) return Optional.of(false); if(a.getLocation().distance(b.getLocation()) <= BundleFilter.pixelSize) return Optional.of(false); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java index a930ec57..9f6439b3 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java @@ -19,12 +19,16 @@ package de.steamwar.bausystem.features.tracer.rendering; +import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.tracer.TNTRecord; import de.steamwar.entity.REntityServer; import de.steamwar.entity.RFallingBlockEntity; import lombok.Getter; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityInteractEvent; import java.util.List; @@ -40,5 +44,23 @@ public class TraceEntity extends RFallingBlockEntity { super(server, location, isExplosion ? Material.RED_STAINED_GLASS : Material.TNT); setNoGravity(true); this.records = records; + + server.setCallback(((player, rEntity, entityAction) -> { + if (entityAction != REntityServer.EntityAction.INTERACT) return; + + TNTRecord representative = records.get(0); + + BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_HEADER", player); + BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_FUSE_TIME", player, representative.getFuse()); + BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_POSITION_X", player, representative.getLocation().getX() + ""); + BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_POSITION_Y", player, representative.getLocation().getY() + ""); + BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_POSITION_Z", player, representative.getLocation().getZ() + ""); + BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_X", player, representative.getVelocity().getX() + ""); + BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_Y", player, representative.getVelocity().getY() + ""); + BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_Z", player, representative.getVelocity().getZ() + ""); + + })); } + + } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java index 7798a679..0a5cd21f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java @@ -68,7 +68,7 @@ public abstract class ViewFlag { public void modify(REntityServer server, List entities) {} }; - public static ViewFlag SOURCE = new ViewFlag(true, false, "source") { + public static ViewFlag SOURCE = new ViewFlag(true, false, IGNITE, "source") { @Override public List filter(List records) { return records.stream() @@ -107,7 +107,7 @@ public abstract class ViewFlag { public static ViewFlag MICROMOTION = new ViewFlag(true, false, "micromotion") { @Override public List filter(List records) { - Set seen = new HashSet<>(); + Set seen = new HashSet<>(); Set toRemove = new HashSet<>(); for(TNTRecord uniqueRecord: records){ @@ -146,23 +146,25 @@ public abstract class ViewFlag { @Override public void modify(REntityServer server, List entities) { for(TraceEntity entity: entities) { - TNTRecord example = entity.getRecords().get(0); + TNTRecord representaitv = entity.getRecords().get(0); - if(example.isExplosion()) continue; + if(representaitv.isExplosion()) continue; - Location pos = example.getLocation(); + Location pos = representaitv.getLocation(); - Vector xVelocity = new Vector(example.getVelocity().getX(), 0, 0); - Vector yVelocity = new Vector(0, example.getVelocity().getY(), 0); - Vector zVelocity = new Vector(0, 0, example.getVelocity().getZ()); + double xVelocity = representaitv.getVelocity().getX(); + double yVelocity = representaitv.getVelocity().getY(); + double zVelocity = representaitv.getVelocity().getZ(); - Vector firstVelocity = xVelocity.getX() >= zVelocity.getZ() ? xVelocity : zVelocity; - - pos = pos.add(yVelocity); + pos = pos.add(0,yVelocity,0); RFallingBlockEntity y = new RFallingBlockEntity(server, pos, Material.WHITE_STAINED_GLASS); y.setNoGravity(true); - pos = pos.add(firstVelocity); + if(xVelocity >= zVelocity) + pos.add(xVelocity, 0, 0); + else + pos.add(0,0,zVelocity); + RFallingBlockEntity secound = new RFallingBlockEntity(server, pos, Material.WHITE_STAINED_GLASS); secound.setNoGravity(true); } @@ -215,6 +217,11 @@ public abstract class ViewFlag { */ public final String[] aliases; + /** + * A flag that is used whenever this flag is used + */ + public final ViewFlag required; + public ViewFlag(boolean isStatic, boolean isInverse, String name, String... aliases) { this.name = name; this.aliases = aliases; @@ -222,7 +229,18 @@ public abstract class ViewFlag { flags.add(this); if(isInverse) inverseFlags.add(this); - } + required = null; + } + + public ViewFlag(boolean isStatic, boolean isInverse, ViewFlag required, String name, String... aliases){ + this.name = name; + this.aliases = aliases; + if(isStatic) + flags.add(this); + if(isInverse) + inverseFlags.add(this); + this.required = required; + } /** Filters the given records for a given condition * diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicFlags/IsolateFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicFlags/IsolateFlag.java new file mode 100644 index 00000000..f112ecb6 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicFlags/IsolateFlag.java @@ -0,0 +1,59 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2024 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.tracer.rendering.dynamicFlags; + +import de.steamwar.bausystem.features.tracer.TNTRecord; +import de.steamwar.bausystem.features.tracer.rendering.TraceEntity; +import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; +import de.steamwar.entity.REntityServer; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +public class IsolateFlag extends ViewFlag { + + private final List tntToIsolate = new ArrayList<>(); + + public IsolateFlag(){ + super(false, false, ViewFlag.IGNITE, "isolate"); + } + + /** + * Toggles the given id to be or not to be rendered + * @param id + */ + public void toggleId(int id){ + if(tntToIsolate.contains(id)) + tntToIsolate.remove(id); + else + tntToIsolate.add(id); + } + + @Override + public List filter(List records) { + return records.stream() + .filter(record -> tntToIsolate.contains(record.getTntId())) + .collect(Collectors.toList()); + } + + @Override + public void modify(REntityServer server, List entities) {} +} -- 2.39.5 From be25b71cb813ea34e6dfd62b551343bb8f6f84ee Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Thu, 21 Mar 2024 14:45:10 +0100 Subject: [PATCH 051/111] added render call to isolate --- .../de/steamwar/bausystem/features/tracer/TraceCommand.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index d51d7cfc..4b30da51 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -104,6 +104,11 @@ public class TraceCommand extends SWCommand { for(TNTRecord record: records) isolationFlag.toggleId(record.getTntId()); + + ViewFlag[] flags = new ViewFlag [1]; + flags[0] = isolationFlag; + + trace.render(player, viewFlags, BundleFilter.STRICT); } @ClassMapper(value = Trace.class, local = true) -- 2.39.5 From 2d7ae673355d82da8580a732d20f7c82ce53ab92 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Thu, 21 Mar 2024 15:04:09 +0100 Subject: [PATCH 052/111] Added required Flags --- .../src/de/steamwar/bausystem/features/tracer/Recorder.java | 2 ++ .../src/de/steamwar/bausystem/features/tracer/Trace.java | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java index 30f5d0d9..8eab6d0f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java @@ -116,6 +116,7 @@ public class Recorder implements Listener { Trace trace = new Trace(region); noExplosionRecorded.add(trace); activeTraces.put(region, trace); + recordsToAddMap.put(trace, new ArrayList<>()); return manager.add(trace); } @@ -133,6 +134,7 @@ public class Recorder implements Listener { for(TNTPrimed tnt : trackedTNT.getOrDefault(region, Collections.emptyList())) historyMap.remove(tnt); + recordsToAddMap.remove(trace); trackedTNT.put(region, new ArrayList<>()); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index 0028f6ab..92146fe2 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -160,6 +160,11 @@ public class Trace { List flagList = new ArrayList<>(); + //Manage required flags + for(ViewFlag flag: flags) + if(flag.required != null) + flagList.add(flag.required); + //Manage inverse flags flagList.addAll(ViewFlag.inverseFlags); for(ViewFlag flag: flags){ -- 2.39.5 From d80e4cf3e0164895642dbe75c78629d81d3ef4b4 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Thu, 21 Mar 2024 16:29:51 +0100 Subject: [PATCH 053/111] Fixed inverse x required flags Fixed exeption handeling in record ClassMapper Fixed advanced flag Added flag aliasses --- .../bausystem/features/tracer/Trace.java | 32 +++++++++++-------- .../features/tracer/TraceCommand.java | 31 +++++++++++++----- .../features/tracer/rendering/ViewFlag.java | 6 ++-- .../rendering/dynamicFlags/IsolateFlag.java | 4 ++- 4 files changed, 49 insertions(+), 24 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index 92146fe2..eea93171 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -55,6 +55,12 @@ public class Trace { @Getter private int nextOpenRecordId = -1; + /** + * List of all used ids + */ + @Getter + private final List usedIds = new ArrayList(); + /** * A map of players -> REntityServers for rendering traces to a player */ @@ -80,6 +86,7 @@ public class Trace { */ protected int getAndIncrementNextOpenRecordId(){ nextOpenRecordId++; + usedIds.add(Integer.toString(nextOpenRecordId)); return nextOpenRecordId; } @@ -158,21 +165,20 @@ public class Trace { List workingRecords = records; - List flagList = new ArrayList<>(); - - //Manage required flags - for(ViewFlag flag: flags) - if(flag.required != null) - flagList.add(flag.required); + //Manage flags and required flags + Set flagList = new HashSet<>(Arrays.asList(flags)); + for (ViewFlag flag : flags) { + if (flag.required != null) { + flagList.addAll(Arrays.asList(flag.required)); + } + } //Manage inverse flags - flagList.addAll(ViewFlag.inverseFlags); - for(ViewFlag flag: flags){ - if(flagList.contains(flag)) - flagList.remove(flag); - else - flagList.add(flag); - } + ViewFlag.inverseFlags.forEach(viewFlag -> { + if (!flagList.remove(viewFlag)) { + flagList.add(viewFlag); + } + }); //Apply filters for(ViewFlag flag : flagList) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index 4b30da51..dc3f95c0 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -94,22 +94,28 @@ public class TraceCommand extends SWCommand { IsolateFlag isolationFlag = null; ViewFlag[] viewFlags = trace.getViewFlags(player); - if(viewFlags != null) - for(ViewFlag flag: viewFlags) - if(flag.name.equals("isolate")) - isolationFlag = (IsolateFlag) flag; + if(viewFlags != null) { + isolationFlag = Stream.of(viewFlags) + .filter(IsolateFlag.class::isInstance) + .map(IsolateFlag.class::cast) + .findFirst() + .orElse(null); + } - if(isolationFlag == null) + if (viewFlags == null || isolationFlag == null) { + viewFlags = new ViewFlag[1]; + } + if (isolationFlag == null) { isolationFlag = new IsolateFlag(); + } + viewFlags[0] = isolationFlag; for(TNTRecord record: records) isolationFlag.toggleId(record.getTntId()); - ViewFlag[] flags = new ViewFlag [1]; - flags[0] = isolationFlag; - trace.render(player, viewFlags, BundleFilter.STRICT); } + //TODO warning if nothing is shown @ClassMapper(value = Trace.class, local = true) public TypeMapper traceClassMapper(){ @@ -147,6 +153,15 @@ public class TraceCommand extends SWCommand { .findFirst() .orElse(null); } + + //TODO change when new command framework update + @Override + public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) { + Trace trace = previousArguments.getFirst(Trace.class).orElse(null); + if(trace == null) return null; + + return trace.getUsedIds(); + } }; } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java index 0a5cd21f..e17bcb48 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java @@ -104,7 +104,8 @@ public abstract class ViewFlag { public void modify(REntityServer server, List entities) {} }; - public static ViewFlag MICROMOTION = new ViewFlag(true, false, "micromotion") { + //TODO fix? + public static ViewFlag MICROMOTION = new ViewFlag(true, false, "micromotion", "m") { @Override public List filter(List records) { Set seen = new HashSet<>(); @@ -139,7 +140,8 @@ public abstract class ViewFlag { public void modify(REntityServer server, List entities) {} }; - public static ViewFlag ADVANCED = new ViewFlag(true, false, "advanced") { + //TODO fix? + public static ViewFlag ADVANCED = new ViewFlag(true, false, "advanced", "a") { @Override public List filter(List records) {return records;} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicFlags/IsolateFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicFlags/IsolateFlag.java index f112ecb6..71e59012 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicFlags/IsolateFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicFlags/IsolateFlag.java @@ -25,12 +25,14 @@ import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; import de.steamwar.entity.REntityServer; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; +import java.util.Set; import java.util.stream.Collectors; public class IsolateFlag extends ViewFlag { - private final List tntToIsolate = new ArrayList<>(); + private final Set tntToIsolate = new HashSet<>(); public IsolateFlag(){ super(false, false, ViewFlag.IGNITE, "isolate"); -- 2.39.5 From c0dcb99f7b806d71893e4894559c9f8115887273 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Thu, 21 Mar 2024 16:30:10 +0100 Subject: [PATCH 054/111] Changes by jojo --- .../bausystem/features/tracer/Trace.java | 11 ++- .../features/tracer/TraceCommand.java | 9 +- .../features/tracer/rendering/ViewFlag.java | 90 +++++++++---------- .../rendering/dynamicFlags/IsolateFlag.java | 7 +- 4 files changed, 58 insertions(+), 59 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index eea93171..062e5a8f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -160,7 +160,7 @@ public class Trace { * @param flags Flags modefieing the rendering * @param bundleFilter Filter to determin bundeling of records */ - private void render (REntityServer server, List records, ViewFlag[] flags, BundleFilter bundleFilter){ + private void render(REntityServer server, List records, ViewFlag[] flags, BundleFilter bundleFilter){ if(records.size() == 0) return; List workingRecords = records; @@ -181,8 +181,9 @@ public class Trace { }); //Apply filters - for(ViewFlag flag : flagList) + for(ViewFlag flag : flagList) { workingRecords = flag.filter(workingRecords); + } //Bundle records at unique positions List> bundles = bundleRecords(workingRecords, bundleFilter); @@ -190,12 +191,14 @@ public class Trace { //Render bundled records List entities = new LinkedList<>(); - for(List bundle : bundles) + for(List bundle : bundles) { entities.add(new TraceEntity(server, bundle.get(0).getLocation(), bundle.get(0).isExplosion(), bundle)); + } //Apply modifiers - for(ViewFlag flag : flags) + for(ViewFlag flag : flags) { flag.modify(server, entities); + } } /** Bundles the passed TNTRecords based on whether they are at the same location diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index dc3f95c0..c40f45dc 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -37,6 +37,7 @@ import org.bukkit.entity.Player; import java.util.*; import java.util.stream.Collectors; +import java.util.stream.Stream; @Linked public class TraceCommand extends SWCommand { @@ -119,7 +120,7 @@ public class TraceCommand extends SWCommand { @ClassMapper(value = Trace.class, local = true) public TypeMapper traceClassMapper(){ - return new TypeMapper() { + return new TypeMapper() { @Override public Trace map(CommandSender commandSender, String[] previousArguments, String s) { int id = Integer.parseInt(s); @@ -199,7 +200,7 @@ public class TraceCommand extends SWCommand { return flag; for(String alias: flag.aliases) - if (s.equals("--" + alias)) + if (s.equals("-" + alias)) return flag; } return null; @@ -207,8 +208,8 @@ public class TraceCommand extends SWCommand { @Override public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) { return ViewFlag.flags.stream() - .map(flag -> flag.name) - .map(name -> "--" + name) + .flatMap(viewFlag -> Stream.concat(Stream.of("--" + viewFlag.name), + Arrays.stream(viewFlag.aliases).map(name -> "-" + name))) .collect(Collectors.toList()); } }; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java index e17bcb48..6f0bd02f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java @@ -20,17 +20,16 @@ package de.steamwar.bausystem.features.tracer.rendering; import de.steamwar.bausystem.features.tracer.TNTRecord; -import de.steamwar.bausystem.features.tracer.rendering.TraceEntity; -import de.steamwar.entity.REntity; import de.steamwar.entity.REntityServer; import de.steamwar.entity.RFallingBlockEntity; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.util.Vector; -import java.util.*; -import java.util.function.BiConsumer; -import java.util.function.UnaryOperator; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import java.util.stream.Collectors; public abstract class ViewFlag { @@ -44,7 +43,7 @@ public abstract class ViewFlag { */ public static final List inverseFlags = new ArrayList<>(); - public static ViewFlag EXPLOSION = new ViewFlag(true, false,"explosion") { + public static ViewFlag EXPLOSION = new ViewFlag(true, false,"explosion", "e") { @Override public List filter(List records) { return records.stream() @@ -56,7 +55,7 @@ public abstract class ViewFlag { public void modify(REntityServer server, List entities) {} }; - public static ViewFlag IGNITE = new ViewFlag(true, true, "ignite") { + public static ViewFlag IGNITE = new ViewFlag(true, true, "ignite", "i") { @Override public List filter(List records) { return records.stream() @@ -68,7 +67,7 @@ public abstract class ViewFlag { public void modify(REntityServer server, List entities) {} }; - public static ViewFlag SOURCE = new ViewFlag(true, false, IGNITE, "source") { + public static ViewFlag SOURCE = new ViewFlag(true, false, IGNITE, "source", "s") { @Override public List filter(List records) { return records.stream() @@ -148,32 +147,33 @@ public abstract class ViewFlag { @Override public void modify(REntityServer server, List entities) { for(TraceEntity entity: entities) { - TNTRecord representaitv = entity.getRecords().get(0); + TNTRecord current = entity.getRecords().get(0); + if(current.isExplosion()) continue; + TNTRecord next = current.getNext().orElse(null); + if (next == null) continue; - if(representaitv.isExplosion()) continue; + Location pos = current.getLocation().clone(); + pos.setY(next.getLocation().getY()); - Location pos = representaitv.getLocation(); + if (pos.distanceSquared(current.getLocation()) >= 1.0 / 256.0) { + RFallingBlockEntity y = new RFallingBlockEntity(server, pos, Material.WHITE_STAINED_GLASS); + y.setNoGravity(true); + } - double xVelocity = representaitv.getVelocity().getX(); - double yVelocity = representaitv.getVelocity().getY(); - double zVelocity = representaitv.getVelocity().getZ(); - - pos = pos.add(0,yVelocity,0); - RFallingBlockEntity y = new RFallingBlockEntity(server, pos, Material.WHITE_STAINED_GLASS); - y.setNoGravity(true); - - if(xVelocity >= zVelocity) - pos.add(xVelocity, 0, 0); - else - pos.add(0,0,zVelocity); - - RFallingBlockEntity secound = new RFallingBlockEntity(server, pos, Material.WHITE_STAINED_GLASS); - secound.setNoGravity(true); + if (current.getVelocity().getX() >= current.getVelocity().getZ()) { + pos.setX(next.getLocation().getX()); + } else { + pos.setZ(next.getLocation().getZ()); + } + if (pos.distanceSquared(next.getLocation()) >= 1.0 / 256.0) { + RFallingBlockEntity second = new RFallingBlockEntity(server, pos, Material.WHITE_STAINED_GLASS); + second.setNoGravity(true); + } } } }; - public static ViewFlag COUNT = new ViewFlag(true, false, "count") { + public static ViewFlag COUNT = new ViewFlag(true, false, "count", "c") { @Override public List filter(List records) { return records; } @@ -185,7 +185,7 @@ public abstract class ViewFlag { } }; - public static ViewFlag FUSE = new ViewFlag(true, false, "fuse") { + public static ViewFlag FUSE = new ViewFlag(true, false, "fuse", "f") { @Override public List filter(List records) { return records; } @@ -197,7 +197,7 @@ public abstract class ViewFlag { } }; - public static ViewFlag TIME = new ViewFlag(true, false, "time") { + public static ViewFlag TIME = new ViewFlag(true, false, "time", "t") { @Override public List filter(List records) { return records; } @@ -222,27 +222,23 @@ public abstract class ViewFlag { /** * A flag that is used whenever this flag is used */ - public final ViewFlag required; + public final ViewFlag[] required; - public ViewFlag(boolean isStatic, boolean isInverse, String name, String... aliases) { + public ViewFlag(boolean isStatic, boolean isInverse, String name, String... aliases) { + this(isStatic, isInverse, new ViewFlag[0], name, aliases); + } + + public ViewFlag(boolean isStatic, boolean isInverse, ViewFlag required, String name, String... aliases) { + this(isStatic, isInverse, new ViewFlag[] { required }, name, aliases); + } + + public ViewFlag(boolean isStatic, boolean isInverse, ViewFlag[] required, String name, String... aliases){ this.name = name; this.aliases = aliases; - if(isStatic) - flags.add(this); - if(isInverse) - inverseFlags.add(this); - required = null; - } - - public ViewFlag(boolean isStatic, boolean isInverse, ViewFlag required, String name, String... aliases){ - this.name = name; - this.aliases = aliases; - if(isStatic) - flags.add(this); - if(isInverse) - inverseFlags.add(this); - this.required = required; - } + if(isStatic) flags.add(this); + if(isInverse) inverseFlags.add(this); + this.required = required; + } /** Filters the given records for a given condition * diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicFlags/IsolateFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicFlags/IsolateFlag.java index 71e59012..85d1f1bb 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicFlags/IsolateFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicFlags/IsolateFlag.java @@ -35,7 +35,7 @@ public class IsolateFlag extends ViewFlag { private final Set tntToIsolate = new HashSet<>(); public IsolateFlag(){ - super(false, false, ViewFlag.IGNITE, "isolate"); + super(false, false, ViewFlag.IGNITE, null); } /** @@ -43,10 +43,9 @@ public class IsolateFlag extends ViewFlag { * @param id */ public void toggleId(int id){ - if(tntToIsolate.contains(id)) - tntToIsolate.remove(id); - else + if (!tntToIsolate.remove(id)) { tntToIsolate.add(id); + } } @Override -- 2.39.5 From 987a00ae51c9a841abcb8749d26a2c0f71f287df Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Tue, 26 Mar 2024 22:11:08 +0100 Subject: [PATCH 055/111] Added proper info print to chat Refactored Isolate --- .../bausystem/features/tracer/TNTRecord.java | 11 +++++ .../bausystem/features/tracer/Trace.java | 49 ++++++++++++++++--- .../features/tracer/TraceCommand.java | 24 +-------- .../tracer/rendering/TraceEntity.java | 36 ++++++++------ .../features/tracer/rendering/ViewFlag.java | 2 - 5 files changed, 74 insertions(+), 48 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java index a6065aaf..27aec28e 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java @@ -136,4 +136,15 @@ public class TNTRecord { ", velocity=" + velocity + '}'; } + + @Override + public boolean equals(Object obj) { + if(!(obj instanceof TNTRecord)) return false; + TNTRecord record = (TNTRecord) obj; + + if(record.isExplosion() != explosion) return false; + if(!record.getLocation().equals(location)) return false; + if(!record.getVelocity().equals(velocity)) return false; + return true; + } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index 062e5a8f..e679dcd0 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -23,12 +23,14 @@ import de.steamwar.bausystem.features.tpslimit.TPSUtils; import de.steamwar.bausystem.features.tracer.rendering.BundleFilter; import de.steamwar.bausystem.features.tracer.rendering.TraceEntity; import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; +import de.steamwar.bausystem.features.tracer.rendering.dynamicFlags.IsolateFlag; import de.steamwar.bausystem.region.Region; import de.steamwar.entity.REntityServer; import lombok.Getter; import org.bukkit.entity.Player; import java.util.*; +import java.util.stream.Stream; public class Trace { /** @@ -199,6 +201,15 @@ public class Trace { for(ViewFlag flag : flags) { flag.modify(server, entities); } + + server.setCallback(((player, rEntity, entityAction) -> { + for(TraceEntity entity: entities){ + if(((TraceEntity) rEntity).equals(entity)){ + entity.printIntoChat(player); + return; + } + } + })); } /** Bundles the passed TNTRecords based on whether they are at the same location @@ -236,6 +247,37 @@ public class Trace { return bundles; } + /** Toggles the isolated render for the given records and player + * + * @param player the player the trace is shown to + * @param records the record for which isolation is toggled + */ + public void isolate(Player player, TNTRecord... records){ + IsolateFlag isolationFlag = null; + + ViewFlag[] viewFlags = viewFlagMap.get(player); + if(viewFlags != null) { + isolationFlag = Stream.of(viewFlags) + .filter(IsolateFlag.class::isInstance) + .map(IsolateFlag.class::cast) + .findFirst() + .orElse(null); + } + + if (viewFlags == null || isolationFlag == null) { + viewFlags = new ViewFlag[1]; + } + if (isolationFlag == null) { + isolationFlag = new IsolateFlag(); + } + viewFlags[0] = isolationFlag; + + for(TNTRecord record: records) + isolationFlag.toggleId(record.getTntId()); + + render(player, viewFlags, BundleFilter.STRICT); + } + /** Hides this trail for the given player * * @param player @@ -249,13 +291,6 @@ public class Trace { server.close(); } - /** Returns the flags used by the given player to render the trace or null if not present - * - * @param player - * @return - */ - protected ViewFlag[] getViewFlags(Player player){return viewFlagMap.get(player);} - @Override public String toString() { return "Trace{" + diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index c40f45dc..c294f473 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -92,29 +92,7 @@ public class TraceCommand extends SWCommand { @Register(value = "isolate", description = "TRACE_COMMAND_HELP_SHOW") public void isolate(Player player, Trace trace, @ErrorMessage("test") TNTRecord... records){ - IsolateFlag isolationFlag = null; - - ViewFlag[] viewFlags = trace.getViewFlags(player); - if(viewFlags != null) { - isolationFlag = Stream.of(viewFlags) - .filter(IsolateFlag.class::isInstance) - .map(IsolateFlag.class::cast) - .findFirst() - .orElse(null); - } - - if (viewFlags == null || isolationFlag == null) { - viewFlags = new ViewFlag[1]; - } - if (isolationFlag == null) { - isolationFlag = new IsolateFlag(); - } - viewFlags[0] = isolationFlag; - - for(TNTRecord record: records) - isolationFlag.toggleId(record.getTntId()); - - trace.render(player, viewFlags, BundleFilter.STRICT); + trace.isolate(player, records); } //TODO warning if nothing is shown diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java index 9f6439b3..ebfb6e43 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java @@ -26,6 +26,7 @@ import de.steamwar.entity.RFallingBlockEntity; import lombok.Getter; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityInteractEvent; @@ -44,23 +45,26 @@ public class TraceEntity extends RFallingBlockEntity { super(server, location, isExplosion ? Material.RED_STAINED_GLASS : Material.TNT); setNoGravity(true); this.records = records; - - server.setCallback(((player, rEntity, entityAction) -> { - if (entityAction != REntityServer.EntityAction.INTERACT) return; - - TNTRecord representative = records.get(0); - - BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_HEADER", player); - BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_FUSE_TIME", player, representative.getFuse()); - BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_POSITION_X", player, representative.getLocation().getX() + ""); - BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_POSITION_Y", player, representative.getLocation().getY() + ""); - BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_POSITION_Z", player, representative.getLocation().getZ() + ""); - BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_X", player, representative.getVelocity().getX() + ""); - BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_Y", player, representative.getVelocity().getY() + ""); - BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_Z", player, representative.getVelocity().getZ() + ""); - - })); } + public void printIntoChat(Player player){ + TNTRecord representative = records.get(0); + BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_HEADER", player); + BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_FUSE_TIME", player, representative.getFuse()); + BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_POSITION_X", player, representative.getLocation().getX() + ""); + BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_POSITION_Y", player, representative.getLocation().getY() + ""); + BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_POSITION_Z", player, representative.getLocation().getZ() + ""); + BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_X", player, representative.getVelocity().getX() + ""); + BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_Y", player, representative.getVelocity().getY() + ""); + BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_Z", player, representative.getVelocity().getZ() + ""); + } + + @Override + public boolean equals(Object object) { + if(!(object instanceof TraceEntity)) return false; + TraceEntity entity = (TraceEntity) object; + + return records.get(0).equals(entity.getRecords().get(0)); + } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java index 6f0bd02f..c38c02a7 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java @@ -103,7 +103,6 @@ public abstract class ViewFlag { public void modify(REntityServer server, List entities) {} }; - //TODO fix? public static ViewFlag MICROMOTION = new ViewFlag(true, false, "micromotion", "m") { @Override public List filter(List records) { @@ -139,7 +138,6 @@ public abstract class ViewFlag { public void modify(REntityServer server, List entities) {} }; - //TODO fix? public static ViewFlag ADVANCED = new ViewFlag(true, false, "advanced", "a") { @Override public List filter(List records) {return records;} -- 2.39.5 From 870578dcf962ba595ef63a7f7b39b686240a8ec8 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Sat, 30 Mar 2024 16:09:06 +0100 Subject: [PATCH 056/111] Added at-Flag --- .../bausystem/features/tracer/Trace.java | 32 ++++++++++ .../tracer/rendering/dynamicFlags/AtFlag.java | 60 +++++++++++++++++++ .../rendering/dynamicFlags/IsolateFlag.java | 3 + 3 files changed, 95 insertions(+) create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicFlags/AtFlag.java diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index e679dcd0..baa263d4 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -23,12 +23,14 @@ import de.steamwar.bausystem.features.tpslimit.TPSUtils; import de.steamwar.bausystem.features.tracer.rendering.BundleFilter; import de.steamwar.bausystem.features.tracer.rendering.TraceEntity; import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; +import de.steamwar.bausystem.features.tracer.rendering.dynamicFlags.AtFlag; import de.steamwar.bausystem.features.tracer.rendering.dynamicFlags.IsolateFlag; import de.steamwar.bausystem.region.Region; import de.steamwar.entity.REntityServer; import lombok.Getter; import org.bukkit.entity.Player; +import java.lang.reflect.Array; import java.util.*; import java.util.stream.Stream; @@ -247,6 +249,36 @@ public class Trace { return bundles; } + + /** Modifies the render for the given player, to only show tnts at the given time interval + * + * @param player + * @param from start of time interval + * @param to end of time interval + */ + public void renderAt(Player player, int from, int to){ + ViewFlag[] viewFlags = viewFlagMap.get(player); + if(viewFlags == null) return; + + AtFlag atFlag = null; + atFlag = Stream.of(viewFlags) + .filter(AtFlag.class::isInstance) + .map(AtFlag.class::cast) + .findFirst() + .orElse(null); + + if(atFlag != null){ + atFlag.update(from, to); + } + else { + atFlag = new AtFlag(from, to); + viewFlags = Arrays.copyOf(viewFlags, viewFlags.length + 1); + viewFlags[viewFlags.length - 1] = atFlag; + } + + render(player, viewFlags, BundleFilter.STRICT); + } + /** Toggles the isolated render for the given records and player * * @param player the player the trace is shown to diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicFlags/AtFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicFlags/AtFlag.java new file mode 100644 index 00000000..cb06685a --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicFlags/AtFlag.java @@ -0,0 +1,60 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2024 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.tracer.rendering.dynamicFlags; + +import de.steamwar.bausystem.features.tracer.TNTRecord; +import de.steamwar.bausystem.features.tracer.rendering.TraceEntity; +import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; +import de.steamwar.entity.REntityServer; + +import java.util.List; +import java.util.stream.Collectors; + +public class AtFlag extends ViewFlag { + private int start; + private int end; + + + public AtFlag(int start, int end){ + super(false, false, ViewFlag.IGNITE, null); + this.start = start; + this.end = end; + } + + /** Update this flag to represent another time interval + * + * @param start new interval start + * @param end new interval end + */ + public void update(int start, int end){ + this.start = start; + this.end = end; + } + + @Override + public List filter(List records) { + return records.stream() + .filter(record -> record.getTicksSinceStart() <= start && record.getTicksSinceStart() >= end) + .collect(Collectors.toList()); + } + + @Override + public void modify(REntityServer server, List entities) {} +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicFlags/IsolateFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicFlags/IsolateFlag.java index 85d1f1bb..7832636f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicFlags/IsolateFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicFlags/IsolateFlag.java @@ -32,6 +32,9 @@ import java.util.stream.Collectors; public class IsolateFlag extends ViewFlag { + /** + * Tnt ids that will be isolated + */ private final Set tntToIsolate = new HashSet<>(); public IsolateFlag(){ -- 2.39.5 From 488866cee6b0031982d869ace1a30c11a24710d0 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Tue, 2 Apr 2024 23:52:18 +0200 Subject: [PATCH 057/111] Added comand for trace at --- .../bausystem/features/tracer/TraceCommand.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index c294f473..dbc6d35b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -91,10 +91,18 @@ public class TraceCommand extends SWCommand { } @Register(value = "isolate", description = "TRACE_COMMAND_HELP_SHOW") - public void isolate(Player player, Trace trace, @ErrorMessage("test") TNTRecord... records){ + public void isolate(Player player, Trace trace, @ErrorMessage("TRACE_RECORD_ID_INVALID") TNTRecord... records){ trace.isolate(player, records); } - //TODO warning if nothing is shown + + @Register(value="at", description = "TRACE_COMMAND_HELP_SHOW") + public void at(Player player, int start, int end){ + for(Trace trace: manager.getAll()){ + trace.renderAt(player, start, end); + } + } + + @ClassMapper(value = Trace.class, local = true) public TypeMapper traceClassMapper(){ -- 2.39.5 From 1fc9a43604dbe0488360e4d32fbf4b043a06c238 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Wed, 3 Apr 2024 00:14:37 +0200 Subject: [PATCH 058/111] Added trace follow --- .../bausystem/features/tracer/Trace.java | 27 +++++++++++++++++++ .../features/tracer/TraceCommand.java | 16 +++++++++++ .../features/tracer/TraceManager.java | 2 +- 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index baa263d4..1572c1ad 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -310,6 +310,33 @@ public class Trace { render(player, viewFlags, BundleFilter.STRICT); } + /**Makes the first passed player follow the trace render of the second passed player + * + * @param player + * @param toFollow + */ + public void follow(Player player, Player toFollow){ + for(REntityServer server :serverMap.values()){ + server.removePlayer(player); + } + + serverMap.get(toFollow).addPlayer(player); + } + + /** Makes the passed player stop following any other players trace render + * + * @param player + */ + public void unfollow(Player player){ + for(REntityServer server :serverMap.values()){ + server.removePlayer(player); + } + + if(serverMap.get(player) != null){ + serverMap.get(player).addPlayer(player); + } + } + /** Hides this trail for the given player * * @param player diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index dbc6d35b..640b898b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -101,8 +101,24 @@ public class TraceCommand extends SWCommand { trace.renderAt(player, start, end); } } + @Register(value="share", description = "TRACE_COMMAND_HELP_SHOW") + public void share(Player player){ + //TODO Rücksprache + } + @Register(value="follow", description = "TRACE_COMMAND_HELP_SHOW") + public void follow(Player player, Player toFollow){ + for(Trace trace: manager.getAll()){ + trace.follow(player, toFollow); + } + } + @Register(value="unfollow", description = "TRACE_COMMAND_HELP_SHOW") + public void unfollow(Player player){ + for(Trace trace: manager.getAll()){ + trace.unfollow(player); + } + } @ClassMapper(value = Trace.class, local = true) public TypeMapper traceClassMapper(){ diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index c000c0b1..1ef128f5 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -149,5 +149,5 @@ public class TraceManager implements Listener { viewFlagMap.remove(player); bundleFilterMap.remove(player); - }; + } } -- 2.39.5 From 207826ae8a5ba5c118570d9214b2ec42805a583f Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 7 Apr 2024 13:29:30 +0200 Subject: [PATCH 059/111] Optimize BundleFilter --- .../bausystem/features/tracer/Trace.java | 14 +++--- .../tracer/rendering/BundleFilter.java | 46 ++++++++++--------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index 1572c1ad..dbfc8162 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -30,7 +30,6 @@ import de.steamwar.entity.REntityServer; import lombok.Getter; import org.bukkit.entity.Player; -import java.lang.reflect.Array; import java.util.*; import java.util.stream.Stream; @@ -222,7 +221,8 @@ public class Trace { private List> bundleRecords(List records, BundleFilter filter){ List> bundles = new ArrayList<>(); - recordsLoop : for(TNTRecord record : records) { + recordsLoop: + for (TNTRecord record : records) { if(bundles.isEmpty()){ List firstBundle = new ArrayList<>(); firstBundle.add(record); @@ -232,17 +232,15 @@ public class Trace { for(int i = bundles.size() - 1; i >= 0; i--){ List bundle = bundles.get(i); - Optional filterResult = filter.apply.apply(record, bundle.get(0)); - - if(filterResult.isPresent() && filterResult.get()) - bundle.add(record); - else{ + Boolean filterResult = filter.function.apply(record, bundle.get(0)); + if (filterResult == null || !filterResult) { ArrayList newBundle = new ArrayList<>(); newBundle.add(record); bundles.add(newBundle); continue recordsLoop; + } else { + bundle.add(record); } - } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java index e511c923..5232065c 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java @@ -20,45 +20,47 @@ package de.steamwar.bausystem.features.tracer.rendering; import de.steamwar.bausystem.features.tracer.TNTRecord; +import lombok.RequiredArgsConstructor; -import java.util.Optional; import java.util.function.BiFunction; +@RequiredArgsConstructor public enum BundleFilter { - //TODO chagne optional to true flase null LOOSE((TNTRecord a, TNTRecord b) -> { - if(a.isExplosion() != b.isExplosion()) return Optional.of(false); - if(a.getLocation().distance(b.getLocation()) <= BundleFilter.pixelSize) return Optional.of(false); - if(a.getVelocity().distance(b.getVelocity()) <= BundleFilter.pixelSize) return Optional.of(false); - return Optional.of(true); + if (a.isExplosion() != b.isExplosion()) return false; + if (a.getLocation().distanceSquared(b.getLocation()) <= BundleFilter.pixelSizeSquared) return false; + if (a.getVelocity().distanceSquared(b.getVelocity()) <= BundleFilter.pixelSizeSquared) return false; + return true; }), DEFAULT((TNTRecord a, TNTRecord b) -> { - if(a.isExplosion() != b.isExplosion()) return Optional.of(false); - if(a.getTicksSinceStart() != b.getTicksSinceStart()) return Optional.empty(); - if(a.getLocation().distance(b.getLocation()) <= BundleFilter.pixelSize) return Optional.of(false); - if(a.getVelocity().distance(b.getVelocity()) <= BundleFilter.pixelSize) return Optional.of(false); - return Optional.of(true); + if (a.isExplosion() != b.isExplosion()) return false; + if (a.getTicksSinceStart() != b.getTicksSinceStart()) return null; + if (a.getLocation().distanceSquared(b.getLocation()) <= BundleFilter.pixelSizeSquared) return false; + if (a.getVelocity().distanceSquared(b.getVelocity()) <= BundleFilter.pixelSizeSquared) return false; + return true; }), STRICT((TNTRecord a, TNTRecord b) -> { - if(a.isExplosion() != b.isExplosion()) return Optional.of(false); - if(!a.getLocation().equals(b.getLocation())) return Optional.of(false); - if(!a.getVelocity().equals(b.getVelocity())) return Optional.of(false); - if(a.getTicksSinceStart() != b.getTicksSinceStart()) return Optional.empty(); - return Optional.of(true); + if (a.isExplosion() != b.isExplosion()) return false; + if (!a.getLocation().equals(b.getLocation())) return false; + if (!a.getVelocity().equals(b.getVelocity())) return false; + if (a.getTicksSinceStart() != b.getTicksSinceStart()) return null; + return true; }), NONE((TNTRecord a, TNTRecord b) -> { - return Optional.empty(); + return null; }); - public BiFunction> apply; + /** + * {@code null}: Bundling can be stopped from this point forward + * {@code false}: No bundling allowed + * {@code true}: Bundling should be applied + */ + public final BiFunction function; private static final double pixelSize = 0.0625; - - BundleFilter(BiFunction> apply){ - this.apply = apply; - } + private static final double pixelSizeSquared = pixelSize * pixelSize; } -- 2.39.5 From e64c50b56622ba4973852b20c75b1e4262cf46f0 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 7 Apr 2024 13:38:36 +0200 Subject: [PATCH 060/111] Reformat many things --- .../bausystem/features/tracer/Recorder.java | 137 ++++++++++-------- .../bausystem/features/tracer/TNTRecord.java | 26 ++-- .../bausystem/features/tracer/Trace.java | 117 ++++++++------- .../features/tracer/TraceCommand.java | 96 ++++++------ .../features/tracer/TraceManager.java | 72 +++++---- .../tracer/rendering/TraceEntity.java | 10 +- .../features/tracer/rendering/ViewFlag.java | 87 ++++------- .../AtFlag.java | 17 +-- .../IsolateFlag.java | 13 +- 9 files changed, 287 insertions(+), 288 deletions(-) rename BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/{dynamicFlags => dynamicflags}/AtFlag.java (77%) rename BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/{dynamicFlags => dynamicflags}/IsolateFlag.java (82%) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java index 8eab6d0f..29a8786b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java @@ -53,8 +53,8 @@ public class Recorder implements Listener { */ private final Map> trackedTNT = new HashMap<>(); - /** Map from TNT to Region the TNT spawned in - * + /** + * Map from TNT to Region the TNT spawned in */ private final Map tntSpawnRegion = new HashMap<>(); @@ -78,41 +78,44 @@ public class Recorder implements Listener { */ private final Set autoTraceRegions = new HashSet<>(); - public Recorder(){ + public Recorder() { BauSystem.runTaskTimer(BauSystem.getInstance(), () -> { record(); checkForAutoTraceFinish(); }, 0, 1); } - /** Toggles auto trace for the given region + /** + * Toggles auto trace for the given region * * @param region */ public void toggleAutoTrace(Region region) { - if (autoTraceRegions.contains(region)) + if (autoTraceRegions.contains(region)) { autoTraceRegions.remove(region); - else + } else { autoTraceRegions.add(region); + } } - /** Makes checks for whether auto traces finished - * + /** + * Makes checks for whether auto traces finished */ - public void checkForAutoTraceFinish(){ - for(Region region: autoTraceRegions) { + public void checkForAutoTraceFinish() { + for (Region region : autoTraceRegions) { if (autoTraceRegions.contains(region) && trackedTNT.getOrDefault(region, Collections.emptyList()).size() == 0) { stopRecording(region); } } } - /** Starts a recording at the given region + /** + * Starts a recording at the given region * - * @param region region to be recorded + * @param region region to be recorded */ - public int startRecording(Region region){ - if(activeTraces.containsKey(region)) return -1; + public int startRecording(Region region) { + if (activeTraces.containsKey(region)) return -1; Trace trace = new Trace(region); noExplosionRecorded.add(trace); activeTraces.put(region, trace); @@ -120,100 +123,110 @@ public class Recorder implements Listener { return manager.add(trace); } - /** Stops the recording at the given region + /** + * Stops the recording at the given region * * @param region region to stop recording */ - public void stopRecording(Region region){ + public void stopRecording(Region region) { Trace trace = activeTraces.getOrDefault(region, null); if (trace == null) return; trace.setRecords(Collections.unmodifiableList(trace.getRecords())); noExplosionRecorded.remove(trace); activeTraces.remove(region); - for(TNTPrimed tnt : trackedTNT.getOrDefault(region, Collections.emptyList())) + for (TNTPrimed tnt : trackedTNT.getOrDefault(region, Collections.emptyList())) { historyMap.remove(tnt); + } recordsToAddMap.remove(trace); trackedTNT.put(region, new ArrayList<>()); } - /** Internal methode to record all tracked TNT Entities - * + /** + * Internal methode to record all tracked TNT Entities */ - private void record(){ - for(Region region : activeTraces.keySet()){ + private void record() { + for (Region region : activeTraces.keySet()) { Trace trace = activeTraces.get(region); - for(TNTPrimed tnt : trackedTNT.getOrDefault(region, Collections.emptyList())){ + for (TNTPrimed tnt : trackedTNT.getOrDefault(region, Collections.emptyList())) { record(tnt, trace, Collections.emptyList()); } trace.addAll(recordsToAddMap.get(trace)); recordsToAddMap.get(trace).clear(); } - } + } - /** Internal methode to record exploded tnt + /** + * Internal methode to record exploded tnt * * @param tntPrimed tnt exploding - * @param trace trace to record the tnt for + * @param trace trace to record the tnt for */ - private void record(TNTPrimed tntPrimed, Trace trace, List destroyedBlocks){ - List history = historyMap.getOrDefault(tntPrimed, new ArrayList<>()); - int tntID; + private void record(TNTPrimed tntPrimed, Trace trace, List destroyedBlocks) { + List history = historyMap.getOrDefault(tntPrimed, new ArrayList<>()); + int tntID; - if(history.size() == 0){ - historyMap.put(tntPrimed, history); - tntID = trace.getAndIncrementNextOpenRecordId(); - } - else - tntID = history.get(0).getTntId(); + if (history.size() == 0) { + historyMap.put(tntPrimed, history); + tntID = trace.getAndIncrementNextOpenRecordId(); + } else { + tntID = history.get(0).getTntId(); + } - boolean isExplosion = tntPrimed.getFuseTicks() == 0; - if(isExplosion) - noExplosionRecorded.remove(trace); - boolean afterFirstExplosion = noExplosionRecorded.contains(trace); + boolean isExplosion = tntPrimed.getFuseTicks() == 0; + if (isExplosion) { + noExplosionRecorded.remove(trace); + } + boolean afterFirstExplosion = noExplosionRecorded.contains(trace); - TNTRecord record = new TNTRecord(tntID, tntPrimed, isExplosion, afterFirstExplosion, TPSUtils.currentTick.get() - trace.getStartTime(), history, destroyedBlocks); - history.add(record); + TNTRecord record = new TNTRecord(tntID, tntPrimed, isExplosion, afterFirstExplosion, TPSUtils.currentTick.get() - trace.getStartTime(), history, destroyedBlocks); + history.add(record); - recordsToAddMap.get(trace).add(record); - } + recordsToAddMap.get(trace).add(record); + } - /** Event for TNTs beeing spawn. + /** + * Event for TNTs beeing spawn. * Registers newly spawned TNT to be traced if reqired + * * @param event */ - @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) - public void onTNTSpawn(EntitySpawnEvent event){ - if(!(event.getEntity() instanceof TNTPrimed)) return; + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void onTNTSpawn(EntitySpawnEvent event) { + if (!(event.getEntity() instanceof TNTPrimed)) return; - Region region = Region.getRegion(event.getLocation()); + Region region = Region.getRegion(event.getLocation()); - if(autoTraceRegions.contains(region) && !activeTraces.containsKey(region)) - startRecording(region); + if (autoTraceRegions.contains(region) && !activeTraces.containsKey(region)) { + startRecording(region); + } - if(activeTraces.containsKey(region)){ - //Check whether set for tracking already exists. Creating it if necessary - if(!trackedTNT.containsKey(region)) - trackedTNT.put(region, new ArrayList<>()); + if (activeTraces.containsKey(region)) { + // Check whether set for tracking already exists. Creating it if necessary + if (!trackedTNT.containsKey(region)) { + trackedTNT.put(region, new ArrayList<>()); + } - trackedTNT.get(region).add((TNTPrimed) event.getEntity()); - tntSpawnRegion.put((TNTPrimed) event.getEntity(), region); - record((TNTPrimed) event.getEntity(), activeTraces.get(region), Collections.emptyList()); - } - } + trackedTNT.get(region).add((TNTPrimed) event.getEntity()); + tntSpawnRegion.put((TNTPrimed) event.getEntity(), region); + record((TNTPrimed) event.getEntity(), activeTraces.get(region), Collections.emptyList()); + } + } - /** Event for TNTs exploding + /** + * Event for TNTs exploding * Unregisters TNTs from beeing traced on explode + * * @param event */ @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public void onTNTExplode(EntityExplodeEvent event){ - if(!(event.getEntity() instanceof TNTPrimed)) return; + public void onTNTExplode(EntityExplodeEvent event) { + if (!(event.getEntity() instanceof TNTPrimed)) return; Region region = tntSpawnRegion.getOrDefault((TNTPrimed) event.getEntity(), null); - if(region == null) return; + if (region == null) return; trackedTNT.get(region).remove((TNTPrimed) event.getEntity()); tntSpawnRegion.remove((TNTPrimed) event.getEntity()); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java index 27aec28e..52671821 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java @@ -30,7 +30,6 @@ import org.bukkit.util.Vector; import java.util.List; import java.util.Optional; -import java.util.UUID; @Getter public class TNTRecord { @@ -90,7 +89,7 @@ public class TNTRecord { */ private final List history; - public TNTRecord(int tntId, TNTPrimed tnt, boolean explosion, boolean afterFirstExplosion, long ticksSinceStart, List history, List destroyedBlocks){ + public TNTRecord(int tntId, TNTPrimed tnt, boolean explosion, boolean afterFirstExplosion, long ticksSinceStart, List history, List destroyedBlocks) { this.tntId = tntId; this.explosion = explosion; this.inWater = tnt.isInWater(); @@ -103,26 +102,26 @@ public class TNTRecord { boolean buildDestroy = false; boolean testblockDestroy = false; - for(Block destroyedBlock: destroyedBlocks){ - if (Region.getRegion(destroyedBlock.getLocation()).inRegion(destroyedBlock.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION)) + for (Block destroyedBlock : destroyedBlocks) { + if (Region.getRegion(destroyedBlock.getLocation()).inRegion(destroyedBlock.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION)) { buildDestroy = true; - if (Region.getRegion(destroyedBlock.getLocation()).inRegion(destroyedBlock.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.EXTENSION)) + } + if (Region.getRegion(destroyedBlock.getLocation()).inRegion(destroyedBlock.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.EXTENSION)) { testblockDestroy = true; + } } destroyedBuildArea = buildDestroy; destroyedTestBlock = testblockDestroy; } - public Optional getNext(){ + public Optional getNext() { int index = history.indexOf(this); - return index == history.size() - 1 ? Optional.empty() : Optional.of(history.get(index + 1)); } - public Optional getPrevious(){ + public Optional getPrevious() { int index = history.indexOf(this); - return index == 0 ? Optional.empty() : Optional.of(history.get(index - 1)); } @@ -139,12 +138,11 @@ public class TNTRecord { @Override public boolean equals(Object obj) { - if(!(obj instanceof TNTRecord)) return false; + if (!(obj instanceof TNTRecord)) return false; TNTRecord record = (TNTRecord) obj; - - if(record.isExplosion() != explosion) return false; - if(!record.getLocation().equals(location)) return false; - if(!record.getVelocity().equals(velocity)) return false; + if (record.isExplosion() != explosion) return false; + if (!record.getLocation().equals(location)) return false; + if (!record.getVelocity().equals(velocity)) return false; return true; } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index dbfc8162..769f7cc0 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -23,8 +23,8 @@ import de.steamwar.bausystem.features.tpslimit.TPSUtils; import de.steamwar.bausystem.features.tracer.rendering.BundleFilter; import de.steamwar.bausystem.features.tracer.rendering.TraceEntity; import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; -import de.steamwar.bausystem.features.tracer.rendering.dynamicFlags.AtFlag; -import de.steamwar.bausystem.features.tracer.rendering.dynamicFlags.IsolateFlag; +import de.steamwar.bausystem.features.tracer.rendering.dynamicflags.AtFlag; +import de.steamwar.bausystem.features.tracer.rendering.dynamicflags.IsolateFlag; import de.steamwar.bausystem.region.Region; import de.steamwar.entity.REntityServer; import lombok.Getter; @@ -79,15 +79,16 @@ public class Trace { */ private final Map viewFlagMap = new HashMap<>(); - public Trace (Region region){ + public Trace(Region region) { this.region = region; } /** * Gets and increments the next open record id + * * @return next open record id */ - protected int getAndIncrementNextOpenRecordId(){ + protected int getAndIncrementNextOpenRecordId() { nextOpenRecordId++; usedIds.add(Integer.toString(nextOpenRecordId)); return nextOpenRecordId; @@ -96,10 +97,10 @@ public class Trace { /** * Adds the given records and updates potential trace renderings */ - protected void addAll(List records){ + protected void addAll(List records) { this.records.addAll(records); - for(Player player: serverMap.keySet()){ + for (Player player : serverMap.keySet()) { REntityServer server = serverMap.get(player); BundleFilter bundleFilter = bundleFilterMap.get(player); ViewFlag[] viewFlags = viewFlagMap.get(player); @@ -108,36 +109,39 @@ public class Trace { } } - /** Internal methode to make records immutable after recording is finished + /** + * Internal methode to make records immutable after recording is finished * * @param records immutable records list */ - protected void setRecords(List records){ + protected void setRecords(List records) { this.records = records; } - /** Gets the historys of all tnts in this trace + /** + * Gets the historys of all tnts in this trace * * @return the historys of this trace */ public Set> getHistories() { Set> histories = new HashSet<>(); - for(TNTRecord record: records) { + for (TNTRecord record : records) { histories.add(record.getHistory()); } return histories; } - /** Renders this traces + /** + * Renders this traces * - * @param player The player the trace is rendered to - * @param flags Flags modefieing the rendering + * @param player The player the trace is rendered to + * @param flags Flags modefieing the rendering * @param bundleFilter Filter to determin bundeling of records */ - public void render(Player player, ViewFlag[] flags, BundleFilter bundleFilter){ - if(serverMap.containsKey(player)){ + public void render(Player player, ViewFlag[] flags, BundleFilter bundleFilter) { + if (serverMap.containsKey(player)) { REntityServer server = serverMap.get(player); server.close(); @@ -156,15 +160,16 @@ public class Trace { render(server, records, flags, bundleFilter); } - /** Internal methode to render records to a REntityServer + /** + * Internal methode to render records to a REntityServer * - * @param server Server to render to - * @param records Records to render - * @param flags Flags modefieing the rendering + * @param server Server to render to + * @param records Records to render + * @param flags Flags modefieing the rendering * @param bundleFilter Filter to determin bundeling of records */ - private void render(REntityServer server, List records, ViewFlag[] flags, BundleFilter bundleFilter){ - if(records.size() == 0) return; + private void render(REntityServer server, List records, ViewFlag[] flags, BundleFilter bundleFilter) { + if (records.isEmpty()) return; List workingRecords = records; @@ -184,7 +189,7 @@ public class Trace { }); //Apply filters - for(ViewFlag flag : flagList) { + for (ViewFlag flag : flagList) { workingRecords = flag.filter(workingRecords); } @@ -194,18 +199,18 @@ public class Trace { //Render bundled records List entities = new LinkedList<>(); - for(List bundle : bundles) { + for (List bundle : bundles) { entities.add(new TraceEntity(server, bundle.get(0).getLocation(), bundle.get(0).isExplosion(), bundle)); } //Apply modifiers - for(ViewFlag flag : flags) { + for (ViewFlag flag : flags) { flag.modify(server, entities); } server.setCallback(((player, rEntity, entityAction) -> { - for(TraceEntity entity: entities){ - if(((TraceEntity) rEntity).equals(entity)){ + for (TraceEntity entity : entities) { + if (rEntity.equals(entity)) { entity.printIntoChat(player); return; } @@ -213,23 +218,24 @@ public class Trace { })); } - /** Bundles the passed TNTRecords based on whether they are at the same location + /** + * Bundles the passed TNTRecords based on whether they are at the same location * * @param records The TNTRecords that are supposed to be bundled * @return A list of bundles */ - private List> bundleRecords(List records, BundleFilter filter){ + private List> bundleRecords(List records, BundleFilter filter) { List> bundles = new ArrayList<>(); recordsLoop: for (TNTRecord record : records) { - if(bundles.isEmpty()){ + if (bundles.isEmpty()) { List firstBundle = new ArrayList<>(); firstBundle.add(record); bundles.add(firstBundle); } - for(int i = bundles.size() - 1; i >= 0; i--){ + for (int i = bundles.size() - 1; i >= 0; i--) { List bundle = bundles.get(i); Boolean filterResult = filter.function.apply(record, bundle.get(0)); @@ -248,15 +254,16 @@ public class Trace { } - /** Modifies the render for the given player, to only show tnts at the given time interval + /** + * Modifies the render for the given player, to only show tnts at the given time interval * * @param player - * @param from start of time interval - * @param to end of time interval + * @param from start of time interval + * @param to end of time interval */ - public void renderAt(Player player, int from, int to){ + public void renderAt(Player player, int from, int to) { ViewFlag[] viewFlags = viewFlagMap.get(player); - if(viewFlags == null) return; + if (viewFlags == null) return; AtFlag atFlag = null; atFlag = Stream.of(viewFlags) @@ -265,10 +272,9 @@ public class Trace { .findFirst() .orElse(null); - if(atFlag != null){ + if (atFlag != null) { atFlag.update(from, to); - } - else { + } else { atFlag = new AtFlag(from, to); viewFlags = Arrays.copyOf(viewFlags, viewFlags.length + 1); viewFlags[viewFlags.length - 1] = atFlag; @@ -277,16 +283,17 @@ public class Trace { render(player, viewFlags, BundleFilter.STRICT); } - /** Toggles the isolated render for the given records and player + /** + * Toggles the isolated render for the given records and player * - * @param player the player the trace is shown to + * @param player the player the trace is shown to * @param records the record for which isolation is toggled */ - public void isolate(Player player, TNTRecord... records){ + public void isolate(Player player, TNTRecord... records) { IsolateFlag isolationFlag = null; ViewFlag[] viewFlags = viewFlagMap.get(player); - if(viewFlags != null) { + if (viewFlags != null) { isolationFlag = Stream.of(viewFlags) .filter(IsolateFlag.class::isInstance) .map(IsolateFlag.class::cast) @@ -302,46 +309,50 @@ public class Trace { } viewFlags[0] = isolationFlag; - for(TNTRecord record: records) + for (TNTRecord record : records) { isolationFlag.toggleId(record.getTntId()); + } render(player, viewFlags, BundleFilter.STRICT); } - /**Makes the first passed player follow the trace render of the second passed player + /** + * Makes the first passed player follow the trace render of the second passed player * * @param player * @param toFollow */ - public void follow(Player player, Player toFollow){ - for(REntityServer server :serverMap.values()){ + public void follow(Player player, Player toFollow) { + for (REntityServer server : serverMap.values()) { server.removePlayer(player); } serverMap.get(toFollow).addPlayer(player); } - /** Makes the passed player stop following any other players trace render + /** + * Makes the passed player stop following any other players trace render * * @param player */ - public void unfollow(Player player){ - for(REntityServer server :serverMap.values()){ + public void unfollow(Player player) { + for (REntityServer server : serverMap.values()) { server.removePlayer(player); } - if(serverMap.get(player) != null){ + if (serverMap.get(player) != null) { serverMap.get(player).addPlayer(player); } } - /** Hides this trail for the given player + /** + * Hides this trail for the given player * * @param player */ - public void hide(Player player){ + public void hide(Player player) { REntityServer server = serverMap.get(player); - if(server == null) return; + if (server == null) return; bundleFilterMap.remove(player); viewFlagMap.remove(player); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index 640b898b..2554e3fa 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -21,21 +21,19 @@ package de.steamwar.bausystem.features.tracer; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.tracer.rendering.BundleFilter; -import de.steamwar.bausystem.features.tracer.rendering.TraceEntity; import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; -import de.steamwar.bausystem.features.tracer.rendering.dynamicFlags.IsolateFlag; import de.steamwar.bausystem.region.Region; import de.steamwar.command.PreviousArguments; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeMapper; -import de.steamwar.command.TypeValidator; -import de.steamwar.entity.REntityServer; import de.steamwar.linkage.Linked; import de.steamwar.linkage.LinkedInstance; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -46,96 +44,96 @@ public class TraceCommand extends SWCommand { public Recorder recorder; @LinkedInstance public TraceManager manager; - public TraceCommand(){super("trace", "trail");} + + public TraceCommand() { + super("trace", "trail"); + } @Register(value = "start", description = "TRACE_COMMAND_HELP_START") - public void start(Player player){ + public void start(@Validator Player player) { Region region = Region.getRegion(player.getLocation()); recorder.startRecording(region); BauSystem.MESSAGE.send("TRACE_MESSAGE_START", player); } @Register(value = "stop", description = "TRACE_COMMAND_HELP_STOP") - public void stop(Player player){ + public void stop(@Validator Player player) { Region region = Region.getRegion(player.getLocation()); recorder.stopRecording(region); BauSystem.MESSAGE.send("TRACE_MESSAGE_STOP", player); } @Register(value = "auto", description = "TRACE_COMMAND_HELP_SHOW") - public void auto (Player player) { + public void auto(@Validator Player player) { Region region = Region.getRegion(player.getLocation()); recorder.toggleAutoTrace(region); } @Register(value = "show", description = "TRACE_COMMAND_HELP_SHOW") - public void show(Player player, @OptionalValue("STRICT") BundleFilter filter, ViewFlag... flags){ + public void show(@Validator Player player, @OptionalValue("STRICT") BundleFilter filter, ViewFlag... flags) { manager.show(player, flags, filter); BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW", player); } @Register(value = "hide", description = "TRACE_COMMAND_HELP_SHOW") - public void hide(Player player){ + public void hide(@Validator Player player) { manager.hide(player); BauSystem.MESSAGE.send("TRACE_MESSAGE_HIDE", player); } @Register(value = "delete", description = "TRACE_COMMAND_HELP_SHOW") - public void delete(Player player){ + public void delete(@Validator Player player) { manager.clear(); } @Register(value = "delete", description = "TRACE_COMMAND_HELP_SHOW") - public void delete(Player player, int id){ + public void delete(@Validator Player player, int id) { manager.remove(id); } @Register(value = "isolate", description = "TRACE_COMMAND_HELP_SHOW") - public void isolate(Player player, Trace trace, @ErrorMessage("TRACE_RECORD_ID_INVALID") TNTRecord... records){ + public void isolate(@Validator Player player, Trace trace, @ErrorMessage("TRACE_RECORD_ID_INVALID") TNTRecord... records) { trace.isolate(player, records); } - @Register(value="at", description = "TRACE_COMMAND_HELP_SHOW") - public void at(Player player, int start, int end){ - for(Trace trace: manager.getAll()){ + @Register(value = "at", description = "TRACE_COMMAND_HELP_SHOW") + public void at(@Validator Player player, int start, int end) { + for (Trace trace : manager.getAll()) { trace.renderAt(player, start, end); } } - @Register(value="share", description = "TRACE_COMMAND_HELP_SHOW") - public void share(Player player){ + + @Register(value = "share", description = "TRACE_COMMAND_HELP_SHOW") + public void share(@Validator Player player) { //TODO Rücksprache } - @Register(value="follow", description = "TRACE_COMMAND_HELP_SHOW") - public void follow(Player player, Player toFollow){ - for(Trace trace: manager.getAll()){ + @Register(value = "follow", description = "TRACE_COMMAND_HELP_SHOW") + public void follow(@Validator Player player, Player toFollow) { + for (Trace trace : manager.getAll()) { trace.follow(player, toFollow); } } - @Register(value="unfollow", description = "TRACE_COMMAND_HELP_SHOW") - public void unfollow(Player player){ - for(Trace trace: manager.getAll()){ + @Register(value = "unfollow", description = "TRACE_COMMAND_HELP_SHOW") + public void unfollow(@Validator Player player) { + for (Trace trace : manager.getAll()) { trace.unfollow(player); } } @ClassMapper(value = Trace.class, local = true) - public TypeMapper traceClassMapper(){ - return new TypeMapper() { + public TypeMapper traceClassMapper() { + return new TypeMapper<>() { @Override public Trace map(CommandSender commandSender, String[] previousArguments, String s) { - int id = Integer.parseInt(s); - - Optional trace = manager.get(id); - - return trace.orElse(null); + return manager.get(Integer.parseInt(s)).orElse(null); } @Override public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) { return manager.getAllIds().stream() - .map(id -> id.toString()) + .map(Object::toString) .collect(Collectors.toList()); } }; @@ -143,14 +141,13 @@ public class TraceCommand extends SWCommand { @ClassMapper(value = TNTRecord.class, local = true) public TypeMapper recordMapper() { - return new TypeMapper() { + return new TypeMapper<>() { @Override public TNTRecord map(CommandSender commandSender, PreviousArguments previousArguments, String s) { Trace trace = previousArguments.getFirst(Trace.class).orElse(null); - if(trace == null) return null; + if (trace == null) return null; int id = Integer.parseInt(s); - return trace.getRecords().stream() .filter(record -> record.getTntId() == id) .findFirst() @@ -161,8 +158,7 @@ public class TraceCommand extends SWCommand { @Override public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) { Trace trace = previousArguments.getFirst(Trace.class).orElse(null); - if(trace == null) return null; - + if (trace == null) return null; return trace.getUsedIds(); } }; @@ -170,20 +166,22 @@ public class TraceCommand extends SWCommand { @ClassMapper(value = BundleFilter.class, local = true) public TypeMapper bundleFilterClassMapper() { - return new TypeMapper() { + return new TypeMapper<>() { @Override public BundleFilter map(CommandSender commandSender, String[] previousArguments, String s) { - for(BundleFilter filter: BundleFilter.values()) { - if (s.equals(filter.toString())) + for (BundleFilter filter : BundleFilter.values()) { + if (s.equals(filter.toString())) { return filter; + } } return null; } @Override public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) { - if(s.length() == 0) + if (s.length() == 0) { return new ArrayList<>(); + } return Arrays.stream(BundleFilter.values()) .map(Enum::toString) @@ -193,20 +191,24 @@ public class TraceCommand extends SWCommand { } @ClassMapper(value = ViewFlag.class, local = true) - public TypeMapper viewFlagClassMapper () { + public TypeMapper viewFlagClassMapper() { return new TypeMapper() { @Override public ViewFlag map(CommandSender commandSender, String[] previousArguments, String s) { - for(ViewFlag flag: ViewFlag.flags) { - if (s.equals("--" + flag.name)) + for (ViewFlag flag : ViewFlag.flags) { + if (s.equals("--" + flag.name)) { return flag; + } - for(String alias: flag.aliases) - if (s.equals("-" + alias)) + for (String alias : flag.aliases) { + if (s.equals("-" + alias)) { return flag; + } + } } return null; } + @Override public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) { return ViewFlag.flags.stream() diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index 1ef128f5..7d75bf00 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -24,9 +24,7 @@ import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; import de.steamwar.bausystem.region.Region; import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerQuitEvent; import java.util.*; import java.util.stream.Collectors; @@ -53,79 +51,92 @@ public class TraceManager implements Listener { */ private int nextOpenId = 0; - /** Adds a new trace to the global record + /** + * Adds a new trace to the global record * * @param trace Trace to be added * @return id of the created trace */ - protected int add(Trace trace){ - for(Player player: viewFlagMap.keySet()) + protected int add(Trace trace) { + for (Player player : viewFlagMap.keySet()) { trace.render(player, viewFlagMap.get(player), bundleFilterMap.get(player)); + } traces.put(nextOpenId, trace); nextOpenId++; return nextOpenId; } - /** Removes the trace with the given id + /** + * Removes the trace with the given id * * @param id id of the trace to be removed */ - public boolean remove(int id){ - if(id >= nextOpenId) return false; - if(traces.get(id) == null) return false; - for(Player player: viewFlagMap.keySet()) + public boolean remove(int id) { + if (id >= nextOpenId) return false; + if (traces.get(id) == null) return false; + for (Player player : viewFlagMap.keySet()) { traces.get(id).hide(player); + } traces.remove(id); return true; } - /** Clears all traces - * + /** + * Clears all traces */ - public void clear(){ - for (Player player: viewFlagMap.keySet()) - for(Trace trace: traces.values()) + public void clear() { + for (Player player : viewFlagMap.keySet()) { + for (Trace trace : traces.values()) { trace.hide(player); + } + } traces.clear(); nextOpenId = 0; } - /** Methode to get all traces in a certain region + /** + * Methode to get all traces in a certain region * * @param region Region to look for traces in * @return All traces recorded in the given Region */ - public Set get(Region region){ + public Set get(Region region) { return traces.values().stream() .filter((Trace trace) -> trace.getRegion() == region) .collect(Collectors.toSet()); } - /** Methode to get the trace with specific id + /** + * Methode to get the trace with specific id * * @param index index of the trace * @return the trace with given id or null if no trace with id is found */ - public Optional get(int index){ - if(index < traces.size()) - return Optional.of(traces.get(index)); + public Optional get(int index) { + if (index < traces.size()) { + return Optional.of(traces.get(index)); + } return Optional.empty(); } - /** Methode to get all traces + /** + * Methode to get all traces * * @return fresh list of all current traces */ - public List getAll(){ + public List getAll() { return new ArrayList<>(traces.values()); } /** * @return all ids of active traces */ - public Set getAllIds(){return traces.keySet();} + public Set getAllIds() { + return traces.keySet(); + } - /** Toggles trace show on for player + /** + * Toggles trace show on for player * * @param player * @param viewFlags @@ -135,17 +146,20 @@ public class TraceManager implements Listener { viewFlagMap.put(player, viewFlags); bundleFilterMap.put(player, bundleFilter); - for(Trace trace: traces.values()) + for (Trace trace : traces.values()) { trace.render(player, viewFlags, bundleFilter); + } } - /** Toggles trace show of for player + /** + * Toggles trace show of for player * * @param player */ - public void hide(Player player){ - for(Trace trace: traces.values()) + public void hide(Player player) { + for (Trace trace : traces.values()) { trace.hide(player); + } viewFlagMap.remove(player); bundleFilterMap.remove(player); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java index ebfb6e43..06a69764 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java @@ -27,9 +27,6 @@ import lombok.Getter; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.EntityInteractEvent; import java.util.List; @@ -41,13 +38,13 @@ public class TraceEntity extends RFallingBlockEntity { @Getter private final List records; - public TraceEntity(REntityServer server, Location location, boolean isExplosion, List records) { + public TraceEntity(REntityServer server, Location location, boolean isExplosion, List records) { super(server, location, isExplosion ? Material.RED_STAINED_GLASS : Material.TNT); setNoGravity(true); this.records = records; } - public void printIntoChat(Player player){ + public void printIntoChat(Player player) { TNTRecord representative = records.get(0); BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_HEADER", player); @@ -62,9 +59,8 @@ public class TraceEntity extends RFallingBlockEntity { @Override public boolean equals(Object object) { - if(!(object instanceof TraceEntity)) return false; + if (!(object instanceof TraceEntity)) return false; TraceEntity entity = (TraceEntity) object; - return records.get(0).equals(entity.getRecords().get(0)); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java index c38c02a7..a42dcb7a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java @@ -43,28 +43,22 @@ public abstract class ViewFlag { */ public static final List inverseFlags = new ArrayList<>(); - public static ViewFlag EXPLOSION = new ViewFlag(true, false,"explosion", "e") { + public static ViewFlag EXPLOSION = new ViewFlag(true, false, "explosion", "e") { @Override public List filter(List records) { return records.stream() .filter(TNTRecord::isExplosion) .collect(Collectors.toList()); } - - @Override - public void modify(REntityServer server, List entities) {} }; public static ViewFlag IGNITE = new ViewFlag(true, true, "ignite", "i") { @Override public List filter(List records) { - return records.stream() + return records.stream() .filter(record -> !record.isAfterFirstExplosion()) .collect(Collectors.toList()); } - - @Override - public void modify(REntityServer server, List entities) {} }; public static ViewFlag SOURCE = new ViewFlag(true, false, IGNITE, "source", "s") { @@ -74,9 +68,6 @@ public abstract class ViewFlag { .filter(record -> record.getFuse() == 80) .collect(Collectors.toList()); } - - @Override - public void modify(REntityServer server, List entities) {} }; public static ViewFlag BUILD_DESTROY_ONLY = new ViewFlag(true, false, "build-destroy-only") { @@ -86,9 +77,6 @@ public abstract class ViewFlag { .filter(record -> record.getHistory().get(record.getHistory().size() - 1).isDestroyedBuildArea()) .collect(Collectors.toList()); } - - @Override - public void modify(REntityServer server, List entities) {} }; public static ViewFlag TESTBLOCK_DESTROY_ONLY = new ViewFlag(true, false, "testblock-destroy-only") { @@ -98,9 +86,6 @@ public abstract class ViewFlag { .filter(record -> record.getHistory().get(record.getHistory().size() - 1).isDestroyedTestBlock()) .collect(Collectors.toList()); } - - @Override - public void modify(REntityServer server, List entities) {} }; public static ViewFlag MICROMOTION = new ViewFlag(true, false, "micromotion", "m") { @@ -109,44 +94,38 @@ public abstract class ViewFlag { Set seen = new HashSet<>(); Set toRemove = new HashSet<>(); - for(TNTRecord uniqueRecord: records){ - if(seen.contains(uniqueRecord.getTntId())) continue; + for (TNTRecord uniqueRecord : records) { + if (seen.contains(uniqueRecord.getTntId())) continue; boolean hasMicromotion = false; - for(TNTRecord record: uniqueRecord.getHistory()){ + for (TNTRecord record : uniqueRecord.getHistory()) { Vector velocity = record.getVelocity(); - if(velocity.getY() == 0 && (Math.abs(velocity.getX()) < 0.001 || Math.abs(velocity.getZ()) < 0.001)){ + if (velocity.getY() == 0 && (Math.abs(velocity.getX()) < 0.001 || Math.abs(velocity.getZ()) < 0.001)) { hasMicromotion = true; break; } } - if(!hasMicromotion) + if (!hasMicromotion) toRemove.add(uniqueRecord); seen.add(uniqueRecord.getTntId()); } - for(TNTRecord record: toRemove){ + for (TNTRecord record : toRemove) { records.removeAll(record.getHistory()); } - return records; + return records; } - - @Override - public void modify(REntityServer server, List entities) {} }; public static ViewFlag ADVANCED = new ViewFlag(true, false, "advanced", "a") { - @Override - public List filter(List records) {return records;} - @Override public void modify(REntityServer server, List entities) { - for(TraceEntity entity: entities) { + for (TraceEntity entity : entities) { TNTRecord current = entity.getRecords().get(0); - if(current.isExplosion()) continue; + if (current.isExplosion()) continue; TNTRecord next = current.getNext().orElse(null); if (next == null) continue; @@ -167,41 +146,32 @@ public abstract class ViewFlag { RFallingBlockEntity second = new RFallingBlockEntity(server, pos, Material.WHITE_STAINED_GLASS); second.setNoGravity(true); } - } + } } }; public static ViewFlag COUNT = new ViewFlag(true, false, "count", "c") { - @Override - public List filter(List records) { return records; } - @Override public void modify(REntityServer server, List entities) { - for(TraceEntity entity: entities){ + for (TraceEntity entity : entities) { entity.setDisplayName(String.valueOf(entity.getRecords().size())); } } }; public static ViewFlag FUSE = new ViewFlag(true, false, "fuse", "f") { - @Override - public List filter(List records) { return records; } - @Override public void modify(REntityServer server, List entities) { - for(TraceEntity entity: entities){ + for (TraceEntity entity : entities) { entity.setDisplayName(String.valueOf(entity.getRecords().get(0).getFuse())); } } }; public static ViewFlag TIME = new ViewFlag(true, false, "time", "t") { - @Override - public List filter(List records) { return records; } - @Override public void modify(REntityServer server, List entities) { - for(TraceEntity entity: entities){ + for (TraceEntity entity : entities) { entity.setDisplayName(String.valueOf(entity.getRecords().get(0).getTicksSinceStart())); } } @@ -222,33 +192,38 @@ public abstract class ViewFlag { */ public final ViewFlag[] required; - public ViewFlag(boolean isStatic, boolean isInverse, String name, String... aliases) { + protected ViewFlag(boolean isStatic, boolean isInverse, String name, String... aliases) { this(isStatic, isInverse, new ViewFlag[0], name, aliases); } - public ViewFlag(boolean isStatic, boolean isInverse, ViewFlag required, String name, String... aliases) { - this(isStatic, isInverse, new ViewFlag[] { required }, name, aliases); + protected ViewFlag(boolean isStatic, boolean isInverse, ViewFlag required, String name, String... aliases) { + this(isStatic, isInverse, new ViewFlag[]{required}, name, aliases); } - public ViewFlag(boolean isStatic, boolean isInverse, ViewFlag[] required, String name, String... aliases){ + protected ViewFlag(boolean isStatic, boolean isInverse, ViewFlag[] required, String name, String... aliases) { this.name = name; this.aliases = aliases; - if(isStatic) flags.add(this); - if(isInverse) inverseFlags.add(this); + if (isStatic) flags.add(this); + if (isInverse) inverseFlags.add(this); this.required = required; } - /** Filters the given records for a given condition + /** + * Filters the given records for a given condition * * @param records Records to be filtered * @return Filtered records */ - public abstract List filter (List records); + public List filter(List records) { + return records; + } - /** Modifies the trace rendering + /** + * Modifies the trace rendering * - * @param server the server the trace is rendered on + * @param server the server the trace is rendered on * @param entities the entities representing tnts */ - public abstract void modify (REntityServer server, List entities); + public void modify(REntityServer server, List entities) { + } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicFlags/AtFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/AtFlag.java similarity index 77% rename from BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicFlags/AtFlag.java rename to BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/AtFlag.java index cb06685a..67462d15 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicFlags/AtFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/AtFlag.java @@ -17,12 +17,10 @@ * along with this program. If not, see . */ -package de.steamwar.bausystem.features.tracer.rendering.dynamicFlags; +package de.steamwar.bausystem.features.tracer.rendering.dynamicflags; import de.steamwar.bausystem.features.tracer.TNTRecord; -import de.steamwar.bausystem.features.tracer.rendering.TraceEntity; import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; -import de.steamwar.entity.REntityServer; import java.util.List; import java.util.stream.Collectors; @@ -31,19 +29,19 @@ public class AtFlag extends ViewFlag { private int start; private int end; - - public AtFlag(int start, int end){ + public AtFlag(int start, int end) { super(false, false, ViewFlag.IGNITE, null); this.start = start; this.end = end; } - /** Update this flag to represent another time interval + /** + * Update this flag to represent another time interval * * @param start new interval start - * @param end new interval end + * @param end new interval end */ - public void update(int start, int end){ + public void update(int start, int end) { this.start = start; this.end = end; } @@ -54,7 +52,4 @@ public class AtFlag extends ViewFlag { .filter(record -> record.getTicksSinceStart() <= start && record.getTicksSinceStart() >= end) .collect(Collectors.toList()); } - - @Override - public void modify(REntityServer server, List entities) {} } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicFlags/IsolateFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/IsolateFlag.java similarity index 82% rename from BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicFlags/IsolateFlag.java rename to BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/IsolateFlag.java index 7832636f..4b008fb0 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicFlags/IsolateFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/IsolateFlag.java @@ -17,14 +17,11 @@ * along with this program. If not, see . */ -package de.steamwar.bausystem.features.tracer.rendering.dynamicFlags; +package de.steamwar.bausystem.features.tracer.rendering.dynamicflags; import de.steamwar.bausystem.features.tracer.TNTRecord; -import de.steamwar.bausystem.features.tracer.rendering.TraceEntity; import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; -import de.steamwar.entity.REntityServer; -import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -37,15 +34,16 @@ public class IsolateFlag extends ViewFlag { */ private final Set tntToIsolate = new HashSet<>(); - public IsolateFlag(){ + public IsolateFlag() { super(false, false, ViewFlag.IGNITE, null); } /** * Toggles the given id to be or not to be rendered + * * @param id */ - public void toggleId(int id){ + public void toggleId(int id) { if (!tntToIsolate.remove(id)) { tntToIsolate.add(id); } @@ -57,7 +55,4 @@ public class IsolateFlag extends ViewFlag { .filter(record -> tntToIsolate.contains(record.getTntId())) .collect(Collectors.toList()); } - - @Override - public void modify(REntityServer server, List entities) {} } -- 2.39.5 From 3755395eab5cac1d585c1e6603608d6da822d736 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Sun, 7 Apr 2024 15:20:58 +0200 Subject: [PATCH 061/111] Integrated TraceRecorder with Simulator Signed-off-by: D4rkr34lm --- .../simulator/execute/SimulatorExecutor.java | 24 +++++++++++++++---- .../features/tracer/TraceCommand.java | 8 +++---- .../{Recorder.java => TraceRecorder.java} | 4 ++-- 3 files changed, 25 insertions(+), 11 deletions(-) rename BauSystem_Main/src/de/steamwar/bausystem/features/tracer/{Recorder.java => TraceRecorder.java} (99%) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/execute/SimulatorExecutor.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/execute/SimulatorExecutor.java index 893161f4..39c2e60b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/execute/SimulatorExecutor.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/execute/SimulatorExecutor.java @@ -23,12 +23,12 @@ import de.steamwar.bausystem.features.simulator.data.Simulator; import de.steamwar.bausystem.features.simulator.data.SimulatorElement; import de.steamwar.bausystem.features.simulator.data.SimulatorGroup; import de.steamwar.bausystem.features.tpslimit.TPSUtils; -import de.steamwar.bausystem.features.tracer.record.Recorder; -import de.steamwar.bausystem.features.tracer.record.SingleTraceRecorder; +import de.steamwar.bausystem.features.tracer.TraceRecorder; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.utils.TickEndEvent; import de.steamwar.bausystem.utils.TickStartEvent; import de.steamwar.linkage.Linked; +import de.steamwar.linkage.LinkedInstance; import de.steamwar.linkage.MinVersion; import org.bukkit.Bukkit; import org.bukkit.World; @@ -46,6 +46,8 @@ public class SimulatorExecutor implements Listener { private static Set currentlyRunning = new HashSet<>(); private static Map>> tickStartActions = new HashMap<>(); private static Map> tickEndActions = new HashMap<>(); + @LinkedInstance + private static TraceRecorder recorder; public static boolean run(Simulator simulator) { if (currentlyRunning.contains(simulator)) return false; @@ -69,6 +71,20 @@ public class SimulatorExecutor implements Listener { @Override public void accept(World world) { currentlyRunning.remove(simulator); + + if (simulator.isAutoTrace()) { + simulator.getGroups() + .stream() + .map(SimulatorGroup::getElements) + .flatMap(List::stream) + .map(SimulatorElement::getPosition) + .map(pos -> pos.toLocation(WORLD)) + .map(Region::getRegion) + .distinct() + .forEach(region -> { + recorder.stopRecording(region); + }); + } } }); @@ -82,9 +98,7 @@ public class SimulatorExecutor implements Listener { .map(Region::getRegion) .distinct() .forEach(region -> { - if (Recorder.INSTANCE.isDisabled(region)) { - Recorder.INSTANCE.set(region, new SingleTraceRecorder(region)); - } + recorder.startRecording(region); }); } return true; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index 2554e3fa..39664b91 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -41,7 +41,7 @@ import java.util.stream.Stream; public class TraceCommand extends SWCommand { @LinkedInstance - public Recorder recorder; + public TraceRecorder traceRecorder; @LinkedInstance public TraceManager manager; @@ -52,21 +52,21 @@ public class TraceCommand extends SWCommand { @Register(value = "start", description = "TRACE_COMMAND_HELP_START") public void start(@Validator Player player) { Region region = Region.getRegion(player.getLocation()); - recorder.startRecording(region); + traceRecorder.startRecording(region); BauSystem.MESSAGE.send("TRACE_MESSAGE_START", player); } @Register(value = "stop", description = "TRACE_COMMAND_HELP_STOP") public void stop(@Validator Player player) { Region region = Region.getRegion(player.getLocation()); - recorder.stopRecording(region); + traceRecorder.stopRecording(region); BauSystem.MESSAGE.send("TRACE_MESSAGE_STOP", player); } @Register(value = "auto", description = "TRACE_COMMAND_HELP_SHOW") public void auto(@Validator Player player) { Region region = Region.getRegion(player.getLocation()); - recorder.toggleAutoTrace(region); + traceRecorder.toggleAutoTrace(region); } @Register(value = "show", description = "TRACE_COMMAND_HELP_SHOW") diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java similarity index 99% rename from BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java rename to BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java index 29a8786b..f79945b3 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java @@ -35,7 +35,7 @@ import org.bukkit.event.entity.EntitySpawnEvent; import java.util.*; @Linked -public class Recorder implements Listener { +public class TraceRecorder implements Listener { /** * Linked instance of TraceManager @@ -78,7 +78,7 @@ public class Recorder implements Listener { */ private final Set autoTraceRegions = new HashSet<>(); - public Recorder() { + public TraceRecorder() { BauSystem.runTaskTimer(BauSystem.getInstance(), () -> { record(); checkForAutoTraceFinish(); -- 2.39.5 From 3f9f3341a3ad2334cef109ffa585c9c0f209fe08 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 7 Apr 2024 16:51:24 +0200 Subject: [PATCH 062/111] Fix AtFlag --- .../features/tracer/rendering/dynamicflags/AtFlag.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/AtFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/AtFlag.java index 67462d15..b8c31f36 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/AtFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/AtFlag.java @@ -49,7 +49,7 @@ public class AtFlag extends ViewFlag { @Override public List filter(List records) { return records.stream() - .filter(record -> record.getTicksSinceStart() <= start && record.getTicksSinceStart() >= end) + .filter(record -> record.getTicksSinceStart() >= start && record.getTicksSinceStart() <= end) .collect(Collectors.toList()); } } -- 2.39.5 From 7cd61fd9a4e1c6609488bc0098f19c979f4f934c Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 7 Apr 2024 17:15:54 +0200 Subject: [PATCH 063/111] Add ViewFlagHolder --- .../bausystem/features/tracer/Trace.java | 95 ++++++------------- .../tracer/rendering/ViewFlagHolder.java | 69 ++++++++++++++ 2 files changed, 99 insertions(+), 65 deletions(-) create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlagHolder.java diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index 769f7cc0..41ed8a13 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -23,6 +23,7 @@ import de.steamwar.bausystem.features.tpslimit.TPSUtils; import de.steamwar.bausystem.features.tracer.rendering.BundleFilter; import de.steamwar.bausystem.features.tracer.rendering.TraceEntity; import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; +import de.steamwar.bausystem.features.tracer.rendering.ViewFlagHolder; import de.steamwar.bausystem.features.tracer.rendering.dynamicflags.AtFlag; import de.steamwar.bausystem.features.tracer.rendering.dynamicflags.IsolateFlag; import de.steamwar.bausystem.region.Region; @@ -31,7 +32,6 @@ import lombok.Getter; import org.bukkit.entity.Player; import java.util.*; -import java.util.stream.Stream; public class Trace { /** @@ -77,7 +77,7 @@ public class Trace { /** * A map saving the view flags for rendered traces, for life rendering */ - private final Map viewFlagMap = new HashMap<>(); + private final Map viewFlagMap = new HashMap<>(); public Trace(Region region) { this.region = region; @@ -103,9 +103,9 @@ public class Trace { for (Player player : serverMap.keySet()) { REntityServer server = serverMap.get(player); BundleFilter bundleFilter = bundleFilterMap.get(player); - ViewFlag[] viewFlags = viewFlagMap.get(player); + ViewFlagHolder viewFlagHolder = viewFlagMap.get(player); - render(server, records, viewFlags, bundleFilter); + render(server, records, viewFlagHolder, bundleFilter); } } @@ -136,11 +136,11 @@ public class Trace { /** * Renders this traces * - * @param player The player the trace is rendered to - * @param flags Flags modefieing the rendering - * @param bundleFilter Filter to determin bundeling of records + * @param player The player the trace is rendered to + * @param viewFlagHolder Flags modefieing the rendering + * @param bundleFilter Filter to determin bundeling of records */ - public void render(Player player, ViewFlag[] flags, BundleFilter bundleFilter) { + public void render(Player player, ViewFlagHolder viewFlagHolder, BundleFilter bundleFilter) { if (serverMap.containsKey(player)) { REntityServer server = serverMap.get(player); server.close(); @@ -150,43 +150,29 @@ public class Trace { bundleFilterMap.remove(player); } - viewFlagMap.put(player, flags); + viewFlagMap.put(player, viewFlagHolder); bundleFilterMap.put(player, bundleFilter); REntityServer server = new REntityServer(); server.addPlayer(player); serverMap.put(player, server); - render(server, records, flags, bundleFilter); + render(server, records, viewFlagHolder, bundleFilter); } /** * Internal methode to render records to a REntityServer * - * @param server Server to render to - * @param records Records to render - * @param flags Flags modefieing the rendering - * @param bundleFilter Filter to determin bundeling of records + * @param server Server to render to + * @param records Records to render + * @param viewFlagHolder Flags modefieing the rendering + * @param bundleFilter Filter to determin bundeling of records */ - private void render(REntityServer server, List records, ViewFlag[] flags, BundleFilter bundleFilter) { + private void render(REntityServer server, List records, ViewFlagHolder viewFlagHolder, BundleFilter bundleFilter) { if (records.isEmpty()) return; List workingRecords = records; - - //Manage flags and required flags - Set flagList = new HashSet<>(Arrays.asList(flags)); - for (ViewFlag flag : flags) { - if (flag.required != null) { - flagList.addAll(Arrays.asList(flag.required)); - } - } - - //Manage inverse flags - ViewFlag.inverseFlags.forEach(viewFlag -> { - if (!flagList.remove(viewFlag)) { - flagList.add(viewFlag); - } - }); + Set flagList = viewFlagHolder.getEffectiveViewFlags(); //Apply filters for (ViewFlag flag : flagList) { @@ -204,7 +190,7 @@ public class Trace { } //Apply modifiers - for (ViewFlag flag : flags) { + for (ViewFlag flag : flagList) { flag.modify(server, entities); } @@ -262,24 +248,12 @@ public class Trace { * @param to end of time interval */ public void renderAt(Player player, int from, int to) { - ViewFlag[] viewFlags = viewFlagMap.get(player); - if (viewFlags == null) return; - - AtFlag atFlag = null; - atFlag = Stream.of(viewFlags) - .filter(AtFlag.class::isInstance) - .map(AtFlag.class::cast) - .findFirst() - .orElse(null); - - if (atFlag != null) { - atFlag.update(from, to); + ViewFlagHolder viewFlags = viewFlagMap.computeIfAbsent(player, p -> new ViewFlagHolder()); + if (viewFlags.hasViewFlag(AtFlag.class)) { + viewFlags.getViewFlag(AtFlag.class).update(from, to); } else { - atFlag = new AtFlag(from, to); - viewFlags = Arrays.copyOf(viewFlags, viewFlags.length + 1); - viewFlags[viewFlags.length - 1] = atFlag; + viewFlags.addViewFlag(new AtFlag(from, to)); } - render(player, viewFlags, BundleFilter.STRICT); } @@ -290,27 +264,18 @@ public class Trace { * @param records the record for which isolation is toggled */ public void isolate(Player player, TNTRecord... records) { - IsolateFlag isolationFlag = null; - - ViewFlag[] viewFlags = viewFlagMap.get(player); - if (viewFlags != null) { - isolationFlag = Stream.of(viewFlags) - .filter(IsolateFlag.class::isInstance) - .map(IsolateFlag.class::cast) - .findFirst() - .orElse(null); + IsolateFlag isolateFlag; + ViewFlagHolder viewFlags = viewFlagMap.get(player); + if (viewFlags != null && viewFlags.hasViewFlag(IsolateFlag.class)) { + isolateFlag = viewFlags.getViewFlag(IsolateFlag.class); + } else { + viewFlags = new ViewFlagHolder(); + isolateFlag = new IsolateFlag(); + viewFlags.addViewFlag(isolateFlag); } - if (viewFlags == null || isolationFlag == null) { - viewFlags = new ViewFlag[1]; - } - if (isolationFlag == null) { - isolationFlag = new IsolateFlag(); - } - viewFlags[0] = isolationFlag; - for (TNTRecord record : records) { - isolationFlag.toggleId(record.getTntId()); + isolateFlag.toggleId(record.getTntId()); } render(player, viewFlags, BundleFilter.STRICT); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlagHolder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlagHolder.java new file mode 100644 index 00000000..9ad156cf --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlagHolder.java @@ -0,0 +1,69 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2024 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.tracer.rendering; + +import java.util.*; + +public class ViewFlagHolder { + + private Map, ViewFlag> viewFlags = new HashMap<>(); + + public ViewFlagHolder(ViewFlag... viewFlags) { + for (ViewFlag viewFlag : viewFlags) { + this.viewFlags.put(viewFlag.getClass(), viewFlag); + } + } + + public Set getEffectiveViewFlags() { + //Manage flags and required flags + Set flagList = new HashSet<>(); + for (ViewFlag flag : viewFlags.values()) { + flagList.add(flag); + if (flag.required != null) { + flagList.addAll(Arrays.asList(flag.required)); + } + } + + //Manage inverse flags + ViewFlag.inverseFlags.forEach(viewFlag -> { + if (!flagList.remove(viewFlag)) { + flagList.add(viewFlag); + } + }); + + return flagList; + } + + public boolean hasViewFlag(Class clazz) { + return viewFlags.containsKey(clazz); + } + + public T getViewFlag(Class clazz) { + return (T) viewFlags.get(clazz); + } + + public T getViewFlagOrDefault(Class clazz, T defaultValue) { + return (T) viewFlags.getOrDefault(clazz, defaultValue); + } + + public void addViewFlag(ViewFlag viewFlag) { + viewFlags.put(viewFlag.getClass(), viewFlag); + } +} -- 2.39.5 From a6867cb4f969df56a68413fb245758a02f04b62a Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 7 Apr 2024 17:19:13 +0200 Subject: [PATCH 064/111] Fix SimulatorExecutor --- .../features/simulator/execute/SimulatorExecutor.java | 7 ++----- .../steamwar/bausystem/features/tracer/TraceRecorder.java | 6 ++++++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/execute/SimulatorExecutor.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/execute/SimulatorExecutor.java index 39c2e60b..5c3d30e0 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/execute/SimulatorExecutor.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/execute/SimulatorExecutor.java @@ -28,7 +28,6 @@ import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.utils.TickEndEvent; import de.steamwar.bausystem.utils.TickStartEvent; import de.steamwar.linkage.Linked; -import de.steamwar.linkage.LinkedInstance; import de.steamwar.linkage.MinVersion; import org.bukkit.Bukkit; import org.bukkit.World; @@ -46,8 +45,6 @@ public class SimulatorExecutor implements Listener { private static Set currentlyRunning = new HashSet<>(); private static Map>> tickStartActions = new HashMap<>(); private static Map> tickEndActions = new HashMap<>(); - @LinkedInstance - private static TraceRecorder recorder; public static boolean run(Simulator simulator) { if (currentlyRunning.contains(simulator)) return false; @@ -82,7 +79,7 @@ public class SimulatorExecutor implements Listener { .map(Region::getRegion) .distinct() .forEach(region -> { - recorder.stopRecording(region); + TraceRecorder.instance.stopRecording(region); }); } } @@ -98,7 +95,7 @@ public class SimulatorExecutor implements Listener { .map(Region::getRegion) .distinct() .forEach(region -> { - recorder.startRecording(region); + TraceRecorder.instance.startRecording(region); }); } return true; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java index f79945b3..58f719bf 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java @@ -37,6 +37,12 @@ import java.util.*; @Linked public class TraceRecorder implements Listener { + public static TraceRecorder instance; + + { + instance = this; + } + /** * Linked instance of TraceManager */ -- 2.39.5 From 4ed5f40fed8ca2c3b6f3c6f4cb2007c3bbec168b Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 7 Apr 2024 17:21:05 +0200 Subject: [PATCH 065/111] Fix build errors --- .../bausystem/features/tracer/TraceCommand.java | 3 ++- .../bausystem/features/tracer/TraceManager.java | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index 39664b91..8dbc9583 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.tracer; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.tracer.rendering.BundleFilter; import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; +import de.steamwar.bausystem.features.tracer.rendering.ViewFlagHolder; import de.steamwar.bausystem.region.Region; import de.steamwar.command.PreviousArguments; import de.steamwar.command.SWCommand; @@ -71,7 +72,7 @@ public class TraceCommand extends SWCommand { @Register(value = "show", description = "TRACE_COMMAND_HELP_SHOW") public void show(@Validator Player player, @OptionalValue("STRICT") BundleFilter filter, ViewFlag... flags) { - manager.show(player, flags, filter); + manager.show(player, new ViewFlagHolder(flags), filter); BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW", player); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index 7d75bf00..3312d794 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -20,7 +20,7 @@ package de.steamwar.bausystem.features.tracer; import de.steamwar.bausystem.features.tracer.rendering.BundleFilter; -import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; +import de.steamwar.bausystem.features.tracer.rendering.ViewFlagHolder; import de.steamwar.bausystem.region.Region; import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; @@ -39,7 +39,7 @@ public class TraceManager implements Listener { /** * A map saving the view flags used by Players */ - private final Map viewFlagMap = new HashMap<>(); + private final Map viewFlagMap = new HashMap<>(); /** * A map saving the bundle filter used by Players @@ -139,15 +139,15 @@ public class TraceManager implements Listener { * Toggles trace show on for player * * @param player - * @param viewFlags + * @param viewFlagHolder * @param bundleFilter */ - public void show(Player player, ViewFlag[] viewFlags, BundleFilter bundleFilter) { - viewFlagMap.put(player, viewFlags); + public void show(Player player, ViewFlagHolder viewFlagHolder, BundleFilter bundleFilter) { + viewFlagMap.put(player, viewFlagHolder); bundleFilterMap.put(player, bundleFilter); for (Trace trace : traces.values()) { - trace.render(player, viewFlags, bundleFilter); + trace.render(player, viewFlagHolder, bundleFilter); } } -- 2.39.5 From 41d4ce2472e52c0ca223d6609889d20aac059bc3 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 7 Apr 2024 17:22:37 +0200 Subject: [PATCH 066/111] Fix build errors --- .../bausystem/features/tracer/rendering/ViewFlagHolder.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlagHolder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlagHolder.java index 9ad156cf..a79d969b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlagHolder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlagHolder.java @@ -59,10 +59,6 @@ public class ViewFlagHolder { return (T) viewFlags.get(clazz); } - public T getViewFlagOrDefault(Class clazz, T defaultValue) { - return (T) viewFlags.getOrDefault(clazz, defaultValue); - } - public void addViewFlag(ViewFlag viewFlag) { viewFlags.put(viewFlag.getClass(), viewFlag); } -- 2.39.5 From b8e79f9c5515e566653712b6073ccf15d34adb9b Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 8 Apr 2024 11:56:52 +0200 Subject: [PATCH 067/111] Update Trace and TraceManager --- .../bausystem/features/tracer/Trace.java | 16 +++++++++----- .../features/tracer/TraceManager.java | 22 +++++++++++-------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index 41ed8a13..a973da95 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -32,8 +32,9 @@ import lombok.Getter; import org.bukkit.entity.Player; import java.util.*; +import java.util.stream.Collectors; -public class Trace { +public class Trace { // TODO: Add UUID for file saving and so on! /** * Region this trace has been recorded in */ @@ -61,8 +62,13 @@ public class Trace { /** * List of all used ids */ - @Getter - private final List usedIds = new ArrayList(); + public List getUsedIds() { + return getRecords() + .stream() + .map(TNTRecord::getTntId) + .map(i -> i + "") + .collect(Collectors.toList()); + } /** * A map of players -> REntityServers for rendering traces to a player @@ -89,9 +95,7 @@ public class Trace { * @return next open record id */ protected int getAndIncrementNextOpenRecordId() { - nextOpenRecordId++; - usedIds.add(Integer.toString(nextOpenRecordId)); - return nextOpenRecordId; + return ++nextOpenRecordId; } /** diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index 3312d794..47819a75 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -27,7 +27,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.Listener; import java.util.*; -import java.util.stream.Collectors; @Linked public class TraceManager implements Listener { @@ -36,6 +35,8 @@ public class TraceManager implements Listener { */ private final Map traces = new HashMap<>(); + private final Map> tracesByRegion = new HashMap<>(); + /** * A map saving the view flags used by Players */ @@ -62,6 +63,7 @@ public class TraceManager implements Listener { trace.render(player, viewFlagMap.get(player), bundleFilterMap.get(player)); } traces.put(nextOpenId, trace); + tracesByRegion.computeIfAbsent(trace.getRegion(), region -> new HashMap<>()).put(nextOpenId, trace); nextOpenId++; return nextOpenId; } @@ -77,7 +79,10 @@ public class TraceManager implements Listener { for (Player player : viewFlagMap.keySet()) { traces.get(id).hide(player); } - traces.remove(id); + Trace trace = traces.remove(id); + if (trace != null) { + tracesByRegion.get(trace.getRegion()).remove(id); + } return true; } @@ -91,6 +96,7 @@ public class TraceManager implements Listener { } } traces.clear(); + tracesByRegion.clear(); nextOpenId = 0; } @@ -100,10 +106,8 @@ public class TraceManager implements Listener { * @param region Region to look for traces in * @return All traces recorded in the given Region */ - public Set get(Region region) { - return traces.values().stream() - .filter((Trace trace) -> trace.getRegion() == region) - .collect(Collectors.toSet()); + public Collection get(Region region) { + return tracesByRegion.getOrDefault(region, Collections.emptyMap()).values(); } /** @@ -122,10 +126,10 @@ public class TraceManager implements Listener { /** * Methode to get all traces * - * @return fresh list of all current traces + * @return internal list of all current traces */ - public List getAll() { - return new ArrayList<>(traces.values()); + public Collection getAll() { + return traces.values(); } /** -- 2.39.5 From af19931946644297aa79f34b4f28029bc90c4f39 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 8 Apr 2024 13:25:13 +0200 Subject: [PATCH 068/111] Optimize ProcessingTracesState --- .../features/slaves/laufbau/Laufbau.java | 39 ++---- .../laufbau/states/CreatingLaufState.java | 5 + .../laufbau/states/FilteringTracesState.java | 95 ------------- .../slaves/laufbau/states/LaufbauState.java | 2 + .../laufbau/states/ProcessingTracesState.java | 131 ++++++++++-------- .../bausystem/features/tracer/Trace.java | 4 +- 6 files changed, 88 insertions(+), 188 deletions(-) delete mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/FilteringTracesState.java diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/Laufbau.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/Laufbau.java index d53995a3..f33f6af3 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/Laufbau.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/Laufbau.java @@ -20,9 +20,7 @@ package de.steamwar.bausystem.features.slaves.laufbau; import com.sk89q.worldedit.EditSession; -import de.steamwar.bausystem.features.slaves.laufbau.states.FilteringTracesState; import de.steamwar.bausystem.features.slaves.laufbau.states.LaufbauState; -import de.steamwar.bausystem.features.slaves.laufbau.states.CreatingLaufState; import de.steamwar.bausystem.features.slaves.laufbau.states.ProcessingTracesState; import de.steamwar.bausystem.utils.WorldEditUtils; import lombok.Getter; @@ -40,9 +38,7 @@ public class Laufbau { private Location pos1; private Location pos2; - private FilteringTracesState filteringTracesState = null; - private ProcessingTracesState processingTracesState = null; - private CreatingLaufState creatingLaufState = null; + private LaufbauState active; private List elements; @@ -62,8 +58,6 @@ public class Laufbau { int zFactor = (int) (Math.abs(selectionSize.getZ()) / 9.875); factor = Math.max(Math.max(xFactor, Math.max(yFactor, zFactor)), 8); - filteringTracesState = new FilteringTracesState(world, this::inRegion); - editSession = WorldEditUtils.getEditSession(player); elements = BlockBoundingBox.elements.stream().filter(blockBoundingBox -> { @@ -86,49 +80,32 @@ public class Laufbau { return -Double.compare(o1.blockData.getMaterial().getBlastResistance(), o2.blockData.getMaterial().getBlastResistance()); }); } - } - private LaufbauState getActive() { - if (creatingLaufState != null) { - return creatingLaufState; - } - if (processingTracesState != null) { - return processingTracesState; - } - return filteringTracesState; + active = new ProcessingTracesState(world, this::inRegion, editSession, elements, factor); } private void createNextState() { - if (creatingLaufState != null) { - return; - } - if (processingTracesState != null) { - creatingLaufState = new CreatingLaufState(processingTracesState.getBlocks(), processingTracesState.getCuboidIntersectionCache(), world, editSession, elements, factor); - return; - } - processingTracesState = new ProcessingTracesState(filteringTracesState.getTntPositions(), this::inRegion, factor); + if (active == null) return; + active = active.getNextState(); } public String actionBarMessage(Player p) { - return getActive().actionBarMessage(p); + return active.actionBarMessage(p); } public boolean hasNext() { - return getActive().hasNext(); + if (active == null) return false; + return active.hasNext(); } public void next() { - LaufbauState state = getActive(); + LaufbauState state = active; state.next(); if (!state.hasNext()) { createNextState(); } } - private boolean inRegion(Location location, int expansion) { - return inRegion(location.toVector(), expansion); - } - private boolean inRegion(Vector location, int expansion) { if (location.getBlockX() >= pos1.getBlockX() - expansion) { if (location.getBlockY() >= pos1.getBlockY() - expansion) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/CreatingLaufState.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/CreatingLaufState.java index 9522518d..e4ed312b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/CreatingLaufState.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/CreatingLaufState.java @@ -196,4 +196,9 @@ public class CreatingLaufState implements LaufbauState { } } } + + @Override + public LaufbauState getNextState() { + return null; + } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/FilteringTracesState.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/FilteringTracesState.java deleted file mode 100644 index 3e91a85b..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/FilteringTracesState.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2022 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.slaves.laufbau.states; - -import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.features.tracer.TNTRecord; -import de.steamwar.bausystem.features.tracer.Trace; -import de.steamwar.bausystem.features.tracer.TraceManager; -import de.steamwar.bausystem.utils.FlatteningWrapper; -import de.steamwar.linkage.LinkedInstance; -import lombok.Getter; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.entity.Player; - -import java.util.ArrayList; -import java.util.List; -import java.util.function.BiPredicate; - -public class FilteringTracesState implements LaufbauState { - - @LinkedInstance - TraceManager traceManager; - private long start = System.currentTimeMillis(); - - private World world; - private BiPredicate inRegionCheck; - - private final int totalRecord; - - List traces; - private List> tntHistories = new ArrayList<>(); - - @Getter - private List tntPositions = new ArrayList<>(); - - public FilteringTracesState(World world, BiPredicate inRegionCheck) { - List traces = new ArrayList<>(traceManager.getAll()); - totalRecord = traces.size(); - - this.world = world; - this.inRegionCheck = inRegionCheck; - } - - @Override - public String actionBarMessage(Player p) { - return BauSystem.MESSAGE.parse("LAUFBAU_SIMPLE_PROGRESS", p, BauSystem.MESSAGE.parse("LAUFBAU_STATE_FILTERING_TRACES", p), totalRecord - traces.size(), totalRecord, eta(p, start, totalRecord - traces.size(), totalRecord)); - } - - @Override - public boolean hasNext() { - return !traces.isEmpty() || !tntHistories.isEmpty(); - } - - @Override - public void next() { - if (tntHistories.isEmpty()) { - Trace trace = traces.remove(0); - tntHistories.addAll(trace.getHistories()); - } - if (tntHistories.isEmpty()) { - return; - } - - List tntRecords = tntHistories.remove(0); - tntRecords.forEach(tntRecord -> { - if (FlatteningWrapper.impl.inWater(world, tntRecord.getLocation().toVector())) { - return; - } - if (inRegionCheck.test(tntRecord.getLocation(), 1)) { - tntPositions.add(tntRecord); - } - if (tntRecord.getPrevious().isPresent() && inRegionCheck.test(tntRecord.getPrevious().get().getLocation(), 1)) { - tntPositions.add(tntRecord); - } - }); - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/LaufbauState.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/LaufbauState.java index 6ece3e22..6843db9e 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/LaufbauState.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/LaufbauState.java @@ -45,4 +45,6 @@ public interface LaufbauState { } return LocalTime.ofNanoOfDay(eta).format(DateTimeFormatter.ofPattern(BauSystem.MESSAGE.parse("TIME", p))); } + + LaufbauState getNextState(); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java index b2a21dd9..e8693105 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java @@ -1,117 +1,128 @@ /* - * This file is a part of the SteamWar software. + * This file is a part of the SteamWar software. * - * Copyright (C) 2022 SteamWar.de-Serverteam + * Copyright (C) 2024 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 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. + * 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 . + * 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.slaves.laufbau.states; +import com.sk89q.worldedit.EditSession; import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox; import de.steamwar.bausystem.features.slaves.laufbau.Cuboid; import de.steamwar.bausystem.features.tracer.TNTRecord; +import de.steamwar.bausystem.features.tracer.TraceRecorder; import de.steamwar.bausystem.region.Point; -import lombok.Getter; +import de.steamwar.bausystem.utils.FlatteningWrapper; import org.bukkit.Location; +import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.util.Vector; import java.util.*; import java.util.function.BiPredicate; +import java.util.stream.Collectors; public class ProcessingTracesState implements LaufbauState { - private long start = System.currentTimeMillis(); + private final long start = System.currentTimeMillis(); + private final World world; + private final BiPredicate inRegionCheck; + private final EditSession editSession; + private final List elements; + private final int factor; - private int totalCuboids; - private List tntPositionList; - private BiPredicate inRegionCheck; - private int factor; + private final List tntRecords; + private final int totalTntRecords; - private List toExpand = new ArrayList<>(); + private final Set affectedBlocks = new HashSet<>(); + private final Map> cuboidsPerChunk = new HashMap<>(); - private int cuboidsDone = 0; - - @Getter - private Set blocks = new HashSet<>(); - - @Getter - private Map> cuboidIntersectionCache = new HashMap<>(); - - public ProcessingTracesState(List tntPositionList, BiPredicate inRegionCheck, int factor) { - this.tntPositionList = tntPositionList; - this.totalCuboids = tntPositionList.stream().mapToInt(tntPosition -> tntPosition.getPrevious() == null ? 1 : 3).sum(); + public ProcessingTracesState(World world, BiPredicate inRegionCheck, EditSession editSession, List elements, int factor) { + this.world = world; this.inRegionCheck = inRegionCheck; + this.editSession = editSession; + this.elements = elements; this.factor = factor; + + // TODO: Optimize only retrieving traces inside of the affected regions! + tntRecords = TraceRecorder.instance.manager.getAll() + .stream() + .flatMap(trace -> trace.getHistories().stream()) + .flatMap(Collection::stream) + .collect(Collectors.toList()); + totalTntRecords = tntRecords.size(); } @Override public String actionBarMessage(Player p) { - return BauSystem.MESSAGE.parse("LAUFBAU_SIMPLE_PROGRESS", p, BauSystem.MESSAGE.parse("LAUFBAU_STATE_PROCESSING_TRACES", p), cuboidsDone, totalCuboids, eta(p, start, cuboidsDone, totalCuboids)); + return BauSystem.MESSAGE.parse("LAUFBAU_SIMPLE_PROGRESS", p, BauSystem.MESSAGE.parse("LAUFBAU_STATE_PROCESSING_TRACES", p), totalTntRecords - tntRecords.size(), totalTntRecords, eta(p, start, totalTntRecords - tntRecords.size(), totalTntRecords)); + } + + private boolean inRegion(Vector location, int expansion) { + return inRegionCheck.test(location, expansion); } @Override public boolean hasNext() { - return !tntPositionList.isEmpty() || !toExpand.isEmpty(); + return !tntRecords.isEmpty(); } @Override public void next() { - if (!toExpand.isEmpty()) { - Cuboid cuboid = toExpand.remove(0); - expandCuboid(cuboid); - } else { - TNTRecord tntPosition = tntPositionList.remove(0); - createCuboid(tntPosition); - } - } + TNTRecord current = tntRecords.remove(0); + if (FlatteningWrapper.impl.inWater(world, current.getLocation().toVector())) return; + if (!(inRegion(current.getLocation().toVector(), 1) || (current.getPrevious().isPresent() && inRegion(current.getPrevious().get().getLocation().toVector(), 1)))) + return; - private void createCuboid(TNTRecord tntPosition) { - Location location = tntPosition.getLocation(); - Optional previous = tntPosition.getPrevious(); - - if (!previous.isPresent()) { - toExpand.add(new Cuboid(location.getX() - 0.49, location.getY(), location.getZ() - 0.49, 0.98, 0.98, 0.98)); - } else { - Location previousLocation = tntPosition.getPrevious().get().getLocation(); + Location location = current.getLocation(); + if (current.getPrevious().isPresent()) { + Vector velocity = current.getPrevious().get().getVelocity(); + Location previousLocation = current.getPrevious().get().getLocation(); Location movement = location.clone().subtract(previousLocation); - toExpand.add(new Cuboid(previousLocation.getX() - 0.49, Math.min(previousLocation.getY(), location.getY()), previousLocation.getZ() - 0.49, 0.98, Math.abs(movement.getY()) + 0.98, 0.98)); - if (tntPosition.getVelocity().getX() >= tntPosition.getVelocity().getZ()) { - toExpand.add(new Cuboid(Math.min(previousLocation.getX(), location.getX()) - 0.49, location.getY(), previousLocation.getZ() - 0.49, Math.abs(movement.getX()) + 0.98, 0.98, 0.98)); - toExpand.add(new Cuboid(location.getX() - 0.49, location.getY(), Math.min(previousLocation.getZ(), location.getZ()) - 0.49, 0.98, 0.98, Math.abs(movement.getZ()) + 0.98)); + calculateCuboid(new Cuboid(previousLocation.getX() - 0.49, Math.min(previousLocation.getY(), location.getY()), previousLocation.getZ() - 0.49, 0.98, Math.abs(movement.getY()) + 0.98, 0.98)); + if (velocity.getX() >= velocity.getZ()) { + calculateCuboid(new Cuboid(Math.min(previousLocation.getX(), location.getX()) - 0.49, location.getY(), previousLocation.getZ() - 0.49, Math.abs(movement.getX()) + 0.98, 0.98, 0.98)); + calculateCuboid(new Cuboid(location.getX() - 0.49, location.getY(), Math.min(previousLocation.getZ(), location.getZ()) - 0.49, 0.98, 0.98, Math.abs(movement.getZ()) + 0.98)); } else { - toExpand.add(new Cuboid(previousLocation.getX() - 0.49, location.getY(), Math.min(previousLocation.getZ(), location.getZ()) - 0.49, 0.98, 0.98, Math.abs(movement.getZ()) + 0.98)); - toExpand.add(new Cuboid(Math.min(previousLocation.getX(), location.getX()) - 0.49, location.getY(), location.getZ() - 0.49, Math.abs(movement.getX()) + 0.98, 0.98, 0.98)); + calculateCuboid(new Cuboid(previousLocation.getX() - 0.49, location.getY(), Math.min(previousLocation.getZ(), location.getZ()) - 0.49, 0.98, 0.98, Math.abs(movement.getZ()) + 0.98)); + calculateCuboid(new Cuboid(Math.min(previousLocation.getX(), location.getX()) - 0.49, location.getY(), location.getZ() - 0.49, Math.abs(movement.getX()) + 0.98, 0.98, 0.98)); } + } else { + calculateCuboid(new Cuboid(location.getX() - 0.49, location.getY(), location.getZ() - 0.49, 0.98, 0.98, 0.98)); } } - private void expandCuboid(Cuboid cuboid) { - cuboidsDone++; + private void calculateCuboid(Cuboid cuboid) { for (double x = cuboid.getX() - 2; x < cuboid.getX() + cuboid.getDx() + 2; x++) { for (double y = cuboid.getY() - 2; y < cuboid.getY() + cuboid.getDy() + 2; y++) { for (double z = cuboid.getZ() - 2; z < cuboid.getZ() + cuboid.getDz() + 2; z++) { Vector location = new Vector(x, y, z); - if (inRegionCheck.test(location, 0)) { - Point point = new Point(location.getBlockX(), location.getBlockY(), location.getBlockZ()); - blocks.add(point); - cuboidIntersectionCache.computeIfAbsent(point.divide(factor), __ -> new HashSet<>()) + if (inRegion(location, 0)) { + affectedBlocks.add(new Point(location.getBlockX(), location.getBlockY(), location.getBlockZ())); + cuboidsPerChunk.computeIfAbsent(new Point(location.getBlockX() / factor, location.getBlockY() / factor, location.getBlockZ() / factor), __ -> new HashSet<>()) .add(cuboid); } } } } } + + @Override + public LaufbauState getNextState() { + return new CreatingLaufState(affectedBlocks, cuboidsPerChunk, world, editSession, elements, factor); + } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index a973da95..68049eb7 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -106,8 +106,8 @@ public class Trace { // TODO: Add UUID for file saving and so on! for (Player player : serverMap.keySet()) { REntityServer server = serverMap.get(player); - BundleFilter bundleFilter = bundleFilterMap.get(player); - ViewFlagHolder viewFlagHolder = viewFlagMap.get(player); + BundleFilter bundleFilter = bundleFilterMap.getOrDefault(player, BundleFilter.DEFAULT); + ViewFlagHolder viewFlagHolder = viewFlagMap.computeIfAbsent(player, ignored -> new ViewFlagHolder()); render(server, records, viewFlagHolder, bundleFilter); } -- 2.39.5 From 1aa63255e7554e37aa6aac912853b5afac0873a3 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Tue, 9 Apr 2024 14:59:19 +0200 Subject: [PATCH 069/111] Update tracer --- BauSystem_Main/src/BauSystem.properties | 30 ++-- ...agHolder.java => PlayerTraceShowData.java} | 24 ++- .../bausystem/features/tracer/Trace.java | 159 +++++------------- .../features/tracer/TraceCommand.java | 82 +++++++-- .../features/tracer/TraceManager.java | 137 ++++++++++----- .../features/tracer/TraceRecorder.java | 6 +- 6 files changed, 235 insertions(+), 203 deletions(-) rename BauSystem_Main/src/de/steamwar/bausystem/features/tracer/{rendering/ViewFlagHolder.java => PlayerTraceShowData.java} (74%) diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index 98f1ea7a..5cb5fdfa 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -482,36 +482,30 @@ TRACE_HAS_TRACES=§ehas Traces TRACE_IDLE_SINGLE=§esingle TRACE_IDLE_AUTO_IGNITE=§eauto TRACE_MESSAGE_AUTO_IDLE_IGNITE = §aAuto-Tracer ignite started -TRACE_MESSAGE_AUTO_DELETE_INVALID = §cAuto delete cannot be used currently -TRACE_MESSAGE_AUTO_DELETE_ALWAYS = §7Last Shot will §ealways §7be deleted -TRACE_MESSAGE_AUTO_DELETE_NEVER = §7Last Shot will §enever §7be deleted -TRACE_MESSAGE_AUTO_DELETE_NO_BUILD_DESTROY = §7Last Shot will be deleted if §eno build §7block was destroyed -TRACE_MESSAGE_AUTO_DELETE_BUILD_DESTROY = §7Last Shot will be deleted if §ea build §7block was destroyed -TRACE_MESSAGE_AUTO_DELETE_NO_TESTBLOCK_DESTROY = §7Last Shot will be deleted if §eno testblock §7block was destroyed -TRACE_MESSAGE_AUTO_DELETE_TESTBLOCK_DESTROY = §7Last Shot will be deleted if §ea testlblock §7block was destroyed TRACE_MESSAGE_START = §aTNT-Tracer started -TRACE_MESSAGE_SINGLE = §aSingle-Tracer started TRACE_MESSAGE_STOP = §cTNT-Tracer stopped TRACE_MESSAGE_DELETE = §cAll TNT-positions deleted +TRACE_MESSAGE_DELETE_SPECIFIC=§cTrace TNT-positions deleted TRACE_MESSAGE_SHOW = §aAll TNT-positions shown TRACE_MESSAGE_HIDE = §cAll TNT-positions hidden -TRACE_MESSAGE_DISALLOWED = §cYou are not allowed to use the TNT-Tracer here -TRACE_MESSAGE_SHOW_AT = §aTNT-positions shown with {0} at {1} -TRACE_MESSAGE_SHOW_FROM = §aAll TNT-positions shown with {0} from {1} -TRACE_MESSAGE_SHOW_FROM_TO = §aAll TNT-positions shown with {0} from {1} to {2} +TRACE_MESSAGE_SHOW_AT=§aTNT-positions shown at {1} +TRACE_MESSAGE_SHOW_FROM=§aAll TNT-positions shown from {1} +TRACE_MESSAGE_SHOW_FROM_TO=§aAll TNT-positions shown from {1} to {2} TRACE_MESSAGE_SHOW_TO_SMALLER = §cTo must be bigger then from TRACE_COMMAND_HELP_START = §8/§etrace start §8- §7Starts recording of all TNT-positions -TRACE_COMMAND_HELP_SINGLE = §8/§etrace single §8- §7Starts a single recording of all TNT-positions TRACE_COMMAND_HELP_STOP = §8/§etrace stop §8- §7Stops the TNT-Tracer TRACE_COMMAND_HELP_AUTO = §8/§etrace toggleauto §8- §7Automatic start of recording -TRACE_COMMAND_HELP_AUTO_REMOVE = §8/§etrace autoremove §8<§eParameter§8> §8- §7Remove last Trace Record automatically TRACE_COMMAND_HELP_SHOW = §8/§etrace show §8<§eParameter§8> - §7Shows all TNT-positions -TRACE_COMMAND_HELP_SHOW_AT = §8/§etrace show §8(§etime§8|§7fuse§8) §7at §8<§eTIME§8> - §7Shows all Trace Positions at §8<§eTIME§8> -TRACE_COMMAND_HELP_SHOW_FROM = §8/§etrace show §8(§etime§8|§7fuse§8) §7from §8<§eFROM§8> - §7Shows all Trace Positions from §8<§eFROM§8> -TRACE_COMMAND_HELP_SHOW_FROM_TO = §8/§etrace show §8(§etime§8|§7fuse§8) §7from §8<§eFROM§8> §7to §8<§eTO§8> - §7Shows all Trace Positions from §8<§eFROM§8> to §8<§eTO§8> +TRACE_COMMAND_HELP_SHOW_AT=§8/§etrace show §7at §8<§eTIME§8> - §7Shows all Trace Positions at §8<§eTIME§8> +TRACE_COMMAND_HELP_SHOW_AT_WITH=§8/§etrace show §7at §8<§eTIME§8> §7with §8<§eParameter§8> - §7Shows all Trace Positions at §8<§eTIME§8> +TRACE_COMMAND_HELP_SHOW_FROM=§8/§etrace show §7from §8<§eFROM§8> - §7Shows all Trace Positions from §8<§eFROM§8> +TRACE_COMMAND_HELP_SHOW_FROM_WITH=§8/§etrace show §7from §8<§eFROM§8> §7with §8<§eParameter§8> - §7Shows all Trace Positions from §8<§eFROM§8> +TRACE_COMMAND_HELP_SHOW_FROM_TO=§8/§etrace show §7from §8<§eFROM§8> §7to §8<§eTO§8> - §7Shows all Trace Positions from §8<§eFROM§8> to §8<§eTO§8> +TRACE_COMMAND_HELP_SHOW_FROM_TO_WITH=§8/§etrace show §7from §8<§eFROM§8> §7to §8<§eTO§8> §7with §8<§eParameter§8> - §7Shows all Trace Positions from §8<§eFROM§8> to §8<§eTO§8> TRACE_COMMAND_HELP_HIDE = §8/§etrace hide §8- §7Hides all TNT-positions -TRACE_COMMAND_HELP_DELETE = §8/§etrace delete §8- §7Deletes all TNT-positions +TRACE_COMMAND_HELP_DELETE=§8/§etrace delete §8[§eTrace§8] §8- §7Deletes all TNT-positions or a Trace +TRACE_COMMAND_HELP_ISOLATE=§8/§etrace isolate §8[§eTrace§8] §8[§eTNT§8] §8- §7Isolates specific TNTs from the Trace TRACE_GUI_ITEM_NAME = §eTracer TRACE_GUI_ITEM_LORE = §7Status§8: {0} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlagHolder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/PlayerTraceShowData.java similarity index 74% rename from BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlagHolder.java rename to BauSystem_Main/src/de/steamwar/bausystem/features/tracer/PlayerTraceShowData.java index a79d969b..8ec215c4 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlagHolder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/PlayerTraceShowData.java @@ -17,15 +17,25 @@ * along with this program. If not, see . */ -package de.steamwar.bausystem.features.tracer.rendering; +package de.steamwar.bausystem.features.tracer; + +import de.steamwar.bausystem.features.tracer.rendering.BundleFilter; +import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; +import lombok.Getter; +import lombok.Setter; import java.util.*; -public class ViewFlagHolder { +public class PlayerTraceShowData { + + @Getter + @Setter + private BundleFilter bundleFilter; private Map, ViewFlag> viewFlags = new HashMap<>(); - public ViewFlagHolder(ViewFlag... viewFlags) { + public PlayerTraceShowData(BundleFilter bundleFilter, ViewFlag... viewFlags) { + this.bundleFilter = bundleFilter; for (ViewFlag viewFlag : viewFlags) { this.viewFlags.put(viewFlag.getClass(), viewFlag); } @@ -51,10 +61,18 @@ public class ViewFlagHolder { return flagList; } + public boolean hasNoViewFlags() { + return viewFlags.isEmpty(); + } + public boolean hasViewFlag(Class clazz) { return viewFlags.containsKey(clazz); } + public boolean hasViewFlagOnly(Class clazz) { + return viewFlags.containsKey(clazz) && viewFlags.size() == 1; + } + public T getViewFlag(Class clazz) { return (T) viewFlags.get(clazz); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index 68049eb7..01c597a0 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -23,15 +23,14 @@ import de.steamwar.bausystem.features.tpslimit.TPSUtils; import de.steamwar.bausystem.features.tracer.rendering.BundleFilter; import de.steamwar.bausystem.features.tracer.rendering.TraceEntity; import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; -import de.steamwar.bausystem.features.tracer.rendering.ViewFlagHolder; -import de.steamwar.bausystem.features.tracer.rendering.dynamicflags.AtFlag; -import de.steamwar.bausystem.features.tracer.rendering.dynamicflags.IsolateFlag; import de.steamwar.bausystem.region.Region; +import de.steamwar.entity.REntity; import de.steamwar.entity.REntityServer; import lombok.Getter; import org.bukkit.entity.Player; import java.util.*; +import java.util.function.Function; import java.util.stream.Collectors; public class Trace { // TODO: Add UUID for file saving and so on! @@ -54,11 +53,13 @@ public class Trace { // TODO: Add UUID for file saving and so on! private List records = new ArrayList<>(); /** - * ID that should be asigned to the next record of a unique tnt + * ID that should be assigned to the next record of a unique tnt */ @Getter private int nextOpenRecordId = -1; + private final Map entityServerMap = new HashMap<>(); + /** * List of all used ids */ @@ -70,21 +71,6 @@ public class Trace { // TODO: Add UUID for file saving and so on! .collect(Collectors.toList()); } - /** - * A map of players -> REntityServers for rendering traces to a player - */ - private final Map serverMap = new HashMap<>(); - - /** - * A map saving the bundle filters for rendered traces, for life rendering - */ - private final Map bundleFilterMap = new HashMap<>(); - - /** - * A map saving the view flags for rendered traces, for life rendering - */ - private final Map viewFlagMap = new HashMap<>(); - public Trace(Region region) { this.region = region; } @@ -101,15 +87,17 @@ public class Trace { // TODO: Add UUID for file saving and so on! /** * Adds the given records and updates potential trace renderings */ - protected void addAll(List records) { + protected void addAll(List records, Function getter) { this.records.addAll(records); - - for (Player player : serverMap.keySet()) { - REntityServer server = serverMap.get(player); - BundleFilter bundleFilter = bundleFilterMap.getOrDefault(player, BundleFilter.DEFAULT); - ViewFlagHolder viewFlagHolder = viewFlagMap.computeIfAbsent(player, ignored -> new ViewFlagHolder()); - - render(server, records, viewFlagHolder, bundleFilter); + Iterator keySetIterator = entityServerMap.keySet().iterator(); + while (keySetIterator.hasNext()) { + Player player = keySetIterator.next(); + PlayerTraceShowData playerTraceShowData = getter.apply(player); + if (playerTraceShowData == null) { + keySetIterator.remove(); + continue; + } + render(getRecords(), entityServerMap.get(player), playerTraceShowData); } } @@ -130,7 +118,7 @@ public class Trace { // TODO: Add UUID for file saving and so on! public Set> getHistories() { Set> histories = new HashSet<>(); - for (TNTRecord record : records) { + for (TNTRecord record : getRecords()) { histories.add(record.getHistory()); } @@ -140,43 +128,31 @@ public class Trace { // TODO: Add UUID for file saving and so on! /** * Renders this traces * - * @param player The player the trace is rendered to - * @param viewFlagHolder Flags modefieing the rendering - * @param bundleFilter Filter to determin bundeling of records + * @param player The player the trace is rendered to + * @param playerTraceShowData The showData for modifying the rendering */ - public void render(Player player, ViewFlagHolder viewFlagHolder, BundleFilter bundleFilter) { - if (serverMap.containsKey(player)) { - REntityServer server = serverMap.get(player); - server.close(); - - serverMap.remove(player); - viewFlagMap.remove(player); - bundleFilterMap.remove(player); + public void render(Player player, PlayerTraceShowData playerTraceShowData) { + REntityServer entityServer = entityServerMap.get(player); + if (entityServer != null) { + entityServer.getEntities().forEach(REntity::die); + } else { + entityServer = new REntityServer(); + entityServerMap.put(player, entityServer); } - - viewFlagMap.put(player, viewFlagHolder); - bundleFilterMap.put(player, bundleFilter); - - REntityServer server = new REntityServer(); - server.addPlayer(player); - serverMap.put(player, server); - - render(server, records, viewFlagHolder, bundleFilter); + render(getRecords(), entityServer, playerTraceShowData); } /** * Internal methode to render records to a REntityServer * - * @param server Server to render to - * @param records Records to render - * @param viewFlagHolder Flags modefieing the rendering - * @param bundleFilter Filter to determin bundeling of records + * @param records Records to render + * @param playerTraceShowData The showData for modifying the rendering */ - private void render(REntityServer server, List records, ViewFlagHolder viewFlagHolder, BundleFilter bundleFilter) { + private void render(List records, REntityServer entityServer, PlayerTraceShowData playerTraceShowData) { if (records.isEmpty()) return; List workingRecords = records; - Set flagList = viewFlagHolder.getEffectiveViewFlags(); + Set flagList = playerTraceShowData.getEffectiveViewFlags(); //Apply filters for (ViewFlag flag : flagList) { @@ -184,28 +160,27 @@ public class Trace { // TODO: Add UUID for file saving and so on! } //Bundle records at unique positions - List> bundles = bundleRecords(workingRecords, bundleFilter); + List> bundles = bundleRecords(workingRecords, playerTraceShowData.getBundleFilter()); //Render bundled records List entities = new LinkedList<>(); for (List bundle : bundles) { - entities.add(new TraceEntity(server, bundle.get(0).getLocation(), bundle.get(0).isExplosion(), bundle)); + entities.add(new TraceEntity(entityServer, bundle.get(0).getLocation(), bundle.get(0).isExplosion(), bundle)); } //Apply modifiers for (ViewFlag flag : flagList) { - flag.modify(server, entities); + flag.modify(entityServer, entities); } - - server.setCallback(((player, rEntity, entityAction) -> { + entityServer.setCallback((player, rEntity, entityAction) -> { for (TraceEntity entity : entities) { if (rEntity.equals(entity)) { entity.printIntoChat(player); return; } } - })); + }); } /** @@ -243,48 +218,6 @@ public class Trace { // TODO: Add UUID for file saving and so on! return bundles; } - - /** - * Modifies the render for the given player, to only show tnts at the given time interval - * - * @param player - * @param from start of time interval - * @param to end of time interval - */ - public void renderAt(Player player, int from, int to) { - ViewFlagHolder viewFlags = viewFlagMap.computeIfAbsent(player, p -> new ViewFlagHolder()); - if (viewFlags.hasViewFlag(AtFlag.class)) { - viewFlags.getViewFlag(AtFlag.class).update(from, to); - } else { - viewFlags.addViewFlag(new AtFlag(from, to)); - } - render(player, viewFlags, BundleFilter.STRICT); - } - - /** - * Toggles the isolated render for the given records and player - * - * @param player the player the trace is shown to - * @param records the record for which isolation is toggled - */ - public void isolate(Player player, TNTRecord... records) { - IsolateFlag isolateFlag; - ViewFlagHolder viewFlags = viewFlagMap.get(player); - if (viewFlags != null && viewFlags.hasViewFlag(IsolateFlag.class)) { - isolateFlag = viewFlags.getViewFlag(IsolateFlag.class); - } else { - viewFlags = new ViewFlagHolder(); - isolateFlag = new IsolateFlag(); - viewFlags.addViewFlag(isolateFlag); - } - - for (TNTRecord record : records) { - isolateFlag.toggleId(record.getTntId()); - } - - render(player, viewFlags, BundleFilter.STRICT); - } - /** * Makes the first passed player follow the trace render of the second passed player * @@ -292,11 +225,7 @@ public class Trace { // TODO: Add UUID for file saving and so on! * @param toFollow */ public void follow(Player player, Player toFollow) { - for (REntityServer server : serverMap.values()) { - server.removePlayer(player); - } - - serverMap.get(toFollow).addPlayer(player); + throw new UnsupportedOperationException(); } /** @@ -305,13 +234,7 @@ public class Trace { // TODO: Add UUID for file saving and so on! * @param player */ public void unfollow(Player player) { - for (REntityServer server : serverMap.values()) { - server.removePlayer(player); - } - - if (serverMap.get(player) != null) { - serverMap.get(player).addPlayer(player); - } + throw new UnsupportedOperationException(); } /** @@ -320,12 +243,8 @@ public class Trace { // TODO: Add UUID for file saving and so on! * @param player */ public void hide(Player player) { - REntityServer server = serverMap.get(player); - if (server == null) return; - - bundleFilterMap.remove(player); - viewFlagMap.remove(player); - server.close(); + REntityServer entityServer = entityServerMap.remove(player); + if (entityServer != null) entityServer.close(); } @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index 8dbc9583..854deaed 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -22,7 +22,7 @@ package de.steamwar.bausystem.features.tracer; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.tracer.rendering.BundleFilter; import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; -import de.steamwar.bausystem.features.tracer.rendering.ViewFlagHolder; +import de.steamwar.bausystem.features.tracer.rendering.dynamicflags.AtFlag; import de.steamwar.bausystem.region.Region; import de.steamwar.command.PreviousArguments; import de.steamwar.command.SWCommand; @@ -43,6 +43,7 @@ public class TraceCommand extends SWCommand { @LinkedInstance public TraceRecorder traceRecorder; + @LinkedInstance public TraceManager manager; @@ -64,44 +65,87 @@ public class TraceCommand extends SWCommand { BauSystem.MESSAGE.send("TRACE_MESSAGE_STOP", player); } - @Register(value = "auto", description = "TRACE_COMMAND_HELP_SHOW") + @Register(value = "auto", description = "TRACE_COMMAND_HELP_AUTO") public void auto(@Validator Player player) { Region region = Region.getRegion(player.getLocation()); traceRecorder.toggleAutoTrace(region); + // TODO: Add Auto toggle Message! } @Register(value = "show", description = "TRACE_COMMAND_HELP_SHOW") - public void show(@Validator Player player, @OptionalValue("STRICT") BundleFilter filter, ViewFlag... flags) { - manager.show(player, new ViewFlagHolder(flags), filter); + public void show(@Validator Player player, @OptionalValue("STRICT") BundleFilter bundleFilter, ViewFlag... flags) { + showInternal(player, 0, Integer.MAX_VALUE, bundleFilter, flags); BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW", player); } - @Register(value = "hide", description = "TRACE_COMMAND_HELP_SHOW") + @Register(value = {"show", "at"}, description = "TRACE_COMMAND_HELP_SHOW_AT_WITH") + public void showAt(@Validator Player player, @Min(intValue = 0) int time, @StaticValue("with") String with, @OptionalValue("STRICT") BundleFilter bundleFilter, @ArrayLength(min = 1) ViewFlag... flags) { + showInternal(player, time, time, bundleFilter, flags); + BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_AT", player, time); + } + + @Register(value = {"show", "from"}, description = "TRACE_COMMAND_HELP_SHOW_FROM_WITH") + public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("with") String with, @OptionalValue("STRICT") BundleFilter bundleFilter, @ArrayLength(min = 1) ViewFlag... flags) { + showInternal(player, from, Integer.MAX_VALUE, bundleFilter, flags); + BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_FROM", player, from); + } + + @Register(value = {"show", "from"}, description = "TRACE_COMMAND_HELP_SHOW_FROM_TO_WITH") + public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("to") String toString, int to, @StaticValue("with") String with, @OptionalValue("STRICT") BundleFilter bundleFilter, @ArrayLength(min = 1) ViewFlag... flags) { + if (to < from) { + BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_TO_SMALLER", player); + return; + } + showInternal(player, from, to, bundleFilter, flags); + BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_FROM_TO", player, from, to); + } + + private void showInternal(Player player, int from, int to, BundleFilter bundleFilter, ViewFlag... flags) { + PlayerTraceShowData playerTraceShowData = new PlayerTraceShowData(bundleFilter, flags); + playerTraceShowData.addViewFlag(new AtFlag(from, to)); + manager.show(player, playerTraceShowData); + } + + @Register(value = {"show", "at"}, description = "TRACE_COMMAND_HELP_SHOW_AT") + public void showAt(@Validator Player player, @Min(intValue = 0) int time) { + manager.renderAt(player, time, time); + BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_AT", player, time); + } + + @Register(value = {"show", "from"}, description = "TRACE_COMMAND_HELP_SHOW_FROM") + public void showFrom(@Validator Player player, @Min(intValue = 0) int from) { + manager.renderAt(player, from, Integer.MAX_VALUE); + BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_FROM", player, from); + } + + @Register(value = {"show", "from"}, description = "TRACE_COMMAND_HELP_SHOW_FROM_TO") + public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("to") String toString, int to) { + manager.renderAt(player, from, to); + BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_FROM_TO", player, from, to); + } + + @Register(value = "hide", description = "TRACE_COMMAND_HELP_HIDE") public void hide(@Validator Player player) { manager.hide(player); BauSystem.MESSAGE.send("TRACE_MESSAGE_HIDE", player); } - @Register(value = "delete", description = "TRACE_COMMAND_HELP_SHOW") + @Register(value = "delete", description = "TRACE_COMMAND_HELP_DELETE") public void delete(@Validator Player player) { manager.clear(); + BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE", player); } - @Register(value = "delete", description = "TRACE_COMMAND_HELP_SHOW") - public void delete(@Validator Player player, int id) { - manager.remove(id); + @Register(value = "delete") + public void delete(@Validator Player player, Trace trace) { + // TODO: Reimplement manager.remove(trace); + BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE_SPECIFIC", player); } - @Register(value = "isolate", description = "TRACE_COMMAND_HELP_SHOW") + @Register(value = "isolate", description = "TRACE_COMMAND_HELP_ISOLATE") public void isolate(@Validator Player player, Trace trace, @ErrorMessage("TRACE_RECORD_ID_INVALID") TNTRecord... records) { - trace.isolate(player, records); - } - - @Register(value = "at", description = "TRACE_COMMAND_HELP_SHOW") - public void at(@Validator Player player, int start, int end) { - for (Trace trace : manager.getAll()) { - trace.renderAt(player, start, end); - } + manager.isolate(player, records); + // TODO: Add Message! } @Register(value = "share", description = "TRACE_COMMAND_HELP_SHOW") @@ -111,6 +155,7 @@ public class TraceCommand extends SWCommand { @Register(value = "follow", description = "TRACE_COMMAND_HELP_SHOW") public void follow(@Validator Player player, Player toFollow) { + // TODO: Implement for (Trace trace : manager.getAll()) { trace.follow(player, toFollow); } @@ -118,6 +163,7 @@ public class TraceCommand extends SWCommand { @Register(value = "unfollow", description = "TRACE_COMMAND_HELP_SHOW") public void unfollow(@Validator Player player) { + // TODO: Implement for (Trace trace : manager.getAll()) { trace.unfollow(player); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index 47819a75..1e693207 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -20,7 +20,8 @@ package de.steamwar.bausystem.features.tracer; import de.steamwar.bausystem.features.tracer.rendering.BundleFilter; -import de.steamwar.bausystem.features.tracer.rendering.ViewFlagHolder; +import de.steamwar.bausystem.features.tracer.rendering.dynamicflags.AtFlag; +import de.steamwar.bausystem.features.tracer.rendering.dynamicflags.IsolateFlag; import de.steamwar.bausystem.region.Region; import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; @@ -37,15 +38,7 @@ public class TraceManager implements Listener { private final Map> tracesByRegion = new HashMap<>(); - /** - * A map saving the view flags used by Players - */ - private final Map viewFlagMap = new HashMap<>(); - - /** - * A map saving the bundle filter used by Players - */ - private final Map bundleFilterMap = new HashMap<>(); + private final Map> showDataPerRegionPerPlayer = new HashMap<>(); /** * Utility variable to keep track of the next open trace id; @@ -59,15 +52,21 @@ public class TraceManager implements Listener { * @return id of the created trace */ protected int add(Trace trace) { - for (Player player : viewFlagMap.keySet()) { - trace.render(player, viewFlagMap.get(player), bundleFilterMap.get(player)); - } + showDataPerRegionPerPlayer.getOrDefault(trace.getRegion(), Collections.emptyMap()).forEach((player, playerTraceShowData) -> { + trace.render(player, playerTraceShowData); + }); traces.put(nextOpenId, trace); tracesByRegion.computeIfAbsent(trace.getRegion(), region -> new HashMap<>()).put(nextOpenId, trace); nextOpenId++; return nextOpenId; } + protected void addAll(Trace trace, List tntRecords) { + trace.addAll(tntRecords, player -> { + return showDataPerRegionPerPlayer.getOrDefault(trace.getRegion(), Collections.emptyMap()).get(player); + }); + } + /** * Removes the trace with the given id * @@ -76,13 +75,11 @@ public class TraceManager implements Listener { public boolean remove(int id) { if (id >= nextOpenId) return false; if (traces.get(id) == null) return false; - for (Player player : viewFlagMap.keySet()) { - traces.get(id).hide(player); - } Trace trace = traces.remove(id); - if (trace != null) { - tracesByRegion.get(trace.getRegion()).remove(id); - } + showDataPerRegionPerPlayer.get(trace.getRegion()).forEach((player, playerTraceShowData) -> { + trace.hide(player); + }); + tracesByRegion.get(trace.getRegion()).remove(id); return true; } @@ -90,11 +87,15 @@ public class TraceManager implements Listener { * Clears all traces */ public void clear() { - for (Player player : viewFlagMap.keySet()) { - for (Trace trace : traces.values()) { - trace.hide(player); - } - } + showDataPerRegionPerPlayer.values() + .stream() + .flatMap(map -> map.entrySet().stream()) + .map(Map.Entry::getKey) + .forEach(player -> { + traces.values().forEach(trace -> { + trace.hide(player); + }); + }); traces.clear(); tracesByRegion.clear(); nextOpenId = 0; @@ -117,10 +118,7 @@ public class TraceManager implements Listener { * @return the trace with given id or null if no trace with id is found */ public Optional get(int index) { - if (index < traces.size()) { - return Optional.of(traces.get(index)); - } - return Optional.empty(); + return Optional.ofNullable(traces.get(index)); } /** @@ -140,32 +138,87 @@ public class TraceManager implements Listener { } /** - * Toggles trace show on for player + * Shows traces for the player of the current Region * * @param player - * @param viewFlagHolder - * @param bundleFilter + * @param playerTraceShowData */ - public void show(Player player, ViewFlagHolder viewFlagHolder, BundleFilter bundleFilter) { - viewFlagMap.put(player, viewFlagHolder); - bundleFilterMap.put(player, bundleFilter); - - for (Trace trace : traces.values()) { - trace.render(player, viewFlagHolder, bundleFilter); - } + public void show(Player player, PlayerTraceShowData playerTraceShowData) { + Region region = Region.getRegion(player.getLocation()); + showDataPerRegionPerPlayer.computeIfAbsent(region, ignored -> new HashMap<>()).put(player, playerTraceShowData); + tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> { + trace.render(player, playerTraceShowData); + }); } /** - * Toggles trace show of for player + * Hides traces for the player of the current Region * * @param player */ public void hide(Player player) { - for (Trace trace : traces.values()) { + Region region = Region.getRegion(player.getLocation()); + PlayerTraceShowData previous = showDataPerRegionPerPlayer.getOrDefault(region, Collections.emptyMap()).remove(player); + if (previous == null) return; + tracesByRegion.getOrDefault(player, Collections.emptyMap()).forEach((integer, trace) -> { trace.hide(player); + }); + } + + /** + * Modifies the render for the given player, to only show tnts at the given time interval + * + * @param player + * @param from start of time interval + * @param to end of time interval + */ + public void renderAt(Player player, int from, int to) { + Region region = Region.getRegion(player.getLocation()); + PlayerTraceShowData playerTraceShowData = showDataPerRegionPerPlayer.computeIfAbsent(region, ignored -> new HashMap<>()).computeIfAbsent(player, ignored -> new PlayerTraceShowData(BundleFilter.STRICT)); + + AtFlag atFlag = playerTraceShowData.getViewFlag(AtFlag.class); + if (atFlag == null) { + atFlag = new AtFlag(from, to); + playerTraceShowData.addViewFlag(atFlag); + } else { + atFlag.update(from, to); } - viewFlagMap.remove(player); - bundleFilterMap.remove(player); + tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> { + trace.render(player, playerTraceShowData); + }); + } + + /** + * Toggles the isolated render for the given records and player + * + * @param player the player the trace is shown to + * @param records the record for which isolation is toggled + */ + public void isolate(Player player, TNTRecord... records) { + Region region = Region.getRegion(player.getLocation()); + PlayerTraceShowData playerTraceShowData = showDataPerRegionPerPlayer.computeIfAbsent(region, ignored -> new HashMap<>()).computeIfAbsent(player, ignored -> new PlayerTraceShowData(BundleFilter.STRICT)); + + IsolateFlag isolateFlag; + if (playerTraceShowData.hasViewFlagOnly(IsolateFlag.class)) { + isolateFlag = playerTraceShowData.getViewFlag(IsolateFlag.class); + } else if (playerTraceShowData.hasNoViewFlags()) { + isolateFlag = new IsolateFlag(); + playerTraceShowData.addViewFlag(isolateFlag); + } else { + playerTraceShowData = new PlayerTraceShowData(BundleFilter.STRICT); + isolateFlag = new IsolateFlag(); + playerTraceShowData.addViewFlag(isolateFlag); + showDataPerRegionPerPlayer.get(region).put(player, playerTraceShowData); + } + + for (TNTRecord record : records) { + isolateFlag.toggleId(record.getTntId()); + } + + PlayerTraceShowData finalPlayerTraceShowData = playerTraceShowData; + tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> { + trace.render(player, finalPlayerTraceShowData); + }); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java index 58f719bf..da31507a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java @@ -159,8 +159,10 @@ public class TraceRecorder implements Listener { for (TNTPrimed tnt : trackedTNT.getOrDefault(region, Collections.emptyList())) { record(tnt, trace, Collections.emptyList()); } - trace.addAll(recordsToAddMap.get(trace)); - recordsToAddMap.get(trace).clear(); + + List tntRecords = recordsToAddMap.get(trace); + manager.addAll(trace, tntRecords); + tntRecords.clear(); } } -- 2.39.5 From 224127eac6e6e81acb7fb52989731001c46d1e94 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Tue, 9 Apr 2024 18:10:18 +0200 Subject: [PATCH 070/111] Update tracer --- .../src/de/steamwar/bausystem/features/tracer/Trace.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index 01c597a0..d90126b8 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -137,6 +137,7 @@ public class Trace { // TODO: Add UUID for file saving and so on! entityServer.getEntities().forEach(REntity::die); } else { entityServer = new REntityServer(); + entityServer.addPlayer(player); entityServerMap.put(player, entityServer); } render(getRecords(), entityServer, playerTraceShowData); @@ -244,7 +245,9 @@ public class Trace { // TODO: Add UUID for file saving and so on! */ public void hide(Player player) { REntityServer entityServer = entityServerMap.remove(player); - if (entityServer != null) entityServer.close(); + if (entityServer == null) return; + entityServer.removePlayer(player); + if (entityServer.getPlayers().isEmpty()) entityServer.close(); } @Override -- 2.39.5 From e06d612a0e848375d4f37aa0d159fdb0c0aecc6e Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Tue, 9 Apr 2024 22:46:00 +0200 Subject: [PATCH 071/111] Renamed TNTRecord Signed-off-by: D4rkr34lm --- .../laufbau/states/ProcessingTracesState.java | 14 ++++---- .../bausystem/features/tracer/Trace.java | 34 +++++++++---------- .../features/tracer/TraceCommand.java | 8 ++--- .../features/tracer/TraceManager.java | 8 ++--- .../{TNTRecord.java => TraceRecord.java} | 14 ++++---- .../features/tracer/TraceRecorder.java | 14 ++++---- .../tracer/rendering/BundleFilter.java | 12 +++---- .../tracer/rendering/TraceEntity.java | 8 ++--- .../features/tracer/rendering/ViewFlag.java | 30 ++++++++-------- .../tracer/rendering/dynamicflags/AtFlag.java | 4 +-- .../rendering/dynamicflags/IsolateFlag.java | 4 +-- 11 files changed, 75 insertions(+), 75 deletions(-) rename BauSystem_Main/src/de/steamwar/bausystem/features/tracer/{TNTRecord.java => TraceRecord.java} (90%) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java index e8693105..ffc4e06d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java @@ -23,7 +23,7 @@ import com.sk89q.worldedit.EditSession; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox; import de.steamwar.bausystem.features.slaves.laufbau.Cuboid; -import de.steamwar.bausystem.features.tracer.TNTRecord; +import de.steamwar.bausystem.features.tracer.TraceRecord; import de.steamwar.bausystem.features.tracer.TraceRecorder; import de.steamwar.bausystem.region.Point; import de.steamwar.bausystem.utils.FlatteningWrapper; @@ -45,7 +45,7 @@ public class ProcessingTracesState implements LaufbauState { private final List elements; private final int factor; - private final List tntRecords; + private final List traceRecords; private final int totalTntRecords; private final Set affectedBlocks = new HashSet<>(); @@ -59,17 +59,17 @@ public class ProcessingTracesState implements LaufbauState { this.factor = factor; // TODO: Optimize only retrieving traces inside of the affected regions! - tntRecords = TraceRecorder.instance.manager.getAll() + traceRecords = TraceRecorder.instance.manager.getAll() .stream() .flatMap(trace -> trace.getHistories().stream()) .flatMap(Collection::stream) .collect(Collectors.toList()); - totalTntRecords = tntRecords.size(); + totalTntRecords = traceRecords.size(); } @Override public String actionBarMessage(Player p) { - return BauSystem.MESSAGE.parse("LAUFBAU_SIMPLE_PROGRESS", p, BauSystem.MESSAGE.parse("LAUFBAU_STATE_PROCESSING_TRACES", p), totalTntRecords - tntRecords.size(), totalTntRecords, eta(p, start, totalTntRecords - tntRecords.size(), totalTntRecords)); + return BauSystem.MESSAGE.parse("LAUFBAU_SIMPLE_PROGRESS", p, BauSystem.MESSAGE.parse("LAUFBAU_STATE_PROCESSING_TRACES", p), totalTntRecords - traceRecords.size(), totalTntRecords, eta(p, start, totalTntRecords - traceRecords.size(), totalTntRecords)); } private boolean inRegion(Vector location, int expansion) { @@ -78,12 +78,12 @@ public class ProcessingTracesState implements LaufbauState { @Override public boolean hasNext() { - return !tntRecords.isEmpty(); + return !traceRecords.isEmpty(); } @Override public void next() { - TNTRecord current = tntRecords.remove(0); + TraceRecord current = traceRecords.remove(0); if (FlatteningWrapper.impl.inWater(world, current.getLocation().toVector())) return; if (!(inRegion(current.getLocation().toVector(), 1) || (current.getPrevious().isPresent() && inRegion(current.getPrevious().get().getLocation().toVector(), 1)))) return; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index d90126b8..f6be4639 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -50,7 +50,7 @@ public class Trace { // TODO: Add UUID for file saving and so on! * Records of TNTs, making up the trace */ @Getter - private List records = new ArrayList<>(); + private List records = new ArrayList<>(); /** * ID that should be assigned to the next record of a unique tnt @@ -66,7 +66,7 @@ public class Trace { // TODO: Add UUID for file saving and so on! public List getUsedIds() { return getRecords() .stream() - .map(TNTRecord::getTntId) + .map(TraceRecord::getTntId) .map(i -> i + "") .collect(Collectors.toList()); } @@ -87,7 +87,7 @@ public class Trace { // TODO: Add UUID for file saving and so on! /** * Adds the given records and updates potential trace renderings */ - protected void addAll(List records, Function getter) { + protected void addAll(List records, Function getter) { this.records.addAll(records); Iterator keySetIterator = entityServerMap.keySet().iterator(); while (keySetIterator.hasNext()) { @@ -106,7 +106,7 @@ public class Trace { // TODO: Add UUID for file saving and so on! * * @param records immutable records list */ - protected void setRecords(List records) { + protected void setRecords(List records) { this.records = records; } @@ -115,10 +115,10 @@ public class Trace { // TODO: Add UUID for file saving and so on! * * @return the historys of this trace */ - public Set> getHistories() { - Set> histories = new HashSet<>(); + public Set> getHistories() { + Set> histories = new HashSet<>(); - for (TNTRecord record : getRecords()) { + for (TraceRecord record : getRecords()) { histories.add(record.getHistory()); } @@ -149,10 +149,10 @@ public class Trace { // TODO: Add UUID for file saving and so on! * @param records Records to render * @param playerTraceShowData The showData for modifying the rendering */ - private void render(List records, REntityServer entityServer, PlayerTraceShowData playerTraceShowData) { + private void render(List records, REntityServer entityServer, PlayerTraceShowData playerTraceShowData) { if (records.isEmpty()) return; - List workingRecords = records; + List workingRecords = records; Set flagList = playerTraceShowData.getEffectiveViewFlags(); //Apply filters @@ -161,12 +161,12 @@ public class Trace { // TODO: Add UUID for file saving and so on! } //Bundle records at unique positions - List> bundles = bundleRecords(workingRecords, playerTraceShowData.getBundleFilter()); + List> bundles = bundleRecords(workingRecords, playerTraceShowData.getBundleFilter()); //Render bundled records List entities = new LinkedList<>(); - for (List bundle : bundles) { + for (List bundle : bundles) { entities.add(new TraceEntity(entityServer, bundle.get(0).getLocation(), bundle.get(0).isExplosion(), bundle)); } @@ -190,23 +190,23 @@ public class Trace { // TODO: Add UUID for file saving and so on! * @param records The TNTRecords that are supposed to be bundled * @return A list of bundles */ - private List> bundleRecords(List records, BundleFilter filter) { - List> bundles = new ArrayList<>(); + private List> bundleRecords(List records, BundleFilter filter) { + List> bundles = new ArrayList<>(); recordsLoop: - for (TNTRecord record : records) { + for (TraceRecord record : records) { if (bundles.isEmpty()) { - List firstBundle = new ArrayList<>(); + List firstBundle = new ArrayList<>(); firstBundle.add(record); bundles.add(firstBundle); } for (int i = bundles.size() - 1; i >= 0; i--) { - List bundle = bundles.get(i); + List bundle = bundles.get(i); Boolean filterResult = filter.function.apply(record, bundle.get(0)); if (filterResult == null || !filterResult) { - ArrayList newBundle = new ArrayList<>(); + ArrayList newBundle = new ArrayList<>(); newBundle.add(record); bundles.add(newBundle); continue recordsLoop; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index 854deaed..393dd0ec 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -143,7 +143,7 @@ public class TraceCommand extends SWCommand { } @Register(value = "isolate", description = "TRACE_COMMAND_HELP_ISOLATE") - public void isolate(@Validator Player player, Trace trace, @ErrorMessage("TRACE_RECORD_ID_INVALID") TNTRecord... records) { + public void isolate(@Validator Player player, Trace trace, @ErrorMessage("TRACE_RECORD_ID_INVALID") TraceRecord... records) { manager.isolate(player, records); // TODO: Add Message! } @@ -186,11 +186,11 @@ public class TraceCommand extends SWCommand { }; } - @ClassMapper(value = TNTRecord.class, local = true) - public TypeMapper recordMapper() { + @ClassMapper(value = TraceRecord.class, local = true) + public TypeMapper recordMapper() { return new TypeMapper<>() { @Override - public TNTRecord map(CommandSender commandSender, PreviousArguments previousArguments, String s) { + public TraceRecord map(CommandSender commandSender, PreviousArguments previousArguments, String s) { Trace trace = previousArguments.getFirst(Trace.class).orElse(null); if (trace == null) return null; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index 1e693207..508d8f20 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -61,8 +61,8 @@ public class TraceManager implements Listener { return nextOpenId; } - protected void addAll(Trace trace, List tntRecords) { - trace.addAll(tntRecords, player -> { + protected void addAll(Trace trace, List traceRecords) { + trace.addAll(traceRecords, player -> { return showDataPerRegionPerPlayer.getOrDefault(trace.getRegion(), Collections.emptyMap()).get(player); }); } @@ -195,7 +195,7 @@ public class TraceManager implements Listener { * @param player the player the trace is shown to * @param records the record for which isolation is toggled */ - public void isolate(Player player, TNTRecord... records) { + public void isolate(Player player, TraceRecord... records) { Region region = Region.getRegion(player.getLocation()); PlayerTraceShowData playerTraceShowData = showDataPerRegionPerPlayer.computeIfAbsent(region, ignored -> new HashMap<>()).computeIfAbsent(player, ignored -> new PlayerTraceShowData(BundleFilter.STRICT)); @@ -212,7 +212,7 @@ public class TraceManager implements Listener { showDataPerRegionPerPlayer.get(region).put(player, playerTraceShowData); } - for (TNTRecord record : records) { + for (TraceRecord record : records) { isolateFlag.toggleId(record.getTntId()); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecord.java similarity index 90% rename from BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java rename to BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecord.java index 52671821..fea06ed3 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecord.java @@ -32,7 +32,7 @@ import java.util.List; import java.util.Optional; @Getter -public class TNTRecord { +public class TraceRecord { /** * Unique number to identify records being of the same tnt @@ -87,9 +87,9 @@ public class TNTRecord { /** * List of all tnt records, that are represent the same tnt */ - private final List history; + private final List history; - public TNTRecord(int tntId, TNTPrimed tnt, boolean explosion, boolean afterFirstExplosion, long ticksSinceStart, List history, List destroyedBlocks) { + public TraceRecord(int tntId, TNTPrimed tnt, boolean explosion, boolean afterFirstExplosion, long ticksSinceStart, List history, List destroyedBlocks) { this.tntId = tntId; this.explosion = explosion; this.inWater = tnt.isInWater(); @@ -115,12 +115,12 @@ public class TNTRecord { destroyedTestBlock = testblockDestroy; } - public Optional getNext() { + public Optional getNext() { int index = history.indexOf(this); return index == history.size() - 1 ? Optional.empty() : Optional.of(history.get(index + 1)); } - public Optional getPrevious() { + public Optional getPrevious() { int index = history.indexOf(this); return index == 0 ? Optional.empty() : Optional.of(history.get(index - 1)); } @@ -138,8 +138,8 @@ public class TNTRecord { @Override public boolean equals(Object obj) { - if (!(obj instanceof TNTRecord)) return false; - TNTRecord record = (TNTRecord) obj; + if (!(obj instanceof TraceRecord)) return false; + TraceRecord record = (TraceRecord) obj; if (record.isExplosion() != explosion) return false; if (!record.getLocation().equals(location)) return false; if (!record.getVelocity().equals(velocity)) return false; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java index da31507a..15b31af0 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java @@ -72,12 +72,12 @@ public class TraceRecorder implements Listener { /** * A map for records that have been taken in the same tick and now have to be added to the traces */ - private final Map> recordsToAddMap = new HashMap<>(); + private final Map> recordsToAddMap = new HashMap<>(); /** * Maps a tracked tnt entity to its entire recording history */ - private final Map> historyMap = new HashMap<>(); + private final Map> historyMap = new HashMap<>(); /** * Regions where auto-trace is enabled @@ -160,9 +160,9 @@ public class TraceRecorder implements Listener { record(tnt, trace, Collections.emptyList()); } - List tntRecords = recordsToAddMap.get(trace); - manager.addAll(trace, tntRecords); - tntRecords.clear(); + List traceRecords = recordsToAddMap.get(trace); + manager.addAll(trace, traceRecords); + traceRecords.clear(); } } @@ -173,7 +173,7 @@ public class TraceRecorder implements Listener { * @param trace trace to record the tnt for */ private void record(TNTPrimed tntPrimed, Trace trace, List destroyedBlocks) { - List history = historyMap.getOrDefault(tntPrimed, new ArrayList<>()); + List history = historyMap.getOrDefault(tntPrimed, new ArrayList<>()); int tntID; if (history.size() == 0) { @@ -189,7 +189,7 @@ public class TraceRecorder implements Listener { } boolean afterFirstExplosion = noExplosionRecorded.contains(trace); - TNTRecord record = new TNTRecord(tntID, tntPrimed, isExplosion, afterFirstExplosion, TPSUtils.currentTick.get() - trace.getStartTime(), history, destroyedBlocks); + TraceRecord record = new TraceRecord(tntID, tntPrimed, isExplosion, afterFirstExplosion, TPSUtils.currentTick.get() - trace.getStartTime(), history, destroyedBlocks); history.add(record); recordsToAddMap.get(trace).add(record); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java index 5232065c..12aa69ea 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java @@ -19,7 +19,7 @@ package de.steamwar.bausystem.features.tracer.rendering; -import de.steamwar.bausystem.features.tracer.TNTRecord; +import de.steamwar.bausystem.features.tracer.TraceRecord; import lombok.RequiredArgsConstructor; import java.util.function.BiFunction; @@ -27,14 +27,14 @@ import java.util.function.BiFunction; @RequiredArgsConstructor public enum BundleFilter { - LOOSE((TNTRecord a, TNTRecord b) -> { + LOOSE((TraceRecord a, TraceRecord b) -> { if (a.isExplosion() != b.isExplosion()) return false; if (a.getLocation().distanceSquared(b.getLocation()) <= BundleFilter.pixelSizeSquared) return false; if (a.getVelocity().distanceSquared(b.getVelocity()) <= BundleFilter.pixelSizeSquared) return false; return true; }), - DEFAULT((TNTRecord a, TNTRecord b) -> { + DEFAULT((TraceRecord a, TraceRecord b) -> { if (a.isExplosion() != b.isExplosion()) return false; if (a.getTicksSinceStart() != b.getTicksSinceStart()) return null; if (a.getLocation().distanceSquared(b.getLocation()) <= BundleFilter.pixelSizeSquared) return false; @@ -42,7 +42,7 @@ public enum BundleFilter { return true; }), - STRICT((TNTRecord a, TNTRecord b) -> { + STRICT((TraceRecord a, TraceRecord b) -> { if (a.isExplosion() != b.isExplosion()) return false; if (!a.getLocation().equals(b.getLocation())) return false; if (!a.getVelocity().equals(b.getVelocity())) return false; @@ -50,7 +50,7 @@ public enum BundleFilter { return true; }), - NONE((TNTRecord a, TNTRecord b) -> { + NONE((TraceRecord a, TraceRecord b) -> { return null; }); @@ -59,7 +59,7 @@ public enum BundleFilter { * {@code false}: No bundling allowed * {@code true}: Bundling should be applied */ - public final BiFunction function; + public final BiFunction function; private static final double pixelSize = 0.0625; private static final double pixelSizeSquared = pixelSize * pixelSize; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java index 06a69764..ec9d0126 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java @@ -20,7 +20,7 @@ package de.steamwar.bausystem.features.tracer.rendering; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.features.tracer.TNTRecord; +import de.steamwar.bausystem.features.tracer.TraceRecord; import de.steamwar.entity.REntityServer; import de.steamwar.entity.RFallingBlockEntity; import lombok.Getter; @@ -36,16 +36,16 @@ public class TraceEntity extends RFallingBlockEntity { * The records represented by this REntity */ @Getter - private final List records; + private final List records; - public TraceEntity(REntityServer server, Location location, boolean isExplosion, List records) { + public TraceEntity(REntityServer server, Location location, boolean isExplosion, List records) { super(server, location, isExplosion ? Material.RED_STAINED_GLASS : Material.TNT); setNoGravity(true); this.records = records; } public void printIntoChat(Player player) { - TNTRecord representative = records.get(0); + TraceRecord representative = records.get(0); BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_HEADER", player); BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_FUSE_TIME", player, representative.getFuse()); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java index a42dcb7a..952907cb 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java @@ -19,7 +19,7 @@ package de.steamwar.bausystem.features.tracer.rendering; -import de.steamwar.bausystem.features.tracer.TNTRecord; +import de.steamwar.bausystem.features.tracer.TraceRecord; import de.steamwar.entity.REntityServer; import de.steamwar.entity.RFallingBlockEntity; import org.bukkit.Location; @@ -45,16 +45,16 @@ public abstract class ViewFlag { public static ViewFlag EXPLOSION = new ViewFlag(true, false, "explosion", "e") { @Override - public List filter(List records) { + public List filter(List records) { return records.stream() - .filter(TNTRecord::isExplosion) + .filter(TraceRecord::isExplosion) .collect(Collectors.toList()); } }; public static ViewFlag IGNITE = new ViewFlag(true, true, "ignite", "i") { @Override - public List filter(List records) { + public List filter(List records) { return records.stream() .filter(record -> !record.isAfterFirstExplosion()) .collect(Collectors.toList()); @@ -63,7 +63,7 @@ public abstract class ViewFlag { public static ViewFlag SOURCE = new ViewFlag(true, false, IGNITE, "source", "s") { @Override - public List filter(List records) { + public List filter(List records) { return records.stream() .filter(record -> record.getFuse() == 80) .collect(Collectors.toList()); @@ -72,7 +72,7 @@ public abstract class ViewFlag { public static ViewFlag BUILD_DESTROY_ONLY = new ViewFlag(true, false, "build-destroy-only") { @Override - public List filter(List records) { + public List filter(List records) { return records.stream() .filter(record -> record.getHistory().get(record.getHistory().size() - 1).isDestroyedBuildArea()) .collect(Collectors.toList()); @@ -81,7 +81,7 @@ public abstract class ViewFlag { public static ViewFlag TESTBLOCK_DESTROY_ONLY = new ViewFlag(true, false, "testblock-destroy-only") { @Override - public List filter(List records) { + public List filter(List records) { return records.stream() .filter(record -> record.getHistory().get(record.getHistory().size() - 1).isDestroyedTestBlock()) .collect(Collectors.toList()); @@ -90,15 +90,15 @@ public abstract class ViewFlag { public static ViewFlag MICROMOTION = new ViewFlag(true, false, "micromotion", "m") { @Override - public List filter(List records) { + public List filter(List records) { Set seen = new HashSet<>(); - Set toRemove = new HashSet<>(); + Set toRemove = new HashSet<>(); - for (TNTRecord uniqueRecord : records) { + for (TraceRecord uniqueRecord : records) { if (seen.contains(uniqueRecord.getTntId())) continue; boolean hasMicromotion = false; - for (TNTRecord record : uniqueRecord.getHistory()) { + for (TraceRecord record : uniqueRecord.getHistory()) { Vector velocity = record.getVelocity(); if (velocity.getY() == 0 && (Math.abs(velocity.getX()) < 0.001 || Math.abs(velocity.getZ()) < 0.001)) { hasMicromotion = true; @@ -112,7 +112,7 @@ public abstract class ViewFlag { seen.add(uniqueRecord.getTntId()); } - for (TNTRecord record : toRemove) { + for (TraceRecord record : toRemove) { records.removeAll(record.getHistory()); } @@ -124,9 +124,9 @@ public abstract class ViewFlag { @Override public void modify(REntityServer server, List entities) { for (TraceEntity entity : entities) { - TNTRecord current = entity.getRecords().get(0); + TraceRecord current = entity.getRecords().get(0); if (current.isExplosion()) continue; - TNTRecord next = current.getNext().orElse(null); + TraceRecord next = current.getNext().orElse(null); if (next == null) continue; Location pos = current.getLocation().clone(); @@ -214,7 +214,7 @@ public abstract class ViewFlag { * @param records Records to be filtered * @return Filtered records */ - public List filter(List records) { + public List filter(List records) { return records; } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/AtFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/AtFlag.java index b8c31f36..30e51c95 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/AtFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/AtFlag.java @@ -19,7 +19,7 @@ package de.steamwar.bausystem.features.tracer.rendering.dynamicflags; -import de.steamwar.bausystem.features.tracer.TNTRecord; +import de.steamwar.bausystem.features.tracer.TraceRecord; import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; import java.util.List; @@ -47,7 +47,7 @@ public class AtFlag extends ViewFlag { } @Override - public List filter(List records) { + public List filter(List records) { return records.stream() .filter(record -> record.getTicksSinceStart() >= start && record.getTicksSinceStart() <= end) .collect(Collectors.toList()); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/IsolateFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/IsolateFlag.java index 4b008fb0..e77b9f99 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/IsolateFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/IsolateFlag.java @@ -19,7 +19,7 @@ package de.steamwar.bausystem.features.tracer.rendering.dynamicflags; -import de.steamwar.bausystem.features.tracer.TNTRecord; +import de.steamwar.bausystem.features.tracer.TraceRecord; import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; import java.util.HashSet; @@ -50,7 +50,7 @@ public class IsolateFlag extends ViewFlag { } @Override - public List filter(List records) { + public List filter(List records) { return records.stream() .filter(record -> tntToIsolate.contains(record.getTntId())) .collect(Collectors.toList()); -- 2.39.5 From 80967ab4e74b0756b359d41d7cc06a5257adab8b Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Tue, 9 Apr 2024 23:10:49 +0200 Subject: [PATCH 072/111] Add date to Trace Signed-off-by: D4rkr34lm --- .../src/de/steamwar/bausystem/features/tracer/Trace.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index f6be4639..edd26dd3 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -46,6 +46,12 @@ public class Trace { // TODO: Add UUID for file saving and so on! @Getter private final long startTime = TPSUtils.currentTick.get(); + /** + * + */ + @Getter + private final Date date = new Date(); + /** * Records of TNTs, making up the trace */ -- 2.39.5 From 43a04a68bf7bb1a860fd232eb8073030a6a4b4da Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Thu, 11 Apr 2024 17:49:23 +0200 Subject: [PATCH 073/111] Renamed TNTRecord sec Signed-off-by: D4rkr34lm --- .../laufbau/states/ProcessingTracesState.java | 14 ++++---- .../{TraceRecord.java => TNTPoint.java} | 14 ++++---- .../bausystem/features/tracer/Trace.java | 34 +++++++++---------- .../features/tracer/TraceCommand.java | 8 ++--- .../features/tracer/TraceManager.java | 8 ++--- .../features/tracer/TraceRecorder.java | 14 ++++---- .../tracer/rendering/BundleFilter.java | 12 +++---- .../tracer/rendering/TraceEntity.java | 8 ++--- .../features/tracer/rendering/ViewFlag.java | 30 ++++++++-------- .../tracer/rendering/dynamicflags/AtFlag.java | 4 +-- .../rendering/dynamicflags/IsolateFlag.java | 4 +-- 11 files changed, 75 insertions(+), 75 deletions(-) rename BauSystem_Main/src/de/steamwar/bausystem/features/tracer/{TraceRecord.java => TNTPoint.java} (90%) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java index ffc4e06d..72f88e5b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java @@ -23,7 +23,7 @@ import com.sk89q.worldedit.EditSession; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox; import de.steamwar.bausystem.features.slaves.laufbau.Cuboid; -import de.steamwar.bausystem.features.tracer.TraceRecord; +import de.steamwar.bausystem.features.tracer.TNTPoint; import de.steamwar.bausystem.features.tracer.TraceRecorder; import de.steamwar.bausystem.region.Point; import de.steamwar.bausystem.utils.FlatteningWrapper; @@ -45,7 +45,7 @@ public class ProcessingTracesState implements LaufbauState { private final List elements; private final int factor; - private final List traceRecords; + private final List TNTPoints; private final int totalTntRecords; private final Set affectedBlocks = new HashSet<>(); @@ -59,17 +59,17 @@ public class ProcessingTracesState implements LaufbauState { this.factor = factor; // TODO: Optimize only retrieving traces inside of the affected regions! - traceRecords = TraceRecorder.instance.manager.getAll() + TNTPoints = TraceRecorder.instance.manager.getAll() .stream() .flatMap(trace -> trace.getHistories().stream()) .flatMap(Collection::stream) .collect(Collectors.toList()); - totalTntRecords = traceRecords.size(); + totalTntRecords = TNTPoints.size(); } @Override public String actionBarMessage(Player p) { - return BauSystem.MESSAGE.parse("LAUFBAU_SIMPLE_PROGRESS", p, BauSystem.MESSAGE.parse("LAUFBAU_STATE_PROCESSING_TRACES", p), totalTntRecords - traceRecords.size(), totalTntRecords, eta(p, start, totalTntRecords - traceRecords.size(), totalTntRecords)); + return BauSystem.MESSAGE.parse("LAUFBAU_SIMPLE_PROGRESS", p, BauSystem.MESSAGE.parse("LAUFBAU_STATE_PROCESSING_TRACES", p), totalTntRecords - TNTPoints.size(), totalTntRecords, eta(p, start, totalTntRecords - TNTPoints.size(), totalTntRecords)); } private boolean inRegion(Vector location, int expansion) { @@ -78,12 +78,12 @@ public class ProcessingTracesState implements LaufbauState { @Override public boolean hasNext() { - return !traceRecords.isEmpty(); + return !TNTPoints.isEmpty(); } @Override public void next() { - TraceRecord current = traceRecords.remove(0); + TNTPoint current = TNTPoints.remove(0); if (FlatteningWrapper.impl.inWater(world, current.getLocation().toVector())) return; if (!(inRegion(current.getLocation().toVector(), 1) || (current.getPrevious().isPresent() && inRegion(current.getPrevious().get().getLocation().toVector(), 1)))) return; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecord.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPoint.java similarity index 90% rename from BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecord.java rename to BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPoint.java index fea06ed3..75f1b274 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecord.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPoint.java @@ -32,7 +32,7 @@ import java.util.List; import java.util.Optional; @Getter -public class TraceRecord { +public class TNTPoint { /** * Unique number to identify records being of the same tnt @@ -87,9 +87,9 @@ public class TraceRecord { /** * List of all tnt records, that are represent the same tnt */ - private final List history; + private final List history; - public TraceRecord(int tntId, TNTPrimed tnt, boolean explosion, boolean afterFirstExplosion, long ticksSinceStart, List history, List destroyedBlocks) { + public TNTPoint(int tntId, TNTPrimed tnt, boolean explosion, boolean afterFirstExplosion, long ticksSinceStart, List history, List destroyedBlocks) { this.tntId = tntId; this.explosion = explosion; this.inWater = tnt.isInWater(); @@ -115,12 +115,12 @@ public class TraceRecord { destroyedTestBlock = testblockDestroy; } - public Optional getNext() { + public Optional getNext() { int index = history.indexOf(this); return index == history.size() - 1 ? Optional.empty() : Optional.of(history.get(index + 1)); } - public Optional getPrevious() { + public Optional getPrevious() { int index = history.indexOf(this); return index == 0 ? Optional.empty() : Optional.of(history.get(index - 1)); } @@ -138,8 +138,8 @@ public class TraceRecord { @Override public boolean equals(Object obj) { - if (!(obj instanceof TraceRecord)) return false; - TraceRecord record = (TraceRecord) obj; + if (!(obj instanceof TNTPoint)) return false; + TNTPoint record = (TNTPoint) obj; if (record.isExplosion() != explosion) return false; if (!record.getLocation().equals(location)) return false; if (!record.getVelocity().equals(velocity)) return false; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index edd26dd3..84d58fac 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -56,7 +56,7 @@ public class Trace { // TODO: Add UUID for file saving and so on! * Records of TNTs, making up the trace */ @Getter - private List records = new ArrayList<>(); + private List records = new ArrayList<>(); /** * ID that should be assigned to the next record of a unique tnt @@ -72,7 +72,7 @@ public class Trace { // TODO: Add UUID for file saving and so on! public List getUsedIds() { return getRecords() .stream() - .map(TraceRecord::getTntId) + .map(TNTPoint::getTntId) .map(i -> i + "") .collect(Collectors.toList()); } @@ -93,7 +93,7 @@ public class Trace { // TODO: Add UUID for file saving and so on! /** * Adds the given records and updates potential trace renderings */ - protected void addAll(List records, Function getter) { + protected void addAll(List records, Function getter) { this.records.addAll(records); Iterator keySetIterator = entityServerMap.keySet().iterator(); while (keySetIterator.hasNext()) { @@ -112,7 +112,7 @@ public class Trace { // TODO: Add UUID for file saving and so on! * * @param records immutable records list */ - protected void setRecords(List records) { + protected void setRecords(List records) { this.records = records; } @@ -121,10 +121,10 @@ public class Trace { // TODO: Add UUID for file saving and so on! * * @return the historys of this trace */ - public Set> getHistories() { - Set> histories = new HashSet<>(); + public Set> getHistories() { + Set> histories = new HashSet<>(); - for (TraceRecord record : getRecords()) { + for (TNTPoint record : getRecords()) { histories.add(record.getHistory()); } @@ -155,10 +155,10 @@ public class Trace { // TODO: Add UUID for file saving and so on! * @param records Records to render * @param playerTraceShowData The showData for modifying the rendering */ - private void render(List records, REntityServer entityServer, PlayerTraceShowData playerTraceShowData) { + private void render(List records, REntityServer entityServer, PlayerTraceShowData playerTraceShowData) { if (records.isEmpty()) return; - List workingRecords = records; + List workingRecords = records; Set flagList = playerTraceShowData.getEffectiveViewFlags(); //Apply filters @@ -167,12 +167,12 @@ public class Trace { // TODO: Add UUID for file saving and so on! } //Bundle records at unique positions - List> bundles = bundleRecords(workingRecords, playerTraceShowData.getBundleFilter()); + List> bundles = bundleRecords(workingRecords, playerTraceShowData.getBundleFilter()); //Render bundled records List entities = new LinkedList<>(); - for (List bundle : bundles) { + for (List bundle : bundles) { entities.add(new TraceEntity(entityServer, bundle.get(0).getLocation(), bundle.get(0).isExplosion(), bundle)); } @@ -196,23 +196,23 @@ public class Trace { // TODO: Add UUID for file saving and so on! * @param records The TNTRecords that are supposed to be bundled * @return A list of bundles */ - private List> bundleRecords(List records, BundleFilter filter) { - List> bundles = new ArrayList<>(); + private List> bundleRecords(List records, BundleFilter filter) { + List> bundles = new ArrayList<>(); recordsLoop: - for (TraceRecord record : records) { + for (TNTPoint record : records) { if (bundles.isEmpty()) { - List firstBundle = new ArrayList<>(); + List firstBundle = new ArrayList<>(); firstBundle.add(record); bundles.add(firstBundle); } for (int i = bundles.size() - 1; i >= 0; i--) { - List bundle = bundles.get(i); + List bundle = bundles.get(i); Boolean filterResult = filter.function.apply(record, bundle.get(0)); if (filterResult == null || !filterResult) { - ArrayList newBundle = new ArrayList<>(); + ArrayList newBundle = new ArrayList<>(); newBundle.add(record); bundles.add(newBundle); continue recordsLoop; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index 393dd0ec..bfeb1a79 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -143,7 +143,7 @@ public class TraceCommand extends SWCommand { } @Register(value = "isolate", description = "TRACE_COMMAND_HELP_ISOLATE") - public void isolate(@Validator Player player, Trace trace, @ErrorMessage("TRACE_RECORD_ID_INVALID") TraceRecord... records) { + public void isolate(@Validator Player player, Trace trace, @ErrorMessage("TRACE_RECORD_ID_INVALID") TNTPoint... records) { manager.isolate(player, records); // TODO: Add Message! } @@ -186,11 +186,11 @@ public class TraceCommand extends SWCommand { }; } - @ClassMapper(value = TraceRecord.class, local = true) - public TypeMapper recordMapper() { + @ClassMapper(value = TNTPoint.class, local = true) + public TypeMapper recordMapper() { return new TypeMapper<>() { @Override - public TraceRecord map(CommandSender commandSender, PreviousArguments previousArguments, String s) { + public TNTPoint map(CommandSender commandSender, PreviousArguments previousArguments, String s) { Trace trace = previousArguments.getFirst(Trace.class).orElse(null); if (trace == null) return null; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index 508d8f20..e275b0ce 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -61,8 +61,8 @@ public class TraceManager implements Listener { return nextOpenId; } - protected void addAll(Trace trace, List traceRecords) { - trace.addAll(traceRecords, player -> { + protected void addAll(Trace trace, List TNTPoints) { + trace.addAll(TNTPoints, player -> { return showDataPerRegionPerPlayer.getOrDefault(trace.getRegion(), Collections.emptyMap()).get(player); }); } @@ -195,7 +195,7 @@ public class TraceManager implements Listener { * @param player the player the trace is shown to * @param records the record for which isolation is toggled */ - public void isolate(Player player, TraceRecord... records) { + public void isolate(Player player, TNTPoint... records) { Region region = Region.getRegion(player.getLocation()); PlayerTraceShowData playerTraceShowData = showDataPerRegionPerPlayer.computeIfAbsent(region, ignored -> new HashMap<>()).computeIfAbsent(player, ignored -> new PlayerTraceShowData(BundleFilter.STRICT)); @@ -212,7 +212,7 @@ public class TraceManager implements Listener { showDataPerRegionPerPlayer.get(region).put(player, playerTraceShowData); } - for (TraceRecord record : records) { + for (TNTPoint record : records) { isolateFlag.toggleId(record.getTntId()); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java index 15b31af0..ebe839ff 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java @@ -72,12 +72,12 @@ public class TraceRecorder implements Listener { /** * A map for records that have been taken in the same tick and now have to be added to the traces */ - private final Map> recordsToAddMap = new HashMap<>(); + private final Map> recordsToAddMap = new HashMap<>(); /** * Maps a tracked tnt entity to its entire recording history */ - private final Map> historyMap = new HashMap<>(); + private final Map> historyMap = new HashMap<>(); /** * Regions where auto-trace is enabled @@ -160,9 +160,9 @@ public class TraceRecorder implements Listener { record(tnt, trace, Collections.emptyList()); } - List traceRecords = recordsToAddMap.get(trace); - manager.addAll(trace, traceRecords); - traceRecords.clear(); + List TNTPoints = recordsToAddMap.get(trace); + manager.addAll(trace, TNTPoints); + TNTPoints.clear(); } } @@ -173,7 +173,7 @@ public class TraceRecorder implements Listener { * @param trace trace to record the tnt for */ private void record(TNTPrimed tntPrimed, Trace trace, List destroyedBlocks) { - List history = historyMap.getOrDefault(tntPrimed, new ArrayList<>()); + List history = historyMap.getOrDefault(tntPrimed, new ArrayList<>()); int tntID; if (history.size() == 0) { @@ -189,7 +189,7 @@ public class TraceRecorder implements Listener { } boolean afterFirstExplosion = noExplosionRecorded.contains(trace); - TraceRecord record = new TraceRecord(tntID, tntPrimed, isExplosion, afterFirstExplosion, TPSUtils.currentTick.get() - trace.getStartTime(), history, destroyedBlocks); + TNTPoint record = new TNTPoint(tntID, tntPrimed, isExplosion, afterFirstExplosion, TPSUtils.currentTick.get() - trace.getStartTime(), history, destroyedBlocks); history.add(record); recordsToAddMap.get(trace).add(record); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java index 12aa69ea..85c2b3ef 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java @@ -19,7 +19,7 @@ package de.steamwar.bausystem.features.tracer.rendering; -import de.steamwar.bausystem.features.tracer.TraceRecord; +import de.steamwar.bausystem.features.tracer.TNTPoint; import lombok.RequiredArgsConstructor; import java.util.function.BiFunction; @@ -27,14 +27,14 @@ import java.util.function.BiFunction; @RequiredArgsConstructor public enum BundleFilter { - LOOSE((TraceRecord a, TraceRecord b) -> { + LOOSE((TNTPoint a, TNTPoint b) -> { if (a.isExplosion() != b.isExplosion()) return false; if (a.getLocation().distanceSquared(b.getLocation()) <= BundleFilter.pixelSizeSquared) return false; if (a.getVelocity().distanceSquared(b.getVelocity()) <= BundleFilter.pixelSizeSquared) return false; return true; }), - DEFAULT((TraceRecord a, TraceRecord b) -> { + DEFAULT((TNTPoint a, TNTPoint b) -> { if (a.isExplosion() != b.isExplosion()) return false; if (a.getTicksSinceStart() != b.getTicksSinceStart()) return null; if (a.getLocation().distanceSquared(b.getLocation()) <= BundleFilter.pixelSizeSquared) return false; @@ -42,7 +42,7 @@ public enum BundleFilter { return true; }), - STRICT((TraceRecord a, TraceRecord b) -> { + STRICT((TNTPoint a, TNTPoint b) -> { if (a.isExplosion() != b.isExplosion()) return false; if (!a.getLocation().equals(b.getLocation())) return false; if (!a.getVelocity().equals(b.getVelocity())) return false; @@ -50,7 +50,7 @@ public enum BundleFilter { return true; }), - NONE((TraceRecord a, TraceRecord b) -> { + NONE((TNTPoint a, TNTPoint b) -> { return null; }); @@ -59,7 +59,7 @@ public enum BundleFilter { * {@code false}: No bundling allowed * {@code true}: Bundling should be applied */ - public final BiFunction function; + public final BiFunction function; private static final double pixelSize = 0.0625; private static final double pixelSizeSquared = pixelSize * pixelSize; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java index ec9d0126..946152c3 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java @@ -20,7 +20,7 @@ package de.steamwar.bausystem.features.tracer.rendering; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.features.tracer.TraceRecord; +import de.steamwar.bausystem.features.tracer.TNTPoint; import de.steamwar.entity.REntityServer; import de.steamwar.entity.RFallingBlockEntity; import lombok.Getter; @@ -36,16 +36,16 @@ public class TraceEntity extends RFallingBlockEntity { * The records represented by this REntity */ @Getter - private final List records; + private final List records; - public TraceEntity(REntityServer server, Location location, boolean isExplosion, List records) { + public TraceEntity(REntityServer server, Location location, boolean isExplosion, List records) { super(server, location, isExplosion ? Material.RED_STAINED_GLASS : Material.TNT); setNoGravity(true); this.records = records; } public void printIntoChat(Player player) { - TraceRecord representative = records.get(0); + TNTPoint representative = records.get(0); BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_HEADER", player); BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_FUSE_TIME", player, representative.getFuse()); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java index 952907cb..a47d349d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java @@ -19,7 +19,7 @@ package de.steamwar.bausystem.features.tracer.rendering; -import de.steamwar.bausystem.features.tracer.TraceRecord; +import de.steamwar.bausystem.features.tracer.TNTPoint; import de.steamwar.entity.REntityServer; import de.steamwar.entity.RFallingBlockEntity; import org.bukkit.Location; @@ -45,16 +45,16 @@ public abstract class ViewFlag { public static ViewFlag EXPLOSION = new ViewFlag(true, false, "explosion", "e") { @Override - public List filter(List records) { + public List filter(List records) { return records.stream() - .filter(TraceRecord::isExplosion) + .filter(TNTPoint::isExplosion) .collect(Collectors.toList()); } }; public static ViewFlag IGNITE = new ViewFlag(true, true, "ignite", "i") { @Override - public List filter(List records) { + public List filter(List records) { return records.stream() .filter(record -> !record.isAfterFirstExplosion()) .collect(Collectors.toList()); @@ -63,7 +63,7 @@ public abstract class ViewFlag { public static ViewFlag SOURCE = new ViewFlag(true, false, IGNITE, "source", "s") { @Override - public List filter(List records) { + public List filter(List records) { return records.stream() .filter(record -> record.getFuse() == 80) .collect(Collectors.toList()); @@ -72,7 +72,7 @@ public abstract class ViewFlag { public static ViewFlag BUILD_DESTROY_ONLY = new ViewFlag(true, false, "build-destroy-only") { @Override - public List filter(List records) { + public List filter(List records) { return records.stream() .filter(record -> record.getHistory().get(record.getHistory().size() - 1).isDestroyedBuildArea()) .collect(Collectors.toList()); @@ -81,7 +81,7 @@ public abstract class ViewFlag { public static ViewFlag TESTBLOCK_DESTROY_ONLY = new ViewFlag(true, false, "testblock-destroy-only") { @Override - public List filter(List records) { + public List filter(List records) { return records.stream() .filter(record -> record.getHistory().get(record.getHistory().size() - 1).isDestroyedTestBlock()) .collect(Collectors.toList()); @@ -90,15 +90,15 @@ public abstract class ViewFlag { public static ViewFlag MICROMOTION = new ViewFlag(true, false, "micromotion", "m") { @Override - public List filter(List records) { + public List filter(List records) { Set seen = new HashSet<>(); - Set toRemove = new HashSet<>(); + Set toRemove = new HashSet<>(); - for (TraceRecord uniqueRecord : records) { + for (TNTPoint uniqueRecord : records) { if (seen.contains(uniqueRecord.getTntId())) continue; boolean hasMicromotion = false; - for (TraceRecord record : uniqueRecord.getHistory()) { + for (TNTPoint record : uniqueRecord.getHistory()) { Vector velocity = record.getVelocity(); if (velocity.getY() == 0 && (Math.abs(velocity.getX()) < 0.001 || Math.abs(velocity.getZ()) < 0.001)) { hasMicromotion = true; @@ -112,7 +112,7 @@ public abstract class ViewFlag { seen.add(uniqueRecord.getTntId()); } - for (TraceRecord record : toRemove) { + for (TNTPoint record : toRemove) { records.removeAll(record.getHistory()); } @@ -124,9 +124,9 @@ public abstract class ViewFlag { @Override public void modify(REntityServer server, List entities) { for (TraceEntity entity : entities) { - TraceRecord current = entity.getRecords().get(0); + TNTPoint current = entity.getRecords().get(0); if (current.isExplosion()) continue; - TraceRecord next = current.getNext().orElse(null); + TNTPoint next = current.getNext().orElse(null); if (next == null) continue; Location pos = current.getLocation().clone(); @@ -214,7 +214,7 @@ public abstract class ViewFlag { * @param records Records to be filtered * @return Filtered records */ - public List filter(List records) { + public List filter(List records) { return records; } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/AtFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/AtFlag.java index 30e51c95..d57c36e0 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/AtFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/AtFlag.java @@ -19,7 +19,7 @@ package de.steamwar.bausystem.features.tracer.rendering.dynamicflags; -import de.steamwar.bausystem.features.tracer.TraceRecord; +import de.steamwar.bausystem.features.tracer.TNTPoint; import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; import java.util.List; @@ -47,7 +47,7 @@ public class AtFlag extends ViewFlag { } @Override - public List filter(List records) { + public List filter(List records) { return records.stream() .filter(record -> record.getTicksSinceStart() >= start && record.getTicksSinceStart() <= end) .collect(Collectors.toList()); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/IsolateFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/IsolateFlag.java index e77b9f99..9fafd7a7 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/IsolateFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/IsolateFlag.java @@ -19,7 +19,7 @@ package de.steamwar.bausystem.features.tracer.rendering.dynamicflags; -import de.steamwar.bausystem.features.tracer.TraceRecord; +import de.steamwar.bausystem.features.tracer.TNTPoint; import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; import java.util.HashSet; @@ -50,7 +50,7 @@ public class IsolateFlag extends ViewFlag { } @Override - public List filter(List records) { + public List filter(List records) { return records.stream() .filter(record -> tntToIsolate.contains(record.getTntId())) .collect(Collectors.toList()); -- 2.39.5 From 597c968463ed388acf0ca946b59705efa635f33b Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 12 Apr 2024 16:18:30 +0200 Subject: [PATCH 074/111] Update tracer --- .../bausystem/features/tracer/Trace.java | 23 +----- .../features/tracer/TraceCommand.java | 14 ++-- .../features/tracer/TraceManager.java | 81 ++++++++++++++++++- 3 files changed, 88 insertions(+), 30 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index 84d58fac..0e7033aa 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -34,6 +34,7 @@ import java.util.function.Function; import java.util.stream.Collectors; public class Trace { // TODO: Add UUID for file saving and so on! + /** * Region this trace has been recorded in */ @@ -225,25 +226,6 @@ public class Trace { // TODO: Add UUID for file saving and so on! return bundles; } - /** - * Makes the first passed player follow the trace render of the second passed player - * - * @param player - * @param toFollow - */ - public void follow(Player player, Player toFollow) { - throw new UnsupportedOperationException(); - } - - /** - * Makes the passed player stop following any other players trace render - * - * @param player - */ - public void unfollow(Player player) { - throw new UnsupportedOperationException(); - } - /** * Hides this trail for the given player * @@ -252,8 +234,7 @@ public class Trace { // TODO: Add UUID for file saving and so on! public void hide(Player player) { REntityServer entityServer = entityServerMap.remove(player); if (entityServer == null) return; - entityServer.removePlayer(player); - if (entityServer.getPlayers().isEmpty()) entityServer.close(); + entityServer.close(); } @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index bfeb1a79..fba84cc0 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -155,18 +155,18 @@ public class TraceCommand extends SWCommand { @Register(value = "follow", description = "TRACE_COMMAND_HELP_SHOW") public void follow(@Validator Player player, Player toFollow) { - // TODO: Implement - for (Trace trace : manager.getAll()) { - trace.follow(player, toFollow); + if (player == toFollow) { + // TODO: Implement message + return; } + manager.follow(player, toFollow); + // TODO: Implement message } @Register(value = "unfollow", description = "TRACE_COMMAND_HELP_SHOW") public void unfollow(@Validator Player player) { - // TODO: Implement - for (Trace trace : manager.getAll()) { - trace.unfollow(player); - } + manager.unfollow(player); + // TODO: Implement message } @ClassMapper(value = Trace.class, local = true) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index e275b0ce..ac36428e 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -40,6 +40,8 @@ public class TraceManager implements Listener { private final Map> showDataPerRegionPerPlayer = new HashMap<>(); + private final Map> followerMap = new HashMap<>(); + /** * Utility variable to keep track of the next open trace id; */ @@ -54,6 +56,9 @@ public class TraceManager implements Listener { protected int add(Trace trace) { showDataPerRegionPerPlayer.getOrDefault(trace.getRegion(), Collections.emptyMap()).forEach((player, playerTraceShowData) -> { trace.render(player, playerTraceShowData); + followerMap.getOrDefault(player, Collections.emptySet()).forEach(follower -> { + trace.render(follower, playerTraceShowData); + }); }); traces.put(nextOpenId, trace); tracesByRegion.computeIfAbsent(trace.getRegion(), region -> new HashMap<>()).put(nextOpenId, trace); @@ -63,7 +68,16 @@ public class TraceManager implements Listener { protected void addAll(Trace trace, List TNTPoints) { trace.addAll(TNTPoints, player -> { - return showDataPerRegionPerPlayer.getOrDefault(trace.getRegion(), Collections.emptyMap()).get(player); + Map.Entry> entry = followerMap.entrySet() + .stream() + .filter(playerSetEntry -> playerSetEntry.getValue().contains(player)) + .findFirst() + .orElse(null); + if (entry == null) { + return showDataPerRegionPerPlayer.getOrDefault(trace.getRegion(), Collections.emptyMap()).get(player); + } else { + return showDataPerRegionPerPlayer.getOrDefault(trace.getRegion(), Collections.emptyMap()).get(entry.getKey()); + } }); } @@ -78,6 +92,7 @@ public class TraceManager implements Listener { Trace trace = traces.remove(id); showDataPerRegionPerPlayer.get(trace.getRegion()).forEach((player, playerTraceShowData) -> { trace.hide(player); + followerMap.getOrDefault(player, Collections.emptySet()).forEach(trace::hide); }); tracesByRegion.get(trace.getRegion()).remove(id); return true; @@ -92,8 +107,10 @@ public class TraceManager implements Listener { .flatMap(map -> map.entrySet().stream()) .map(Map.Entry::getKey) .forEach(player -> { + Set players = followerMap.getOrDefault(player, Collections.emptySet()); traces.values().forEach(trace -> { trace.hide(player); + players.forEach(trace::hide); }); }); traces.clear(); @@ -144,10 +161,15 @@ public class TraceManager implements Listener { * @param playerTraceShowData */ public void show(Player player, PlayerTraceShowData playerTraceShowData) { + unfollow(player); + Region region = Region.getRegion(player.getLocation()); showDataPerRegionPerPlayer.computeIfAbsent(region, ignored -> new HashMap<>()).put(player, playerTraceShowData); tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> { trace.render(player, playerTraceShowData); + followerMap.getOrDefault(player, Collections.emptySet()).forEach(follower -> { + trace.render(follower, playerTraceShowData); + }); }); } @@ -157,11 +179,56 @@ public class TraceManager implements Listener { * @param player */ public void hide(Player player) { + unfollow(player); + Region region = Region.getRegion(player.getLocation()); PlayerTraceShowData previous = showDataPerRegionPerPlayer.getOrDefault(region, Collections.emptyMap()).remove(player); if (previous == null) return; - tracesByRegion.getOrDefault(player, Collections.emptyMap()).forEach((integer, trace) -> { + tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> { trace.hide(player); + followerMap.getOrDefault(player, Collections.emptySet()).forEach(trace::hide); + }); + } + + public boolean hasFollower(Player player) { + return followerMap.containsKey(player); + } + + public boolean follow(Player follower, Player following) { + if (followerMap.containsKey(follower)) return false; + followerMap.computeIfAbsent(following, ignored -> new HashSet<>()).add(follower); + + showDataPerRegionPerPlayer.forEach((region, playerPlayerTraceShowDataMap) -> { + if (playerPlayerTraceShowDataMap.containsKey(follower)) { + tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> { + trace.hide(follower); + }); + } + + PlayerTraceShowData playerTraceShowData = playerPlayerTraceShowDataMap.get(following); + if (playerTraceShowData == null) return; + tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> { + trace.render(follower, playerTraceShowData); + }); + }); + return true; + } + + public void unfollow(Player follower) { + if (followerMap.containsKey(follower)) return; + List toRemove = new ArrayList<>(); + followerMap.forEach((player, players) -> { + players.remove(player); + if (players.isEmpty()) toRemove.add(player); + }); + toRemove.forEach(followerMap::remove); + + showDataPerRegionPerPlayer.forEach((region, playerPlayerTraceShowDataMap) -> { + PlayerTraceShowData playerTraceShowData = playerPlayerTraceShowDataMap.get(follower); + if (playerTraceShowData == null) return; + tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> { + trace.render(follower, playerTraceShowData); + }); }); } @@ -173,6 +240,8 @@ public class TraceManager implements Listener { * @param to end of time interval */ public void renderAt(Player player, int from, int to) { + unfollow(player); + Region region = Region.getRegion(player.getLocation()); PlayerTraceShowData playerTraceShowData = showDataPerRegionPerPlayer.computeIfAbsent(region, ignored -> new HashMap<>()).computeIfAbsent(player, ignored -> new PlayerTraceShowData(BundleFilter.STRICT)); @@ -186,6 +255,9 @@ public class TraceManager implements Listener { tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> { trace.render(player, playerTraceShowData); + followerMap.getOrDefault(player, Collections.emptySet()).forEach(follower -> { + trace.render(follower, playerTraceShowData); + }); }); } @@ -196,6 +268,8 @@ public class TraceManager implements Listener { * @param records the record for which isolation is toggled */ public void isolate(Player player, TNTPoint... records) { + unfollow(player); + Region region = Region.getRegion(player.getLocation()); PlayerTraceShowData playerTraceShowData = showDataPerRegionPerPlayer.computeIfAbsent(region, ignored -> new HashMap<>()).computeIfAbsent(player, ignored -> new PlayerTraceShowData(BundleFilter.STRICT)); @@ -219,6 +293,9 @@ public class TraceManager implements Listener { PlayerTraceShowData finalPlayerTraceShowData = playerTraceShowData; tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> { trace.render(player, finalPlayerTraceShowData); + followerMap.getOrDefault(player, Collections.emptySet()).forEach(follower -> { + trace.render(follower, finalPlayerTraceShowData); + }); }); } } -- 2.39.5 From bcdad382c7a04c0e7e69e1634b31edab22c20bd4 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 12 Apr 2024 16:24:32 +0200 Subject: [PATCH 075/111] Update tracer --- .../features/tracer/TraceManager.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index ac36428e..8cca81b7 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -25,7 +25,9 @@ import de.steamwar.bausystem.features.tracer.rendering.dynamicflags.IsolateFlag; import de.steamwar.bausystem.region.Region; import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerQuitEvent; import java.util.*; @@ -190,10 +192,6 @@ public class TraceManager implements Listener { }); } - public boolean hasFollower(Player player) { - return followerMap.containsKey(player); - } - public boolean follow(Player follower, Player following) { if (followerMap.containsKey(follower)) return false; followerMap.computeIfAbsent(following, ignored -> new HashSet<>()).add(follower); @@ -298,4 +296,20 @@ public class TraceManager implements Listener { }); }); } + + @EventHandler + public void onPlayerQuit(PlayerQuitEvent event) { + unfollow(event.getPlayer()); + new ArrayList<>(followerMap.getOrDefault(event.getPlayer(), Collections.emptySet())).forEach(this::unfollow); + + showDataPerRegionPerPlayer.forEach((region, playerPlayerTraceShowDataMap) -> { + playerPlayerTraceShowDataMap.remove(event.getPlayer()); + }); + + tracesByRegion.forEach((region, integerTraceMap) -> { + integerTraceMap.forEach((integer, trace) -> { + trace.hide(event.getPlayer()); + }); + }); + } } -- 2.39.5 From 31e0a0172fb009851ee676daa4110df938b1bd9d Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 12 Apr 2024 17:13:27 +0200 Subject: [PATCH 076/111] Fix some stuff and make it more ugly --- .../steamwar/bausystem/features/tracer/Trace.java | 2 +- .../bausystem/features/tracer/TraceManager.java | 14 +++++++++++++- .../features/tracer/rendering/TraceEntity.java | 13 ++++++++++--- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index 0e7033aa..3e91061c 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -159,7 +159,7 @@ public class Trace { // TODO: Add UUID for file saving and so on! private void render(List records, REntityServer entityServer, PlayerTraceShowData playerTraceShowData) { if (records.isEmpty()) return; - List workingRecords = records; + List workingRecords = new ArrayList<>(records); Set flagList = playerTraceShowData.getEffectiveViewFlags(); //Apply filters diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index 8cca81b7..f476f3f9 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -194,6 +194,10 @@ public class TraceManager implements Listener { public boolean follow(Player follower, Player following) { if (followerMap.containsKey(follower)) return false; + if (followerMap.entrySet().stream().anyMatch(playerSetEntry -> playerSetEntry.getValue().contains(follower))) { + unfollow(follower); + } + followerMap.computeIfAbsent(following, ignored -> new HashSet<>()).add(follower); showDataPerRegionPerPlayer.forEach((region, playerPlayerTraceShowDataMap) -> { @@ -215,13 +219,21 @@ public class TraceManager implements Listener { public void unfollow(Player follower) { if (followerMap.containsKey(follower)) return; List toRemove = new ArrayList<>(); + Set toHide = new HashSet<>(); followerMap.forEach((player, players) -> { - players.remove(player); + if (players.remove(follower)) toHide.add(follower); if (players.isEmpty()) toRemove.add(player); }); toRemove.forEach(followerMap::remove); showDataPerRegionPerPlayer.forEach((region, playerPlayerTraceShowDataMap) -> { + toHide.forEach(player -> { + if (!playerPlayerTraceShowDataMap.containsKey(player)) return; + tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> { + trace.hide(follower); + }); + }); + PlayerTraceShowData playerTraceShowData = playerPlayerTraceShowDataMap.get(follower); if (playerTraceShowData == null) return; tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java index 946152c3..f88d0eab 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java @@ -19,18 +19,24 @@ package de.steamwar.bausystem.features.tracer.rendering; +import com.comphenix.tinyprotocol.Reflection; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.tracer.TNTPoint; +import de.steamwar.core.Core; +import de.steamwar.entity.REntity; import de.steamwar.entity.REntityServer; -import de.steamwar.entity.RFallingBlockEntity; +import de.steamwar.techhider.BlockIds; import lombok.Getter; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import java.util.List; -public class TraceEntity extends RFallingBlockEntity { +public class TraceEntity extends REntity { + + private static final Reflection.MethodInvoker addEntityMethod = Reflection.getMethod(REntityServer.class, "addEntity", REntity.class); /** * The records represented by this REntity @@ -39,9 +45,10 @@ public class TraceEntity extends RFallingBlockEntity { private final List records; public TraceEntity(REntityServer server, Location location, boolean isExplosion, List records) { - super(server, location, isExplosion ? Material.RED_STAINED_GLASS : Material.TNT); + super(server, EntityType.FALLING_BLOCK, location, BlockIds.impl.materialToId(isExplosion ? Material.RED_STAINED_GLASS : Material.TNT) >> (Core.getVersion() <= 12 ? 4 : 0)); setNoGravity(true); this.records = records; + addEntityMethod.invoke(server, this); } public void printIntoChat(Player player) { -- 2.39.5 From c4296a3781cc05bc96e33d7280a10199a9f48c1f Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 12 Apr 2024 17:18:39 +0200 Subject: [PATCH 077/111] Fix performance stuff --- .../src/de/steamwar/bausystem/features/tracer/Trace.java | 4 ++-- .../de/steamwar/bausystem/features/tracer/TraceCommand.java | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index 3e91061c..db82233b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -95,7 +95,7 @@ public class Trace { // TODO: Add UUID for file saving and so on! * Adds the given records and updates potential trace renderings */ protected void addAll(List records, Function getter) { - this.records.addAll(records); + this.getRecords().addAll(records); Iterator keySetIterator = entityServerMap.keySet().iterator(); while (keySetIterator.hasNext()) { Player player = keySetIterator.next(); @@ -104,7 +104,7 @@ public class Trace { // TODO: Add UUID for file saving and so on! keySetIterator.remove(); continue; } - render(getRecords(), entityServerMap.get(player), playerTraceShowData); + render(records, entityServerMap.get(player), playerTraceShowData); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index fba84cc0..fad14bdc 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -131,6 +131,7 @@ public class TraceCommand extends SWCommand { } @Register(value = "delete", description = "TRACE_COMMAND_HELP_DELETE") + @Register(value = "clear") public void delete(@Validator Player player) { manager.clear(); BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE", player); -- 2.39.5 From 39d2205b857608821f74d2e253a8bbd1acbfcc2d Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 12 Apr 2024 17:58:20 +0200 Subject: [PATCH 078/111] Fix TraceCommand.delete --- .../bausystem/features/tracer/Trace.java | 7 +++++++ .../features/tracer/TraceCommand.java | 2 +- .../features/tracer/TraceManager.java | 21 ++++++++++--------- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index db82233b..d39b872c 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -237,6 +237,13 @@ public class Trace { // TODO: Add UUID for file saving and so on! entityServer.close(); } + public void hide() { + entityServerMap.forEach((player, entityServer) -> { + entityServer.close(); + }); + entityServerMap.clear(); + } + @Override public String toString() { return "Trace{" + diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index fad14bdc..149ad5ef 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -139,7 +139,7 @@ public class TraceCommand extends SWCommand { @Register(value = "delete") public void delete(@Validator Player player, Trace trace) { - // TODO: Reimplement manager.remove(trace); + manager.remove(trace); BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE_SPECIFIC", player); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index f476f3f9..6d531ed8 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -86,17 +86,18 @@ public class TraceManager implements Listener { /** * Removes the trace with the given id * - * @param id id of the trace to be removed + * @param trace the trace to be removed */ - public boolean remove(int id) { - if (id >= nextOpenId) return false; - if (traces.get(id) == null) return false; - Trace trace = traces.remove(id); - showDataPerRegionPerPlayer.get(trace.getRegion()).forEach((player, playerTraceShowData) -> { - trace.hide(player); - followerMap.getOrDefault(player, Collections.emptySet()).forEach(trace::hide); - }); - tracesByRegion.get(trace.getRegion()).remove(id); + public boolean remove(Trace trace) { + Integer traceId = traces.entrySet().stream() + .filter(entry -> entry.getValue() == trace) + .map(Map.Entry::getKey) + .findFirst() + .orElse(null); + if (traceId == null) return false; + traces.remove(traceId); + tracesByRegion.getOrDefault(trace.getRegion(), Collections.emptyMap()).remove(traceId); + trace.hide(); return true; } -- 2.39.5 From d13c415565cadd3a714d30ec1f9cd5f673b39174 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Tue, 16 Apr 2024 22:35:07 +0200 Subject: [PATCH 079/111] Added savind and loading for traces --- .gitignore | 10 +- .../laufbau/states/ProcessingTracesState.java | 4 +- .../bausystem/features/tracer/TNTPoint.java | 98 ++++++-- .../bausystem/features/tracer/Trace.java | 230 ++++++++++++------ .../features/tracer/TraceCommand.java | 98 ++++---- .../features/tracer/TraceManager.java | 99 +++++--- .../features/tracer/TraceRecorder.java | 88 +++---- .../tracer/TraceRecordingWrapper.java | 102 ++++++++ .../{ => rendering}/PlayerTraceShowData.java | 10 +- 9 files changed, 503 insertions(+), 236 deletions(-) create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java rename BauSystem_Main/src/de/steamwar/bausystem/features/tracer/{ => rendering}/PlayerTraceShowData.java (90%) diff --git a/.gitignore b/.gitignore index 36e1257e..7f1c1b0e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ -# Package Files +# Build files *.jar +**/bin +**/build # Gradle .gradle @@ -10,6 +12,10 @@ steamwar.properties # IntelliJ IDEA .idea *.iml +plugin.yml # Other -lib \ No newline at end of file +lib + +#linkage +LinkageUtils.java \ No newline at end of file diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java index 72f88e5b..cec4c2cb 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java @@ -24,7 +24,7 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox; import de.steamwar.bausystem.features.slaves.laufbau.Cuboid; import de.steamwar.bausystem.features.tracer.TNTPoint; -import de.steamwar.bausystem.features.tracer.TraceRecorder; +import de.steamwar.bausystem.features.tracer.TraceManager; import de.steamwar.bausystem.region.Point; import de.steamwar.bausystem.utils.FlatteningWrapper; import org.bukkit.Location; @@ -59,7 +59,7 @@ public class ProcessingTracesState implements LaufbauState { this.factor = factor; // TODO: Optimize only retrieving traces inside of the affected regions! - TNTPoints = TraceRecorder.instance.manager.getAll() + TNTPoints = TraceManager.instance.getAll() .stream() .flatMap(trace -> trace.getHistories().stream()) .flatMap(Collection::stream) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPoint.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPoint.java index 75f1b274..eeb5f0e1 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPoint.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPoint.java @@ -23,73 +23,81 @@ import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.utils.RegionExtensionType; import de.steamwar.bausystem.region.utils.RegionType; import lombok.Getter; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.block.Block; import org.bukkit.entity.TNTPrimed; import org.bukkit.util.Vector; +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; import java.util.List; import java.util.Optional; @Getter -public class TNTPoint { - +public class TNTPoint implements Externalizable { /** * Unique number to identify records being of the same tnt */ - private final int tntId; + private int tntId; /** * Whether this is a record of a tnt explosion or an entity */ - private final boolean explosion; + private boolean explosion; /** * Whether this is a record of a tnt that was in water */ - private final boolean inWater; + private boolean inWater; /** * Whether this record was taken after the first tnt exploded */ - private final boolean afterFirstExplosion; + private boolean afterFirstExplosion; /** * Whether this record has destroyed blocks in build area */ - private final boolean destroyedBuildArea; + private boolean destroyedBuildArea; /** * Whether this record has destroyed blocks in testblock area */ - private final boolean destroyedTestBlock; + private boolean destroyedTestBlock; /** * Tick offset, from this record being taken to the start of the trace */ - private final long ticksSinceStart; + private long ticksSinceStart; /** * Fuse ticks of the recorded tnt (0 if this is an explosion) */ - private final int fuse; + private int fuse; /** * Location of the recorded tnt */ - private final Location location; + private Location location; /** * Velocity of the recorded tnt */ - private final Vector velocity; + private Vector velocity; /** * List of all tnt records, that are represent the same tnt */ - private final List history; + private List history; - public TNTPoint(int tntId, TNTPrimed tnt, boolean explosion, boolean afterFirstExplosion, long ticksSinceStart, List history, List destroyedBlocks) { + public TNTPoint() { + } + + public TNTPoint(int tntId, TNTPrimed tnt, boolean explosion, boolean afterFirstExplosion, long ticksSinceStart, + List history, List destroyedBlocks) { this.tntId = tntId; this.explosion = explosion; this.inWater = tnt.isInWater(); @@ -103,10 +111,12 @@ public class TNTPoint { boolean buildDestroy = false; boolean testblockDestroy = false; for (Block destroyedBlock : destroyedBlocks) { - if (Region.getRegion(destroyedBlock.getLocation()).inRegion(destroyedBlock.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION)) { + if (Region.getRegion(destroyedBlock.getLocation()).inRegion(destroyedBlock.getLocation(), RegionType.BUILD, + RegionExtensionType.EXTENSION)) { buildDestroy = true; } - if (Region.getRegion(destroyedBlock.getLocation()).inRegion(destroyedBlock.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.EXTENSION)) { + if (Region.getRegion(destroyedBlock.getLocation()).inRegion(destroyedBlock.getLocation(), + RegionType.TESTBLOCK, RegionExtensionType.EXTENSION)) { testblockDestroy = true; } } @@ -125,6 +135,50 @@ public class TNTPoint { return index == 0 ? Optional.empty() : Optional.of(history.get(index - 1)); } + void setHistory(List history) { + this.history = history; + } + + @Override + public void writeExternal(ObjectOutput objectOutput) throws IOException { + objectOutput.writeInt(tntId); + objectOutput.writeBoolean(explosion); + objectOutput.writeBoolean(inWater); + objectOutput.writeBoolean(afterFirstExplosion); + objectOutput.writeBoolean(destroyedBuildArea); + objectOutput.writeBoolean(destroyedTestBlock); + objectOutput.writeLong(ticksSinceStart); + objectOutput.writeInt(fuse); + objectOutput.writeUTF(location.getWorld().getName()); + objectOutput.writeDouble(location.getX()); + objectOutput.writeDouble(location.getY()); + objectOutput.writeDouble(location.getZ()); + objectOutput.writeDouble(velocity.getX()); + objectOutput.writeDouble(velocity.getY()); + objectOutput.writeDouble(velocity.getZ()); + } + + @Override + public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException { + tntId = objectInput.readInt(); + explosion = objectInput.readBoolean(); + inWater = objectInput.readBoolean(); + afterFirstExplosion = objectInput.readBoolean(); + destroyedBuildArea = objectInput.readBoolean(); + destroyedTestBlock = objectInput.readBoolean(); + ticksSinceStart = objectInput.readLong(); + fuse = objectInput.readInt(); + String worldName = objectInput.readUTF(); + double locX = objectInput.readDouble(); + double locY = objectInput.readDouble(); + double locZ = objectInput.readDouble(); + location = new Location(Bukkit.getWorld(worldName), locX, locY, locZ); + double velX = objectInput.readDouble(); + double velY = objectInput.readDouble(); + double velZ = objectInput.readDouble(); + velocity = new Vector(velX, velY, velZ); + } + @Override public String toString() { return "TNTRecord{" + @@ -138,11 +192,15 @@ public class TNTPoint { @Override public boolean equals(Object obj) { - if (!(obj instanceof TNTPoint)) return false; + if (!(obj instanceof TNTPoint)) + return false; TNTPoint record = (TNTPoint) obj; - if (record.isExplosion() != explosion) return false; - if (!record.getLocation().equals(location)) return false; - if (!record.getVelocity().equals(velocity)) return false; + if (record.isExplosion() != explosion) + return false; + if (!record.getLocation().equals(location)) + return false; + if (!record.getVelocity().equals(velocity)) + return false; return true; } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index d39b872c..838436fe 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -19,102 +19,104 @@ package de.steamwar.bausystem.features.tracer; -import de.steamwar.bausystem.features.tpslimit.TPSUtils; import de.steamwar.bausystem.features.tracer.rendering.BundleFilter; +import de.steamwar.bausystem.features.tracer.rendering.PlayerTraceShowData; import de.steamwar.bausystem.features.tracer.rendering.TraceEntity; import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; import de.steamwar.bausystem.region.Region; import de.steamwar.entity.REntity; import de.steamwar.entity.REntityServer; +import lombok.Cleanup; import lombok.Getter; import org.bukkit.entity.Player; +import java.io.*; +import java.lang.ref.SoftReference; import java.util.*; -import java.util.function.Function; import java.util.stream.Collectors; -public class Trace { // TODO: Add UUID for file saving and so on! +public class Trace { + /** + * UUID of the trace used for + */ + @Getter + private final UUID uuid; /** - * Region this trace has been recorded in + * File the records are saved in + */ + @Getter + private final File recordsSaveFile; + + /** + * File the metadata are saved in + */ + @Getter + private final File metadataSaveFile; + + /** + * Region the trace was recorded in */ @Getter private final Region region; /** - * Tick the recording started at + * Date the trace was recorded at */ @Getter - private final long startTime = TPSUtils.currentTick.get(); - - /** - * - */ - @Getter - private final Date date = new Date(); + private final Date date; /** * Records of TNTs, making up the trace */ - @Getter - private List records = new ArrayList<>(); - - /** - * ID that should be assigned to the next record of a unique tnt - */ - @Getter - private int nextOpenRecordId = -1; + private SoftReference> records; private final Map entityServerMap = new HashMap<>(); - - /** - * List of all used ids - */ - public List getUsedIds() { - return getRecords() - .stream() - .map(TNTPoint::getTntId) - .map(i -> i + "") - .collect(Collectors.toList()); - } - public Trace(Region region) { + public Trace(Region region, List recordList) { + this.uuid = UUID.randomUUID(); + recordsSaveFile = new File(TraceManager.tracesFolder, uuid + ".records"); this.region = region; - } + this.date = new Date(); + records = new SoftReference<>(recordList); + metadataSaveFile = new File(TraceManager.tracesFolder, uuid + ".meta"); - /** - * Gets and increments the next open record id - * - * @return next open record id - */ - protected int getAndIncrementNextOpenRecordId() { - return ++nextOpenRecordId; - } - - /** - * Adds the given records and updates potential trace renderings - */ - protected void addAll(List records, Function getter) { - this.getRecords().addAll(records); - Iterator keySetIterator = entityServerMap.keySet().iterator(); - while (keySetIterator.hasNext()) { - Player player = keySetIterator.next(); - PlayerTraceShowData playerTraceShowData = getter.apply(player); - if (playerTraceShowData == null) { - keySetIterator.remove(); - continue; - } - render(records, entityServerMap.get(player), playerTraceShowData); + try { + @Cleanup + ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(metadataSaveFile)); + outputStream.writeUTF(uuid.toString()); + outputStream.writeUTF(region.getName()); + outputStream.writeObject(date); + } catch (IOException | ClassCastException e) { + e.printStackTrace(); } } - /** - * Internal methode to make records immutable after recording is finished - * - * @param records immutable records list - */ - protected void setRecords(List records) { - this.records = records; + public Trace(File metadataSaveFile) { + String uuid = null; + Region region = null; + Date date = null; + + this.metadataSaveFile = metadataSaveFile; + + try { + @Cleanup + ObjectInputStream inputStream = new ObjectInputStream(new FileInputStream(metadataSaveFile)); + uuid = inputStream.readUTF(); + region = Region.getREGION_MAP().get(inputStream.readUTF()); + date = (Date) inputStream.readObject(); + inputStream.close(); + } catch (IOException | ClassNotFoundException e) { + e.printStackTrace(); + } finally { + this.uuid = UUID.fromString(uuid); + this.region = region; + this.date = date; + recordsSaveFile = new File(TraceManager.tracesFolder, uuid + ".records"); + this.records = new SoftReference<>(null); + } + + System.out.println(this); } /** @@ -132,6 +134,17 @@ public class Trace { // TODO: Add UUID for file saving and so on! return histories; } + /** + * List of all used ids + */ + public List getUsedIds() { + return getRecords() + .stream() + .map(TNTPoint::getTntId) + .map(i -> i + "") + .collect(Collectors.toList()); + } + /** * Renders this traces * @@ -150,34 +163,41 @@ public class Trace { // TODO: Add UUID for file saving and so on! render(getRecords(), entityServer, playerTraceShowData); } + protected void render(List records, Player player, PlayerTraceShowData playerTraceShowData) { + render(records, entityServerMap.get(player), playerTraceShowData); + } + /** * Internal methode to render records to a REntityServer * * @param records Records to render + * @param entityServer The show server the trace will be renderd to * @param playerTraceShowData The showData for modifying the rendering */ private void render(List records, REntityServer entityServer, PlayerTraceShowData playerTraceShowData) { - if (records.isEmpty()) return; + if (records.isEmpty()) + return; List workingRecords = new ArrayList<>(records); Set flagList = playerTraceShowData.getEffectiveViewFlags(); - //Apply filters + // Apply filters for (ViewFlag flag : flagList) { workingRecords = flag.filter(workingRecords); } - //Bundle records at unique positions + // Bundle records at unique positions List> bundles = bundleRecords(workingRecords, playerTraceShowData.getBundleFilter()); - //Render bundled records + // Render bundled records List entities = new LinkedList<>(); for (List bundle : bundles) { - entities.add(new TraceEntity(entityServer, bundle.get(0).getLocation(), bundle.get(0).isExplosion(), bundle)); + entities.add( + new TraceEntity(entityServer, bundle.get(0).getLocation(), bundle.get(0).isExplosion(), bundle)); } - //Apply modifiers + // Apply modifiers for (ViewFlag flag : flagList) { flag.modify(entityServer, entities); } @@ -195,13 +215,13 @@ public class Trace { // TODO: Add UUID for file saving and so on! * Bundles the passed TNTRecords based on whether they are at the same location * * @param records The TNTRecords that are supposed to be bundled + * @param filter A filter specefieng whether records can be bundled * @return A list of bundles */ private List> bundleRecords(List records, BundleFilter filter) { List> bundles = new ArrayList<>(); - recordsLoop: - for (TNTPoint record : records) { + recordsLoop: for (TNTPoint record : records) { if (bundles.isEmpty()) { List firstBundle = new ArrayList<>(); firstBundle.add(record); @@ -226,6 +246,26 @@ public class Trace { // TODO: Add UUID for file saving and so on! return bundles; } + /** + * Makes the first passed player follow the trace render of the second passed + * player + * + * @param player + * @param toFollow + */ + public void follow(Player player, Player toFollow) { + throw new UnsupportedOperationException(); + } + + /** + * Makes the passed player stop following any other players trace render + * + * @param player + */ + public void unfollow(Player player) { + throw new UnsupportedOperationException(); + } + /** * Hides this trail for the given player * @@ -233,8 +273,11 @@ public class Trace { // TODO: Add UUID for file saving and so on! */ public void hide(Player player) { REntityServer entityServer = entityServerMap.remove(player); - if (entityServer == null) return; - entityServer.close(); + if (entityServer == null) + return; + entityServer.removePlayer(player); + if (entityServer.getPlayers().isEmpty()) + entityServer.close(); } public void hide() { @@ -244,12 +287,47 @@ public class Trace { // TODO: Add UUID for file saving and so on! entityServerMap.clear(); } + private void loadRecords() { + try { + List records = new ArrayList<>(); + @Cleanup + FileInputStream fileInputStream = new FileInputStream(recordsSaveFile); + @Cleanup + ObjectInputStream inputStream = new ObjectInputStream(fileInputStream); + while (fileInputStream.getChannel().position() < recordsSaveFile.length()) { + records.add((TNTPoint) inputStream.readObject()); + } + + System.out.println("Loaded... " + records); + + Map> histories = new HashMap<>(); + for (TNTPoint record : records) { + int tntId = record.getTntId(); + List history = histories.computeIfAbsent(tntId, id -> new ArrayList<>()); + history.add(record); + record.setHistory(history); + } + + this.records = new SoftReference<>(records); + } catch (IOException | ClassNotFoundException e) { + e.printStackTrace(); + } + } + + public List getRecords() { + if (records.get() == null) + loadRecords(); + return records.get(); + } + @Override public String toString() { return "Trace{" + - "region=" + region + - ", startTime=" + startTime + - ", records=" + records + + "uuid=" + uuid + + ", region=" + region + + ", creationTime=" + date + + ", recordsSaveFile=" + recordsSaveFile.getName() + + ", records=" + getRecords() + '}'; } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index 149ad5ef..370f0fed 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.tracer; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.tracer.rendering.BundleFilter; +import de.steamwar.bausystem.features.tracer.rendering.PlayerTraceShowData; import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; import de.steamwar.bausystem.features.tracer.rendering.dynamicflags.AtFlag; import de.steamwar.bausystem.region.Region; @@ -28,7 +29,6 @@ import de.steamwar.command.PreviousArguments; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeMapper; import de.steamwar.linkage.Linked; -import de.steamwar.linkage.LinkedInstance; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -41,12 +41,6 @@ import java.util.stream.Stream; @Linked public class TraceCommand extends SWCommand { - @LinkedInstance - public TraceRecorder traceRecorder; - - @LinkedInstance - public TraceManager manager; - public TraceCommand() { super("trace", "trail"); } @@ -54,21 +48,21 @@ public class TraceCommand extends SWCommand { @Register(value = "start", description = "TRACE_COMMAND_HELP_START") public void start(@Validator Player player) { Region region = Region.getRegion(player.getLocation()); - traceRecorder.startRecording(region); + TraceRecorder.instance.startRecording(region); BauSystem.MESSAGE.send("TRACE_MESSAGE_START", player); } @Register(value = "stop", description = "TRACE_COMMAND_HELP_STOP") public void stop(@Validator Player player) { Region region = Region.getRegion(player.getLocation()); - traceRecorder.stopRecording(region); + TraceRecorder.instance.stopRecording(region); BauSystem.MESSAGE.send("TRACE_MESSAGE_STOP", player); } @Register(value = "auto", description = "TRACE_COMMAND_HELP_AUTO") public void auto(@Validator Player player) { Region region = Region.getRegion(player.getLocation()); - traceRecorder.toggleAutoTrace(region); + TraceRecorder.instance.toggleAutoTrace(region); // TODO: Add Auto toggle Message! } @@ -78,20 +72,24 @@ public class TraceCommand extends SWCommand { BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW", player); } - @Register(value = {"show", "at"}, description = "TRACE_COMMAND_HELP_SHOW_AT_WITH") - public void showAt(@Validator Player player, @Min(intValue = 0) int time, @StaticValue("with") String with, @OptionalValue("STRICT") BundleFilter bundleFilter, @ArrayLength(min = 1) ViewFlag... flags) { + @Register(value = { "show", "at" }, description = "TRACE_COMMAND_HELP_SHOW_AT_WITH") + public void showAt(@Validator Player player, @Min(intValue = 0) int time, @StaticValue("with") String with, + @OptionalValue("STRICT") BundleFilter bundleFilter, @ArrayLength(min = 1) ViewFlag... flags) { showInternal(player, time, time, bundleFilter, flags); BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_AT", player, time); } - @Register(value = {"show", "from"}, description = "TRACE_COMMAND_HELP_SHOW_FROM_WITH") - public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("with") String with, @OptionalValue("STRICT") BundleFilter bundleFilter, @ArrayLength(min = 1) ViewFlag... flags) { + @Register(value = { "show", "from" }, description = "TRACE_COMMAND_HELP_SHOW_FROM_WITH") + public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("with") String with, + @OptionalValue("STRICT") BundleFilter bundleFilter, @ArrayLength(min = 1) ViewFlag... flags) { showInternal(player, from, Integer.MAX_VALUE, bundleFilter, flags); BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_FROM", player, from); } - @Register(value = {"show", "from"}, description = "TRACE_COMMAND_HELP_SHOW_FROM_TO_WITH") - public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("to") String toString, int to, @StaticValue("with") String with, @OptionalValue("STRICT") BundleFilter bundleFilter, @ArrayLength(min = 1) ViewFlag... flags) { + @Register(value = { "show", "from" }, description = "TRACE_COMMAND_HELP_SHOW_FROM_TO_WITH") + public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("to") String toString, + int to, @StaticValue("with") String with, @OptionalValue("STRICT") BundleFilter bundleFilter, + @ArrayLength(min = 1) ViewFlag... flags) { if (to < from) { BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_TO_SMALLER", player); return; @@ -103,71 +101,73 @@ public class TraceCommand extends SWCommand { private void showInternal(Player player, int from, int to, BundleFilter bundleFilter, ViewFlag... flags) { PlayerTraceShowData playerTraceShowData = new PlayerTraceShowData(bundleFilter, flags); playerTraceShowData.addViewFlag(new AtFlag(from, to)); - manager.show(player, playerTraceShowData); + TraceManager.instance.show(player, playerTraceShowData); } - @Register(value = {"show", "at"}, description = "TRACE_COMMAND_HELP_SHOW_AT") + @Register(value = { "show", "at" }, description = "TRACE_COMMAND_HELP_SHOW_AT") public void showAt(@Validator Player player, @Min(intValue = 0) int time) { - manager.renderAt(player, time, time); + TraceManager.instance.renderAt(player, time, time); BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_AT", player, time); } - @Register(value = {"show", "from"}, description = "TRACE_COMMAND_HELP_SHOW_FROM") + @Register(value = { "show", "from" }, description = "TRACE_COMMAND_HELP_SHOW_FROM") public void showFrom(@Validator Player player, @Min(intValue = 0) int from) { - manager.renderAt(player, from, Integer.MAX_VALUE); + TraceManager.instance.renderAt(player, from, Integer.MAX_VALUE); BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_FROM", player, from); } - @Register(value = {"show", "from"}, description = "TRACE_COMMAND_HELP_SHOW_FROM_TO") - public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("to") String toString, int to) { - manager.renderAt(player, from, to); + @Register(value = { "show", "from" }, description = "TRACE_COMMAND_HELP_SHOW_FROM_TO") + public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("to") String toString, + int to) { + TraceManager.instance.renderAt(player, from, to); BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_FROM_TO", player, from, to); } @Register(value = "hide", description = "TRACE_COMMAND_HELP_HIDE") public void hide(@Validator Player player) { - manager.hide(player); + TraceManager.instance.hide(player); BauSystem.MESSAGE.send("TRACE_MESSAGE_HIDE", player); } @Register(value = "delete", description = "TRACE_COMMAND_HELP_DELETE") @Register(value = "clear") public void delete(@Validator Player player) { - manager.clear(); + TraceManager.instance.clear(); BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE", player); } @Register(value = "delete") public void delete(@Validator Player player, Trace trace) { - manager.remove(trace); + TraceManager.instance.remove(trace); BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE_SPECIFIC", player); } @Register(value = "isolate", description = "TRACE_COMMAND_HELP_ISOLATE") - public void isolate(@Validator Player player, Trace trace, @ErrorMessage("TRACE_RECORD_ID_INVALID") TNTPoint... records) { - manager.isolate(player, records); + public void isolate(@Validator Player player, Trace trace, + @ErrorMessage("TRACE_RECORD_ID_INVALID") TNTPoint... records) { + TraceManager.instance.isolate(player, records); // TODO: Add Message! } @Register(value = "share", description = "TRACE_COMMAND_HELP_SHOW") public void share(@Validator Player player) { - //TODO Rücksprache + // TODO Rücksprache } @Register(value = "follow", description = "TRACE_COMMAND_HELP_SHOW") public void follow(@Validator Player player, Player toFollow) { - if (player == toFollow) { - // TODO: Implement message - return; + // TODO: Implement + for (Trace trace : TraceManager.instance.getAll()) { + trace.follow(player, toFollow); } - manager.follow(player, toFollow); - // TODO: Implement message } @Register(value = "unfollow", description = "TRACE_COMMAND_HELP_SHOW") public void unfollow(@Validator Player player) { - manager.unfollow(player); - // TODO: Implement message + // TODO: Implement + for (Trace trace : TraceManager.instance.getAll()) { + trace.unfollow(player); + } } @ClassMapper(value = Trace.class, local = true) @@ -175,12 +175,13 @@ public class TraceCommand extends SWCommand { return new TypeMapper<>() { @Override public Trace map(CommandSender commandSender, String[] previousArguments, String s) { - return manager.get(Integer.parseInt(s)).orElse(null); + return TraceManager.instance.get(Integer.parseInt(s)).orElse(null); } @Override - public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) { - return manager.getAllIds().stream() + public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, + String s) { + return TraceManager.instance.getAllIds().stream() .map(Object::toString) .collect(Collectors.toList()); } @@ -193,7 +194,8 @@ public class TraceCommand extends SWCommand { @Override public TNTPoint map(CommandSender commandSender, PreviousArguments previousArguments, String s) { Trace trace = previousArguments.getFirst(Trace.class).orElse(null); - if (trace == null) return null; + if (trace == null) + return null; int id = Integer.parseInt(s); return trace.getRecords().stream() @@ -202,11 +204,13 @@ public class TraceCommand extends SWCommand { .orElse(null); } - //TODO change when new command framework update + // TODO change when new command framework update @Override - public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) { + public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, + String s) { Trace trace = previousArguments.getFirst(Trace.class).orElse(null); - if (trace == null) return null; + if (trace == null) + return null; return trace.getUsedIds(); } }; @@ -226,7 +230,8 @@ public class TraceCommand extends SWCommand { } @Override - public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) { + public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, + String s) { if (s.length() == 0) { return new ArrayList<>(); } @@ -258,7 +263,8 @@ public class TraceCommand extends SWCommand { } @Override - public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) { + public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, + String s) { return ViewFlag.flags.stream() .flatMap(viewFlag -> Stream.concat(Stream.of("--" + viewFlag.name), Arrays.stream(viewFlag.aliases).map(name -> "-" + name))) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index 6d531ed8..dd4225f7 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -20,19 +20,47 @@ package de.steamwar.bausystem.features.tracer; import de.steamwar.bausystem.features.tracer.rendering.BundleFilter; +import de.steamwar.bausystem.features.tracer.rendering.PlayerTraceShowData; import de.steamwar.bausystem.features.tracer.rendering.dynamicflags.AtFlag; import de.steamwar.bausystem.features.tracer.rendering.dynamicflags.IsolateFlag; import de.steamwar.bausystem.region.Region; import de.steamwar.linkage.Linked; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerQuitEvent; +import java.io.File; import java.util.*; @Linked public class TraceManager implements Listener { + + public static TraceManager instance; + + { + instance = this; + } + + public static File tracesFolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "traces"); + + public TraceManager() { + if (!tracesFolder.exists()) + tracesFolder.mkdir(); + + File[] traceFiles = tracesFolder.listFiles(); + if (traceFiles == null) + return; + + for (File traceFile : traceFiles) { + if (traceFile.getName().contains(".records")) + continue; + + add(new Trace(traceFile)); + } + } + /** * List of all current traces */ @@ -56,31 +84,15 @@ public class TraceManager implements Listener { * @return id of the created trace */ protected int add(Trace trace) { - showDataPerRegionPerPlayer.getOrDefault(trace.getRegion(), Collections.emptyMap()).forEach((player, playerTraceShowData) -> { - trace.render(player, playerTraceShowData); - followerMap.getOrDefault(player, Collections.emptySet()).forEach(follower -> { - trace.render(follower, playerTraceShowData); - }); - }); + showDataPerRegionPerPlayer.getOrDefault(trace.getRegion(), Collections.emptyMap()).forEach(trace::render); traces.put(nextOpenId, trace); tracesByRegion.computeIfAbsent(trace.getRegion(), region -> new HashMap<>()).put(nextOpenId, trace); nextOpenId++; return nextOpenId; } - protected void addAll(Trace trace, List TNTPoints) { - trace.addAll(TNTPoints, player -> { - Map.Entry> entry = followerMap.entrySet() - .stream() - .filter(playerSetEntry -> playerSetEntry.getValue().contains(player)) - .findFirst() - .orElse(null); - if (entry == null) { - return showDataPerRegionPerPlayer.getOrDefault(trace.getRegion(), Collections.emptyMap()).get(player); - } else { - return showDataPerRegionPerPlayer.getOrDefault(trace.getRegion(), Collections.emptyMap()).get(entry.getKey()); - } - }); + protected Map getTraceShowDataPlayerMapping(Region region) { + return showDataPerRegionPerPlayer.getOrDefault(region, new HashMap<>()); } /** @@ -94,7 +106,8 @@ public class TraceManager implements Listener { .map(Map.Entry::getKey) .findFirst() .orElse(null); - if (traceId == null) return false; + if (traceId == null) + return false; traces.remove(traceId); tracesByRegion.getOrDefault(trace.getRegion(), Collections.emptyMap()).remove(traceId); trace.hide(); @@ -116,6 +129,10 @@ public class TraceManager implements Listener { players.forEach(trace::hide); }); }); + traces.forEach((i, trace) -> { + trace.getMetadataSaveFile().delete(); + trace.getRecordsSaveFile().delete(); + }); traces.clear(); tracesByRegion.clear(); nextOpenId = 0; @@ -135,7 +152,7 @@ public class TraceManager implements Listener { * Methode to get the trace with specific id * * @param index index of the trace - * @return the trace with given id or null if no trace with id is found + * @return the trace with given id */ public Optional get(int index) { return Optional.ofNullable(traces.get(index)); @@ -185,16 +202,19 @@ public class TraceManager implements Listener { unfollow(player); Region region = Region.getRegion(player.getLocation()); - PlayerTraceShowData previous = showDataPerRegionPerPlayer.getOrDefault(region, Collections.emptyMap()).remove(player); - if (previous == null) return; - tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> { + PlayerTraceShowData previous = showDataPerRegionPerPlayer.getOrDefault(region, Collections.emptyMap()) + .remove(player); + if (previous == null) + return; + tracesByRegion.getOrDefault(player, Collections.emptyMap()).forEach((integer, trace) -> { trace.hide(player); followerMap.getOrDefault(player, Collections.emptySet()).forEach(trace::hide); }); } public boolean follow(Player follower, Player following) { - if (followerMap.containsKey(follower)) return false; + if (followerMap.containsKey(follower)) + return false; if (followerMap.entrySet().stream().anyMatch(playerSetEntry -> playerSetEntry.getValue().contains(follower))) { unfollow(follower); } @@ -209,7 +229,8 @@ public class TraceManager implements Listener { } PlayerTraceShowData playerTraceShowData = playerPlayerTraceShowDataMap.get(following); - if (playerTraceShowData == null) return; + if (playerTraceShowData == null) + return; tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> { trace.render(follower, playerTraceShowData); }); @@ -218,25 +239,30 @@ public class TraceManager implements Listener { } public void unfollow(Player follower) { - if (followerMap.containsKey(follower)) return; + if (followerMap.containsKey(follower)) + return; List toRemove = new ArrayList<>(); Set toHide = new HashSet<>(); followerMap.forEach((player, players) -> { - if (players.remove(follower)) toHide.add(follower); - if (players.isEmpty()) toRemove.add(player); + if (players.remove(follower)) + toHide.add(follower); + if (players.isEmpty()) + toRemove.add(player); }); toRemove.forEach(followerMap::remove); showDataPerRegionPerPlayer.forEach((region, playerPlayerTraceShowDataMap) -> { toHide.forEach(player -> { - if (!playerPlayerTraceShowDataMap.containsKey(player)) return; + if (!playerPlayerTraceShowDataMap.containsKey(player)) + return; tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> { trace.hide(follower); }); }); PlayerTraceShowData playerTraceShowData = playerPlayerTraceShowDataMap.get(follower); - if (playerTraceShowData == null) return; + if (playerTraceShowData == null) + return; tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> { trace.render(follower, playerTraceShowData); }); @@ -244,7 +270,8 @@ public class TraceManager implements Listener { } /** - * Modifies the render for the given player, to only show tnts at the given time interval + * Modifies the render for the given player, to only show tnts at the given time + * interval * * @param player * @param from start of time interval @@ -254,7 +281,9 @@ public class TraceManager implements Listener { unfollow(player); Region region = Region.getRegion(player.getLocation()); - PlayerTraceShowData playerTraceShowData = showDataPerRegionPerPlayer.computeIfAbsent(region, ignored -> new HashMap<>()).computeIfAbsent(player, ignored -> new PlayerTraceShowData(BundleFilter.STRICT)); + PlayerTraceShowData playerTraceShowData = showDataPerRegionPerPlayer + .computeIfAbsent(region, ignored -> new HashMap<>()) + .computeIfAbsent(player, ignored -> new PlayerTraceShowData(BundleFilter.STRICT)); AtFlag atFlag = playerTraceShowData.getViewFlag(AtFlag.class); if (atFlag == null) { @@ -282,7 +311,9 @@ public class TraceManager implements Listener { unfollow(player); Region region = Region.getRegion(player.getLocation()); - PlayerTraceShowData playerTraceShowData = showDataPerRegionPerPlayer.computeIfAbsent(region, ignored -> new HashMap<>()).computeIfAbsent(player, ignored -> new PlayerTraceShowData(BundleFilter.STRICT)); + PlayerTraceShowData playerTraceShowData = showDataPerRegionPerPlayer + .computeIfAbsent(region, ignored -> new HashMap<>()) + .computeIfAbsent(player, ignored -> new PlayerTraceShowData(BundleFilter.STRICT)); IsolateFlag isolateFlag; if (playerTraceShowData.hasViewFlagOnly(IsolateFlag.class)) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java index ebe839ff..cb7ac370 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java @@ -23,7 +23,6 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.tpslimit.TPSUtils; import de.steamwar.bausystem.region.Region; import de.steamwar.linkage.Linked; -import de.steamwar.linkage.LinkedInstance; import org.bukkit.block.Block; import org.bukkit.entity.TNTPrimed; import org.bukkit.event.EventHandler; @@ -43,16 +42,10 @@ public class TraceRecorder implements Listener { instance = this; } - /** - * Linked instance of TraceManager - */ - @LinkedInstance - public TraceManager manager; - /** * Map for all traces being actively recorded */ - private final Map activeTraces = new HashMap<>(); + private final Map activeTraces = new HashMap<>(); /** * Map for all TNTs being traced, by region @@ -64,16 +57,6 @@ public class TraceRecorder implements Listener { */ private final Map tntSpawnRegion = new HashMap<>(); - /** - * Set of all active traces that no explosion has been recorded on - */ - private final Set noExplosionRecorded = new HashSet<>(); - - /** - * A map for records that have been taken in the same tick and now have to be added to the traces - */ - private final Map> recordsToAddMap = new HashMap<>(); - /** * Maps a tracked tnt entity to its entire recording history */ @@ -109,7 +92,8 @@ public class TraceRecorder implements Listener { */ public void checkForAutoTraceFinish() { for (Region region : autoTraceRegions) { - if (autoTraceRegions.contains(region) && trackedTNT.getOrDefault(region, Collections.emptyList()).size() == 0) { + if (autoTraceRegions.contains(region) + && trackedTNT.getOrDefault(region, Collections.emptyList()).size() == 0) { stopRecording(region); } } @@ -121,12 +105,12 @@ public class TraceRecorder implements Listener { * @param region region to be recorded */ public int startRecording(Region region) { - if (activeTraces.containsKey(region)) return -1; - Trace trace = new Trace(region); - noExplosionRecorded.add(trace); - activeTraces.put(region, trace); - recordsToAddMap.put(trace, new ArrayList<>()); - return manager.add(trace); + if (activeTraces.containsKey(region)) + return -1; + + TraceRecordingWrapper wrappedTrace = new TraceRecordingWrapper(region); + activeTraces.put(region, wrappedTrace); + return TraceManager.instance.add(wrappedTrace.getTrace()); } /** @@ -135,17 +119,14 @@ public class TraceRecorder implements Listener { * @param region region to stop recording */ public void stopRecording(Region region) { - Trace trace = activeTraces.getOrDefault(region, null); - if (trace == null) return; - trace.setRecords(Collections.unmodifiableList(trace.getRecords())); + TraceRecordingWrapper wrappedTrace = activeTraces.getOrDefault(region, null); + if (wrappedTrace == null) + return; - noExplosionRecorded.remove(trace); activeTraces.remove(region); for (TNTPrimed tnt : trackedTNT.getOrDefault(region, Collections.emptyList())) { historyMap.remove(tnt); } - - recordsToAddMap.remove(trace); trackedTNT.put(region, new ArrayList<>()); } @@ -154,45 +135,45 @@ public class TraceRecorder implements Listener { */ private void record() { for (Region region : activeTraces.keySet()) { - Trace trace = activeTraces.get(region); - + TraceRecordingWrapper wrappedTrace = activeTraces.get(region); for (TNTPrimed tnt : trackedTNT.getOrDefault(region, Collections.emptyList())) { - record(tnt, trace, Collections.emptyList()); + TNTPoint record = record(tnt, wrappedTrace, Collections.emptyList()); + wrappedTrace.addRecord(record); } - - List TNTPoints = recordsToAddMap.get(trace); - manager.addAll(trace, TNTPoints); - TNTPoints.clear(); + wrappedTrace.commitRecorded(); } } /** * Internal methode to record exploded tnt * - * @param tntPrimed tnt exploding - * @param trace trace to record the tnt for + * @param tntPrimed tnt exploding + * @param wrappedTrace the trace to record the tnt for wrapped with metadata + * @param destroyedBlocks the blocks destoryed by the passed tnt + * @return the record creaded of the passed tnt */ - private void record(TNTPrimed tntPrimed, Trace trace, List destroyedBlocks) { + private TNTPoint record(TNTPrimed tntPrimed, TraceRecordingWrapper wrappedTrace, List destroyedBlocks) { List history = historyMap.getOrDefault(tntPrimed, new ArrayList<>()); int tntID; if (history.size() == 0) { historyMap.put(tntPrimed, history); - tntID = trace.getAndIncrementNextOpenRecordId(); + tntID = wrappedTrace.getNextOpenRecordIdAndIncrement(); } else { tntID = history.get(0).getTntId(); } boolean isExplosion = tntPrimed.getFuseTicks() == 0; if (isExplosion) { - noExplosionRecorded.remove(trace); + wrappedTrace.activateExplosionRecorded(); } - boolean afterFirstExplosion = noExplosionRecorded.contains(trace); + boolean afterFirstExplosion = wrappedTrace.isExplosionRecorded(); - TNTPoint record = new TNTPoint(tntID, tntPrimed, isExplosion, afterFirstExplosion, TPSUtils.currentTick.get() - trace.getStartTime(), history, destroyedBlocks); + TNTPoint record = new TNTPoint(tntID, tntPrimed, isExplosion, afterFirstExplosion, + TPSUtils.currentTick.get() - wrappedTrace.getStartTick(), history, destroyedBlocks); history.add(record); - recordsToAddMap.get(trace).add(record); + return record; } /** @@ -203,7 +184,8 @@ public class TraceRecorder implements Listener { */ @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onTNTSpawn(EntitySpawnEvent event) { - if (!(event.getEntity() instanceof TNTPrimed)) return; + if (!(event.getEntity() instanceof TNTPrimed)) + return; Region region = Region.getRegion(event.getLocation()); @@ -219,7 +201,8 @@ public class TraceRecorder implements Listener { trackedTNT.get(region).add((TNTPrimed) event.getEntity()); tntSpawnRegion.put((TNTPrimed) event.getEntity(), region); - record((TNTPrimed) event.getEntity(), activeTraces.get(region), Collections.emptyList()); + activeTraces.get(region).addRecord( + record((TNTPrimed) event.getEntity(), activeTraces.get(region), Collections.emptyList())); } } @@ -231,13 +214,16 @@ public class TraceRecorder implements Listener { */ @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onTNTExplode(EntityExplodeEvent event) { - if (!(event.getEntity() instanceof TNTPrimed)) return; + if (!(event.getEntity() instanceof TNTPrimed)) + return; Region region = tntSpawnRegion.getOrDefault((TNTPrimed) event.getEntity(), null); - if (region == null) return; + if (region == null) + return; trackedTNT.get(region).remove((TNTPrimed) event.getEntity()); tntSpawnRegion.remove((TNTPrimed) event.getEntity()); - record((TNTPrimed) event.getEntity(), activeTraces.get(region), event.blockList()); + activeTraces.get(region) + .addRecord(record((TNTPrimed) event.getEntity(), activeTraces.get(region), event.blockList())); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java new file mode 100644 index 00000000..7a264d51 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java @@ -0,0 +1,102 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2024 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.tracer; + +import de.steamwar.bausystem.features.tpslimit.TPSUtils; +import de.steamwar.bausystem.region.Region; +import lombok.Getter; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.ObjectOutputStream; +import java.util.ArrayList; +import java.util.List; + +//TODO Rename ? +public class TraceRecordingWrapper { + private final Region region; + @Getter + private final long startTick; + private final List recordsToAdd; + private final List recordList; + private ObjectOutputStream recordsOutputStream; + private int nextOpenRecordId = 0; + @Getter + private boolean explosionRecorded = false; + + @Getter + private final Trace trace; + + public TraceRecordingWrapper(Region region) { + this.region = region; + startTick = TPSUtils.currentTick.get(); + recordsToAdd = new ArrayList<>(); + recordList = new ArrayList<>(); + + trace = new Trace(region, recordList); + TraceManager.instance.add(trace); + File recordsSaveFile = new File(TraceManager.tracesFolder, trace.getUuid() + ".records"); + try { + recordsOutputStream = new ObjectOutputStream(new FileOutputStream(recordsSaveFile)); + } catch (IOException e) { + e.printStackTrace(); + } + + } + + public int getNextOpenRecordIdAndIncrement() { + return nextOpenRecordId++; + } + + public void activateExplosionRecorded() { + explosionRecorded = true; + } + + public void addRecord(TNTPoint record) { + recordsToAdd.add(record); + } + + public void commitRecorded() { + TraceManager.instance.getTraceShowDataPlayerMapping(region).forEach((key, value) -> trace.render(recordsToAdd, key, value)); + + recordsToAdd.forEach(record -> { + try { + recordsOutputStream.writeObject(record); + } catch (IOException e) { + e.printStackTrace(); + } + }); + + recordList.addAll(recordsToAdd); + recordsToAdd.clear(); + + System.out.println(recordList); + } + + protected void finalizeRecording() { + try { + recordsOutputStream.flush(); + recordsOutputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/PlayerTraceShowData.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/PlayerTraceShowData.java similarity index 90% rename from BauSystem_Main/src/de/steamwar/bausystem/features/tracer/PlayerTraceShowData.java rename to BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/PlayerTraceShowData.java index 8ec215c4..8ddff2d3 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/PlayerTraceShowData.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/PlayerTraceShowData.java @@ -17,10 +17,8 @@ * along with this program. If not, see . */ -package de.steamwar.bausystem.features.tracer; +package de.steamwar.bausystem.features.tracer.rendering; -import de.steamwar.bausystem.features.tracer.rendering.BundleFilter; -import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; import lombok.Getter; import lombok.Setter; @@ -42,7 +40,7 @@ public class PlayerTraceShowData { } public Set getEffectiveViewFlags() { - //Manage flags and required flags + // Manage flags and required flags Set flagList = new HashSet<>(); for (ViewFlag flag : viewFlags.values()) { flagList.add(flag); @@ -51,7 +49,7 @@ public class PlayerTraceShowData { } } - //Manage inverse flags + // Manage inverse flags ViewFlag.inverseFlags.forEach(viewFlag -> { if (!flagList.remove(viewFlag)) { flagList.add(viewFlag); @@ -73,6 +71,8 @@ public class PlayerTraceShowData { return viewFlags.containsKey(clazz) && viewFlags.size() == 1; } + // TODO ? + @SuppressWarnings("unchecked") public T getViewFlag(Class clazz) { return (T) viewFlags.get(clazz); } -- 2.39.5 From ed799b2937b13cb53c4f5af3dfaadc731ebd1838 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 17 Apr 2024 16:31:36 +0200 Subject: [PATCH 080/111] Fix some things maybe! --- .../portablehole/PortableHoleListener.java | 115 ++++++++ .../bausystem/features/tracer/TNTPoint.java | 16 +- .../bausystem/features/tracer/Trace.java | 97 +++---- .../features/tracer/TraceCommand.java | 45 ++-- .../features/tracer/TraceManager.java | 24 +- .../features/tracer/TraceRecorder.java | 18 +- .../tracer/TraceRecordingWrapper.java | 19 +- MiningIII.md | 252 ++++++++++++++++++ 8 files changed, 449 insertions(+), 137 deletions(-) create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/portablehole/PortableHoleListener.java create mode 100644 MiningIII.md diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/portablehole/PortableHoleListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/portablehole/PortableHoleListener.java new file mode 100644 index 00000000..9bc5a947 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/portablehole/PortableHoleListener.java @@ -0,0 +1,115 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2024 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.portablehole; + +import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.features.tpslimit.TPSUtils; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.block.BlockState; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerInteractEvent; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +// @Linked +public class PortableHoleListener implements Listener { + + private Map> toReplace = new HashMap<>(); + + { + Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> { + List blockStates = toReplace.remove(TPSUtils.currentRealTick.get()); + if (blockStates == null) return; + blockStates.forEach(blockState -> { + blockState.update(true, false); + }); + }, 1, 1); + } + + @EventHandler + public void onPlayerInteract(PlayerInteractEvent event) { + if (!event.hasItem()) return; + if (event.getItem().getType() != Material.FIREWORK_STAR) return; + + BlockFace blockFace; + if (event.getPlayer().getLocation().getPitch() < -45) { + blockFace = BlockFace.UP; + } else if (event.getPlayer().getLocation().getPitch() > 45) { + blockFace = BlockFace.DOWN; + } else if (event.getPlayer().getLocation().getYaw() > 135) { + blockFace = BlockFace.NORTH; + } else if (event.getPlayer().getLocation().getYaw() > 45) { + blockFace = BlockFace.WEST; + } else if (event.getPlayer().getLocation().getYaw() > -45) { + blockFace = BlockFace.SOUTH; + } else if (event.getPlayer().getLocation().getYaw() > -135) { + blockFace = BlockFace.EAST; + } else { + blockFace = BlockFace.NORTH; + } + + for (int i = 0; i < 10; i++) { + Location source = event.getPlayer().getLocation().getBlock().getLocation().clone(); + source.add(blockFace.getDirection().clone().multiply(i + 1 + (blockFace == BlockFace.UP ? 1 : 0))); + Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> { + long reappearTime = TPSUtils.currentRealTick.get() + 100; + if (blockFace == BlockFace.UP || blockFace == BlockFace.DOWN) { + for (int dx = -1; dx <= 1; dx++) { + for (int dz = -1; dz <= 1; dz++) { + Block block = source.clone().add(dx, 0, dz).getBlock(); + BlockState blockState = block.getState(); + if (blockState.getType().isAir()) continue; + toReplace.computeIfAbsent(reappearTime, __ -> new ArrayList<>()).add(blockState); + block.setType(Material.AIR); + } + } + } else if (blockFace == BlockFace.NORTH || blockFace == BlockFace.SOUTH) { + for (int dx = -1; dx <= 1; dx++) { + for (int dy = 0; dy <= 2; dy++) { + Block block = source.clone().add(dx, dy, 0).getBlock(); + BlockState blockState = block.getState(); + if (blockState.getType().isAir()) continue; + toReplace.computeIfAbsent(reappearTime, __ -> new ArrayList<>()).add(blockState); + block.setType(Material.AIR); + } + } + } else { + for (int dy = 0; dy <= 2; dy++) { + for (int dz = -1; dz <= 1; dz++) { + Block block = source.clone().add(0, dy, dz).getBlock(); + BlockState blockState = block.getState(); + if (blockState.getType().isAir()) continue; + toReplace.computeIfAbsent(reappearTime, __ -> new ArrayList<>()).add(blockState); + block.setType(Material.AIR); + } + } + } + }, i); + } + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPoint.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPoint.java index eeb5f0e1..4dc8cf39 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPoint.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPoint.java @@ -149,7 +149,6 @@ public class TNTPoint implements Externalizable { objectOutput.writeBoolean(destroyedTestBlock); objectOutput.writeLong(ticksSinceStart); objectOutput.writeInt(fuse); - objectOutput.writeUTF(location.getWorld().getName()); objectOutput.writeDouble(location.getX()); objectOutput.writeDouble(location.getY()); objectOutput.writeDouble(location.getZ()); @@ -168,11 +167,10 @@ public class TNTPoint implements Externalizable { destroyedTestBlock = objectInput.readBoolean(); ticksSinceStart = objectInput.readLong(); fuse = objectInput.readInt(); - String worldName = objectInput.readUTF(); double locX = objectInput.readDouble(); double locY = objectInput.readDouble(); double locZ = objectInput.readDouble(); - location = new Location(Bukkit.getWorld(worldName), locX, locY, locZ); + location = new Location(Bukkit.getWorlds().get(0), locX, locY, locZ); double velX = objectInput.readDouble(); double velY = objectInput.readDouble(); double velZ = objectInput.readDouble(); @@ -192,15 +190,11 @@ public class TNTPoint implements Externalizable { @Override public boolean equals(Object obj) { - if (!(obj instanceof TNTPoint)) - return false; + if (!(obj instanceof TNTPoint)) return false; TNTPoint record = (TNTPoint) obj; - if (record.isExplosion() != explosion) - return false; - if (!record.getLocation().equals(location)) - return false; - if (!record.getVelocity().equals(velocity)) - return false; + if (record.isExplosion() != explosion) return false; + if (!record.getLocation().equals(location)) return false; + if (!record.getVelocity().equals(velocity)) return false; return true; } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index 838436fe..bb69bea2 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -28,6 +28,7 @@ import de.steamwar.entity.REntity; import de.steamwar.entity.REntityServer; import lombok.Cleanup; import lombok.Getter; +import lombok.SneakyThrows; import org.bukkit.entity.Player; import java.io.*; @@ -73,6 +74,7 @@ public class Trace { private final Map entityServerMap = new HashMap<>(); + @SneakyThrows public Trace(Region region, List recordList) { this.uuid = UUID.randomUUID(); recordsSaveFile = new File(TraceManager.tracesFolder, uuid + ".records"); @@ -81,17 +83,14 @@ public class Trace { records = new SoftReference<>(recordList); metadataSaveFile = new File(TraceManager.tracesFolder, uuid + ".meta"); - try { - @Cleanup - ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(metadataSaveFile)); - outputStream.writeUTF(uuid.toString()); - outputStream.writeUTF(region.getName()); - outputStream.writeObject(date); - } catch (IOException | ClassCastException e) { - e.printStackTrace(); - } + @Cleanup + ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(metadataSaveFile)); + outputStream.writeUTF(uuid.toString()); + outputStream.writeUTF(region.getName()); + outputStream.writeObject(date); } + @SneakyThrows public Trace(File metadataSaveFile) { String uuid = null; Region region = null; @@ -106,8 +105,6 @@ public class Trace { region = Region.getREGION_MAP().get(inputStream.readUTF()); date = (Date) inputStream.readObject(); inputStream.close(); - } catch (IOException | ClassNotFoundException e) { - e.printStackTrace(); } finally { this.uuid = UUID.fromString(uuid); this.region = region; @@ -115,8 +112,6 @@ public class Trace { recordsSaveFile = new File(TraceManager.tracesFolder, uuid + ".records"); this.records = new SoftReference<>(null); } - - System.out.println(this); } /** @@ -175,8 +170,9 @@ public class Trace { * @param playerTraceShowData The showData for modifying the rendering */ private void render(List records, REntityServer entityServer, PlayerTraceShowData playerTraceShowData) { - if (records.isEmpty()) + if (records.isEmpty()) { return; + } List workingRecords = new ArrayList<>(records); Set flagList = playerTraceShowData.getEffectiveViewFlags(); @@ -221,7 +217,8 @@ public class Trace { private List> bundleRecords(List records, BundleFilter filter) { List> bundles = new ArrayList<>(); - recordsLoop: for (TNTPoint record : records) { + recordsLoop: + for (TNTPoint record : records) { if (bundles.isEmpty()) { List firstBundle = new ArrayList<>(); firstBundle.add(record); @@ -246,26 +243,6 @@ public class Trace { return bundles; } - /** - * Makes the first passed player follow the trace render of the second passed - * player - * - * @param player - * @param toFollow - */ - public void follow(Player player, Player toFollow) { - throw new UnsupportedOperationException(); - } - - /** - * Makes the passed player stop following any other players trace render - * - * @param player - */ - public void unfollow(Player player) { - throw new UnsupportedOperationException(); - } - /** * Hides this trail for the given player * @@ -273,11 +250,13 @@ public class Trace { */ public void hide(Player player) { REntityServer entityServer = entityServerMap.remove(player); - if (entityServer == null) + if (entityServer == null) { return; + } entityServer.removePlayer(player); - if (entityServer.getPlayers().isEmpty()) + if (entityServer.getPlayers().isEmpty()) { entityServer.close(); + } } public void hide() { @@ -287,36 +266,36 @@ public class Trace { entityServerMap.clear(); } + @SneakyThrows private void loadRecords() { - try { - List records = new ArrayList<>(); - @Cleanup - FileInputStream fileInputStream = new FileInputStream(recordsSaveFile); - @Cleanup - ObjectInputStream inputStream = new ObjectInputStream(fileInputStream); - while (fileInputStream.getChannel().position() < recordsSaveFile.length()) { - records.add((TNTPoint) inputStream.readObject()); - } + List records = new ArrayList<>(); - System.out.println("Loaded... " + records); + @Cleanup + FileInputStream fileInputStream = new FileInputStream(recordsSaveFile); - Map> histories = new HashMap<>(); - for (TNTPoint record : records) { - int tntId = record.getTntId(); - List history = histories.computeIfAbsent(tntId, id -> new ArrayList<>()); - history.add(record); - record.setHistory(history); - } - - this.records = new SoftReference<>(records); - } catch (IOException | ClassNotFoundException e) { - e.printStackTrace(); + @Cleanup + ObjectInputStream inputStream = new ObjectInputStream(fileInputStream); + while (fileInputStream.getChannel().position() < recordsSaveFile.length()) { + records.add((TNTPoint) inputStream.readObject()); } + + System.out.println("Loaded... " + records); + + Map> histories = new HashMap<>(); + for (TNTPoint record : records) { + int tntId = record.getTntId(); + List history = histories.computeIfAbsent(tntId, id -> new ArrayList<>()); + history.add(record); + record.setHistory(history); + } + + this.records = new SoftReference<>(records); } public List getRecords() { - if (records.get() == null) + if (records.get() == null) { loadRecords(); + } return records.get(); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index 370f0fed..ee3467af 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -73,8 +73,7 @@ public class TraceCommand extends SWCommand { } @Register(value = { "show", "at" }, description = "TRACE_COMMAND_HELP_SHOW_AT_WITH") - public void showAt(@Validator Player player, @Min(intValue = 0) int time, @StaticValue("with") String with, - @OptionalValue("STRICT") BundleFilter bundleFilter, @ArrayLength(min = 1) ViewFlag... flags) { + public void showAt(@Validator Player player, @Min(intValue = 0) int time, @StaticValue("with") String with, @OptionalValue("STRICT") BundleFilter bundleFilter, @ArrayLength(min = 1) ViewFlag... flags) { showInternal(player, time, time, bundleFilter, flags); BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_AT", player, time); } @@ -87,9 +86,7 @@ public class TraceCommand extends SWCommand { } @Register(value = { "show", "from" }, description = "TRACE_COMMAND_HELP_SHOW_FROM_TO_WITH") - public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("to") String toString, - int to, @StaticValue("with") String with, @OptionalValue("STRICT") BundleFilter bundleFilter, - @ArrayLength(min = 1) ViewFlag... flags) { + public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("to") String toString, int to, @StaticValue("with") String with, @OptionalValue("STRICT") BundleFilter bundleFilter, @ArrayLength(min = 1) ViewFlag... flags) { if (to < from) { BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_TO_SMALLER", player); return; @@ -117,8 +114,7 @@ public class TraceCommand extends SWCommand { } @Register(value = { "show", "from" }, description = "TRACE_COMMAND_HELP_SHOW_FROM_TO") - public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("to") String toString, - int to) { + public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("to") String toString, int to) { TraceManager.instance.renderAt(player, from, to); BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_FROM_TO", player, from, to); } @@ -143,8 +139,7 @@ public class TraceCommand extends SWCommand { } @Register(value = "isolate", description = "TRACE_COMMAND_HELP_ISOLATE") - public void isolate(@Validator Player player, Trace trace, - @ErrorMessage("TRACE_RECORD_ID_INVALID") TNTPoint... records) { + public void isolate(@Validator Player player, Trace trace, @ErrorMessage("TRACE_RECORD_ID_INVALID") TNTPoint... records) { TraceManager.instance.isolate(player, records); // TODO: Add Message! } @@ -156,18 +151,18 @@ public class TraceCommand extends SWCommand { @Register(value = "follow", description = "TRACE_COMMAND_HELP_SHOW") public void follow(@Validator Player player, Player toFollow) { - // TODO: Implement - for (Trace trace : TraceManager.instance.getAll()) { - trace.follow(player, toFollow); + if (player == toFollow) { + // TODO: Implement message + return; } + TraceManager.instance.follow(player, toFollow); + // TODO: Implement message } @Register(value = "unfollow", description = "TRACE_COMMAND_HELP_SHOW") public void unfollow(@Validator Player player) { - // TODO: Implement - for (Trace trace : TraceManager.instance.getAll()) { - trace.unfollow(player); - } + TraceManager.instance.unfollow(player); + // TODO: Implement message } @ClassMapper(value = Trace.class, local = true) @@ -179,8 +174,7 @@ public class TraceCommand extends SWCommand { } @Override - public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, - String s) { + public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) { return TraceManager.instance.getAllIds().stream() .map(Object::toString) .collect(Collectors.toList()); @@ -194,8 +188,7 @@ public class TraceCommand extends SWCommand { @Override public TNTPoint map(CommandSender commandSender, PreviousArguments previousArguments, String s) { Trace trace = previousArguments.getFirst(Trace.class).orElse(null); - if (trace == null) - return null; + if (trace == null) return null; int id = Integer.parseInt(s); return trace.getRecords().stream() @@ -206,11 +199,9 @@ public class TraceCommand extends SWCommand { // TODO change when new command framework update @Override - public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, - String s) { + public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) { Trace trace = previousArguments.getFirst(Trace.class).orElse(null); - if (trace == null) - return null; + if (trace == null) return null; return trace.getUsedIds(); } }; @@ -230,8 +221,7 @@ public class TraceCommand extends SWCommand { } @Override - public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, - String s) { + public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) { if (s.length() == 0) { return new ArrayList<>(); } @@ -263,8 +253,7 @@ public class TraceCommand extends SWCommand { } @Override - public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, - String s) { + public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) { return ViewFlag.flags.stream() .flatMap(viewFlag -> Stream.concat(Stream.of("--" + viewFlag.name), Arrays.stream(viewFlag.aliases).map(name -> "-" + name))) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index dd4225f7..6de2a88e 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -204,8 +204,7 @@ public class TraceManager implements Listener { Region region = Region.getRegion(player.getLocation()); PlayerTraceShowData previous = showDataPerRegionPerPlayer.getOrDefault(region, Collections.emptyMap()) .remove(player); - if (previous == null) - return; + if (previous == null) return; tracesByRegion.getOrDefault(player, Collections.emptyMap()).forEach((integer, trace) -> { trace.hide(player); followerMap.getOrDefault(player, Collections.emptySet()).forEach(trace::hide); @@ -213,8 +212,7 @@ public class TraceManager implements Listener { } public boolean follow(Player follower, Player following) { - if (followerMap.containsKey(follower)) - return false; + if (followerMap.containsKey(follower)) return false; if (followerMap.entrySet().stream().anyMatch(playerSetEntry -> playerSetEntry.getValue().contains(follower))) { unfollow(follower); } @@ -229,8 +227,7 @@ public class TraceManager implements Listener { } PlayerTraceShowData playerTraceShowData = playerPlayerTraceShowDataMap.get(following); - if (playerTraceShowData == null) - return; + if (playerTraceShowData == null) return; tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> { trace.render(follower, playerTraceShowData); }); @@ -239,30 +236,25 @@ public class TraceManager implements Listener { } public void unfollow(Player follower) { - if (followerMap.containsKey(follower)) - return; + if (followerMap.containsKey(follower)) return; List toRemove = new ArrayList<>(); Set toHide = new HashSet<>(); followerMap.forEach((player, players) -> { - if (players.remove(follower)) - toHide.add(follower); - if (players.isEmpty()) - toRemove.add(player); + if (players.remove(follower)) toHide.add(follower); + if (players.isEmpty()) toRemove.add(player); }); toRemove.forEach(followerMap::remove); showDataPerRegionPerPlayer.forEach((region, playerPlayerTraceShowDataMap) -> { toHide.forEach(player -> { - if (!playerPlayerTraceShowDataMap.containsKey(player)) - return; + if (!playerPlayerTraceShowDataMap.containsKey(player)) return; tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> { trace.hide(follower); }); }); PlayerTraceShowData playerTraceShowData = playerPlayerTraceShowDataMap.get(follower); - if (playerTraceShowData == null) - return; + if (playerTraceShowData == null) return; tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> { trace.render(follower, playerTraceShowData); }); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java index cb7ac370..3266850f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java @@ -92,8 +92,7 @@ public class TraceRecorder implements Listener { */ public void checkForAutoTraceFinish() { for (Region region : autoTraceRegions) { - if (autoTraceRegions.contains(region) - && trackedTNT.getOrDefault(region, Collections.emptyList()).size() == 0) { + if (autoTraceRegions.contains(region) && trackedTNT.getOrDefault(region, Collections.emptyList()).size() == 0) { stopRecording(region); } } @@ -105,8 +104,9 @@ public class TraceRecorder implements Listener { * @param region region to be recorded */ public int startRecording(Region region) { - if (activeTraces.containsKey(region)) + if (activeTraces.containsKey(region)) { return -1; + } TraceRecordingWrapper wrappedTrace = new TraceRecordingWrapper(region); activeTraces.put(region, wrappedTrace); @@ -120,8 +120,7 @@ public class TraceRecorder implements Listener { */ public void stopRecording(Region region) { TraceRecordingWrapper wrappedTrace = activeTraces.getOrDefault(region, null); - if (wrappedTrace == null) - return; + if (wrappedTrace == null) return; activeTraces.remove(region); for (TNTPrimed tnt : trackedTNT.getOrDefault(region, Collections.emptyList())) { @@ -184,8 +183,7 @@ public class TraceRecorder implements Listener { */ @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onTNTSpawn(EntitySpawnEvent event) { - if (!(event.getEntity() instanceof TNTPrimed)) - return; + if (!(event.getEntity() instanceof TNTPrimed)) return; Region region = Region.getRegion(event.getLocation()); @@ -214,12 +212,10 @@ public class TraceRecorder implements Listener { */ @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onTNTExplode(EntityExplodeEvent event) { - if (!(event.getEntity() instanceof TNTPrimed)) - return; + if (!(event.getEntity() instanceof TNTPrimed)) return; Region region = tntSpawnRegion.getOrDefault((TNTPrimed) event.getEntity(), null); - if (region == null) - return; + if (region == null) return; trackedTNT.get(region).remove((TNTPrimed) event.getEntity()); tntSpawnRegion.remove((TNTPrimed) event.getEntity()); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java index 7a264d51..735a975d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java @@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.tracer; import de.steamwar.bausystem.features.tpslimit.TPSUtils; import de.steamwar.bausystem.region.Region; import lombok.Getter; +import lombok.SneakyThrows; import java.io.File; import java.io.FileOutputStream; @@ -45,6 +46,7 @@ public class TraceRecordingWrapper { @Getter private final Trace trace; + @SneakyThrows public TraceRecordingWrapper(Region region) { this.region = region; startTick = TPSUtils.currentTick.get(); @@ -54,12 +56,7 @@ public class TraceRecordingWrapper { trace = new Trace(region, recordList); TraceManager.instance.add(trace); File recordsSaveFile = new File(TraceManager.tracesFolder, trace.getUuid() + ".records"); - try { - recordsOutputStream = new ObjectOutputStream(new FileOutputStream(recordsSaveFile)); - } catch (IOException e) { - e.printStackTrace(); - } - + recordsOutputStream = new ObjectOutputStream(new FileOutputStream(recordsSaveFile)); } public int getNextOpenRecordIdAndIncrement() { @@ -80,6 +77,7 @@ public class TraceRecordingWrapper { recordsToAdd.forEach(record -> { try { recordsOutputStream.writeObject(record); + recordsOutputStream.flush(); } catch (IOException e) { e.printStackTrace(); } @@ -91,12 +89,9 @@ public class TraceRecordingWrapper { System.out.println(recordList); } + @SneakyThrows // TODO: Why is this not called? protected void finalizeRecording() { - try { - recordsOutputStream.flush(); - recordsOutputStream.close(); - } catch (IOException e) { - e.printStackTrace(); - } + recordsOutputStream.flush(); + recordsOutputStream.close(); } } diff --git a/MiningIII.md b/MiningIII.md new file mode 100644 index 00000000..4e2b1d32 --- /dev/null +++ b/MiningIII.md @@ -0,0 +1,252 @@ +# Mining III + +Stats menu, blocks broken +Pickaxe skins? / Cosmetics (Armor) +Crystals? +Music selector +McPrison enchantments? +Legendary enchantments? -> Overdrive entchantments via prestige points +Combo Perk Enchantments? +Show proc rate enchtantment +Crystal Level increase by mining? +Keeping -> Keep an enchantment or n levels on random enchantments +Max upgrade? +5 upgrade? +Auto buy? + +## Enchantments + +### Efficiency + +- Increases Mining speed +- id: efficiency +- max: 10 +- cost_block_base: 50 +- cost_block_inc: 10 +- cost_shards_base: -80 +- cost_shards_inc: 20 + +### Haste + +- Gain Haste +- id: haste +- max: 10 +- cost_block_base: 1000 +- cost_block_inc: 0 +- cost_gold_base: 100 +- cost_gold_inc: 100 + +### Speed + +- Gain Speed +- id: speed +- max: 5 +- cost_blocks_base: 500 +- cost_blocks_inc: -100 +- cost_shards_base: 100 +- cost_shards_inc: 150 + +### Fortune + +- Increases Blocks gained +- id: fortune +- max: 50 +- cost_block_base: 100 +- cost_block_inc: 25 +- cost_gold_base: 200 +- cost_gold_inc: 50 +- cost_shards_base: -40 +- cost_shards_inc: 10 + +### Prosperity + +- Rare chance to greatly increse block gain +- id: prosperity +- max: 10 +- cost_block_base: 1000 +- cost_block_inc: 100 +- cost_gold_base: 1000 +- cost_gold_inc: 100 +- cost_shards_base: 100 +- cost_shards_inc: 100 + +### Gifted + +- Get luckier prosperity procs +- id: gifted +- max: 25 +- cost_block_base: 10000 +- cost_block_inc: 1000 +- cost_shards_base: 1000 +- cost_shards_inc: 250 + +### Shard Fusing Tome + +- Chance to turn ores into shards +- id: shard_fusing_tome +- max: 10 +- cost_block_base: 5000 +- cost_block_inc: 500 +- cost_shards_base: 1000 +- cost_shards_inc: 0 + +### Unstable shards + +- Destroy every shard created by Shard Fusing Tome +- id: unstable_shards +- max: 1 +- cost_block_base: 100000 +- cost_block_inc: 0 +- cost_gold_base: 25000 +- cost_gold_inc: 0 +- cost_shards_base: 10000 +- cost_shards_inc: 0 + +### Gatherer + +- Chance to gain Gold on Block break +- id: gatherer +- max: 10 +- cost_block_base: 1000 +- cost_block_inc: 1000 +- cost_gold_base: 1000 +- cost_gold_inc: 0 + +### Block Shatterer + +- Greatly increase Block gain +- id: block_shatterer +- max: 10 +- cost_block_base: 5000 +- cost_block_inc: 5000 +- cost_gold_base: 1000 +- cost_gold_inc: 1000 +- cost_shards_base: 500 +- cost_shards_inc: 500 + +### Gold Shatterer + +- Greatly increase Gold gain +- id: gold_shatterer +- max: 10 +- cost_block_base: 1000 +- cost_block_inc: 1000 +- cost_gold_base: 5000 +- cost_gold_inc: 5000 +- cost_shards_base: 500 +- cost_shards_inc: 500 + +### Shard Shatterer + +- Greatly increase Shard gain +- id: shard_shatterer +- max: 10 +- cost_block_base: 5000 +- cost_block_inc: 5000 +- cost_gold_base: 500 +- cost_gold_inc: 500 +- cost_shards_base: 1000 +- cost_shards_inc: 1000 + +### Explosive + +- Chance to explode +- id: explosive +- max: 30 +- cost_block_base: 200 +- cost_block_inc: 50 +- cost_gold_base: -700 +- cost_gold_inc: 100 +- cost_shards_base: -3200 +- cost_shards_inc: 200 + +### Laser + +- Chance to fire a laser +- id: laser +- max: 300 +- cost_block_base: 1000 +- cost_block_inc: 0 +- cost_gold_base: 3000 +- cost_gold_inc: -20 +- cost_shards_base: 0 +- cost_shards_inc: 30 + +### Jackhammer + +- Chance to destroy 3*3*3 (100) or 5*5*5 (200) area +- id: jackhammer +- max: 200 +- cost_block_base: 10000 +- cost_block_inc: 100 +- cost_gold_base: -12250 +- cost_gold_inc: 250 +- cost_shards_base: -74500 +- cost_shards_inc: 500 + +### Corrosive Mine + +- Destroy level number of blocks in the vicinity +- id: corrosive_mine +- max: 25 +- cost_block_base: 5000 +- cost_block_inc: 100 +- cost_gold_base: 5000 +- cost_gold_inc: 100 +- cost_shards_base: 5000 +- cost_shards_inc: 100 + +### Jackpot + +- Chance to receive the jackpot of 1000 blocks, 1000 gold and 1000 shards +- id: jackpot +- max: 1 +- cost_shards_base: 50000 +- cost_shards_inc: 0 + +### Dual Pickaxe + +- Chance to proc enchantments on another block in vicinity +- id: dual_pickaxe +- max: 10 +- cost_block_base: 2500 +- cost_block_inc: 500 +- cost_gold_base: 2500 +- cost_gold_inc: 500 +- cost_shards_base: 2500 +- cost_shards_inc: 500 + +### Luck + +- Chance for laser bounces to proc any enchantment +- id: luck +- max: 10 +- cost_block_base: 10000 +- cost_block_inc: 10000 +- cost_gold_base: 10000 +- cost_gold_inc: 10000 +- cost_shards_base: 10000 +- cost_shards_inc: 10000 + +### Lumberjack + +- Change to axe while looking onto Wood +- id: lumberjack +- max: 1 +- cost_block_base: 5000 +- cost_block_inc: 0 +- cost_gold_base: 5000 +- cost_gold_inc: 0 +- cost_shards_base: 5000 +- cost_shards_inc: 0 + +### Soul Remover + +- Change to shovel while looking onto Wood +- id: soul_remover +- max: 1 +- cost_block_base: 5000 +- cost_block_inc: 0 +- cost_gold_base: 5000 +- cost_gold_inc: 0 +- cost_shards_base: 5000 +- cost_shards_inc: 0 \ No newline at end of file -- 2.39.5 From 163967483fd6ccf27ad1545f03254e02a0871ee4 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 17 Apr 2024 21:41:56 +0200 Subject: [PATCH 081/111] Remove accidental committed stuff --- .../portablehole/PortableHoleListener.java | 115 -------- MiningIII.md | 252 ------------------ 2 files changed, 367 deletions(-) delete mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/portablehole/PortableHoleListener.java delete mode 100644 MiningIII.md diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/portablehole/PortableHoleListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/portablehole/PortableHoleListener.java deleted file mode 100644 index 9bc5a947..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/portablehole/PortableHoleListener.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2024 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.portablehole; - -import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.features.tpslimit.TPSUtils; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.block.BlockState; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerInteractEvent; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -// @Linked -public class PortableHoleListener implements Listener { - - private Map> toReplace = new HashMap<>(); - - { - Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> { - List blockStates = toReplace.remove(TPSUtils.currentRealTick.get()); - if (blockStates == null) return; - blockStates.forEach(blockState -> { - blockState.update(true, false); - }); - }, 1, 1); - } - - @EventHandler - public void onPlayerInteract(PlayerInteractEvent event) { - if (!event.hasItem()) return; - if (event.getItem().getType() != Material.FIREWORK_STAR) return; - - BlockFace blockFace; - if (event.getPlayer().getLocation().getPitch() < -45) { - blockFace = BlockFace.UP; - } else if (event.getPlayer().getLocation().getPitch() > 45) { - blockFace = BlockFace.DOWN; - } else if (event.getPlayer().getLocation().getYaw() > 135) { - blockFace = BlockFace.NORTH; - } else if (event.getPlayer().getLocation().getYaw() > 45) { - blockFace = BlockFace.WEST; - } else if (event.getPlayer().getLocation().getYaw() > -45) { - blockFace = BlockFace.SOUTH; - } else if (event.getPlayer().getLocation().getYaw() > -135) { - blockFace = BlockFace.EAST; - } else { - blockFace = BlockFace.NORTH; - } - - for (int i = 0; i < 10; i++) { - Location source = event.getPlayer().getLocation().getBlock().getLocation().clone(); - source.add(blockFace.getDirection().clone().multiply(i + 1 + (blockFace == BlockFace.UP ? 1 : 0))); - Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> { - long reappearTime = TPSUtils.currentRealTick.get() + 100; - if (blockFace == BlockFace.UP || blockFace == BlockFace.DOWN) { - for (int dx = -1; dx <= 1; dx++) { - for (int dz = -1; dz <= 1; dz++) { - Block block = source.clone().add(dx, 0, dz).getBlock(); - BlockState blockState = block.getState(); - if (blockState.getType().isAir()) continue; - toReplace.computeIfAbsent(reappearTime, __ -> new ArrayList<>()).add(blockState); - block.setType(Material.AIR); - } - } - } else if (blockFace == BlockFace.NORTH || blockFace == BlockFace.SOUTH) { - for (int dx = -1; dx <= 1; dx++) { - for (int dy = 0; dy <= 2; dy++) { - Block block = source.clone().add(dx, dy, 0).getBlock(); - BlockState blockState = block.getState(); - if (blockState.getType().isAir()) continue; - toReplace.computeIfAbsent(reappearTime, __ -> new ArrayList<>()).add(blockState); - block.setType(Material.AIR); - } - } - } else { - for (int dy = 0; dy <= 2; dy++) { - for (int dz = -1; dz <= 1; dz++) { - Block block = source.clone().add(0, dy, dz).getBlock(); - BlockState blockState = block.getState(); - if (blockState.getType().isAir()) continue; - toReplace.computeIfAbsent(reappearTime, __ -> new ArrayList<>()).add(blockState); - block.setType(Material.AIR); - } - } - } - }, i); - } - } -} diff --git a/MiningIII.md b/MiningIII.md deleted file mode 100644 index 4e2b1d32..00000000 --- a/MiningIII.md +++ /dev/null @@ -1,252 +0,0 @@ -# Mining III - -Stats menu, blocks broken -Pickaxe skins? / Cosmetics (Armor) -Crystals? -Music selector -McPrison enchantments? -Legendary enchantments? -> Overdrive entchantments via prestige points -Combo Perk Enchantments? -Show proc rate enchtantment -Crystal Level increase by mining? -Keeping -> Keep an enchantment or n levels on random enchantments -Max upgrade? +5 upgrade? -Auto buy? - -## Enchantments - -### Efficiency - -- Increases Mining speed -- id: efficiency -- max: 10 -- cost_block_base: 50 -- cost_block_inc: 10 -- cost_shards_base: -80 -- cost_shards_inc: 20 - -### Haste - -- Gain Haste -- id: haste -- max: 10 -- cost_block_base: 1000 -- cost_block_inc: 0 -- cost_gold_base: 100 -- cost_gold_inc: 100 - -### Speed - -- Gain Speed -- id: speed -- max: 5 -- cost_blocks_base: 500 -- cost_blocks_inc: -100 -- cost_shards_base: 100 -- cost_shards_inc: 150 - -### Fortune - -- Increases Blocks gained -- id: fortune -- max: 50 -- cost_block_base: 100 -- cost_block_inc: 25 -- cost_gold_base: 200 -- cost_gold_inc: 50 -- cost_shards_base: -40 -- cost_shards_inc: 10 - -### Prosperity - -- Rare chance to greatly increse block gain -- id: prosperity -- max: 10 -- cost_block_base: 1000 -- cost_block_inc: 100 -- cost_gold_base: 1000 -- cost_gold_inc: 100 -- cost_shards_base: 100 -- cost_shards_inc: 100 - -### Gifted - -- Get luckier prosperity procs -- id: gifted -- max: 25 -- cost_block_base: 10000 -- cost_block_inc: 1000 -- cost_shards_base: 1000 -- cost_shards_inc: 250 - -### Shard Fusing Tome - -- Chance to turn ores into shards -- id: shard_fusing_tome -- max: 10 -- cost_block_base: 5000 -- cost_block_inc: 500 -- cost_shards_base: 1000 -- cost_shards_inc: 0 - -### Unstable shards - -- Destroy every shard created by Shard Fusing Tome -- id: unstable_shards -- max: 1 -- cost_block_base: 100000 -- cost_block_inc: 0 -- cost_gold_base: 25000 -- cost_gold_inc: 0 -- cost_shards_base: 10000 -- cost_shards_inc: 0 - -### Gatherer - -- Chance to gain Gold on Block break -- id: gatherer -- max: 10 -- cost_block_base: 1000 -- cost_block_inc: 1000 -- cost_gold_base: 1000 -- cost_gold_inc: 0 - -### Block Shatterer - -- Greatly increase Block gain -- id: block_shatterer -- max: 10 -- cost_block_base: 5000 -- cost_block_inc: 5000 -- cost_gold_base: 1000 -- cost_gold_inc: 1000 -- cost_shards_base: 500 -- cost_shards_inc: 500 - -### Gold Shatterer - -- Greatly increase Gold gain -- id: gold_shatterer -- max: 10 -- cost_block_base: 1000 -- cost_block_inc: 1000 -- cost_gold_base: 5000 -- cost_gold_inc: 5000 -- cost_shards_base: 500 -- cost_shards_inc: 500 - -### Shard Shatterer - -- Greatly increase Shard gain -- id: shard_shatterer -- max: 10 -- cost_block_base: 5000 -- cost_block_inc: 5000 -- cost_gold_base: 500 -- cost_gold_inc: 500 -- cost_shards_base: 1000 -- cost_shards_inc: 1000 - -### Explosive - -- Chance to explode -- id: explosive -- max: 30 -- cost_block_base: 200 -- cost_block_inc: 50 -- cost_gold_base: -700 -- cost_gold_inc: 100 -- cost_shards_base: -3200 -- cost_shards_inc: 200 - -### Laser - -- Chance to fire a laser -- id: laser -- max: 300 -- cost_block_base: 1000 -- cost_block_inc: 0 -- cost_gold_base: 3000 -- cost_gold_inc: -20 -- cost_shards_base: 0 -- cost_shards_inc: 30 - -### Jackhammer - -- Chance to destroy 3*3*3 (100) or 5*5*5 (200) area -- id: jackhammer -- max: 200 -- cost_block_base: 10000 -- cost_block_inc: 100 -- cost_gold_base: -12250 -- cost_gold_inc: 250 -- cost_shards_base: -74500 -- cost_shards_inc: 500 - -### Corrosive Mine - -- Destroy level number of blocks in the vicinity -- id: corrosive_mine -- max: 25 -- cost_block_base: 5000 -- cost_block_inc: 100 -- cost_gold_base: 5000 -- cost_gold_inc: 100 -- cost_shards_base: 5000 -- cost_shards_inc: 100 - -### Jackpot - -- Chance to receive the jackpot of 1000 blocks, 1000 gold and 1000 shards -- id: jackpot -- max: 1 -- cost_shards_base: 50000 -- cost_shards_inc: 0 - -### Dual Pickaxe - -- Chance to proc enchantments on another block in vicinity -- id: dual_pickaxe -- max: 10 -- cost_block_base: 2500 -- cost_block_inc: 500 -- cost_gold_base: 2500 -- cost_gold_inc: 500 -- cost_shards_base: 2500 -- cost_shards_inc: 500 - -### Luck - -- Chance for laser bounces to proc any enchantment -- id: luck -- max: 10 -- cost_block_base: 10000 -- cost_block_inc: 10000 -- cost_gold_base: 10000 -- cost_gold_inc: 10000 -- cost_shards_base: 10000 -- cost_shards_inc: 10000 - -### Lumberjack - -- Change to axe while looking onto Wood -- id: lumberjack -- max: 1 -- cost_block_base: 5000 -- cost_block_inc: 0 -- cost_gold_base: 5000 -- cost_gold_inc: 0 -- cost_shards_base: 5000 -- cost_shards_inc: 0 - -### Soul Remover - -- Change to shovel while looking onto Wood -- id: soul_remover -- max: 1 -- cost_block_base: 5000 -- cost_block_inc: 0 -- cost_gold_base: 5000 -- cost_gold_inc: 0 -- cost_shards_base: 5000 -- cost_shards_inc: 0 \ No newline at end of file -- 2.39.5 From d5d8c528627c47ee1a4550ec22debb13cc3d4619 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Wed, 17 Apr 2024 21:49:47 +0200 Subject: [PATCH 082/111] Fixed Ignite Flag Fixed Formating Signed-off-by: D4rkr34lm --- .../portablehole/PortableHoleListener.java | 115 -------- .../bausystem/features/tracer/TNTPoint.java | 9 +- .../bausystem/features/tracer/Trace.java | 2 - .../features/tracer/TraceCommand.java | 32 ++- .../features/tracer/TraceManager.java | 7 +- .../features/tracer/TraceRecorder.java | 9 +- .../tracer/TraceRecordingWrapper.java | 2 +- .../tracer/rendering/PlayerTraceShowData.java | 6 +- .../features/tracer/rendering/ViewFlag.java | 2 +- MiningIII.md | 252 ------------------ 10 files changed, 38 insertions(+), 398 deletions(-) delete mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/portablehole/PortableHoleListener.java delete mode 100644 MiningIII.md diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/portablehole/PortableHoleListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/portablehole/PortableHoleListener.java deleted file mode 100644 index 9bc5a947..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/portablehole/PortableHoleListener.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2024 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.portablehole; - -import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.features.tpslimit.TPSUtils; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.block.BlockState; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerInteractEvent; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -// @Linked -public class PortableHoleListener implements Listener { - - private Map> toReplace = new HashMap<>(); - - { - Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> { - List blockStates = toReplace.remove(TPSUtils.currentRealTick.get()); - if (blockStates == null) return; - blockStates.forEach(blockState -> { - blockState.update(true, false); - }); - }, 1, 1); - } - - @EventHandler - public void onPlayerInteract(PlayerInteractEvent event) { - if (!event.hasItem()) return; - if (event.getItem().getType() != Material.FIREWORK_STAR) return; - - BlockFace blockFace; - if (event.getPlayer().getLocation().getPitch() < -45) { - blockFace = BlockFace.UP; - } else if (event.getPlayer().getLocation().getPitch() > 45) { - blockFace = BlockFace.DOWN; - } else if (event.getPlayer().getLocation().getYaw() > 135) { - blockFace = BlockFace.NORTH; - } else if (event.getPlayer().getLocation().getYaw() > 45) { - blockFace = BlockFace.WEST; - } else if (event.getPlayer().getLocation().getYaw() > -45) { - blockFace = BlockFace.SOUTH; - } else if (event.getPlayer().getLocation().getYaw() > -135) { - blockFace = BlockFace.EAST; - } else { - blockFace = BlockFace.NORTH; - } - - for (int i = 0; i < 10; i++) { - Location source = event.getPlayer().getLocation().getBlock().getLocation().clone(); - source.add(blockFace.getDirection().clone().multiply(i + 1 + (blockFace == BlockFace.UP ? 1 : 0))); - Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> { - long reappearTime = TPSUtils.currentRealTick.get() + 100; - if (blockFace == BlockFace.UP || blockFace == BlockFace.DOWN) { - for (int dx = -1; dx <= 1; dx++) { - for (int dz = -1; dz <= 1; dz++) { - Block block = source.clone().add(dx, 0, dz).getBlock(); - BlockState blockState = block.getState(); - if (blockState.getType().isAir()) continue; - toReplace.computeIfAbsent(reappearTime, __ -> new ArrayList<>()).add(blockState); - block.setType(Material.AIR); - } - } - } else if (blockFace == BlockFace.NORTH || blockFace == BlockFace.SOUTH) { - for (int dx = -1; dx <= 1; dx++) { - for (int dy = 0; dy <= 2; dy++) { - Block block = source.clone().add(dx, dy, 0).getBlock(); - BlockState blockState = block.getState(); - if (blockState.getType().isAir()) continue; - toReplace.computeIfAbsent(reappearTime, __ -> new ArrayList<>()).add(blockState); - block.setType(Material.AIR); - } - } - } else { - for (int dy = 0; dy <= 2; dy++) { - for (int dz = -1; dz <= 1; dz++) { - Block block = source.clone().add(0, dy, dz).getBlock(); - BlockState blockState = block.getState(); - if (blockState.getType().isAir()) continue; - toReplace.computeIfAbsent(reappearTime, __ -> new ArrayList<>()).add(blockState); - block.setType(Material.AIR); - } - } - } - }, i); - } - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPoint.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPoint.java index 4dc8cf39..42c6d662 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPoint.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPoint.java @@ -179,8 +179,13 @@ public class TNTPoint implements Externalizable { @Override public String toString() { - return "TNTRecord{" + - "explosion=" + explosion + + return "TNTPoint{" + + "tntId=" + tntId + + ", explosion=" + explosion + + ", inWater=" + inWater + + ", afterFirstExplosion=" + afterFirstExplosion + + ", destroyedBuildArea=" + destroyedBuildArea + + ", destroyedTestBlock=" + destroyedTestBlock + ", ticksSinceStart=" + ticksSinceStart + ", fuse=" + fuse + ", location=" + location + diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index bb69bea2..f5292c38 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -279,8 +279,6 @@ public class Trace { records.add((TNTPoint) inputStream.readObject()); } - System.out.println("Loaded... " + records); - Map> histories = new HashMap<>(); for (TNTPoint record : records) { int tntId = record.getTntId(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index ee3467af..c88adc91 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -68,24 +68,24 @@ public class TraceCommand extends SWCommand { @Register(value = "show", description = "TRACE_COMMAND_HELP_SHOW") public void show(@Validator Player player, @OptionalValue("STRICT") BundleFilter bundleFilter, ViewFlag... flags) { - showInternal(player, 0, Integer.MAX_VALUE, bundleFilter, flags); + showInternal(player, bundleFilter, flags); BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW", player); } - @Register(value = { "show", "at" }, description = "TRACE_COMMAND_HELP_SHOW_AT_WITH") + @Register(value = {"show", "at"}, description = "TRACE_COMMAND_HELP_SHOW_AT_WITH") public void showAt(@Validator Player player, @Min(intValue = 0) int time, @StaticValue("with") String with, @OptionalValue("STRICT") BundleFilter bundleFilter, @ArrayLength(min = 1) ViewFlag... flags) { showInternal(player, time, time, bundleFilter, flags); BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_AT", player, time); } - @Register(value = { "show", "from" }, description = "TRACE_COMMAND_HELP_SHOW_FROM_WITH") + @Register(value = {"show", "from"}, description = "TRACE_COMMAND_HELP_SHOW_FROM_WITH") public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("with") String with, - @OptionalValue("STRICT") BundleFilter bundleFilter, @ArrayLength(min = 1) ViewFlag... flags) { + @OptionalValue("STRICT") BundleFilter bundleFilter, @ArrayLength(min = 1) ViewFlag... flags) { showInternal(player, from, Integer.MAX_VALUE, bundleFilter, flags); BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_FROM", player, from); } - @Register(value = { "show", "from" }, description = "TRACE_COMMAND_HELP_SHOW_FROM_TO_WITH") + @Register(value = {"show", "from"}, description = "TRACE_COMMAND_HELP_SHOW_FROM_TO_WITH") public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("to") String toString, int to, @StaticValue("with") String with, @OptionalValue("STRICT") BundleFilter bundleFilter, @ArrayLength(min = 1) ViewFlag... flags) { if (to < from) { BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_TO_SMALLER", player); @@ -95,30 +95,36 @@ public class TraceCommand extends SWCommand { BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_FROM_TO", player, from, to); } - private void showInternal(Player player, int from, int to, BundleFilter bundleFilter, ViewFlag... flags) { - PlayerTraceShowData playerTraceShowData = new PlayerTraceShowData(bundleFilter, flags); - playerTraceShowData.addViewFlag(new AtFlag(from, to)); - TraceManager.instance.show(player, playerTraceShowData); - } - @Register(value = { "show", "at" }, description = "TRACE_COMMAND_HELP_SHOW_AT") + @Register(value = {"show", "at"}, description = "TRACE_COMMAND_HELP_SHOW_AT") public void showAt(@Validator Player player, @Min(intValue = 0) int time) { TraceManager.instance.renderAt(player, time, time); BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_AT", player, time); } - @Register(value = { "show", "from" }, description = "TRACE_COMMAND_HELP_SHOW_FROM") + @Register(value = {"show", "from"}, description = "TRACE_COMMAND_HELP_SHOW_FROM") public void showFrom(@Validator Player player, @Min(intValue = 0) int from) { TraceManager.instance.renderAt(player, from, Integer.MAX_VALUE); BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_FROM", player, from); } - @Register(value = { "show", "from" }, description = "TRACE_COMMAND_HELP_SHOW_FROM_TO") + @Register(value = {"show", "from"}, description = "TRACE_COMMAND_HELP_SHOW_FROM_TO") public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("to") String toString, int to) { TraceManager.instance.renderAt(player, from, to); BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_FROM_TO", player, from, to); } + private void showInternal(Player player, BundleFilter bundleFilter, ViewFlag... flags) { + PlayerTraceShowData playerTraceShowData = new PlayerTraceShowData(bundleFilter, flags); + TraceManager.instance.show(player, playerTraceShowData); + } + + private void showInternal(Player player, int from, int to, BundleFilter bundleFilter, ViewFlag... flags) { + PlayerTraceShowData playerTraceShowData = new PlayerTraceShowData(bundleFilter, flags); + playerTraceShowData.addViewFlag(new AtFlag(from, to)); + TraceManager.instance.show(player, playerTraceShowData); + } + @Register(value = "hide", description = "TRACE_COMMAND_HELP_HIDE") public void hide(@Validator Player player) { TraceManager.instance.hide(player); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index 6de2a88e..db49af71 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -202,8 +202,7 @@ public class TraceManager implements Listener { unfollow(player); Region region = Region.getRegion(player.getLocation()); - PlayerTraceShowData previous = showDataPerRegionPerPlayer.getOrDefault(region, Collections.emptyMap()) - .remove(player); + PlayerTraceShowData previous = showDataPerRegionPerPlayer.getOrDefault(region, Collections.emptyMap()).remove(player); if (previous == null) return; tracesByRegion.getOrDefault(player, Collections.emptyMap()).forEach((integer, trace) -> { trace.hide(player); @@ -221,9 +220,7 @@ public class TraceManager implements Listener { showDataPerRegionPerPlayer.forEach((region, playerPlayerTraceShowDataMap) -> { if (playerPlayerTraceShowDataMap.containsKey(follower)) { - tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> { - trace.hide(follower); - }); + tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> trace.hide(follower)); } PlayerTraceShowData playerTraceShowData = playerPlayerTraceShowDataMap.get(following); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java index 3266850f..7a118a9a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java @@ -168,8 +168,7 @@ public class TraceRecorder implements Listener { } boolean afterFirstExplosion = wrappedTrace.isExplosionRecorded(); - TNTPoint record = new TNTPoint(tntID, tntPrimed, isExplosion, afterFirstExplosion, - TPSUtils.currentTick.get() - wrappedTrace.getStartTick(), history, destroyedBlocks); + TNTPoint record = new TNTPoint(tntID, tntPrimed, isExplosion, afterFirstExplosion, TPSUtils.currentTick.get() - wrappedTrace.getStartTick(), history, destroyedBlocks); history.add(record); return record; @@ -199,8 +198,7 @@ public class TraceRecorder implements Listener { trackedTNT.get(region).add((TNTPrimed) event.getEntity()); tntSpawnRegion.put((TNTPrimed) event.getEntity(), region); - activeTraces.get(region).addRecord( - record((TNTPrimed) event.getEntity(), activeTraces.get(region), Collections.emptyList())); + activeTraces.get(region).addRecord(record((TNTPrimed) event.getEntity(), activeTraces.get(region), Collections.emptyList())); } } @@ -219,7 +217,6 @@ public class TraceRecorder implements Listener { trackedTNT.get(region).remove((TNTPrimed) event.getEntity()); tntSpawnRegion.remove((TNTPrimed) event.getEntity()); - activeTraces.get(region) - .addRecord(record((TNTPrimed) event.getEntity(), activeTraces.get(region), event.blockList())); + activeTraces.get(region).addRecord(record((TNTPrimed) event.getEntity(), activeTraces.get(region), event.blockList())); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java index 735a975d..3fe22bce 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java @@ -38,7 +38,7 @@ public class TraceRecordingWrapper { private final long startTick; private final List recordsToAdd; private final List recordList; - private ObjectOutputStream recordsOutputStream; + private final ObjectOutputStream recordsOutputStream; private int nextOpenRecordId = 0; @Getter private boolean explosionRecorded = false; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/PlayerTraceShowData.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/PlayerTraceShowData.java index 8ddff2d3..0e4320fb 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/PlayerTraceShowData.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/PlayerTraceShowData.java @@ -30,7 +30,7 @@ public class PlayerTraceShowData { @Setter private BundleFilter bundleFilter; - private Map, ViewFlag> viewFlags = new HashMap<>(); + private final Map, ViewFlag> viewFlags = new HashMap<>(); public PlayerTraceShowData(BundleFilter bundleFilter, ViewFlag... viewFlags) { this.bundleFilter = bundleFilter; @@ -49,6 +49,8 @@ public class PlayerTraceShowData { } } + System.out.println(flagList); + // Manage inverse flags ViewFlag.inverseFlags.forEach(viewFlag -> { if (!flagList.remove(viewFlag)) { @@ -56,6 +58,8 @@ public class PlayerTraceShowData { } }); + System.out.println(flagList); + return flagList; } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java index a47d349d..ea47abac 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java @@ -56,7 +56,7 @@ public abstract class ViewFlag { @Override public List filter(List records) { return records.stream() - .filter(record -> !record.isAfterFirstExplosion()) + .filter(record -> record.isAfterFirstExplosion()) .collect(Collectors.toList()); } }; diff --git a/MiningIII.md b/MiningIII.md deleted file mode 100644 index 4e2b1d32..00000000 --- a/MiningIII.md +++ /dev/null @@ -1,252 +0,0 @@ -# Mining III - -Stats menu, blocks broken -Pickaxe skins? / Cosmetics (Armor) -Crystals? -Music selector -McPrison enchantments? -Legendary enchantments? -> Overdrive entchantments via prestige points -Combo Perk Enchantments? -Show proc rate enchtantment -Crystal Level increase by mining? -Keeping -> Keep an enchantment or n levels on random enchantments -Max upgrade? +5 upgrade? -Auto buy? - -## Enchantments - -### Efficiency - -- Increases Mining speed -- id: efficiency -- max: 10 -- cost_block_base: 50 -- cost_block_inc: 10 -- cost_shards_base: -80 -- cost_shards_inc: 20 - -### Haste - -- Gain Haste -- id: haste -- max: 10 -- cost_block_base: 1000 -- cost_block_inc: 0 -- cost_gold_base: 100 -- cost_gold_inc: 100 - -### Speed - -- Gain Speed -- id: speed -- max: 5 -- cost_blocks_base: 500 -- cost_blocks_inc: -100 -- cost_shards_base: 100 -- cost_shards_inc: 150 - -### Fortune - -- Increases Blocks gained -- id: fortune -- max: 50 -- cost_block_base: 100 -- cost_block_inc: 25 -- cost_gold_base: 200 -- cost_gold_inc: 50 -- cost_shards_base: -40 -- cost_shards_inc: 10 - -### Prosperity - -- Rare chance to greatly increse block gain -- id: prosperity -- max: 10 -- cost_block_base: 1000 -- cost_block_inc: 100 -- cost_gold_base: 1000 -- cost_gold_inc: 100 -- cost_shards_base: 100 -- cost_shards_inc: 100 - -### Gifted - -- Get luckier prosperity procs -- id: gifted -- max: 25 -- cost_block_base: 10000 -- cost_block_inc: 1000 -- cost_shards_base: 1000 -- cost_shards_inc: 250 - -### Shard Fusing Tome - -- Chance to turn ores into shards -- id: shard_fusing_tome -- max: 10 -- cost_block_base: 5000 -- cost_block_inc: 500 -- cost_shards_base: 1000 -- cost_shards_inc: 0 - -### Unstable shards - -- Destroy every shard created by Shard Fusing Tome -- id: unstable_shards -- max: 1 -- cost_block_base: 100000 -- cost_block_inc: 0 -- cost_gold_base: 25000 -- cost_gold_inc: 0 -- cost_shards_base: 10000 -- cost_shards_inc: 0 - -### Gatherer - -- Chance to gain Gold on Block break -- id: gatherer -- max: 10 -- cost_block_base: 1000 -- cost_block_inc: 1000 -- cost_gold_base: 1000 -- cost_gold_inc: 0 - -### Block Shatterer - -- Greatly increase Block gain -- id: block_shatterer -- max: 10 -- cost_block_base: 5000 -- cost_block_inc: 5000 -- cost_gold_base: 1000 -- cost_gold_inc: 1000 -- cost_shards_base: 500 -- cost_shards_inc: 500 - -### Gold Shatterer - -- Greatly increase Gold gain -- id: gold_shatterer -- max: 10 -- cost_block_base: 1000 -- cost_block_inc: 1000 -- cost_gold_base: 5000 -- cost_gold_inc: 5000 -- cost_shards_base: 500 -- cost_shards_inc: 500 - -### Shard Shatterer - -- Greatly increase Shard gain -- id: shard_shatterer -- max: 10 -- cost_block_base: 5000 -- cost_block_inc: 5000 -- cost_gold_base: 500 -- cost_gold_inc: 500 -- cost_shards_base: 1000 -- cost_shards_inc: 1000 - -### Explosive - -- Chance to explode -- id: explosive -- max: 30 -- cost_block_base: 200 -- cost_block_inc: 50 -- cost_gold_base: -700 -- cost_gold_inc: 100 -- cost_shards_base: -3200 -- cost_shards_inc: 200 - -### Laser - -- Chance to fire a laser -- id: laser -- max: 300 -- cost_block_base: 1000 -- cost_block_inc: 0 -- cost_gold_base: 3000 -- cost_gold_inc: -20 -- cost_shards_base: 0 -- cost_shards_inc: 30 - -### Jackhammer - -- Chance to destroy 3*3*3 (100) or 5*5*5 (200) area -- id: jackhammer -- max: 200 -- cost_block_base: 10000 -- cost_block_inc: 100 -- cost_gold_base: -12250 -- cost_gold_inc: 250 -- cost_shards_base: -74500 -- cost_shards_inc: 500 - -### Corrosive Mine - -- Destroy level number of blocks in the vicinity -- id: corrosive_mine -- max: 25 -- cost_block_base: 5000 -- cost_block_inc: 100 -- cost_gold_base: 5000 -- cost_gold_inc: 100 -- cost_shards_base: 5000 -- cost_shards_inc: 100 - -### Jackpot - -- Chance to receive the jackpot of 1000 blocks, 1000 gold and 1000 shards -- id: jackpot -- max: 1 -- cost_shards_base: 50000 -- cost_shards_inc: 0 - -### Dual Pickaxe - -- Chance to proc enchantments on another block in vicinity -- id: dual_pickaxe -- max: 10 -- cost_block_base: 2500 -- cost_block_inc: 500 -- cost_gold_base: 2500 -- cost_gold_inc: 500 -- cost_shards_base: 2500 -- cost_shards_inc: 500 - -### Luck - -- Chance for laser bounces to proc any enchantment -- id: luck -- max: 10 -- cost_block_base: 10000 -- cost_block_inc: 10000 -- cost_gold_base: 10000 -- cost_gold_inc: 10000 -- cost_shards_base: 10000 -- cost_shards_inc: 10000 - -### Lumberjack - -- Change to axe while looking onto Wood -- id: lumberjack -- max: 1 -- cost_block_base: 5000 -- cost_block_inc: 0 -- cost_gold_base: 5000 -- cost_gold_inc: 0 -- cost_shards_base: 5000 -- cost_shards_inc: 0 - -### Soul Remover - -- Change to shovel while looking onto Wood -- id: soul_remover -- max: 1 -- cost_block_base: 5000 -- cost_block_inc: 0 -- cost_gold_base: 5000 -- cost_gold_inc: 0 -- cost_shards_base: 5000 -- cost_shards_inc: 0 \ No newline at end of file -- 2.39.5 From 356b14d49c1dceea0c6bc3fa1f76ed2bb816732d Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 18 Apr 2024 15:52:30 +0200 Subject: [PATCH 083/111] Fix some stuff --- .../features/tracer/TraceManager.java | 20 ++++++++++++++++--- .../tracer/TraceRecordingWrapper.java | 2 +- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index db49af71..1eb0373c 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -84,13 +84,28 @@ public class TraceManager implements Listener { * @return id of the created trace */ protected int add(Trace trace) { - showDataPerRegionPerPlayer.getOrDefault(trace.getRegion(), Collections.emptyMap()).forEach(trace::render); + showDataPerRegionPerPlayer.getOrDefault(trace.getRegion(), Collections.emptyMap()).forEach((player, playerTraceShowData) -> { + trace.render(player, playerTraceShowData); + followerMap.getOrDefault(player, Collections.emptySet()).forEach(follower -> { + trace.render(follower, playerTraceShowData); + }); + }); + traces.put(nextOpenId, trace); tracesByRegion.computeIfAbsent(trace.getRegion(), region -> new HashMap<>()).put(nextOpenId, trace); nextOpenId++; return nextOpenId; } + protected void showPartial(Trace trace, List recordsToAdd) { + showDataPerRegionPerPlayer.getOrDefault(trace.getRegion(), Collections.emptyMap()).forEach((player, playerTraceShowData) -> { + trace.render(recordsToAdd, player, playerTraceShowData); + followerMap.getOrDefault(player, Collections.emptySet()).forEach(follower -> { + trace.render(recordsToAdd, follower, playerTraceShowData); + }); + }); + } + protected Map getTraceShowDataPlayerMapping(Region region) { return showDataPerRegionPerPlayer.getOrDefault(region, new HashMap<>()); } @@ -106,8 +121,7 @@ public class TraceManager implements Listener { .map(Map.Entry::getKey) .findFirst() .orElse(null); - if (traceId == null) - return false; + if (traceId == null) return false; traces.remove(traceId); tracesByRegion.getOrDefault(trace.getRegion(), Collections.emptyMap()).remove(traceId); trace.hide(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java index 3fe22bce..be3bfed8 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java @@ -72,7 +72,7 @@ public class TraceRecordingWrapper { } public void commitRecorded() { - TraceManager.instance.getTraceShowDataPlayerMapping(region).forEach((key, value) -> trace.render(recordsToAdd, key, value)); + TraceManager.instance.showPartial(trace, recordsToAdd); recordsToAdd.forEach(record -> { try { -- 2.39.5 From d170e96542cfe05b55f5fa8bbca8ea7401db625d Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Thu, 18 Apr 2024 16:10:15 +0200 Subject: [PATCH 084/111] Made trace clear region wise Signed-off-by: D4rkr34lm --- .../features/tracer/TraceCommand.java | 9 ++++---- .../features/tracer/TraceManager.java | 23 +++++++++---------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index c88adc91..5ef8c6d0 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -131,14 +131,13 @@ public class TraceCommand extends SWCommand { BauSystem.MESSAGE.send("TRACE_MESSAGE_HIDE", player); } - @Register(value = "delete", description = "TRACE_COMMAND_HELP_DELETE") @Register(value = "clear") - public void delete(@Validator Player player) { - TraceManager.instance.clear(); - BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE", player); + public void clear(@Validator Player player) { + TraceManager.instance.clear(Region.getRegion(player.getLocation())); + BauSystem.MESSAGE.send("TRACE_MESSAGE_CLEAR", player); } - @Register(value = "delete") + @Register(value = "delete", description = "TRACE_MESSAGE_DELETE") public void delete(@Validator Player player, Trace trace) { TraceManager.instance.remove(trace); BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE_SPECIFIC", player); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index 1eb0373c..878a1eda 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -131,11 +131,9 @@ public class TraceManager implements Listener { /** * Clears all traces */ - public void clear() { - showDataPerRegionPerPlayer.values() - .stream() - .flatMap(map -> map.entrySet().stream()) - .map(Map.Entry::getKey) + public void clear(Region region) { + showDataPerRegionPerPlayer.getOrDefault(region, new HashMap<>()) + .keySet() .forEach(player -> { Set players = followerMap.getOrDefault(player, Collections.emptySet()); traces.values().forEach(trace -> { @@ -143,13 +141,14 @@ public class TraceManager implements Listener { players.forEach(trace::hide); }); }); - traces.forEach((i, trace) -> { - trace.getMetadataSaveFile().delete(); - trace.getRecordsSaveFile().delete(); - }); - traces.clear(); - tracesByRegion.clear(); - nextOpenId = 0; + tracesByRegion.getOrDefault(region, new HashMap<>()) + .forEach((i, trace) -> { + if (trace.getRegion() != region) return; + traces.remove(i); + trace.getMetadataSaveFile().delete(); + trace.getRecordsSaveFile().delete(); + }); + tracesByRegion.getOrDefault(region, new HashMap<>()).clear(); } /** -- 2.39.5 From 17a83897033801414ed14dac2c9f1b628b45c92b Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 18 Apr 2024 16:11:46 +0200 Subject: [PATCH 085/111] Add Loader.single --- BauSystem_Main/src/BauSystem.properties | 5 +++- BauSystem_Main/src/BauSystem_de.properties | 3 +++ .../bausystem/features/loader/Loader.java | 24 ++++++++++++++++++- .../features/loader/LoaderCommand.java | 10 ++++++-- 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index 5cb5fdfa..7579ca7c 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -522,6 +522,7 @@ LOADER_SETUP = §eSetup LOADER_RUNNING = §aRunning LOADER_PAUSE = §7Pause LOADER_END = §8Finished +LOADER_SINGLE=§aSingle LOADER_MESSAGE_INTERACT=§e{0} added {1} LOADER_MESSAGE_UNINTERACT=§eRemoved Element @@ -543,7 +544,8 @@ LOADER_BUTTON_FENCEGATE=Fencegate LOADER_HELP_SETUP=§8/§eloader setup §8- §7Starts recording actions LOADER_SETUP_STOP_FIRST=§cPlease stop the current loader first! -LOADER_HELP_START=§8/§eloader start §8- §7Playback of previously recorded action +LOADER_HELP_START=§8/§eloader start §8- §7Playback of previously recorded actions +LOADER_HELP_SINGLE=§8/§7loader single - §7Single playback of previously recoded actions LOADER_HELP_PAUSE=§8/§7loader pause §8- §7Pauses Loader LOADER_HELP_GUI=§8/§7loader gui §8- §7Shows Loader gui LOADER_HELP_STOP=§8/§eloader stop §8- §7Stops recording/playback @@ -554,6 +556,7 @@ LOADER_NEW=§7Load your cannon and fire it once, to initialise the loader. LOADER_HOW_TO_START=§7Then, execute /§eloader start§7 to start the Loader LOADER_ACTIVE=§7The Loader is now active. LOADER_STOP=§7The Loader has been stopped. +LOADER_SINGLE_CMD=§7The Loader does a single playback. LOADER_PAUSED=§7The Loader is now paused. LOADER_SMALL_TIME=§cThe wait time is too small LOADER_NEW_TIME=§7The wait time is now: {0} diff --git a/BauSystem_Main/src/BauSystem_de.properties b/BauSystem_Main/src/BauSystem_de.properties index ca651035..965db404 100644 --- a/BauSystem_Main/src/BauSystem_de.properties +++ b/BauSystem_Main/src/BauSystem_de.properties @@ -498,6 +498,7 @@ LOADER_SETUP = §eEinrichtung LOADER_RUNNING = §aLaufend LOADER_PAUSE = §7Pausiert LOADER_END = §8Beendet +LOADER_SINGLE=§aEinmal LOADER_MESSAGE_INTERACT = §e{0} hinzugefügt {1} LOADER_BUTTON_TNT = TNT @@ -519,6 +520,7 @@ LOADER_BUTTON_FENCEGATE=Fencegate LOADER_HELP_SETUP=§8/§eloader setup §8- §7Startet die Aufnahme der Aktionen LOADER_SETUP_STOP_FIRST=§cBitte stoppe zuerst den Loader LOADER_HELP_START=§8/§eloader start §8- §7Spielt die zuvor aufgenommenen Aktionen ab +LOADER_HELP_SINGLE=§8/§eloader single §8- §7Spielt die zuvor aufgenommenen Aktionen einmal ab LOADER_HELP_PAUSE=§8/§7loader pause §8- §7Pausiert das Abspielen LOADER_HELP_GUI=§8/§7loader settings §8- §7Zeigt die Einstellungen an LOADER_HELP_STOP=§8/§eloader stop §8- §7Stoppt die Aufnahme bzw. das Abspielen @@ -529,6 +531,7 @@ LOADER_NEW=§7Belade und feuer einmal die Kanone ab, um den Loader zu initialisi LOADER_HOW_TO_START=§7Führe dann /§eloader start§7 um den Loader zu starten LOADER_ACTIVE=§7Der Loader ist nun aktiviert. LOADER_STOP=§7Der Loader ist nun gestoppt. +LOADER_SINGLE_CMD=§7Der Loader spielt nun einmal ab. LOADER_PAUSED=§7Der Loader ist nun pausiert. LOADER_SMALL_TIME=§cDie Wartezeit ist zu klein LOADER_NEW_TIME=§7Die Schusswartezeit ist nun: {0} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/Loader.java b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/Loader.java index 266cd65b..d8489a0f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/Loader.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/Loader.java @@ -39,7 +39,10 @@ import org.bukkit.event.Listener; import org.bukkit.event.inventory.ClickType; import org.bukkit.event.player.PlayerQuitEvent; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; public class Loader implements Listener { @@ -78,6 +81,10 @@ public class Loader implements Listener { } if (currentElement >= elements.size()) { currentElement = 0; + if (stage == Stage.SINGLE) { + stage = Stage.PAUSE; + return; + } } while (currentElement < elements.size()) { @@ -92,6 +99,20 @@ public class Loader implements Listener { }, 0, 1); } + public void single() { + if (stage == Stage.END) return; + if (stage == Stage.RUNNING) return; + stage = Stage.SINGLE; + if (recorder != null) { + recorder.stop(); + recorder = null; + } + if (elements.isEmpty()) { + BauSystem.MESSAGE.send("LOADER_NOTHING_RECORDED", p); + stop(); + } + } + public void start() { if (stage == Stage.END) return; if (stage == Stage.RUNNING) return; @@ -349,6 +370,7 @@ public class Loader implements Listener { public enum Stage implements EnumDisplay { SETUP("LOADER_SETUP"), RUNNING("LOADER_RUNNING"), + SINGLE("LOADER_SINGLE"), PAUSE("LOADER_PAUSE"), END("LOADER_END"); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/LoaderCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/LoaderCommand.java index ffe27e64..021ad330 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/LoaderCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/LoaderCommand.java @@ -20,10 +20,8 @@ package de.steamwar.bausystem.features.loader; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.utils.BauMemberUpdateEvent; import de.steamwar.command.SWCommand; -import de.steamwar.command.TypeValidator; import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -105,6 +103,14 @@ public class LoaderCommand extends SWCommand implements Listener { loader.setTicksBetweenBlocks(delay); } + @Register(value = "single", description = "LOADER_HELP_SINGLE") + public void singleLoader(@Validator Player p) { + Loader loader = Loader.getLoader(p); + if (loaderNullCheck(loader, p)) return; + loader.single(); + BauSystem.MESSAGE.send("LOADER_SINGLE_CMD", p); + } + @EventHandler public void onBauMemberUpdate(BauMemberUpdateEvent event) { event.getNewSpectator().forEach(player -> { -- 2.39.5 From 1bcf415186cbbb73e0e8e3aa441bbfdf81b17e5c Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Thu, 18 Apr 2024 16:14:49 +0200 Subject: [PATCH 086/111] Closed recource leak Signed-off-by: D4rkr34lm --- .../de/steamwar/bausystem/features/tracer/TraceRecorder.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java index 7a118a9a..23fae040 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java @@ -122,6 +122,8 @@ public class TraceRecorder implements Listener { TraceRecordingWrapper wrappedTrace = activeTraces.getOrDefault(region, null); if (wrappedTrace == null) return; + wrappedTrace.finalizeRecording(); + activeTraces.remove(region); for (TNTPrimed tnt : trackedTNT.getOrDefault(region, Collections.emptyList())) { historyMap.remove(tnt); -- 2.39.5 From 33d687b21656e83dc4d7be6fde2b51831e048ee9 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 18 Apr 2024 16:19:23 +0200 Subject: [PATCH 087/111] Add gzip compression to trace data --- .../src/de/steamwar/bausystem/features/tracer/Trace.java | 4 ++-- .../bausystem/features/tracer/TraceRecordingWrapper.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index f5292c38..0d61771e 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -35,6 +35,7 @@ import java.io.*; import java.lang.ref.SoftReference; import java.util.*; import java.util.stream.Collectors; +import java.util.zip.GZIPInputStream; public class Trace { /** @@ -270,11 +271,10 @@ public class Trace { private void loadRecords() { List records = new ArrayList<>(); - @Cleanup FileInputStream fileInputStream = new FileInputStream(recordsSaveFile); @Cleanup - ObjectInputStream inputStream = new ObjectInputStream(fileInputStream); + ObjectInputStream inputStream = new ObjectInputStream(new GZIPInputStream(fileInputStream)); while (fileInputStream.getChannel().position() < recordsSaveFile.length()) { records.add((TNTPoint) inputStream.readObject()); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java index be3bfed8..6cdc97ed 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java @@ -30,10 +30,11 @@ import java.io.IOException; import java.io.ObjectOutputStream; import java.util.ArrayList; import java.util.List; +import java.util.zip.GZIPOutputStream; //TODO Rename ? public class TraceRecordingWrapper { - private final Region region; + @Getter private final long startTick; private final List recordsToAdd; @@ -48,7 +49,6 @@ public class TraceRecordingWrapper { @SneakyThrows public TraceRecordingWrapper(Region region) { - this.region = region; startTick = TPSUtils.currentTick.get(); recordsToAdd = new ArrayList<>(); recordList = new ArrayList<>(); @@ -56,7 +56,7 @@ public class TraceRecordingWrapper { trace = new Trace(region, recordList); TraceManager.instance.add(trace); File recordsSaveFile = new File(TraceManager.tracesFolder, trace.getUuid() + ".records"); - recordsOutputStream = new ObjectOutputStream(new FileOutputStream(recordsSaveFile)); + recordsOutputStream = new ObjectOutputStream(new GZIPOutputStream(new FileOutputStream(recordsSaveFile))); } public int getNextOpenRecordIdAndIncrement() { -- 2.39.5 From 4422c249dc32aff7297e5787c3ae99975d9281f4 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Thu, 18 Apr 2024 17:07:16 +0200 Subject: [PATCH 088/111] Made loose filter more loose Signed-off-by: D4rkr34lm --- .../de/steamwar/bausystem/features/tracer/TraceCommand.java | 3 +-- .../bausystem/features/tracer/rendering/BundleFilter.java | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index 5ef8c6d0..35c1eed4 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -79,8 +79,7 @@ public class TraceCommand extends SWCommand { } @Register(value = {"show", "from"}, description = "TRACE_COMMAND_HELP_SHOW_FROM_WITH") - public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("with") String with, - @OptionalValue("STRICT") BundleFilter bundleFilter, @ArrayLength(min = 1) ViewFlag... flags) { + public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("with") String with, @OptionalValue("STRICT") BundleFilter bundleFilter, @ArrayLength(min = 1) ViewFlag... flags) { showInternal(player, from, Integer.MAX_VALUE, bundleFilter, flags); BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_FROM", player, from); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java index 85c2b3ef..475b22ff 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java @@ -29,8 +29,8 @@ public enum BundleFilter { LOOSE((TNTPoint a, TNTPoint b) -> { if (a.isExplosion() != b.isExplosion()) return false; - if (a.getLocation().distanceSquared(b.getLocation()) <= BundleFilter.pixelSizeSquared) return false; - if (a.getVelocity().distanceSquared(b.getVelocity()) <= BundleFilter.pixelSizeSquared) return false; + if (a.getLocation().distanceSquared(b.getLocation()) <= BundleFilter.pixelSizeSquared * 8) return false; + if (a.getVelocity().distanceSquared(b.getVelocity()) <= BundleFilter.pixelSizeSquared * 8) return false; return true; }), -- 2.39.5 From 4e6755033aa47071ef77e58bff4a0b21f16932ef Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 18 Apr 2024 17:08:39 +0200 Subject: [PATCH 089/111] Fix some stuff --- BauSystem_Main/src/BauSystem.properties | 6 +++--- BauSystem_Main/src/BauSystem_de.properties | 6 +++--- .../de/steamwar/bausystem/features/tracer/TraceCommand.java | 6 +++--- .../bausystem/features/tracer/TraceRecordingWrapper.java | 6 ++---- .../features/tracer/rendering/PlayerTraceShowData.java | 4 ---- 5 files changed, 11 insertions(+), 17 deletions(-) diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index 7579ca7c..e7512036 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -488,9 +488,9 @@ TRACE_MESSAGE_DELETE = §cAll TNT-positions deleted TRACE_MESSAGE_DELETE_SPECIFIC=§cTrace TNT-positions deleted TRACE_MESSAGE_SHOW = §aAll TNT-positions shown TRACE_MESSAGE_HIDE = §cAll TNT-positions hidden -TRACE_MESSAGE_SHOW_AT=§aTNT-positions shown at {1} -TRACE_MESSAGE_SHOW_FROM=§aAll TNT-positions shown from {1} -TRACE_MESSAGE_SHOW_FROM_TO=§aAll TNT-positions shown from {1} to {2} +TRACE_MESSAGE_SHOW_AT=§aTNT-positions shown at {0} +TRACE_MESSAGE_SHOW_FROM=§aAll TNT-positions shown from {0} +TRACE_MESSAGE_SHOW_FROM_TO=§aAll TNT-positions shown from {0} to {1} TRACE_MESSAGE_SHOW_TO_SMALLER = §cTo must be bigger then from TRACE_COMMAND_HELP_START = §8/§etrace start §8- §7Starts recording of all TNT-positions diff --git a/BauSystem_Main/src/BauSystem_de.properties b/BauSystem_Main/src/BauSystem_de.properties index 965db404..466f26c6 100644 --- a/BauSystem_Main/src/BauSystem_de.properties +++ b/BauSystem_Main/src/BauSystem_de.properties @@ -466,9 +466,9 @@ TRACE_MESSAGE_DELETE = §cAlle TNT-Positionen gelöscht TRACE_MESSAGE_SHOW = §aAlle TNT-Positionen angezeigt TRACE_MESSAGE_HIDE = §cAlle TNT-Positionen ausgeblendet TRACE_MESSAGE_DISALLOWED = §cDu darfst hier nicht den TNT-Tracer nutzen -TRACE_MESSAGE_SHOW_AT = §aTNT-positions angezeigt mit {0} bei {1} -TRACE_MESSAGE_SHOW_FROM = §aAll TNT-positions angezeigt mit {0} von {1} -TRACE_MESSAGE_SHOW_FROM_TO = §aAll TNT-positions angezeigt mit {0} von {1} bis {2} +TRACE_MESSAGE_SHOW_AT=§aTNT-positions angezeigt bei {0} +TRACE_MESSAGE_SHOW_FROM=§aAll TNT-positions angezeigt von {0} +TRACE_MESSAGE_SHOW_FROM_TO=§aAll TNT-positions angezeigt von {0} bis {1} TRACE_MESSAGE_SHOW_TO_SMALLER = §cBis muss größer als von sein TRACE_COMMAND_HELP_START = §8/§etrace start §8- §7Startet die Aufnahme aller TNT-Positionen diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index 35c1eed4..3255deca 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -73,19 +73,19 @@ public class TraceCommand extends SWCommand { } @Register(value = {"show", "at"}, description = "TRACE_COMMAND_HELP_SHOW_AT_WITH") - public void showAt(@Validator Player player, @Min(intValue = 0) int time, @StaticValue("with") String with, @OptionalValue("STRICT") BundleFilter bundleFilter, @ArrayLength(min = 1) ViewFlag... flags) { + public void showAt(@Validator Player player, @Min(intValue = 0) int time, @StaticValue("with") String with, @OptionalValue("STRICT") BundleFilter bundleFilter, ViewFlag... flags) { showInternal(player, time, time, bundleFilter, flags); BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_AT", player, time); } @Register(value = {"show", "from"}, description = "TRACE_COMMAND_HELP_SHOW_FROM_WITH") - public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("with") String with, @OptionalValue("STRICT") BundleFilter bundleFilter, @ArrayLength(min = 1) ViewFlag... flags) { + public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("with") String with, @OptionalValue("STRICT") BundleFilter bundleFilter, ViewFlag... flags) { showInternal(player, from, Integer.MAX_VALUE, bundleFilter, flags); BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_FROM", player, from); } @Register(value = {"show", "from"}, description = "TRACE_COMMAND_HELP_SHOW_FROM_TO_WITH") - public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("to") String toString, int to, @StaticValue("with") String with, @OptionalValue("STRICT") BundleFilter bundleFilter, @ArrayLength(min = 1) ViewFlag... flags) { + public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("to") String toString, int to, @StaticValue("with") String with, @OptionalValue("STRICT") BundleFilter bundleFilter, ViewFlag... flags) { if (to < from) { BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_TO_SMALLER", player); return; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java index 6cdc97ed..c68a3a75 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java @@ -34,7 +34,7 @@ import java.util.zip.GZIPOutputStream; //TODO Rename ? public class TraceRecordingWrapper { - + @Getter private final long startTick; private final List recordsToAdd; @@ -85,11 +85,9 @@ public class TraceRecordingWrapper { recordList.addAll(recordsToAdd); recordsToAdd.clear(); - - System.out.println(recordList); } - @SneakyThrows // TODO: Why is this not called? + @SneakyThrows protected void finalizeRecording() { recordsOutputStream.flush(); recordsOutputStream.close(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/PlayerTraceShowData.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/PlayerTraceShowData.java index 0e4320fb..aedfba16 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/PlayerTraceShowData.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/PlayerTraceShowData.java @@ -49,8 +49,6 @@ public class PlayerTraceShowData { } } - System.out.println(flagList); - // Manage inverse flags ViewFlag.inverseFlags.forEach(viewFlag -> { if (!flagList.remove(viewFlag)) { @@ -58,8 +56,6 @@ public class PlayerTraceShowData { } }); - System.out.println(flagList); - return flagList; } -- 2.39.5 From 6a3f3f8b0a8a4cee6d5e1c23e5afb1a65551b6a0 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Thu, 18 Apr 2024 17:12:53 +0200 Subject: [PATCH 090/111] fixed filters Signed-off-by: D4rkr34lm --- .../bausystem/features/tracer/rendering/BundleFilter.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java index 475b22ff..640bce74 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java @@ -29,16 +29,16 @@ public enum BundleFilter { LOOSE((TNTPoint a, TNTPoint b) -> { if (a.isExplosion() != b.isExplosion()) return false; - if (a.getLocation().distanceSquared(b.getLocation()) <= BundleFilter.pixelSizeSquared * 8) return false; - if (a.getVelocity().distanceSquared(b.getVelocity()) <= BundleFilter.pixelSizeSquared * 8) return false; + if (a.getLocation().distanceSquared(b.getLocation()) > BundleFilter.pixelSizeSquared * 8) return false; + if (a.getVelocity().distanceSquared(b.getVelocity()) > BundleFilter.pixelSizeSquared * 8) return false; return true; }), DEFAULT((TNTPoint a, TNTPoint b) -> { if (a.isExplosion() != b.isExplosion()) return false; if (a.getTicksSinceStart() != b.getTicksSinceStart()) return null; - if (a.getLocation().distanceSquared(b.getLocation()) <= BundleFilter.pixelSizeSquared) return false; - if (a.getVelocity().distanceSquared(b.getVelocity()) <= BundleFilter.pixelSizeSquared) return false; + if (a.getLocation().distanceSquared(b.getLocation()) > BundleFilter.pixelSizeSquared) return false; + if (a.getVelocity().distanceSquared(b.getVelocity()) > BundleFilter.pixelSizeSquared) return false; return true; }), -- 2.39.5 From 8b07e93a706c072218f2667675cdca0520fe83c1 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 18 Apr 2024 17:25:47 +0200 Subject: [PATCH 091/111] Fix Trace.bundleRecords --- .../steamwar/bausystem/features/tracer/Trace.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index 0d61771e..b0313b8e 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -216,6 +216,10 @@ public class Trace { * @return A list of bundles */ private List> bundleRecords(List records, BundleFilter filter) { + if (filter == BundleFilter.NONE) { + return records.stream().map(List::of).collect(Collectors.toList()); + } + List> bundles = new ArrayList<>(); recordsLoop: @@ -230,15 +234,20 @@ public class Trace { List bundle = bundles.get(i); Boolean filterResult = filter.function.apply(record, bundle.get(0)); - if (filterResult == null || !filterResult) { + if (filterResult == null) { ArrayList newBundle = new ArrayList<>(); newBundle.add(record); bundles.add(newBundle); continue recordsLoop; - } else { + } else if (filterResult) { bundle.add(record); + continue recordsLoop; } } + + ArrayList newBundle = new ArrayList<>(); + newBundle.add(record); + bundles.add(newBundle); } return bundles; -- 2.39.5 From 5af9cfcaad3763eecfa5bc31c38de93efbeee689 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 18 Apr 2024 17:42:40 +0200 Subject: [PATCH 092/111] Fix Trace.bundleRecords --- BauSystem_Main/src/BauSystem.properties | 1 - .../bausystem/features/tracer/TraceCommand.java | 12 ++++++------ .../bausystem/features/tracer/TraceManager.java | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index e7512036..bc211929 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -481,7 +481,6 @@ TRACE_RECORD=§aon TRACE_HAS_TRACES=§ehas Traces TRACE_IDLE_SINGLE=§esingle TRACE_IDLE_AUTO_IGNITE=§eauto -TRACE_MESSAGE_AUTO_IDLE_IGNITE = §aAuto-Tracer ignite started TRACE_MESSAGE_START = §aTNT-Tracer started TRACE_MESSAGE_STOP = §cTNT-Tracer stopped TRACE_MESSAGE_DELETE = §cAll TNT-positions deleted diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index 3255deca..52525e4e 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -67,25 +67,25 @@ public class TraceCommand extends SWCommand { } @Register(value = "show", description = "TRACE_COMMAND_HELP_SHOW") - public void show(@Validator Player player, @OptionalValue("STRICT") BundleFilter bundleFilter, ViewFlag... flags) { + public void show(@Validator Player player, @OptionalValue("DEFAULT") BundleFilter bundleFilter, ViewFlag... flags) { showInternal(player, bundleFilter, flags); BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW", player); } @Register(value = {"show", "at"}, description = "TRACE_COMMAND_HELP_SHOW_AT_WITH") - public void showAt(@Validator Player player, @Min(intValue = 0) int time, @StaticValue("with") String with, @OptionalValue("STRICT") BundleFilter bundleFilter, ViewFlag... flags) { + public void showAt(@Validator Player player, @Min(intValue = 0) int time, @StaticValue("with") String with, @OptionalValue("DEFAULT") BundleFilter bundleFilter, ViewFlag... flags) { showInternal(player, time, time, bundleFilter, flags); BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_AT", player, time); } @Register(value = {"show", "from"}, description = "TRACE_COMMAND_HELP_SHOW_FROM_WITH") - public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("with") String with, @OptionalValue("STRICT") BundleFilter bundleFilter, ViewFlag... flags) { + public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("with") String with, @OptionalValue("DEFAULT") BundleFilter bundleFilter, ViewFlag... flags) { showInternal(player, from, Integer.MAX_VALUE, bundleFilter, flags); BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_FROM", player, from); } @Register(value = {"show", "from"}, description = "TRACE_COMMAND_HELP_SHOW_FROM_TO_WITH") - public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("to") String toString, int to, @StaticValue("with") String with, @OptionalValue("STRICT") BundleFilter bundleFilter, ViewFlag... flags) { + public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("to") String toString, int to, @StaticValue("with") String with, @OptionalValue("DEFAULT") BundleFilter bundleFilter, ViewFlag... flags) { if (to < from) { BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_TO_SMALLER", player); return; @@ -133,10 +133,10 @@ public class TraceCommand extends SWCommand { @Register(value = "clear") public void clear(@Validator Player player) { TraceManager.instance.clear(Region.getRegion(player.getLocation())); - BauSystem.MESSAGE.send("TRACE_MESSAGE_CLEAR", player); + BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE", player); } - @Register(value = "delete", description = "TRACE_MESSAGE_DELETE") + @Register(value = "delete", description = "TRACE_COMMAND_HELP_DELETE") public void delete(@Validator Player player, Trace trace) { TraceManager.instance.remove(trace); BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE_SPECIFIC", player); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index 878a1eda..e01aa675 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -217,7 +217,7 @@ public class TraceManager implements Listener { Region region = Region.getRegion(player.getLocation()); PlayerTraceShowData previous = showDataPerRegionPerPlayer.getOrDefault(region, Collections.emptyMap()).remove(player); if (previous == null) return; - tracesByRegion.getOrDefault(player, Collections.emptyMap()).forEach((integer, trace) -> { + tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> { trace.hide(player); followerMap.getOrDefault(player, Collections.emptySet()).forEach(trace::hide); }); -- 2.39.5 From 67a34ee5ca41c92b677cc659c7eee3da230b032a Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 18 Apr 2024 17:54:20 +0200 Subject: [PATCH 093/111] Fix bundle counting entity twice --- BauSystem_Main/src/BauSystem.properties | 4 ++-- BauSystem_Main/src/BauSystem_de.properties | 2 +- .../bausystem/features/tracer/Trace.java | 23 ++++++------------- .../features/tracer/TraceCommand.java | 4 ++-- 4 files changed, 12 insertions(+), 21 deletions(-) diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index bc211929..af866f4a 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -483,8 +483,8 @@ TRACE_IDLE_SINGLE=§esingle TRACE_IDLE_AUTO_IGNITE=§eauto TRACE_MESSAGE_START = §aTNT-Tracer started TRACE_MESSAGE_STOP = §cTNT-Tracer stopped -TRACE_MESSAGE_DELETE = §cAll TNT-positions deleted -TRACE_MESSAGE_DELETE_SPECIFIC=§cTrace TNT-positions deleted +TRACE_MESSAGE_CLEAR=§cAll TNT-positions deleted +TRACE_MESSAGE_DELETE=§cTrace TNT-positions deleted TRACE_MESSAGE_SHOW = §aAll TNT-positions shown TRACE_MESSAGE_HIDE = §cAll TNT-positions hidden TRACE_MESSAGE_SHOW_AT=§aTNT-positions shown at {0} diff --git a/BauSystem_Main/src/BauSystem_de.properties b/BauSystem_Main/src/BauSystem_de.properties index 466f26c6..d73906be 100644 --- a/BauSystem_Main/src/BauSystem_de.properties +++ b/BauSystem_Main/src/BauSystem_de.properties @@ -462,7 +462,7 @@ TRACE_MESSAGE_AUTO_DELETE_TESTBLOCK_DESTROY = §7Der letzte Schuss wird gelösch TRACE_MESSAGE_START = §aTNT-Tracer gestartet TRACE_MESSAGE_SINGLE = §aSingle-Tracer gestartet TRACE_MESSAGE_STOP = §cTNT-Tracer gestoppt -TRACE_MESSAGE_DELETE = §cAlle TNT-Positionen gelöscht +TRACE_MESSAGE_CLEAR=§cAlle TNT-Positionen gelöscht TRACE_MESSAGE_SHOW = §aAlle TNT-Positionen angezeigt TRACE_MESSAGE_HIDE = §cAlle TNT-Positionen ausgeblendet TRACE_MESSAGE_DISALLOWED = §cDu darfst hier nicht den TNT-Tracer nutzen diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index b0313b8e..655cab4c 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -154,6 +154,12 @@ public class Trace { } else { entityServer = new REntityServer(); entityServer.addPlayer(player); + entityServer.setCallback((p, rEntity, entityAction) -> { + if (entityAction != REntityServer.EntityAction.INTERACT) return; + if (rEntity instanceof TraceEntity) { + ((TraceEntity) rEntity).printIntoChat(p); + } + }); entityServerMap.put(player, entityServer); } render(getRecords(), entityServer, playerTraceShowData); @@ -190,22 +196,13 @@ public class Trace { List entities = new LinkedList<>(); for (List bundle : bundles) { - entities.add( - new TraceEntity(entityServer, bundle.get(0).getLocation(), bundle.get(0).isExplosion(), bundle)); + entities.add(new TraceEntity(entityServer, bundle.get(0).getLocation(), bundle.get(0).isExplosion(), bundle)); } // Apply modifiers for (ViewFlag flag : flagList) { flag.modify(entityServer, entities); } - entityServer.setCallback((player, rEntity, entityAction) -> { - for (TraceEntity entity : entities) { - if (rEntity.equals(entity)) { - entity.printIntoChat(player); - return; - } - } - }); } /** @@ -224,12 +221,6 @@ public class Trace { recordsLoop: for (TNTPoint record : records) { - if (bundles.isEmpty()) { - List firstBundle = new ArrayList<>(); - firstBundle.add(record); - bundles.add(firstBundle); - } - for (int i = bundles.size() - 1; i >= 0; i--) { List bundle = bundles.get(i); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index 52525e4e..afd10cc7 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -133,13 +133,13 @@ public class TraceCommand extends SWCommand { @Register(value = "clear") public void clear(@Validator Player player) { TraceManager.instance.clear(Region.getRegion(player.getLocation())); - BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE", player); + BauSystem.MESSAGE.send("TRACE_MESSAGE_CLEAR", player); } @Register(value = "delete", description = "TRACE_COMMAND_HELP_DELETE") public void delete(@Validator Player player, Trace trace) { TraceManager.instance.remove(trace); - BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE_SPECIFIC", player); + BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE", player); } @Register(value = "isolate", description = "TRACE_COMMAND_HELP_ISOLATE") -- 2.39.5 From 35988bfcd3d0529da247af5c90a42a12e56db905 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Thu, 18 Apr 2024 17:56:45 +0200 Subject: [PATCH 094/111] Made name consistent with old naming Signed-off-by: D4rkr34lm --- .../bausystem/features/tracer/rendering/BundleFilter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java index 640bce74..d6ba6b8b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java @@ -42,7 +42,7 @@ public enum BundleFilter { return true; }), - STRICT((TNTPoint a, TNTPoint b) -> { + RAW((TNTPoint a, TNTPoint b) -> { if (a.isExplosion() != b.isExplosion()) return false; if (!a.getLocation().equals(b.getLocation())) return false; if (!a.getVelocity().equals(b.getVelocity())) return false; -- 2.39.5 From 83e5324986d003e2569efa9a3f589ef6f3b0bd08 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 18 Apr 2024 18:06:05 +0200 Subject: [PATCH 095/111] Update ViewFlag.FUSE --- .../bausystem/features/tracer/TraceManager.java | 6 +++--- .../features/tracer/rendering/ViewFlag.java | 13 ++++++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index e01aa675..bf853943 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -285,7 +285,7 @@ public class TraceManager implements Listener { Region region = Region.getRegion(player.getLocation()); PlayerTraceShowData playerTraceShowData = showDataPerRegionPerPlayer .computeIfAbsent(region, ignored -> new HashMap<>()) - .computeIfAbsent(player, ignored -> new PlayerTraceShowData(BundleFilter.STRICT)); + .computeIfAbsent(player, ignored -> new PlayerTraceShowData(BundleFilter.DEFAULT)); AtFlag atFlag = playerTraceShowData.getViewFlag(AtFlag.class); if (atFlag == null) { @@ -315,7 +315,7 @@ public class TraceManager implements Listener { Region region = Region.getRegion(player.getLocation()); PlayerTraceShowData playerTraceShowData = showDataPerRegionPerPlayer .computeIfAbsent(region, ignored -> new HashMap<>()) - .computeIfAbsent(player, ignored -> new PlayerTraceShowData(BundleFilter.STRICT)); + .computeIfAbsent(player, ignored -> new PlayerTraceShowData(BundleFilter.DEFAULT)); IsolateFlag isolateFlag; if (playerTraceShowData.hasViewFlagOnly(IsolateFlag.class)) { @@ -324,7 +324,7 @@ public class TraceManager implements Listener { isolateFlag = new IsolateFlag(); playerTraceShowData.addViewFlag(isolateFlag); } else { - playerTraceShowData = new PlayerTraceShowData(BundleFilter.STRICT); + playerTraceShowData = new PlayerTraceShowData(BundleFilter.DEFAULT); isolateFlag = new IsolateFlag(); playerTraceShowData.addViewFlag(isolateFlag); showDataPerRegionPerPlayer.get(region).put(player, playerTraceShowData); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java index ea47abac..f43ef173 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java @@ -163,7 +163,18 @@ public abstract class ViewFlag { @Override public void modify(REntityServer server, List entities) { for (TraceEntity entity : entities) { - entity.setDisplayName(String.valueOf(entity.getRecords().get(0).getFuse())); + List fuses = entity.getRecords() + .stream() + .map(TNTPoint::getFuse) + .distinct() + .sorted() + .map(i -> i + "") + .collect(Collectors.toList()); + if (fuses.size() <= 5) { + entity.setDisplayName(String.join(",", fuses)); + } else { + entity.setDisplayName(fuses.stream().limit(5).collect(Collectors.joining(",")) + ", +" + (fuses.size() - 5)); + } } } }; -- 2.39.5 From 47772ad23dfbb44b223c9eafc66faec389b09773 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 18 Apr 2024 18:08:11 +0200 Subject: [PATCH 096/111] Update ViewFlag.TIME --- .../features/tracer/rendering/ViewFlag.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java index f43ef173..5e2c4626 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java @@ -183,7 +183,18 @@ public abstract class ViewFlag { @Override public void modify(REntityServer server, List entities) { for (TraceEntity entity : entities) { - entity.setDisplayName(String.valueOf(entity.getRecords().get(0).getTicksSinceStart())); + List time = entity.getRecords() + .stream() + .map(TNTPoint::getTicksSinceStart) + .distinct() + .sorted() + .map(i -> i + "") + .collect(Collectors.toList()); + if (time.size() <= 5) { + entity.setDisplayName(String.join(",", time)); + } else { + entity.setDisplayName(time.stream().limit(5).collect(Collectors.joining(",")) + ", +" + (time.size() - 5)); + } } } }; -- 2.39.5 From 0d09db2284861f6c46a5c2b33afa57e906fca175 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Sat, 20 Apr 2024 00:51:51 +0200 Subject: [PATCH 097/111] Docs at 90 Percent Signed-off-by: D4rkr34lm --- .../bausystem/features/tracer/TNTPoint.java | 24 +++++++++++++- .../bausystem/features/tracer/Trace.java | 31 +++++++++++++++++-- .../features/tracer/TraceManager.java | 13 ++++++++ .../tracer/rendering/BundleFilter.java | 3 ++ .../tracer/rendering/PlayerTraceShowData.java | 15 +++++++++ .../tracer/rendering/TraceEntity.java | 8 +++++ .../features/tracer/rendering/ViewFlag.java | 5 ++- .../tracer/rendering/dynamicflags/AtFlag.java | 9 ++++++ .../rendering/dynamicflags/IsolateFlag.java | 3 ++ 9 files changed, 107 insertions(+), 4 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPoint.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPoint.java index 42c6d662..7a5d5425 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPoint.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPoint.java @@ -36,6 +36,9 @@ import java.io.ObjectOutput; import java.util.List; import java.util.Optional; +/** + * Recording of a tnt at a specific tick + */ @Getter public class TNTPoint implements Externalizable { /** @@ -93,6 +96,9 @@ public class TNTPoint implements Externalizable { */ private List history; + /** + * Constructor for deserialization only !! Do not Call !! + */ public TNTPoint() { } @@ -125,16 +131,32 @@ public class TNTPoint implements Externalizable { destroyedTestBlock = testblockDestroy; } + /** + * Method for getting the next record of the tnt represented by this record + * + * @return the next record + */ public Optional getNext() { int index = history.indexOf(this); return index == history.size() - 1 ? Optional.empty() : Optional.of(history.get(index + 1)); } + /** + * Method for getting the previous record of the tnt represented by this record + * + * @return the previous record + */ public Optional getPrevious() { int index = history.indexOf(this); return index == 0 ? Optional.empty() : Optional.of(history.get(index - 1)); } + /** + * Internal methode for setting the history of this record + * during deserialization. + * + * @param history + */ void setHistory(List history) { this.history = history; } @@ -158,7 +180,7 @@ public class TNTPoint implements Externalizable { } @Override - public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException { + public void readExternal(ObjectInput objectInput) throws IOException { tntId = objectInput.readInt(); explosion = objectInput.readBoolean(); inWater = objectInput.readBoolean(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index 655cab4c..fd2c9cf4 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -73,8 +73,17 @@ public class Trace { */ private SoftReference> records; + /** + * A map of all REntityServers rendering this trace + */ private final Map entityServerMap = new HashMap<>(); + /** + * Constructor for the creation of a new trace + * + * @param region the region the trace is created at + * @param recordList the list for the records making up this trace + */ @SneakyThrows public Trace(Region region, List recordList) { this.uuid = UUID.randomUUID(); @@ -91,6 +100,11 @@ public class Trace { outputStream.writeObject(date); } + /** + * Constructor for serialising a trace from the file system + * + * @param metadataSaveFile the file for this traces metadata + */ @SneakyThrows public Trace(File metadataSaveFile) { String uuid = null; @@ -116,9 +130,9 @@ public class Trace { } /** - * Gets the historys of all tnts in this trace + * Gets the histories of all tnts in this trace * - * @return the historys of this trace + * @return the histories of this trace */ public Set> getHistories() { Set> histories = new HashSet<>(); @@ -165,6 +179,13 @@ public class Trace { render(getRecords(), entityServer, playerTraceShowData); } + /** + * Renders specific records to this trace rendering + * + * @param records The records to be rendered + * @param player The player the records are rendered to + * @param playerTraceShowData The showData for modifying the rendering + */ protected void render(List records, Player player, PlayerTraceShowData playerTraceShowData) { render(records, entityServerMap.get(player), playerTraceShowData); } @@ -260,6 +281,9 @@ public class Trace { } } + /** + * Hides this trace for all players + */ public void hide() { entityServerMap.forEach((player, entityServer) -> { entityServer.close(); @@ -267,6 +291,9 @@ public class Trace { entityServerMap.clear(); } + /** + * Loads the records of this trace from storage to memory + */ @SneakyThrows private void loadRecords() { List records = new ArrayList<>(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index bf853943..e6dd941c 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -97,6 +97,12 @@ public class TraceManager implements Listener { return nextOpenId; } + /** + * Renders only the given records to the specified trace + * + * @param trace + * @param recordsToAdd + */ protected void showPartial(Trace trace, List recordsToAdd) { showDataPerRegionPerPlayer.getOrDefault(trace.getRegion(), Collections.emptyMap()).forEach((player, playerTraceShowData) -> { trace.render(recordsToAdd, player, playerTraceShowData); @@ -223,6 +229,13 @@ public class TraceManager implements Listener { }); } + /** + * Makes the given player + * + * @param follower + * @param following + * @return + */ public boolean follow(Player follower, Player following) { if (followerMap.containsKey(follower)) return false; if (followerMap.entrySet().stream().anyMatch(playerSetEntry -> playerSetEntry.getValue().contains(follower))) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java index d6ba6b8b..9380b3f8 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/BundleFilter.java @@ -24,6 +24,9 @@ import lombok.RequiredArgsConstructor; import java.util.function.BiFunction; +/** + * A Comparator for determining whether two records should be bundled + */ @RequiredArgsConstructor public enum BundleFilter { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/PlayerTraceShowData.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/PlayerTraceShowData.java index aedfba16..4029f2e2 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/PlayerTraceShowData.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/PlayerTraceShowData.java @@ -24,12 +24,21 @@ import lombok.Setter; import java.util.*; +/** + * A holder for the view data of a player trace render + */ public class PlayerTraceShowData { + /** + * The bundle filter applied by this class + */ @Getter @Setter private BundleFilter bundleFilter; + /** + * A map for stating whether a flag is contained in this holder or not + */ private final Map, ViewFlag> viewFlags = new HashMap<>(); public PlayerTraceShowData(BundleFilter bundleFilter, ViewFlag... viewFlags) { @@ -39,6 +48,12 @@ public class PlayerTraceShowData { } } + /** + * A methode that returns the flags that should be used by renders according + * to this holder. Especially handles inverse and required flags + * + * @return the flags that should be used in a render according to this holder + */ public Set getEffectiveViewFlags() { // Manage flags and required flags Set flagList = new HashSet<>(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java index f88d0eab..273d9ecc 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java @@ -34,6 +34,9 @@ import org.bukkit.entity.Player; import java.util.List; +/** + * Wrapper for the rendering of a record bundle + */ public class TraceEntity extends REntity { private static final Reflection.MethodInvoker addEntityMethod = Reflection.getMethod(REntityServer.class, "addEntity", REntity.class); @@ -51,6 +54,11 @@ public class TraceEntity extends REntity { addEntityMethod.invoke(server, this); } + /** + * Message for printing the data contained in this wrapper into player chat + * + * @param player the player the message should be printed for + */ public void printIntoChat(Player player) { TNTPoint representative = records.get(0); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java index 5e2c4626..d8910c4e 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java @@ -32,6 +32,9 @@ import java.util.List; import java.util.Set; import java.util.stream.Collectors; +/** + * A settable flag that changes how a trace is rendered + */ public abstract class ViewFlag { /** * Static registry of static flags @@ -39,7 +42,7 @@ public abstract class ViewFlag { public static final List flags = new ArrayList<>(); /** - * Inverse flags are used by trace render by default, as long as they are not explicidly added as argument + * Inverse flags are used by trace render by default, as long as they are not explicitly added as argument */ public static final List inverseFlags = new ArrayList<>(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/AtFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/AtFlag.java index d57c36e0..5ad1157b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/AtFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/AtFlag.java @@ -25,8 +25,17 @@ import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; import java.util.List; import java.util.stream.Collectors; +/** + * A view flag for rendering a trace only in a given time intervall + */ public class AtFlag extends ViewFlag { + /** + * Start of the time interval + */ private int start; + /** + * End of the time interval + */ private int end; public AtFlag(int start, int end) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/IsolateFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/IsolateFlag.java index 9fafd7a7..723e7d9c 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/IsolateFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/IsolateFlag.java @@ -27,6 +27,9 @@ import java.util.List; import java.util.Set; import java.util.stream.Collectors; +/** + * A flag for rendering only the records of specific tnts + */ public class IsolateFlag extends ViewFlag { /** -- 2.39.5 From f69cbd2724837ed8018c4fd938c1225a884f8ab9 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 21 Apr 2024 13:17:28 +0200 Subject: [PATCH 098/111] Add TraceScoreboardElement --- BauSystem_Main/src/BauSystem.properties | 3 +- BauSystem_Main/src/BauSystem_de.properties | 3 - .../features/tracer/TraceRecorder.java | 8 +++ .../tracer/TraceRecordingWrapper.java | 4 ++ .../tracer/TraceScoreboardElement.java | 60 +++++++++++++++++++ 5 files changed, 73 insertions(+), 5 deletions(-) create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceScoreboardElement.java diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index af866f4a..6b52862b 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -479,8 +479,7 @@ TPSLIMIT_FROZEN = §eTPS frozen # Trace TRACE_RECORD=§aon TRACE_HAS_TRACES=§ehas Traces -TRACE_IDLE_SINGLE=§esingle -TRACE_IDLE_AUTO_IGNITE=§eauto +TRACE_IDLE_AUTO=§eauto TRACE_MESSAGE_START = §aTNT-Tracer started TRACE_MESSAGE_STOP = §cTNT-Tracer stopped TRACE_MESSAGE_CLEAR=§cAll TNT-positions deleted diff --git a/BauSystem_Main/src/BauSystem_de.properties b/BauSystem_Main/src/BauSystem_de.properties index d73906be..0c33a977 100644 --- a/BauSystem_Main/src/BauSystem_de.properties +++ b/BauSystem_Main/src/BauSystem_de.properties @@ -448,9 +448,6 @@ TPSLIMIT_FROZEN = §eTPS eingefroren. # Trace TRACE_RECORD=§aan TRACE_HAS_TRACES=§ehat Traces -TRACE_IDLE_SINGLE=§esingle -TRACE_IDLE_AUTO_EXPLODE=§eauto §8(§7explode§8) -TRACE_IDLE_AUTO_IGNITE=§eauto §8(§7ignite§8) TRACE_MESSAGE_AUTO_IDLE_IGNITE = §aAuto-Tracer ignite gestartet TRACE_MESSAGE_AUTO_DELETE_INVALID = §cAuto delete kann aktuell nicht genutzt werden TRACE_MESSAGE_AUTO_DELETE_ALWAYS = §7Der letzte Schuss wird §eimmer§7 gelöscht diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java index 23fae040..a706433b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java @@ -176,6 +176,14 @@ public class TraceRecorder implements Listener { return record; } + public boolean isAutoTraceEnabledInRegion(Region region) { + return autoTraceRegions.contains(region); + } + + public boolean isTraceActiveInRegion(Region region) { + return activeTraces.containsKey(region); + } + /** * Event for TNTs beeing spawn. * Registers newly spawned TNT to be traced if reqired diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java index c68a3a75..48f00569 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java @@ -91,5 +91,9 @@ public class TraceRecordingWrapper { protected void finalizeRecording() { recordsOutputStream.flush(); recordsOutputStream.close(); + + if (trace.getRecords().isEmpty()) { + TraceManager.instance.remove(trace); + } } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceScoreboardElement.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceScoreboardElement.java new file mode 100644 index 00000000..7a34f29a --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceScoreboardElement.java @@ -0,0 +1,60 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2024 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.tracer; + +import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.Permission; +import de.steamwar.bausystem.region.Region; +import de.steamwar.bausystem.utils.ScoreboardElement; +import de.steamwar.linkage.Linked; +import org.bukkit.entity.Player; + +import java.util.Collection; + +@Linked +public class TraceScoreboardElement implements ScoreboardElement { + + @Override + public ScoreboardGroup getGroup() { + return ScoreboardGroup.OTHER; + } + + @Override + public int order() { + return 1; + } + + @Override + public String get(Region region, Player p) { + if (!Permission.BUILD.hasPermission(p)) return null; + if (TraceRecorder.instance.isTraceActiveInRegion(region)) { + return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TRACE", p) + "§8: " + BauSystem.MESSAGE.parse("TRACE_RECORD", p); + } else if (TraceRecorder.instance.isAutoTraceEnabledInRegion(region)) { + return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TRACE", p) + "§8: " + BauSystem.MESSAGE.parse("TRACE_IDLE_AUTO", p); + } + + Collection traces = TraceManager.instance.get(region); + if (traces.isEmpty()) { + return null; + } else { + return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TRACE", p) + "§8: " + BauSystem.MESSAGE.parse("TRACE_HAS_TRACES", p); + } + } +} -- 2.39.5 From f7727eb01c9549e94bbef395654bb76a942dbe67 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 21 Apr 2024 13:23:15 +0200 Subject: [PATCH 099/111] Add TraceScoreboardElement --- .../steamwar/bausystem/features/tracer/TraceRecorder.java | 6 ++++++ .../bausystem/features/tracer/TraceScoreboardElement.java | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java index a706433b..b7ac25a1 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java @@ -184,6 +184,12 @@ public class TraceRecorder implements Listener { return activeTraces.containsKey(region); } + public long getStartTimeOfTraceInRegion(Region region) { + TraceRecordingWrapper wrapper = activeTraces.get(region); + if (wrapper == null) return 0; + return wrapper.getStartTick(); + } + /** * Event for TNTs beeing spawn. * Registers newly spawned TNT to be traced if reqired diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceScoreboardElement.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceScoreboardElement.java index 7a34f29a..f7b20f8c 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceScoreboardElement.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceScoreboardElement.java @@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.tracer; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; +import de.steamwar.bausystem.features.tpslimit.TPSUtils; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.utils.ScoreboardElement; import de.steamwar.linkage.Linked; @@ -45,7 +46,7 @@ public class TraceScoreboardElement implements ScoreboardElement { public String get(Region region, Player p) { if (!Permission.BUILD.hasPermission(p)) return null; if (TraceRecorder.instance.isTraceActiveInRegion(region)) { - return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TRACE", p) + "§8: " + BauSystem.MESSAGE.parse("TRACE_RECORD", p); + return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TRACE", p) + "§8: " + BauSystem.MESSAGE.parse("TRACE_RECORD", p) + " §8| §e" + (TPSUtils.currentRealTick.get() - TraceRecorder.instance.getStartTimeOfTraceInRegion(region)) + " §7" + BauSystem.MESSAGE.parse("SCOREBOARD_TRACE_TICKS", p); } else if (TraceRecorder.instance.isAutoTraceEnabledInRegion(region)) { return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TRACE", p) + "§8: " + BauSystem.MESSAGE.parse("TRACE_IDLE_AUTO", p); } -- 2.39.5 From 295eb82fe918790d90b5355165522ed7a6fe0157 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 21 Apr 2024 14:29:26 +0200 Subject: [PATCH 100/111] Add TraceCommand.share --- BauSystem_Main/src/BauSystem.properties | 6 +++++- BauSystem_Main/src/BauSystem_de.properties | 4 ++++ .../steamwar/bausystem/features/tracer/TraceCommand.java | 9 +++++---- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index 6b52862b..6fc4c270 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -490,6 +490,7 @@ TRACE_MESSAGE_SHOW_AT=§aTNT-positions shown at {0} TRACE_MESSAGE_SHOW_FROM=§aAll TNT-positions shown from {0} TRACE_MESSAGE_SHOW_FROM_TO=§aAll TNT-positions shown from {0} to {1} TRACE_MESSAGE_SHOW_TO_SMALLER = §cTo must be bigger then from +TRACE_MESSAGE_SHARE=§e{0} shared his trace show state. Click to view. TRACE_COMMAND_HELP_START = §8/§etrace start §8- §7Starts recording of all TNT-positions TRACE_COMMAND_HELP_STOP = §8/§etrace stop §8- §7Stops the TNT-Tracer @@ -503,7 +504,10 @@ TRACE_COMMAND_HELP_SHOW_FROM_TO=§8/§etrace show §7from §8<§eFROM§8> §7to TRACE_COMMAND_HELP_SHOW_FROM_TO_WITH=§8/§etrace show §7from §8<§eFROM§8> §7to §8<§eTO§8> §7with §8<§eParameter§8> - §7Shows all Trace Positions from §8<§eFROM§8> to §8<§eTO§8> TRACE_COMMAND_HELP_HIDE = §8/§etrace hide §8- §7Hides all TNT-positions TRACE_COMMAND_HELP_DELETE=§8/§etrace delete §8[§eTrace§8] §8- §7Deletes all TNT-positions or a Trace -TRACE_COMMAND_HELP_ISOLATE=§8/§etrace isolate §8[§eTrace§8] §8[§eTNT§8] §8- §7Isolates specific TNTs from the Trace +TRACE_COMMAND_HELP_ISOLATE=§8/§etrace isolate §8[§eTrace§8] §8[§eTNT§8] §8- §7Isolates specific TNTs from the Trace +TRACE_COMMAND_HELP_SHARE=§8/§etrace share §8- §7Share your current Trace show state with others +TRACE_COMMAND_HELP_FOLLOW=§8/§etrace follow §8[§ePlayer§8] §8- §7Follow a players Trace show state +TRACE_COMMAND_HELP_UNFOLLOW=§8/§etrace unfollow §8- §7Unfollow the Trace show state TRACE_GUI_ITEM_NAME = §eTracer TRACE_GUI_ITEM_LORE = §7Status§8: {0} diff --git a/BauSystem_Main/src/BauSystem_de.properties b/BauSystem_Main/src/BauSystem_de.properties index 0c33a977..b89cc5f4 100644 --- a/BauSystem_Main/src/BauSystem_de.properties +++ b/BauSystem_Main/src/BauSystem_de.properties @@ -467,6 +467,7 @@ TRACE_MESSAGE_SHOW_AT=§aTNT-positions angezeigt bei {0} TRACE_MESSAGE_SHOW_FROM=§aAll TNT-positions angezeigt von {0} TRACE_MESSAGE_SHOW_FROM_TO=§aAll TNT-positions angezeigt von {0} bis {1} TRACE_MESSAGE_SHOW_TO_SMALLER = §cBis muss größer als von sein +TRACE_MESSAGE_SHARE=§e{0} teilte seinen Trace-Show-Status. Zum Ansehen klicken. TRACE_COMMAND_HELP_START = §8/§etrace start §8- §7Startet die Aufnahme aller TNT-Positionen TRACE_COMMAND_HELP_SINGLE = §8/§etrace single §8- §7Startet eine einzelne Aufnahme aller TNT-Positionen @@ -479,6 +480,9 @@ TRACE_COMMAND_HELP_SHOW_FROM = §8/§etrace show §8(§etime§8|§7fuse§8) §7f TRACE_COMMAND_HELP_SHOW_FROM_TO = §8/§etrace show §8(§etime§8|§7fuse§8) §7from §8<§eFROM§8> §7to §8<§eTO§8> - §7Zeigt alle TNT-Positionen zwischen §8<§eFROM§8> und §8<§eTO§8> TRACE_COMMAND_HELP_HIDE = §8/§etrace hide §8- §7Versteckt alle TNT-Positionen TRACE_COMMAND_HELP_DELETE = §8/§etrace delete §8- §7Löscht alle TNT-Positionen +TRACE_COMMAND_HELP_SHARE=§8/§etrace share §8- §7Teilt den aktuellen Trace-Show-Status mit anderen +TRACE_COMMAND_HELP_FOLLOW=§8/§etrace follow §8[§ePlayer§8] §8- §7Verfolgen eines Spielers Status anzeigen +TRACE_COMMAND_HELP_UNFOLLOW=§8/§etrace unfollow §8- §7Den Status der Trace-Anzeige aufheben TRACE_GUI_ITEM_NAME = §eTracer TRACE_GUI_ITEM_LORE = §7Status§8: {0} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index afd10cc7..7aec03b2 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -29,6 +29,7 @@ import de.steamwar.command.PreviousArguments; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeMapper; import de.steamwar.linkage.Linked; +import net.md_5.bungee.api.chat.ClickEvent; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -148,12 +149,12 @@ public class TraceCommand extends SWCommand { // TODO: Add Message! } - @Register(value = "share", description = "TRACE_COMMAND_HELP_SHOW") + @Register(value = "share", description = "TRACE_COMMAND_HELP_SHARE") public void share(@Validator Player player) { - // TODO Rücksprache + BauSystem.MESSAGE.broadcast("TRACE_MESSAGE_SHARE", null, new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/trace follow " + player.getName()), player.getName()); } - @Register(value = "follow", description = "TRACE_COMMAND_HELP_SHOW") + @Register(value = "follow", description = "TRACE_COMMAND_HELP_FOLLOW") public void follow(@Validator Player player, Player toFollow) { if (player == toFollow) { // TODO: Implement message @@ -163,7 +164,7 @@ public class TraceCommand extends SWCommand { // TODO: Implement message } - @Register(value = "unfollow", description = "TRACE_COMMAND_HELP_SHOW") + @Register(value = "unfollow", description = "TRACE_COMMAND_HELP_UNFOLLOW") public void unfollow(@Validator Player player) { TraceManager.instance.unfollow(player); // TODO: Implement message -- 2.39.5 From 56a72b1e83f00fec747b377a5edf114cb05a3699 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 21 Apr 2024 14:36:15 +0200 Subject: [PATCH 101/111] Add TraceCommand.share --- BauSystem_Main/src/BauSystem.properties | 3 ++- BauSystem_Main/src/BauSystem_de.properties | 3 ++- .../de/steamwar/bausystem/features/tracer/TraceCommand.java | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index 6fc4c270..4b2c9792 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -490,7 +490,8 @@ TRACE_MESSAGE_SHOW_AT=§aTNT-positions shown at {0} TRACE_MESSAGE_SHOW_FROM=§aAll TNT-positions shown from {0} TRACE_MESSAGE_SHOW_FROM_TO=§aAll TNT-positions shown from {0} to {1} TRACE_MESSAGE_SHOW_TO_SMALLER = §cTo must be bigger then from -TRACE_MESSAGE_SHARE=§e{0} shared his trace show state. Click to view. +TRACE_MESSAGE_SHARE=§e{0} shared his trace show state. +TRACE_MESSAGE_SHARE_HOVER=§eClick to view TRACE_COMMAND_HELP_START = §8/§etrace start §8- §7Starts recording of all TNT-positions TRACE_COMMAND_HELP_STOP = §8/§etrace stop §8- §7Stops the TNT-Tracer diff --git a/BauSystem_Main/src/BauSystem_de.properties b/BauSystem_Main/src/BauSystem_de.properties index b89cc5f4..b3871b82 100644 --- a/BauSystem_Main/src/BauSystem_de.properties +++ b/BauSystem_Main/src/BauSystem_de.properties @@ -467,7 +467,8 @@ TRACE_MESSAGE_SHOW_AT=§aTNT-positions angezeigt bei {0} TRACE_MESSAGE_SHOW_FROM=§aAll TNT-positions angezeigt von {0} TRACE_MESSAGE_SHOW_FROM_TO=§aAll TNT-positions angezeigt von {0} bis {1} TRACE_MESSAGE_SHOW_TO_SMALLER = §cBis muss größer als von sein -TRACE_MESSAGE_SHARE=§e{0} teilte seinen Trace-Show-Status. Zum Ansehen klicken. +TRACE_MESSAGE_SHARE=§e{0} teilte seinen Trace-Show-Status. +TRACE_MESSAGE_SHARE_HOVER=§eZum Ansehen klicken. TRACE_COMMAND_HELP_START = §8/§etrace start §8- §7Startet die Aufnahme aller TNT-Positionen TRACE_COMMAND_HELP_SINGLE = §8/§etrace single §8- §7Startet eine einzelne Aufnahme aller TNT-Positionen diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index 7aec03b2..81ecea7d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -151,7 +151,7 @@ public class TraceCommand extends SWCommand { @Register(value = "share", description = "TRACE_COMMAND_HELP_SHARE") public void share(@Validator Player player) { - BauSystem.MESSAGE.broadcast("TRACE_MESSAGE_SHARE", null, new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/trace follow " + player.getName()), player.getName()); + BauSystem.MESSAGE.broadcast("TRACE_MESSAGE_SHARE", "TRACE_MESSAGE_SHARE_HOVER", new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/trace follow " + player.getName()), player.getName()); } @Register(value = "follow", description = "TRACE_COMMAND_HELP_FOLLOW") -- 2.39.5 From 09aa662171976abebe728bd53a4b2ec0ccf4ba0b Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 21 Apr 2024 14:46:47 +0200 Subject: [PATCH 102/111] Add messages to TraceCommand --- BauSystem_Main/src/BauSystem.properties | 5 +++++ BauSystem_Main/src/BauSystem_de.properties | 17 +++++------------ .../bausystem/features/tracer/TraceCommand.java | 13 ++++++++----- .../features/tracer/TraceRecorder.java | 9 +++++---- 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index 4b2c9792..e9ddfc9c 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -481,6 +481,8 @@ TRACE_RECORD=§aon TRACE_HAS_TRACES=§ehas Traces TRACE_IDLE_AUTO=§eauto TRACE_MESSAGE_START = §aTNT-Tracer started +TRACE_MESSAGE_AUTO_START=§eAuto TNT-Tracer started +TRACE_MESSAGE_AUTO_STOP=§cAuto TNT-Tracer stopped TRACE_MESSAGE_STOP = §cTNT-Tracer stopped TRACE_MESSAGE_CLEAR=§cAll TNT-positions deleted TRACE_MESSAGE_DELETE=§cTrace TNT-positions deleted @@ -492,6 +494,9 @@ TRACE_MESSAGE_SHOW_FROM_TO=§aAll TNT-positions shown from {0} to {1} TRACE_MESSAGE_SHOW_TO_SMALLER = §cTo must be bigger then from TRACE_MESSAGE_SHARE=§e{0} shared his trace show state. TRACE_MESSAGE_SHARE_HOVER=§eClick to view +TRACE_MESSAGE_FOLLOW=§aYou are now following {0} Trace show state +TRACE_MESSAGE_FOLLOW_SELF=§cYou cannot follow yourself! +TRACE_MESSAGE_UNFOLLOW=§eYou are no longer following a Trace show state TRACE_COMMAND_HELP_START = §8/§etrace start §8- §7Starts recording of all TNT-positions TRACE_COMMAND_HELP_STOP = §8/§etrace stop §8- §7Stops the TNT-Tracer diff --git a/BauSystem_Main/src/BauSystem_de.properties b/BauSystem_Main/src/BauSystem_de.properties index b3871b82..11cbacac 100644 --- a/BauSystem_Main/src/BauSystem_de.properties +++ b/BauSystem_Main/src/BauSystem_de.properties @@ -448,33 +448,26 @@ TPSLIMIT_FROZEN = §eTPS eingefroren. # Trace TRACE_RECORD=§aan TRACE_HAS_TRACES=§ehat Traces -TRACE_MESSAGE_AUTO_IDLE_IGNITE = §aAuto-Tracer ignite gestartet -TRACE_MESSAGE_AUTO_DELETE_INVALID = §cAuto delete kann aktuell nicht genutzt werden -TRACE_MESSAGE_AUTO_DELETE_ALWAYS = §7Der letzte Schuss wird §eimmer§7 gelöscht -TRACE_MESSAGE_AUTO_DELETE_NEVER = §7Der letzte Schuss wird §enie§7 gelöscht -TRACE_MESSAGE_AUTO_DELETE_NO_BUILD_DESTROY = §7Der letzte Schuss wird gelöscht, wenn §ekein§7 Block aus dem §eBaubereich§7 zerstört wurde -TRACE_MESSAGE_AUTO_DELETE_BUILD_DESTROY = §7Der letzte Schuss wird gelöscht, wenn §eein§7 Block aus dem §eBaubereich§7 zerstört wurde -TRACE_MESSAGE_AUTO_DELETE_NO_TESTBLOCK_DESTROY = §7Der letzte Schuss wird gelöscht, wenn §ekein§7 Block aus dem §eTestblock§7 zerstört wurde -TRACE_MESSAGE_AUTO_DELETE_TESTBLOCK_DESTROY = §7Der letzte Schuss wird gelöscht, wenn §eein§7 Block aus dem §eTestblock§7 zerstört wurde TRACE_MESSAGE_START = §aTNT-Tracer gestartet -TRACE_MESSAGE_SINGLE = §aSingle-Tracer gestartet +TRACE_MESSAGE_AUTO_START=§eAuto TNT-Tracer gestartet +TRACE_MESSAGE_AUTO_STOP=§cAuto TNT-Tracer gestoppt TRACE_MESSAGE_STOP = §cTNT-Tracer gestoppt TRACE_MESSAGE_CLEAR=§cAlle TNT-Positionen gelöscht TRACE_MESSAGE_SHOW = §aAlle TNT-Positionen angezeigt TRACE_MESSAGE_HIDE = §cAlle TNT-Positionen ausgeblendet -TRACE_MESSAGE_DISALLOWED = §cDu darfst hier nicht den TNT-Tracer nutzen TRACE_MESSAGE_SHOW_AT=§aTNT-positions angezeigt bei {0} TRACE_MESSAGE_SHOW_FROM=§aAll TNT-positions angezeigt von {0} TRACE_MESSAGE_SHOW_FROM_TO=§aAll TNT-positions angezeigt von {0} bis {1} TRACE_MESSAGE_SHOW_TO_SMALLER = §cBis muss größer als von sein TRACE_MESSAGE_SHARE=§e{0} teilte seinen Trace-Show-Status. TRACE_MESSAGE_SHARE_HOVER=§eZum Ansehen klicken. +TRACE_MESSAGE_FOLLOW=§aSie folgen nun {0} Trace show state +TRACE_MESSAGE_FOLLOW_SELF=§cSie können sich selbst nicht folgen! +TRACE_MESSAGE_UNFOLLOW=§eSie folgen nicht mehr dem Status einer Trace-Show TRACE_COMMAND_HELP_START = §8/§etrace start §8- §7Startet die Aufnahme aller TNT-Positionen -TRACE_COMMAND_HELP_SINGLE = §8/§etrace single §8- §7Startet eine einzelne Aufnahme aller TNT-Positionen TRACE_COMMAND_HELP_STOP = §8/§etrace stop §8- §7Stoppt den TNT-Tracer TRACE_COMMAND_HELP_AUTO = §8/§etrace toggleauto §8- §7Automatischer Aufnahmenstart -TRACE_COMMAND_HELP_AUTO_REMOVE = §8/§etrace autoremove §8<§eParameter§8> §8- §7Löscht den letzten Trace automatisch TRACE_COMMAND_HELP_SHOW = §8/§etrace show §8<§eParameter§8> - §7Zeigt alle TNT-Positionen TRACE_COMMAND_HELP_SHOW_AT = §8/§etrace show §8(§etime§8|§7fuse§8) §7at §8<§eTIME§8> - §7Zeigt alle TNT-Positionen bei §8<§eTIME§8> an TRACE_COMMAND_HELP_SHOW_FROM = §8/§etrace show §8(§etime§8|§7fuse§8) §7from §8<§eFROM§8> - §7Zeigt alle TNT-Positionen von §8<§eFROM§8> diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index 81ecea7d..26ded08b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -63,8 +63,11 @@ public class TraceCommand extends SWCommand { @Register(value = "auto", description = "TRACE_COMMAND_HELP_AUTO") public void auto(@Validator Player player) { Region region = Region.getRegion(player.getLocation()); - TraceRecorder.instance.toggleAutoTrace(region); - // TODO: Add Auto toggle Message! + if (TraceRecorder.instance.toggleAutoTrace(region)) { + BauSystem.MESSAGE.send("TRACE_MESSAGE_AUTO_START", player); + } else { + BauSystem.MESSAGE.send("TRACE_MESSAGE_AUTO_STOP", player); + } } @Register(value = "show", description = "TRACE_COMMAND_HELP_SHOW") @@ -157,17 +160,17 @@ public class TraceCommand extends SWCommand { @Register(value = "follow", description = "TRACE_COMMAND_HELP_FOLLOW") public void follow(@Validator Player player, Player toFollow) { if (player == toFollow) { - // TODO: Implement message + BauSystem.MESSAGE.send("TRACE_MESSAGE_FOLLOW_SELF", player); return; } TraceManager.instance.follow(player, toFollow); - // TODO: Implement message + BauSystem.MESSAGE.send("TRACE_MESSAGE_FOLLOW", player, toFollow.getName()); } @Register(value = "unfollow", description = "TRACE_COMMAND_HELP_UNFOLLOW") public void unfollow(@Validator Player player) { TraceManager.instance.unfollow(player); - // TODO: Implement message + BauSystem.MESSAGE.send("TRACE_MESSAGE_UNFOLLOW", player); } @ClassMapper(value = Trace.class, local = true) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java index b7ac25a1..52b87156 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecorder.java @@ -79,11 +79,12 @@ public class TraceRecorder implements Listener { * * @param region */ - public void toggleAutoTrace(Region region) { - if (autoTraceRegions.contains(region)) { - autoTraceRegions.remove(region); - } else { + public boolean toggleAutoTrace(Region region) { + if (!autoTraceRegions.remove(region)) { autoTraceRegions.add(region); + return true; + } else { + return false; } } -- 2.39.5 From 7ddfcb83ece9acb87937577dd2b8a7e966829ee7 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Sun, 21 Apr 2024 14:57:44 +0200 Subject: [PATCH 103/111] Added isolate on trace entity --- BauSystem_Main/src/BauSystem.properties | 1134 ++++++++--------- BauSystem_Main/src/BauSystem_de.properties | 1102 ++++++++-------- .../tracer/rendering/TraceEntity.java | 6 + 3 files changed, 1024 insertions(+), 1218 deletions(-) diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index 6b52862b..b3cfa251 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -16,109 +16,90 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # - -PREFIX = §eBau§8System§8» -TIME = HH:mm:ss +PREFIX=§eBau§8System§8» +TIME=HH:mm:ss DATE=........ COMMAND_HELP_HEAD=§7---=== (§e{0}§7) ===--- ONLY_SCHEMS=§cFolders are unselectable - PAGE_LIST=§e Page ({0}/{1}) »» LIST_PREVIOUS_PAGE=§ePrevious page LIST_NEXT_PAGE=§eNext page - # Permissions -NO_PERMISSION = You are not allowed to use that here -SPECTATOR = §fSpectator - +NO_PERMISSION=You are not allowed to use that here +SPECTATOR=§fSpectator # Scoreboard -SCOREBOARD_TIME = Time -SCOREBOARD_REGION = Region -SCOREBOARD_TRACE = Trace -SCOREBOARD_LOADER = Loader -SCOREBOARD_TPS = TPS -SCOREBOARD_TPS_FROZEN = §eFrozen - -SCOREBOARD_TRACE_TICKS = Ticks - -SCOREBOARD_TECHHIDER = TechHider§8: §aOn -SCOREBOARD_XRAY = XRay§8: §aOn - -SCOREBOARD_LOCK_TEAM = Bau Lock§8: §eTeam -SCOREBOARD_LOCK_TEAM_AND_SERVERTEAM = Bau Lock§8: §e(Server) Team -SCOREBOARD_LOCK_SERVERTEAM = Bau Lock§8: §eServer Team -SCOREBOARD_LOCK_NOBODY = Bau Lock§8: §cNobody - +SCOREBOARD_TIME=Time +SCOREBOARD_REGION=Region +SCOREBOARD_TRACE=Trace +SCOREBOARD_LOADER=Loader +SCOREBOARD_TPS=TPS +SCOREBOARD_TPS_FROZEN=§eFrozen +SCOREBOARD_TRACE_TICKS=Ticks +SCOREBOARD_TECHHIDER=TechHider§8: §aOn +SCOREBOARD_XRAY=XRay§8: §aOn +SCOREBOARD_LOCK_TEAM=Bau Lock§8: §eTeam +SCOREBOARD_LOCK_TEAM_AND_SERVERTEAM=Bau Lock§8: §e(Server) Team +SCOREBOARD_LOCK_SERVERTEAM=Bau Lock§8: §eServer Team +SCOREBOARD_LOCK_NOBODY=Bau Lock§8: §cNobody # Flags -FLAG_COLOR = Color -FLAG_TNT = TNT -FLAG_FIRE = Fire -FLAG_FREEZE = Freeze -FLAG_PROTECT = Protect -FLAG_ITEMS = Items - -FLAG_FIRE_ALLOW = §con -FLAG_FIRE_DENY = §aoff - -FLAG_FREEZE_ACTIVE = §aon -FLAG_FREEZE_INACTIVE = §coff - -FLAG_PROTECT_ACTIVE = §aon -FLAG_PROTECT_INACTIVE = §coff - -FLAG_TNT_ALLOW = §aon -FLAG_TNT_DENY = §coff -FLAG_TNT_ONLY_TB = §7no §ebuild area -FLAG_TNT_ONLY_BUILD = §7no §etestblock area - -FLAG_ITEMS_ACTIVE = §aon -FLAG_ITEMS_INACTIVE = §coff - -FLAG_COLOR_WHITE = §fWhite -FLAG_COLOR_ORANGE = §6Orange -FLAG_COLOR_MAGENTA = §dMagenta -FLAG_COLOR_LIGHT_BLUE = §bLight blue -FLAG_COLOR_YELLOW = §eYellow -FLAG_COLOR_LIME = §aLime +FLAG_COLOR=Color +FLAG_TNT=TNT +FLAG_FIRE=Fire +FLAG_FREEZE=Freeze +FLAG_PROTECT=Protect +FLAG_ITEMS=Items +FLAG_FIRE_ALLOW=§con +FLAG_FIRE_DENY=§aoff +FLAG_FREEZE_ACTIVE=§aon +FLAG_FREEZE_INACTIVE=§coff +FLAG_PROTECT_ACTIVE=§aon +FLAG_PROTECT_INACTIVE=§coff +FLAG_TNT_ALLOW=§aon +FLAG_TNT_DENY=§coff +FLAG_TNT_ONLY_TB=§7no §ebuild area +FLAG_TNT_ONLY_BUILD=§7no §etestblock area +FLAG_ITEMS_ACTIVE=§aon +FLAG_ITEMS_INACTIVE=§coff +FLAG_COLOR_WHITE=§fWhite +FLAG_COLOR_ORANGE=§6Orange +FLAG_COLOR_MAGENTA=§dMagenta +FLAG_COLOR_LIGHT_BLUE=§bLight blue +FLAG_COLOR_YELLOW=§eYellow +FLAG_COLOR_LIME=§aLime ## This cannot be converted -FLAG_COLOR_PINK = §ePink -FLAG_COLOR_GRAY = §8Gray -FLAG_COLOR_LIGHT_GRAY = §7Light gray -FLAG_COLOR_CYAN = §3Cyan -FLAG_COLOR_PURPLE = §5Purple -FLAG_COLOR_BLUE = §1Blue +FLAG_COLOR_PINK=§ePink +FLAG_COLOR_GRAY=§8Gray +FLAG_COLOR_LIGHT_GRAY=§7Light gray +FLAG_COLOR_CYAN=§3Cyan +FLAG_COLOR_PURPLE=§5Purple +FLAG_COLOR_BLUE=§1Blue ## This cannot be converted -FLAG_COLOR_BROWN = §eBrown -FLAG_COLOR_GREEN = §2Green -FLAG_COLOR_RED = §cRed -FLAG_COLOR_BLACK = §0Black - +FLAG_COLOR_BROWN=§eBrown +FLAG_COLOR_GREEN=§2Green +FLAG_COLOR_RED=§cRed +FLAG_COLOR_BLACK=§0Black # Region -REGION_TYPE_NORMAL = Normal -REGION_TYPE_BUILD = Build area -REGION_TYPE_ONLY_TB = Dummy - +REGION_TYPE_NORMAL=Normal +REGION_TYPE_BUILD=Build area +REGION_TYPE_ONLY_TB=Dummy # AttributesCopy -ATTRIBUTES_CANT_COPY = §cYou need to hold the same item type and hover over the same block to copy. -ATTRIBUTES_NO_COPY = §cNo attributes to copy. -ATTRIBUTES_COPIED = §eAttributes copied. - -ATTRIBUTE_REMOVE_COMMAND_HELP = §8/§eattributeremove §8[§eattribute§8|§7all§8|§7*§8] -ATTRIBUTE_REMOVE_ALL = §eAll attributes removed. -ATTRIBUTE_REMOVE_SINGLE = §eAttribute §7{0}§e removed. -ATTRIBUTE_REMOVE_NOT_FOUND = §cAttribute not found - +ATTRIBUTES_CANT_COPY=§cYou need to hold the same item type and hover over the same block to copy. +ATTRIBUTES_NO_COPY=§cNo attributes to copy. +ATTRIBUTES_COPIED=§eAttributes copied. +ATTRIBUTE_REMOVE_COMMAND_HELP=§8/§eattributeremove §8[§eattribute§8|§7all§8|§7*§8] +ATTRIBUTE_REMOVE_ALL=§eAll attributes removed. +ATTRIBUTE_REMOVE_SINGLE=§eAttribute §7{0}§e removed. +ATTRIBUTE_REMOVE_NOT_FOUND=§cAttribute not found # AutoStart -AUTOSTART_COMMAND_HELP = §8/§etimer §8- §7Retrieve AutostartTimer Tool -AUTOSTART_ITEM_NAME = §eAutostartTimer -AUTOSTART_ITEM_LORE = §eRight Click Block §8- §7Start Timer -AUTOSTART_MESSAGE_NO_REGION = §cYou are not inside any region -AUTOSTART_MESSAGE_RESET = §eAutostartTimer restarted -AUTOSTART_MESSAGE_START = §eAutostartTimer started -AUTOSTART_MESSAGE_RESULT1 = §eTime §7until §eexplosion §7at enemy§8:§e {0}§7 game ticks -AUTOSTART_MESSAGE_RESULT2 = §7Time difference in §egame-ticks §7until {0} seconds§8:§e {1} -AUTOSTART_MESSAGE_RESULT3 = §7positive, if too few, negative if too many - +AUTOSTART_COMMAND_HELP=§8/§etimer §8- §7Retrieve AutostartTimer Tool +AUTOSTART_ITEM_NAME=§eAutostartTimer +AUTOSTART_ITEM_LORE=§eRight Click Block §8- §7Start Timer +AUTOSTART_MESSAGE_NO_REGION=§cYou are not inside any region +AUTOSTART_MESSAGE_RESET=§eAutostartTimer restarted +AUTOSTART_MESSAGE_START=§eAutostartTimer started +AUTOSTART_MESSAGE_RESULT1=§eTime §7until §eexplosion §7at enemy§8:§e {0}§7 game ticks +AUTOSTART_MESSAGE_RESULT2=§7Time difference in §egame-ticks §7until {0} seconds§8:§e {1} +AUTOSTART_MESSAGE_RESULT3=§7positive, if too few, negative if too many # Backup BACKUP_HELP_CREATE=§8/§ebackup create §8- §7Create a region backup BACKUP_HELP_LOAD=§8/§ebackup load §8[§7BackupName§8] §8- §7Load a region backup @@ -135,44 +116,38 @@ BACKUP_LOAD=§7Backup loaded BACKUP_INV_NAME=§eBackup BACKUP_ITEM_NAME=§eBackup §7from §e{0} BACKUP_LORE=§eClick to load - # Bau -BAU_COMMAND_HELP_INFO = §8/§ebau info §8- §7Alias for §8/§ebauinfo - -BAU_INFO_ITEM_NAME = §eBau-Management +BAU_COMMAND_HELP_INFO=§8/§ebau info §8- §7Alias for §8/§ebauinfo +BAU_INFO_ITEM_NAME=§eBau-Management ## This is used in BauInfoBauGuiItem.java -BAU_INFO_ITEM_LORE_TNT = §7TNT§8: §e{0} -BAU_INFO_ITEM_LORE_FREEZE = §7Freeze§8: §e{0} -BAU_INFO_ITEM_LORE_FIRE = §7Fire§8: §e{0} -BAU_INFO_ITEM_LORE_COLOR = §7Color§8: §e{0} -BAU_INFO_ITEM_LORE_PROTECT = §7Protect§8: §e{0} -BAU_INFO_ITEM_LORE_ITEMS = §7Items§8: §e{0} - -BAU_INFO_COMMAND_HELP = §8/§ebauinfo §8- §7Information regarding this build server -BAU_INFO_COMMAND_OWNER = §7Owner§8: §e{0} -BAU_INFO_COMMAND_MEMBER = §7{0} §8[§7{1}§8]§8: §e{2} -BAU_INFO_COMMAND_FLAG = §7{0}§8: §7{1} -BAU_INFO_COMMAND_TPS = §7TPS§8:§e - +BAU_INFO_ITEM_LORE_TNT=§7TNT§8: §e{0} +BAU_INFO_ITEM_LORE_FREEZE=§7Freeze§8: §e{0} +BAU_INFO_ITEM_LORE_FIRE=§7Fire§8: §e{0} +BAU_INFO_ITEM_LORE_COLOR=§7Color§8: §e{0} +BAU_INFO_ITEM_LORE_PROTECT=§7Protect§8: §e{0} +BAU_INFO_ITEM_LORE_ITEMS=§7Items§8: §e{0} +BAU_INFO_COMMAND_HELP=§8/§ebauinfo §8- §7Information regarding this build server +BAU_INFO_COMMAND_OWNER=§7Owner§8: §e{0} +BAU_INFO_COMMAND_MEMBER=§7{0} §8[§7{1}§8]§8: §e{2} +BAU_INFO_COMMAND_FLAG=§7{0}§8: §7{1} +BAU_INFO_COMMAND_TPS=§7TPS§8:§e # Countingwand -COUNTINGWAND_COMMAND_HELP = §8/§ecountingwand §8- §7Receive a CountingWand -COUNTINGWAND_ITEM_NAME = §eMeterstick -COUNTINGWAND_ITEM_LORE1 = §eLeft-Click §8- §7Set the first position -COUNTINGWAND_ITEM_LORE2 = §eRicht-Click §8- §7Set the second position -COUNTINGWAND_MESSAGE_RCLICK = §7First position at: §8[§7{0}§8, §7{1}§8, §7{2}§8] ({3}§8) ({4}§8) -COUNTINGWAND_MESSAGE_LCLICK = §7Second position at: §8[§7{0}§8, §7{1}§8, §7{2}§8] ({3}§8) ({4}§8) -COUNTINGWAND_MESSAGE_VOLUME = §e{0} -COUNTINGWAND_MESSAGE_DIMENSION = §e{0}§8, §e{1}§8, §e{2} - +COUNTINGWAND_COMMAND_HELP=§8/§ecountingwand §8- §7Receive a CountingWand +COUNTINGWAND_ITEM_NAME=§eMeterstick +COUNTINGWAND_ITEM_LORE1=§eLeft-Click §8- §7Set the first position +COUNTINGWAND_ITEM_LORE2=§eRicht-Click §8- §7Set the second position +COUNTINGWAND_MESSAGE_RCLICK=§7First position at: §8[§7{0}§8, §7{1}§8, §7{2}§8] ({3}§8) ({4}§8) +COUNTINGWAND_MESSAGE_LCLICK=§7Second position at: §8[§7{0}§8, §7{1}§8, §7{2}§8] ({3}§8) ({4}§8) +COUNTINGWAND_MESSAGE_VOLUME=§e{0} +COUNTINGWAND_MESSAGE_DIMENSION=§e{0}§8, §e{1}§8, §e{2} # Design Endstone -DESIGN_ENDSTONE_COMMAND_HELP = §8/§edesignendstone §8- §7Highlight endstone in design -DESIGN_ENDSTONE_REGION_ERROR = §cThis region has no build area -DESIGN_ENDSTONE_ENABLE = §aEndstone is highlighted -DESIGN_ENDSTONE_DISABLE = §cEndstone is no longer hightlighted - +DESIGN_ENDSTONE_COMMAND_HELP=§8/§edesignendstone §8- §7Highlight endstone in design +DESIGN_ENDSTONE_REGION_ERROR=§cThis region has no build area +DESIGN_ENDSTONE_ENABLE=§aEndstone is highlighted +DESIGN_ENDSTONE_DISABLE=§cEndstone is no longer hightlighted # Detonator -DETONATOR_LOC_REMOVE = §e{0} removed -DETONATOR_LOC_ADD = §e{0} added +DETONATOR_LOC_REMOVE=§e{0} removed +DETONATOR_LOC_ADD=§e{0} added DETONATOR_BUTTON_SWITCH=Lever DETONATOR_BUTTON_WOOD_BUTTON=Button DETONATOR_BUTTON_STONE_BUTTON=Button @@ -219,309 +194,274 @@ GUI_EDITOR_ITEM_TRASH_LORE=§7Drop item here GUI_EDITOR_ITEM_MORE=§eMore items GUI_EDITOR_ITEM_CLOSE=§eClose GUI_EDITOR_TITLE_MORE=Select item - # Script ## Errors SCRIPT_ERROR_GUI=§cError in parsing script: Line {0} SCRIPT_ERROR_GLOBAL=§cError in global script: Line {0} SCRIPT_ERROR_CLICK=§cError in script: Line {0} SCRIPT_ERROR_ONLY_IN_GLOBAL=§cThis function is only available in global scripts - ## CustomScript -SCRIPT_HOTKEY_ITEM_NAME = §7Hotkey§8: §e{0} -SCRIPT_EVENT_ITEM_NAME = §7Event§8: §e{0} -SCRIPT_COMMAND_ITEM_NAME = §7Command§8: §e/{0} - +SCRIPT_HOTKEY_ITEM_NAME=§7Hotkey§8: §e{0} +SCRIPT_EVENT_ITEM_NAME=§7Event§8: §e{0} +SCRIPT_COMMAND_ITEM_NAME=§7Command§8: §e/{0} ## Script Menu GUI -SCRIPT_MENU_GUI_ITEM_LORE_1 = §7Click to retrieve -SCRIPT_MENU_GUI_ITEM_LORE_2 = §7Shift-Click to copy -SCRIPT_MENU_GUI_ITEM_LORE_3 = §7Right-Click to edit -SCRIPT_MENU_GUI_ITEM_LORE_4 = §7Middle-Click to preview -SCRIPT_MENU_GUI_NAME = §eScript-Menu -SCRIPT_MENU_GUI_ITEM_ADD_NAME = §eInsert -SCRIPT_MENU_GUI_ITEM_ADD_LORE = §7Click with a book to insert - -SCRIPT_MENU_GUI_ENTER_NAME = §eEnter a name +SCRIPT_MENU_GUI_ITEM_LORE_1=§7Click to retrieve +SCRIPT_MENU_GUI_ITEM_LORE_2=§7Shift-Click to copy +SCRIPT_MENU_GUI_ITEM_LORE_3=§7Right-Click to edit +SCRIPT_MENU_GUI_ITEM_LORE_4=§7Middle-Click to preview +SCRIPT_MENU_GUI_NAME=§eScript-Menu +SCRIPT_MENU_GUI_ITEM_ADD_NAME=§eInsert +SCRIPT_MENU_GUI_ITEM_ADD_LORE=§7Click with a book to insert +SCRIPT_MENU_GUI_ENTER_NAME=§eEnter a name SCRIPT_DEPRECATED=§cThe function §8\'§e{0}§8\'§c is deprecated and will be removed in the future. Please use §8\'§e{1}§8\'§c instead. - # Shield Printing -SHIELD_PRINTING_HELP_START = §8/§eshieldprinting start §8- §7Starts the shield printing -SHIELD_PRINTING_HELP_COPY = §8/§eshieldprinting copy §8- §7Copies the shield configuration -SHIELD_PRINTING_HELP_APPLY = §8/§eshieldprinting apply §8- §7Applies the shield configuration -SHIELD_PRINTING_HELP_STOP = §8/§eshieldprinting stop §8- §7Stops the shield printing -SHIELD_PRINTING_HELP_STEP_1 = §81. §7Paste the schematic you want to use -SHIELD_PRINTING_HELP_STEP_2 = §82. §7Start the shield printing with §8/§eshieldprinting start -SHIELD_PRINTING_HELP_STEP_3 = §83. §7Wait until the shield printing is finished -SHIELD_PRINTING_HELP_STEP_4 = §84. §7Edit the shields if necessary -SHIELD_PRINTING_HELP_STEP_5 = §85. §7Copy the shields printing with §8/§eshieldprinting copy -SHIELD_PRINTING_HELP_STEP_6 = §86. §7Paste the original schematic -SHIELD_PRINTING_HELP_STEP_7 = §87. §7Apply the shield printing with §8/§eshieldprinting apply - -SHIELD_PRINTING_NO_REGION = §cYou are not in a region. -SHIELD_PRINTING_NOT_RUNNING = §cThe shield printing is not running. -SHIELD_PRINTING_BOSSBAR = §fMovements: {0} -SHIELD_PRINTING_BOSSBAR_COPIED = §fMovements: {0} Copied: {1} - -SHIELD_PRINTING_GUI_NAME = §7Shield Printing -SHIELD_PRINTING_GUI_APPLY = §aApply -SHIELD_PRINTING_GUI_STATE_PREVIOUS = §7R-Click§8: §7Previous -SHIELD_PRINTING_GUI_STATE_NEXT = §7L-Click§8: §7Next -SHIELD_PRINTING_GUI_STATE_ACTIVE = §e> §7{0} -SHIELD_PRINTING_GUI_STATE_INACTIVE = §8> §7{0} -SHIELD_PRINTING_GUI_STATE_FROM_ORIGINAL = Original -SHIELD_PRINTING_GUI_STATE_FROM_COPY = Copy -SHIELD_PRINTING_GUI_STATE_ALWAYS_ON = On -SHIELD_PRINTING_GUI_STATE_ALWAYS_OFF = Off -SHIELD_PRINTING_GUI_STATE_ALWAYS_OPEN = Open -SHIELD_PRINTING_GUI_STATE_ALWAYS_CLOSED = Closed -SHIELD_PRINTING_GUI_STATE_FENCE = §7{0} §fFence Connections -SHIELD_PRINTING_GUI_STATE_OPENABLE = §7{0} §fOpened -SHIELD_PRINTING_GUI_STATE_PISTON = §7{0} §fExtended -SHIELD_PRINTING_GUI_STATE_POWERABLE = §7{0} §fPowered -SHIELD_PRINTING_GUI_STATE_WALL = §7{0} §fWall Connections - -SHIELD_PRINTING_START = §aThe shield printing has been started. -SHIELD_PRINTING_COPY = §aThe shield has been copied. -SHIELD_PRINTING_APPLY = §aThe shield has been applied. -SHIELD_PRINTING_STOP = §aThe shield printing has been stopped. - +SHIELD_PRINTING_HELP_START=§8/§eshieldprinting start §8- §7Starts the shield printing +SHIELD_PRINTING_HELP_COPY=§8/§eshieldprinting copy §8- §7Copies the shield configuration +SHIELD_PRINTING_HELP_APPLY=§8/§eshieldprinting apply §8- §7Applies the shield configuration +SHIELD_PRINTING_HELP_STOP=§8/§eshieldprinting stop §8- §7Stops the shield printing +SHIELD_PRINTING_HELP_STEP_1=§81. §7Paste the schematic you want to use +SHIELD_PRINTING_HELP_STEP_2=§82. §7Start the shield printing with §8/§eshieldprinting start +SHIELD_PRINTING_HELP_STEP_3=§83. §7Wait until the shield printing is finished +SHIELD_PRINTING_HELP_STEP_4=§84. §7Edit the shields if necessary +SHIELD_PRINTING_HELP_STEP_5=§85. §7Copy the shields printing with §8/§eshieldprinting copy +SHIELD_PRINTING_HELP_STEP_6=§86. §7Paste the original schematic +SHIELD_PRINTING_HELP_STEP_7=§87. §7Apply the shield printing with §8/§eshieldprinting apply +SHIELD_PRINTING_NO_REGION=§cYou are not in a region. +SHIELD_PRINTING_NOT_RUNNING=§cThe shield printing is not running. +SHIELD_PRINTING_BOSSBAR=§fMovements: {0} +SHIELD_PRINTING_BOSSBAR_COPIED=§fMovements: {0} Copied: {1} +SHIELD_PRINTING_GUI_NAME=§7Shield Printing +SHIELD_PRINTING_GUI_APPLY=§aApply +SHIELD_PRINTING_GUI_STATE_PREVIOUS=§7R-Click§8: §7Previous +SHIELD_PRINTING_GUI_STATE_NEXT=§7L-Click§8: §7Next +SHIELD_PRINTING_GUI_STATE_ACTIVE=§e> §7{0} +SHIELD_PRINTING_GUI_STATE_INACTIVE=§8> §7{0} +SHIELD_PRINTING_GUI_STATE_FROM_ORIGINAL=Original +SHIELD_PRINTING_GUI_STATE_FROM_COPY=Copy +SHIELD_PRINTING_GUI_STATE_ALWAYS_ON=On +SHIELD_PRINTING_GUI_STATE_ALWAYS_OFF=Off +SHIELD_PRINTING_GUI_STATE_ALWAYS_OPEN=Open +SHIELD_PRINTING_GUI_STATE_ALWAYS_CLOSED=Closed +SHIELD_PRINTING_GUI_STATE_FENCE=§7{0} §fFence Connections +SHIELD_PRINTING_GUI_STATE_OPENABLE=§7{0} §fOpened +SHIELD_PRINTING_GUI_STATE_PISTON=§7{0} §fExtended +SHIELD_PRINTING_GUI_STATE_POWERABLE=§7{0} §fPowered +SHIELD_PRINTING_GUI_STATE_WALL=§7{0} §fWall Connections +SHIELD_PRINTING_START=§aThe shield printing has been started. +SHIELD_PRINTING_COPY=§aThe shield has been copied. +SHIELD_PRINTING_APPLY=§aThe shield has been applied. +SHIELD_PRINTING_STOP=§aThe shield printing has been stopped. # Unsign Book UNSIGN_HELP=§8/§eunsign §8- §7Make a signed book writable again - # Simulator -SIMULATOR_HELP = §8/§esimulator §8-§7 Gives you the simulator wand -SIMULATOR_CREATE_HELP = §8/§esimulator create §8[§7name§8] §8-§7 Create a new simulator -SIMULATOR_CHANGE_HELP = §8/§esimulator change §8-§7 Change your simulator wand selection -SIMULATOR_DELETE_HELP = §8/§esimulator delete §8[§7name§8] §8-§7 Deletes the simulator -SIMULATOR_START_HELP = §8/§esimulator start §8[§7name§8] §8-§7 Starts the simulator -SIMULATOR_COPY_HELP = §8/§esimulator copy §8[§7to-copy§8] §8[§7name§8] §8-§7 Copy the simulator - -SIMULATOR_GUI_ITEM_NAME = §eTNT Simulator - -SIMULATOR_NO_SIM_IN_HAND = §cNo simulator item selected -SIMULATOR_GUI_SELECT_SIM = Simulator selection -SIMULATOR_GUI_CREATE_SIM = §eCreate simulator -SIMULATOR_GUI_CREATE_SIM_GUI = Create simulator -SIMULATOR_NAME_ALREADY_EXISTS = §cSimulator already exists -SIMULATOR_NAME_INVALID = §cInvalid name -SIMULATOR_ERROR_COPY = §cCopy failed -SIMULATOR_NOT_EXISTS = §cSimulator does not exist -SIMULATOR_CREATE = §aSimulator created -SIMULATOR_EDIT_LOCATION = §7Edit position -SIMULATOR_EDIT_PROPERTIES = §7Edit properties -SIMULATOR_EDIT_OTHER = §7Edit other -SIMULATOR_EDIT_GROUP = §7Edit group - -SIMULATOR_EDIT_GROUP_MENU = §eEdit group - -SIMULATOR_WAND_NAME = §eSimulator -SIMULATOR_WAND_NAME_SELECTED = §7Simulator §8- §e{0} -SIMULATOR_WAND_LORE_1 = §eRight click §8- §7Adds a position -SIMULATOR_WAND_LORE_2 = §eSneaking §8- §7Free movement -SIMULATOR_WAND_LORE_3 = §eLeft click §8- §7Start the simulation -SIMULATOR_WAND_LORE_4 = §eRight click in air §8- §7Opens the gui -SIMULATOR_WAND_LORE_5 = §eDouble Sneak §8- §7Swap between TNT and Redstone Block - -SIMULATOR_REGION_FROZEN = §cSimulator cannot be used inside frozen regions - +SIMULATOR_HELP=§8/§esimulator §8-§7 Gives you the simulator wand +SIMULATOR_CREATE_HELP=§8/§esimulator create §8[§7name§8] §8-§7 Create a new simulator +SIMULATOR_CHANGE_HELP=§8/§esimulator change §8-§7 Change your simulator wand selection +SIMULATOR_DELETE_HELP=§8/§esimulator delete §8[§7name§8] §8-§7 Deletes the simulator +SIMULATOR_START_HELP=§8/§esimulator start §8[§7name§8] §8-§7 Starts the simulator +SIMULATOR_COPY_HELP=§8/§esimulator copy §8[§7to-copy§8] §8[§7name§8] §8-§7 Copy the simulator +SIMULATOR_GUI_ITEM_NAME=§eTNT Simulator +SIMULATOR_NO_SIM_IN_HAND=§cNo simulator item selected +SIMULATOR_GUI_SELECT_SIM=Simulator selection +SIMULATOR_GUI_CREATE_SIM=§eCreate simulator +SIMULATOR_GUI_CREATE_SIM_GUI=Create simulator +SIMULATOR_NAME_ALREADY_EXISTS=§cSimulator already exists +SIMULATOR_NAME_INVALID=§cInvalid name +SIMULATOR_ERROR_COPY=§cCopy failed +SIMULATOR_NOT_EXISTS=§cSimulator does not exist +SIMULATOR_CREATE=§aSimulator created +SIMULATOR_EDIT_LOCATION=§7Edit position +SIMULATOR_EDIT_PROPERTIES=§7Edit properties +SIMULATOR_EDIT_OTHER=§7Edit other +SIMULATOR_EDIT_GROUP=§7Edit group +SIMULATOR_EDIT_GROUP_MENU=§eEdit group +SIMULATOR_WAND_NAME=§eSimulator +SIMULATOR_WAND_NAME_SELECTED=§7Simulator §8- §e{0} +SIMULATOR_WAND_LORE_1=§eRight click §8- §7Adds a position +SIMULATOR_WAND_LORE_2=§eSneaking §8- §7Free movement +SIMULATOR_WAND_LORE_3=§eLeft click §8- §7Start the simulation +SIMULATOR_WAND_LORE_4=§eRight click in air §8- §7Opens the gui +SIMULATOR_WAND_LORE_5=§eDouble Sneak §8- §7Swap between TNT and Redstone Block +SIMULATOR_REGION_FROZEN=§cSimulator cannot be used inside frozen regions ## Other -SIMULATOR_PLUS_ONE = §7+1 -SIMULATOR_PLUS_PIXEL_SHIFT = §eShift §7Click for §e+0,0625 -SIMULATOR_PLUS_FIVE_SHIFT = §eShift §7Click for §e+5 -SIMULATOR_MINUS_ONE = §7-1 -SIMULATOR_MINUS_PIXEL_SHIFT = §eShift §7Click for §e-0,0625 -SIMULATOR_MINUS_FIVE_SHIFT = §eShift §7Click for §e-5 -SIMULATOR_POSITION_X = §7x-Position -SIMULATOR_POSITION_Y = §7y-Position -SIMULATOR_POSITION_Z = §7z-Position -SIMULATOR_BACK = §eBack - -SIMULATOR_GUI_TOTAL_TNT = §7Total TNT§8: §e{0} - -SIMULATOR_DELETED = §cSimulator deleted - +SIMULATOR_PLUS_ONE=§7+1 +SIMULATOR_PLUS_PIXEL_SHIFT=§eShift §7Click for §e+0,0625 +SIMULATOR_PLUS_FIVE_SHIFT=§eShift §7Click for §e+5 +SIMULATOR_MINUS_ONE=§7-1 +SIMULATOR_MINUS_PIXEL_SHIFT=§eShift §7Click for §e-0,0625 +SIMULATOR_MINUS_FIVE_SHIFT=§eShift §7Click for §e-5 +SIMULATOR_POSITION_X=§7x-Position +SIMULATOR_POSITION_Y=§7y-Position +SIMULATOR_POSITION_Z=§7z-Position +SIMULATOR_BACK=§eBack +SIMULATOR_GUI_TOTAL_TNT=§7Total TNT§8: §e{0} +SIMULATOR_DELETED=§cSimulator deleted ## GUI -SIMULATOR_POSITION_EDIT = §eEdit position -SIMULATOR_POSITION_ADD = §eSet position -SIMULATOR_GUI_TNT_SPAWN_NAME = §eTNT -SIMULATOR_GUI_TNT_SPAWN_LORE_1 = §7TNT-Count§8: §e{0} -SIMULATOR_GUI_TNT_SPAWN_LORE_2 = §7Tick§8: §e{0} -SIMULATOR_GUI_TNT_SPAWN_LORE_3 = §7Lifespan§8: §e{0} -SIMULATOR_GUI_TNT_SPAWN_LORE_4 = §7 -SIMULATOR_GUI_TNT_SPAWN_LORE_5 = §7x§8: §e{0} -SIMULATOR_GUI_TNT_SPAWN_LORE_6 = §7y§8: §e{0} -SIMULATOR_GUI_TNT_SPAWN_LORE_7 = §7z§8: §e{0} -SIMULATOR_GUI_TNT_GROUP_NAME = §eTNT group -SIMULATOR_GUI_TNT_GROUP_LORE_1 = §7Element count§8: §e{0} -SIMULATOR_GUI_TNT_GROUP_LORE_2 = §7Tick§8: §e{0} -SIMULATOR_GUI_TNT_GROUP_LORE_3 = §7 -SIMULATOR_GUI_TNT_GROUP_LORE_4 = §7x§8: §e{0} -SIMULATOR_GUI_TNT_GROUP_LORE_5 = §7y§8: §e{0} -SIMULATOR_GUI_TNT_GROUP_LORE_6 = §7z§8: §e{0} -SIMULATOR_GUI_TNT_DISABLED = §cDisabled -SIMULATOR_GUI_NAME = Simulator -SIMULATOR_GUI_DELETE = §cDelete TNT -SIMULATOR_GUI_AUTO_TRACE = §eAutoTrace§8: §7{0} -SIMULATOR_GUI_MOVE_ALL = §eMove all - -SIMULATOR_ALIGNMENT_CENTER = §7Alignment§8: §eCenter -SIMULATOR_ALIGNMENT_POSITIVE_X = §7Alignment§8: §ePositive X -SIMULATOR_ALIGNMENT_NEGATIVE_X = §7Alignment§8: §eNegative X -SIMULATOR_ALIGNMENT_POSITIVE_Z = §7Alignment§8: §ePositive Z -SIMULATOR_ALIGNMENT_NEGATIVE_Z = §7Alignment§8: §eNegative Z - -SIMULATOR_MOVE_ALL_GUI_NAME = Move TNT - -SIMULATOR_TNT_SPAWN_GUI_NAME = Configure TNT {0} -SIMULATOR_TNT_SPAWN_EDIT_LOCATION = - Location -SIMULATOR_TNT_SPAWN_EDIT_PROPERTIES = - Properties -SIMULATOR_TNT_SPAWN_EDIT_OTHER = - Other -SIMULATOR_TNT_SPAWN_LORE = §eClick to change -SIMULATOR_TNT_SPAWN_COUNT = §7TNT-Count §8- §e{0} -SIMULATOR_TNT_SPAWN_COUNT_ANVIL_GUI_NAME = TNT-Count -SIMULATOR_TNT_SPAWN_TICK = §7Tick §8- §e{0} -SIMULATOR_TNT_SPAWN_TICK_ANVIL_GUI_NAME = Tick offset -SIMULATOR_TNT_SPAWN_FUSE = §7Lifespan §8- §e{0} -SIMULATOR_TNT_SPAWN_FUSE_ANVIL_GUI_NAME = Fuse-Ticks -SIMULATOR_TNT_SPAWN_VELOCITY_NAME = §7TNT -SIMULATOR_TNT_SPAWN_VELOCITY_X = §7TNT §eJump X §8- {0} -SIMULATOR_TNT_SPAWN_VELOCITY_Y = §7TNT §eJump Y §8- {0} -SIMULATOR_TNT_SPAWN_VELOCITY_Z = §7TNT §eJump Z §8- {0} -SIMULATOR_TNT_SPAWN_VELOCITY_ON = §aon -SIMULATOR_TNT_SPAWN_VELOCITY_OFF = §coff -SIMULATOR_TNT_SPAWN_POSITION_X = §7x-Position §8- §e{0} -SIMULATOR_TNT_SPAWN_POSITION_Y = §7y-Position §8- §e{0} -SIMULATOR_TNT_SPAWN_POSITION_Z = §7z-Position §8- §e{0} -SIMULATOR_TNT_SPAWN_ACTIVATED_NAME = §7Primed by -SIMULATOR_TNT_SPAWN_ACTIVATED_WITH = §7Primed by §8- §e{0} -SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_COMPARATOR = Comparator -SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_REPEATER = Repeater -SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_OBSERVER = Observer -SIMULATOR_TNT_SPAWN_INACTIVE = §7> §7{0} -SIMULATOR_TNT_SPAWN_ACTIVE = §e> §7{0} -SIMULATOR_TNT_SPAWN_MATERIAL = §eMaterial -SIMULATOR_TNT_SPAWN_MATERIAL_LORE_1 = §7Current material§8: §e{0} -SIMULATOR_TNT_SPAWN_MATERIAL_LORE_2 = §eLeft-Click §7to change -SIMULATOR_TNT_SPAWN_MATERIAL_LORE_3 = §eRight-Click §7to reset -SIMULATOR_TNT_SPAWN_ENABLED = §aEnabled -SIMULATOR_TNT_SPAWN_DISABLED = §cDisabled -SIMULATOR_MATERIAL_GUI_NAME = Change material -SIMULATOR_MATERIAL_NAME = §e{0} -SIMULATOR_MATERIAL_NAME_LORE = §7Material §8- §e{0} -SIMULATOR_MATERIAL_CLICK = §eClick to choose -SIMULATOR_TNT_SPAWN_ADD_IGNITION_PHASE = §eAdd prime phase -SIMULATOR_TNT_SPAWN_ADD_TNT = §eAdd TNT -SIMULATOR_TNT_SPAWN_REMOVE_TNT = §cRemove -SIMULATOR_TNT_SPAWN_POSITION_ANVIL_GUI_NAME = Position - +SIMULATOR_POSITION_EDIT=§eEdit position +SIMULATOR_POSITION_ADD=§eSet position +SIMULATOR_GUI_TNT_SPAWN_NAME=§eTNT +SIMULATOR_GUI_TNT_SPAWN_LORE_1=§7TNT-Count§8: §e{0} +SIMULATOR_GUI_TNT_SPAWN_LORE_2=§7Tick§8: §e{0} +SIMULATOR_GUI_TNT_SPAWN_LORE_3=§7Lifespan§8: §e{0} +SIMULATOR_GUI_TNT_SPAWN_LORE_4=§7 +SIMULATOR_GUI_TNT_SPAWN_LORE_5=§7x§8: §e{0} +SIMULATOR_GUI_TNT_SPAWN_LORE_6=§7y§8: §e{0} +SIMULATOR_GUI_TNT_SPAWN_LORE_7=§7z§8: §e{0} +SIMULATOR_GUI_TNT_GROUP_NAME=§eTNT group +SIMULATOR_GUI_TNT_GROUP_LORE_1=§7Element count§8: §e{0} +SIMULATOR_GUI_TNT_GROUP_LORE_2=§7Tick§8: §e{0} +SIMULATOR_GUI_TNT_GROUP_LORE_3=§7 +SIMULATOR_GUI_TNT_GROUP_LORE_4=§7x§8: §e{0} +SIMULATOR_GUI_TNT_GROUP_LORE_5=§7y§8: §e{0} +SIMULATOR_GUI_TNT_GROUP_LORE_6=§7z§8: §e{0} +SIMULATOR_GUI_TNT_DISABLED=§cDisabled +SIMULATOR_GUI_NAME=Simulator +SIMULATOR_GUI_DELETE=§cDelete TNT +SIMULATOR_GUI_AUTO_TRACE=§eAutoTrace§8: §7{0} +SIMULATOR_GUI_MOVE_ALL=§eMove all +SIMULATOR_ALIGNMENT_CENTER=§7Alignment§8: §eCenter +SIMULATOR_ALIGNMENT_POSITIVE_X=§7Alignment§8: §ePositive X +SIMULATOR_ALIGNMENT_NEGATIVE_X=§7Alignment§8: §eNegative X +SIMULATOR_ALIGNMENT_POSITIVE_Z=§7Alignment§8: §ePositive Z +SIMULATOR_ALIGNMENT_NEGATIVE_Z=§7Alignment§8: §eNegative Z +SIMULATOR_MOVE_ALL_GUI_NAME=Move TNT +SIMULATOR_TNT_SPAWN_GUI_NAME=Configure TNT {0} +SIMULATOR_TNT_SPAWN_EDIT_LOCATION=- Location +SIMULATOR_TNT_SPAWN_EDIT_PROPERTIES=- Properties +SIMULATOR_TNT_SPAWN_EDIT_OTHER=- Other +SIMULATOR_TNT_SPAWN_LORE=§eClick to change +SIMULATOR_TNT_SPAWN_COUNT=§7TNT-Count §8- §e{0} +SIMULATOR_TNT_SPAWN_COUNT_ANVIL_GUI_NAME=TNT-Count +SIMULATOR_TNT_SPAWN_TICK=§7Tick §8- §e{0} +SIMULATOR_TNT_SPAWN_TICK_ANVIL_GUI_NAME=Tick offset +SIMULATOR_TNT_SPAWN_FUSE=§7Lifespan §8- §e{0} +SIMULATOR_TNT_SPAWN_FUSE_ANVIL_GUI_NAME=Fuse-Ticks +SIMULATOR_TNT_SPAWN_VELOCITY_NAME=§7TNT +SIMULATOR_TNT_SPAWN_VELOCITY_X=§7TNT §eJump X §8- {0} +SIMULATOR_TNT_SPAWN_VELOCITY_Y=§7TNT §eJump Y §8- {0} +SIMULATOR_TNT_SPAWN_VELOCITY_Z=§7TNT §eJump Z §8- {0} +SIMULATOR_TNT_SPAWN_VELOCITY_ON=§aon +SIMULATOR_TNT_SPAWN_VELOCITY_OFF=§coff +SIMULATOR_TNT_SPAWN_POSITION_X=§7x-Position §8- §e{0} +SIMULATOR_TNT_SPAWN_POSITION_Y=§7y-Position §8- §e{0} +SIMULATOR_TNT_SPAWN_POSITION_Z=§7z-Position §8- §e{0} +SIMULATOR_TNT_SPAWN_ACTIVATED_NAME=§7Primed by +SIMULATOR_TNT_SPAWN_ACTIVATED_WITH=§7Primed by §8- §e{0} +SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_COMPARATOR=Comparator +SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_REPEATER=Repeater +SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_OBSERVER=Observer +SIMULATOR_TNT_SPAWN_INACTIVE=§7> §7{0} +SIMULATOR_TNT_SPAWN_ACTIVE=§e> §7{0} +SIMULATOR_TNT_SPAWN_MATERIAL=§eMaterial +SIMULATOR_TNT_SPAWN_MATERIAL_LORE_1=§7Current material§8: §e{0} +SIMULATOR_TNT_SPAWN_MATERIAL_LORE_2=§eLeft-Click §7to change +SIMULATOR_TNT_SPAWN_MATERIAL_LORE_3=§eRight-Click §7to reset +SIMULATOR_TNT_SPAWN_ENABLED=§aEnabled +SIMULATOR_TNT_SPAWN_DISABLED=§cDisabled +SIMULATOR_MATERIAL_GUI_NAME=Change material +SIMULATOR_MATERIAL_NAME=§e{0} +SIMULATOR_MATERIAL_NAME_LORE=§7Material §8- §e{0} +SIMULATOR_MATERIAL_CLICK=§eClick to choose +SIMULATOR_TNT_SPAWN_ADD_IGNITION_PHASE=§eAdd prime phase +SIMULATOR_TNT_SPAWN_ADD_TNT=§eAdd TNT +SIMULATOR_TNT_SPAWN_REMOVE_TNT=§cRemove +SIMULATOR_TNT_SPAWN_POSITION_ANVIL_GUI_NAME=Position # SmartPlace -SMART_PLACE_HELP = §8/§esmartplace §8-§7 Toggles SmartPlace -SMART_PLACE_INFO = §7Places rotatable blocks §eaway§7 from you when §esneaking§7. -SMART_PLACE_ENABLE = §aSmartPlace activated -SMART_PLACE_DISABLE = §cSmartPlace deactivated - +SMART_PLACE_HELP=§8/§esmartplace §8-§7 Toggles SmartPlace +SMART_PLACE_INFO=§7Places rotatable blocks §eaway§7 from you when §esneaking§7. +SMART_PLACE_ENABLE=§aSmartPlace activated +SMART_PLACE_DISABLE=§cSmartPlace deactivated # InventoryFiller -INVENTORY_FILL_HELP = §8/§einventoryfill §8- §7Toggles InventoryFill -INVENTORY_FILL_INFO = §7Helps you fill containers by looking at them while sneaking and dropping the item. Or just scroll on a container to change the amount of the item inside. -INVENTORY_FILL_ENABLE = §aInventoryFiller activated -INVENTORY_FILL_DISABLE = §cInventoryFiller deactivated - +INVENTORY_FILL_HELP=§8/§einventoryfill §8- §7Toggles InventoryFill +INVENTORY_FILL_INFO=§7Helps you fill containers by looking at them while sneaking and dropping the item. Or just scroll on a container to change the amount of the item inside. +INVENTORY_FILL_ENABLE=§aInventoryFiller activated +INVENTORY_FILL_DISABLE=§cInventoryFiller deactivated # Killchecker -KILLCHECKER_HELP_ENABLE = §8/§ekillchecker enable §8- §7Enables Killchecker / Recalculates kills -KILLCHECKER_HELP_DISABLE = §8/§ekillchecker disable §8- §7Disables Killchecker -KILLCHECKER_INFO = §7Shows the overlaps of cannon kills in your build area. -KILLCHECKER_INFO2 = §7Only colorable blocks like Wool, Terractotta, Stained Glass and Concrete are counted. -KILLCHECKER_ENABLE = §aKillchecker activated -KILLCHECKER_DISABLE = §cKillchecker deactivated -KILLCHECKER_BOSSBAR = §e§l{0} §7(§e{1}%§7) §e§l{2}§7 cannons - +KILLCHECKER_HELP_ENABLE=§8/§ekillchecker enable §8- §7Enables Killchecker / Recalculates kills +KILLCHECKER_HELP_DISABLE=§8/§ekillchecker disable §8- §7Disables Killchecker +KILLCHECKER_INFO=§7Shows the overlaps of cannon kills in your build area. +KILLCHECKER_INFO2=§7Only colorable blocks like Wool, Terractotta, Stained Glass and Concrete are counted. +KILLCHECKER_ENABLE=§aKillchecker activated +KILLCHECKER_DISABLE=§cKillchecker deactivated +KILLCHECKER_BOSSBAR=§e§l{0} §7(§e{1}%§7) §e§l{2}§7 cannons # BlockCounter -BLOCK_COUNTER_HELP_TOGGLE = §8/§eblockcounter §8- §7Toggle on/off -BLOCK_COUNTER_HELP_ENABLE = §8/§eblockcounter enable §8- §7Toggles BlockCounter on -BLOCK_COUNTER_HELP_DISABLE = §8/§eblockcounter disable §8- §7Toggles BlockCounter off -BLOCK_COUNTER_MESSAGE = §7Damage §8> §e{0} §7Blocks §e{1} §7TNT §e{2} §7Blocks/TNT §e{3} §7Blocks/tick -BLOCK_COUNTER_MESSAGE_SECOND = §7Damage §8> §e{0} §7Blocks §e{1} §7TNT §e{2} §7Blocks/TNT §e{3} §7Blocks/s -BLOCK_COUNTER_ENABLE = §7BlockCounter activated -BLOCK_COUNTER_DISABLE = §7BlockCounter deactivated - +BLOCK_COUNTER_HELP_TOGGLE=§8/§eblockcounter §8- §7Toggle on/off +BLOCK_COUNTER_HELP_ENABLE=§8/§eblockcounter enable §8- §7Toggles BlockCounter on +BLOCK_COUNTER_HELP_DISABLE=§8/§eblockcounter disable §8- §7Toggles BlockCounter off +BLOCK_COUNTER_MESSAGE=§7Damage §8> §e{0} §7Blocks §e{1} §7TNT §e{2} §7Blocks/TNT §e{3} §7Blocks/tick +BLOCK_COUNTER_MESSAGE_SECOND=§7Damage §8> §e{0} §7Blocks §e{1} §7TNT §e{2} §7Blocks/TNT §e{3} §7Blocks/s +BLOCK_COUNTER_ENABLE=§7BlockCounter activated +BLOCK_COUNTER_DISABLE=§7BlockCounter deactivated # DepthCounter -DEPTH_COUNTER_MESSAGE = §7Depth §8> §7 -DEPTH_COUNTER_COUNT = {0}{1}§8×{2}{3}§8×{4}{5} -DEPTH_COUNTER_HOVER = §7X§8ק7Y§8ק7Z -DEPTH_COUNTER_TNT = §7 TNT§8: §e{0} - +DEPTH_COUNTER_MESSAGE=§7Depth §8> §7 +DEPTH_COUNTER_COUNT={0}{1}§8×{2}{3}§8×{4}{5} +DEPTH_COUNTER_HOVER=§7X§8ק7Y§8ק7Z +DEPTH_COUNTER_TNT=§7 TNT§8: §e{0} # TPSLimit -TPSLIMIT_FREEZE_HELP = §8/§etpslimit 0 §8-§7 Freeze TPS -TPSLIMIT_LIMIT_HELP = §8/§etpslimit §8[§720>x>0.5§8] §8-§7 Slow TPS down -TPSLIMIT_WARP_HELP = §8/§etpslimit §8[§7x>20§8] §8-§7 Speed TPS up -TPSLIMIT_DEFAULT_HELP = §8/§etpslimit default §8-§7 Set TPS to 20 -TPSLIMIT_HELP = §8/§etpslimit §8-§7 Show current TPS - -TICK_FREEZE_HELP = §8/§etick rate 0 §8-§7 Freeze TPS -TICK_FREEZE_HELP_2 = §8/§etick freeze §8-§7 Freeze TPS -TICK_UNFREEZE_HELP = §8/§etick unfreeze §8-§7 Set TPS to 20 -TICK_LIMIT_HELP = §8/§etick rate §8[§720>x>0.5§8] §8-§7 Slow TPS down -TICK_WARP_HELP = §8/§etick rate §8[§7x>20§8] §8-§7 Speed TPS up -TICK_DEFAULT_HELP = §8/§etick rate default §8-§7 Set TPS to 20 -TICK_HELP = §8/§etick rate §8-§7 Show current TPS - -TICK_STEPPING_HELP = §8/§etick step §8<§7Ticks§8> §8-§7 Step n ticks or 1 forward -TICK_WARPING_HELP = §8/§etick warp §8<§7Ticks§8> §8<§7TPS§8> §8-§7 Warp n ticks or 1 forward - -TICK_BOSSBAR = §7Skipped §e{0}§8/§7{1} -TPSLIMIT_GUI_ITEM_NAME = §eTPS limiter -TPSLIMIT_GUI_ITEM_LORE = §7Currently: §e{0} -TPSLIMIT_ANVIL_GUI = New TPS limit -TPSLIMIT_CURRENT = §7Current TPS limit§8: §e{0} -TPSLIMIT_SET = §eSet TPS limit to {0} -TPSLIMIT_FROZEN = §eTPS frozen - +TPSLIMIT_FREEZE_HELP=§8/§etpslimit 0 §8-§7 Freeze TPS +TPSLIMIT_LIMIT_HELP=§8/§etpslimit §8[§720>x>0.5§8] §8-§7 Slow TPS down +TPSLIMIT_WARP_HELP=§8/§etpslimit §8[§7x>20§8] §8-§7 Speed TPS up +TPSLIMIT_DEFAULT_HELP=§8/§etpslimit default §8-§7 Set TPS to 20 +TPSLIMIT_HELP=§8/§etpslimit §8-§7 Show current TPS +TICK_FREEZE_HELP=§8/§etick rate 0 §8-§7 Freeze TPS +TICK_FREEZE_HELP_2=§8/§etick freeze §8-§7 Freeze TPS +TICK_UNFREEZE_HELP=§8/§etick unfreeze §8-§7 Set TPS to 20 +TICK_LIMIT_HELP=§8/§etick rate §8[§720>x>0.5§8] §8-§7 Slow TPS down +TICK_WARP_HELP=§8/§etick rate §8[§7x>20§8] §8-§7 Speed TPS up +TICK_DEFAULT_HELP=§8/§etick rate default §8-§7 Set TPS to 20 +TICK_HELP=§8/§etick rate §8-§7 Show current TPS +TICK_STEPPING_HELP=§8/§etick step §8<§7Ticks§8> §8-§7 Step n ticks or 1 forward +TICK_WARPING_HELP=§8/§etick warp §8<§7Ticks§8> §8<§7TPS§8> §8-§7 Warp n ticks or 1 forward +TICK_BOSSBAR=§7Skipped §e{0}§8/§7{1} +TPSLIMIT_GUI_ITEM_NAME=§eTPS limiter +TPSLIMIT_GUI_ITEM_LORE=§7Currently: §e{0} +TPSLIMIT_ANVIL_GUI=New TPS limit +TPSLIMIT_CURRENT=§7Current TPS limit§8: §e{0} +TPSLIMIT_SET=§eSet TPS limit to {0} +TPSLIMIT_FROZEN=§eTPS frozen # Trace TRACE_RECORD=§aon TRACE_HAS_TRACES=§ehas Traces TRACE_IDLE_AUTO=§eauto -TRACE_MESSAGE_START = §aTNT-Tracer started -TRACE_MESSAGE_STOP = §cTNT-Tracer stopped +TRACE_MESSAGE_START=§aTNT-Tracer started +TRACE_MESSAGE_STOP=§cTNT-Tracer stopped TRACE_MESSAGE_CLEAR=§cAll TNT-positions deleted TRACE_MESSAGE_DELETE=§cTrace TNT-positions deleted -TRACE_MESSAGE_SHOW = §aAll TNT-positions shown -TRACE_MESSAGE_HIDE = §cAll TNT-positions hidden +TRACE_MESSAGE_SHOW=§aAll TNT-positions shown +TRACE_MESSAGE_HIDE=§cAll TNT-positions hidden TRACE_MESSAGE_SHOW_AT=§aTNT-positions shown at {0} TRACE_MESSAGE_SHOW_FROM=§aAll TNT-positions shown from {0} TRACE_MESSAGE_SHOW_FROM_TO=§aAll TNT-positions shown from {0} to {1} -TRACE_MESSAGE_SHOW_TO_SMALLER = §cTo must be bigger then from - -TRACE_COMMAND_HELP_START = §8/§etrace start §8- §7Starts recording of all TNT-positions -TRACE_COMMAND_HELP_STOP = §8/§etrace stop §8- §7Stops the TNT-Tracer -TRACE_COMMAND_HELP_AUTO = §8/§etrace toggleauto §8- §7Automatic start of recording -TRACE_COMMAND_HELP_SHOW = §8/§etrace show §8<§eParameter§8> - §7Shows all TNT-positions +TRACE_MESSAGE_SHOW_TO_SMALLER=§cTo must be bigger then from +TRACE_MESSAGE_CLICK_ISOLATE=§eClick to §aisolate§8/§cunisolate +TRACE_COMMAND_HELP_START=§8/§etrace start §8- §7Starts recording of all TNT-positions +TRACE_COMMAND_HELP_STOP=§8/§etrace stop §8- §7Stops the TNT-Tracer +TRACE_COMMAND_HELP_AUTO=§8/§etrace toggleauto §8- §7Automatic start of recording +TRACE_COMMAND_HELP_SHOW=§8/§etrace show §8<§eParameter§8> - §7Shows all TNT-positions TRACE_COMMAND_HELP_SHOW_AT=§8/§etrace show §7at §8<§eTIME§8> - §7Shows all Trace Positions at §8<§eTIME§8> TRACE_COMMAND_HELP_SHOW_AT_WITH=§8/§etrace show §7at §8<§eTIME§8> §7with §8<§eParameter§8> - §7Shows all Trace Positions at §8<§eTIME§8> TRACE_COMMAND_HELP_SHOW_FROM=§8/§etrace show §7from §8<§eFROM§8> - §7Shows all Trace Positions from §8<§eFROM§8> TRACE_COMMAND_HELP_SHOW_FROM_WITH=§8/§etrace show §7from §8<§eFROM§8> §7with §8<§eParameter§8> - §7Shows all Trace Positions from §8<§eFROM§8> TRACE_COMMAND_HELP_SHOW_FROM_TO=§8/§etrace show §7from §8<§eFROM§8> §7to §8<§eTO§8> - §7Shows all Trace Positions from §8<§eFROM§8> to §8<§eTO§8> TRACE_COMMAND_HELP_SHOW_FROM_TO_WITH=§8/§etrace show §7from §8<§eFROM§8> §7to §8<§eTO§8> §7with §8<§eParameter§8> - §7Shows all Trace Positions from §8<§eFROM§8> to §8<§eTO§8> -TRACE_COMMAND_HELP_HIDE = §8/§etrace hide §8- §7Hides all TNT-positions +TRACE_COMMAND_HELP_HIDE=§8/§etrace hide §8- §7Hides all TNT-positions TRACE_COMMAND_HELP_DELETE=§8/§etrace delete §8[§eTrace§8] §8- §7Deletes all TNT-positions or a Trace -TRACE_COMMAND_HELP_ISOLATE=§8/§etrace isolate §8[§eTrace§8] §8[§eTNT§8] §8- §7Isolates specific TNTs from the Trace - -TRACE_GUI_ITEM_NAME = §eTracer -TRACE_GUI_ITEM_LORE = §7Status§8: {0} -TRACE_GUI_NAME = Trace Gui -TRACE_GUI_TRACE_INACTIVE = §eStart Tracer -TRACE_GUI_TRACE_ACTIVE = §eStop Tracer -TRACE_GUI_TRACE_ACTIVE_AUTO = §eAuto-Trace is active -TRACE_GUI_AUTO_TRACE_INACTIVE = §eacitvate Auto-Tracer -TRACE_GUI_AUTO_TRACE_ACTIVE = §edeactivate Auto-Tracer -TRACE_GUI_DELETE = §eDelete trace - +TRACE_COMMAND_HELP_ISOLATE=§8/§etrace isolate §8[§eTrace§8] §8[§eTNT§8] §8- §7Isolates specific TNTs from the Trace +TRACE_GUI_ITEM_NAME=§eTracer +TRACE_GUI_ITEM_LORE=§7Status§8: {0} +TRACE_GUI_NAME=Trace Gui +TRACE_GUI_TRACE_INACTIVE=§eStart Tracer +TRACE_GUI_TRACE_ACTIVE=§eStop Tracer +TRACE_GUI_TRACE_ACTIVE_AUTO=§eAuto-Trace is active +TRACE_GUI_AUTO_TRACE_INACTIVE=§eacitvate Auto-Tracer +TRACE_GUI_AUTO_TRACE_ACTIVE=§edeactivate Auto-Tracer +TRACE_GUI_DELETE=§eDelete trace # Loader -LOADER_SETUP = §eSetup -LOADER_RUNNING = §aRunning -LOADER_PAUSE = §7Pause -LOADER_END = §8Finished +LOADER_SETUP=§eSetup +LOADER_RUNNING=§aRunning +LOADER_PAUSE=§7Pause +LOADER_END=§8Finished LOADER_SINGLE=§aSingle - LOADER_MESSAGE_INTERACT=§e{0} added {1} LOADER_MESSAGE_UNINTERACT=§eRemoved Element LOADER_BUTTON_TNT=TNT @@ -539,7 +479,6 @@ LOADER_BUTTON_LECTERN=Lectern LOADER_BUTTON_TRAPDOOR=Trapdoor LOADER_BUTTON_DOOR=Door LOADER_BUTTON_FENCEGATE=Fencegate - LOADER_HELP_SETUP=§8/§eloader setup §8- §7Starts recording actions LOADER_SETUP_STOP_FIRST=§cPlease stop the current loader first! LOADER_HELP_START=§8/§eloader start §8- §7Playback of previously recorded actions @@ -559,7 +498,6 @@ LOADER_PAUSED=§7The Loader is now paused. LOADER_SMALL_TIME=§cThe wait time is too small LOADER_NEW_TIME=§7The wait time is now: {0} LOADER_NEW_LOAD_TIME=§7The action wait time is now: {0} - LOADER_NOTHING_RECORDED=§cYou have not recorded anything yet! LOADER_GUI_TITLE=Loader GUI LOADER_GUI_SHOW_ALL=Show all @@ -576,7 +514,6 @@ LOADER_GUI_SETTINGS_COPY=§7Copy LOADER_GUI_SETTINGS_DELETE=§cDelete LOADER_GUI_WAIT_TITLE=Settings LOADER_GUI_WAIT_BACK=§8Back - LOADER_GUI_CLICK_TO_EDIT=§7Click to edit LOADER_GUI_ITEM_NAME=§7{0}§8: §e{1} LOADER_SETTING_NAME=§7{0} @@ -611,7 +548,6 @@ LOADER_INTERACTION_OPEN=Open LOADER_INTERACTION_CLOSED=Closed LOADER_INTERACTION_COMPARE=Compare LOADER_INTERACTION_SUBTRACT=Subtract - # Loadtimer LOADTIMER_HELP_OVERVIEW=§7Compete with your friends loading your cannon and get information about the cannon LOADTIMER_HELP_START_1=§8/§eloadtimer start §8-§7 Starts the simple Loadtimer @@ -633,27 +569,25 @@ LOADTIMER_SUMARY_PLAYERTABLE_HEAD=§7Player: §eTNT §7(§eTNT/s§7) LOADTIMER_SUMARY_PLAYERTABLE_PLAYER=§7{0}: §e{1} §7(§e{2}/s§7) LOADTIMER_SUMARY_PLAYERTABLE_ALL=Total LOADTIMER_SUMARY_TIMES_HEAD=§7Time: §eSeconds §7(§eTicks§7) -LOADTIMER_SUMARY_TIMES_START = §7 || §7Start! -LOADTIMER_SUMARY_TIMES_ACTIVATION = §7 || Activation: §e{0}s §7(§e{1}t§7) -LOADTIMER_SUMARY_TIMES_IGNITION = §7 || Priming: §e{0}s §7(§e{1}t§7) -LOADTIMER_SUMARY_TIMES_EXPLOSION = §7 || Explosion: §e{0}s §7(§e{1}t§7) +LOADTIMER_SUMARY_TIMES_START=§7 || §7Start! +LOADTIMER_SUMARY_TIMES_ACTIVATION=§7 || Activation: §e{0}s §7(§e{1}t§7) +LOADTIMER_SUMARY_TIMES_IGNITION=§7 || Priming: §e{0}s §7(§e{1}t§7) +LOADTIMER_SUMARY_TIMES_EXPLOSION=§7 || Explosion: §e{0}s §7(§e{1}t§7) LOADTIMER_SUMARY_TIMES_LAST=§7\\/ LOADTIMER_SUMARY_STATS_HEAD=§7Cannon-Stats§8: LOADTIMER_SUMARY_STATS_TNT=§7TNT: §e{0} LOADTIMER_SUMARY_STATS_FREQ=§7Loading frequency: §e{0}/m§8, §7Shot frequency: §e{1}/m - # Observer -OBSERVER_HELP = §7Right-Click an Observer to get the Trace. Flame particles have to be enabled. The Particles will be shown in the block. -OBSERVER_HELP_ENABLE = §8/§eobserver enable §8-§7 Activates the Observer-Tracer -OBSERVER_HELP_DISABLE = §8/§eobserver disable §8-§7 Deactivates the Observer-Tracer -OBSERVER_HELP_DELETE = §8/§eobserver delete §8-§7 Deletes the Obersver-Tracer -OBSERVER_HELP_RETRACE = §8/§eobserver retrace §8-§7 Retraces The Observer-Tracer -OBSERVER_ENABLE = §7Observer trace started -OBSERVER_DISABLE = §7Observer trace stopped -OBSERVER_DELETE = §7Observer trace deleted -OBSERVER_RETRACE_DONE = §7Observer trace retraced -OBSERVER_RETRACE_NO_TRACE = §7No Observer trace to retrace - +OBSERVER_HELP=§7Right-Click an Observer to get the Trace. Flame particles have to be enabled. The Particles will be shown in the block. +OBSERVER_HELP_ENABLE=§8/§eobserver enable §8-§7 Activates the Observer-Tracer +OBSERVER_HELP_DISABLE=§8/§eobserver disable §8-§7 Deactivates the Observer-Tracer +OBSERVER_HELP_DELETE=§8/§eobserver delete §8-§7 Deletes the Obersver-Tracer +OBSERVER_HELP_RETRACE=§8/§eobserver retrace §8-§7 Retraces The Observer-Tracer +OBSERVER_ENABLE=§7Observer trace started +OBSERVER_DISABLE=§7Observer trace stopped +OBSERVER_DELETE=§7Observer trace deleted +OBSERVER_RETRACE_DONE=§7Observer trace retraced +OBSERVER_RETRACE_NO_TRACE=§7No Observer trace to retrace # Other OTHER_ITEMS_TELEPORT_NAME=§eTeleporter OTHER_ITEMS_TELEPORT_GUI_NAME=Teleport @@ -671,8 +605,8 @@ OTHER_ITEMS_INVENTORY_FILL_LORE_ACTIVE=§aActivated OTHER_ITEMS_INVENTORY_FILL_LORE_INACTIVE=§aDisabled OTHER_SLOT_INVALID_SLOT=§cInvalid slot OTHER_NOCLIP_SLOT_INFO=§7With /slot you can change the selected slot and take another block in the slot. -OTHER_NOCLIP_SLOT_HELP_PICK = §8/§eslot pick §8-§7 Take the faced block into your inventory. -OTHER_NOCLIP_SLOT_HELP_DROP = §8/§eslot drop §8-§7 Clears your slot +OTHER_NOCLIP_SLOT_HELP_PICK=§8/§eslot pick §8-§7 Take the faced block into your inventory. +OTHER_NOCLIP_SLOT_HELP_DROP=§8/§eslot drop §8-§7 Clears your slot OTHER_CLEAR_HELP_SELF=§8/§eclear §8- §7Clears your inventory OTHER_CLEAR_HELP_PLAYER=§8/§eclear §8[§7Player§8] §8- §7Clears a player inventory OTHER_CLEAR_CLEARED=Your inventory was cleared. @@ -686,7 +620,7 @@ OTHER_KILLALL_HELP_SELF=§8/§ekillall §8- §7Remove all entities from your reg OTHER_KILLALL_HELP_ALL=§8/§ekillall §8[§7Global§8/Local§7] §8- §7Remove all entities from your region or globally OTHER_KILLALL_REGION=§a{0} Entities removed OTHER_KILLALL_GLOBAL=§a{0} Entities removed from the world -OTHER_TELEPORT_HELP = §8/§etp §8[§7Player§8] §8-§7 Teleports you to another player +OTHER_TELEPORT_HELP=§8/§etp §8[§7Player§8] §8-§7 Teleports you to another player OTHER_TELEPORT_SELF_0=§cBe one with yourself! OTHER_TELEPORT_SELF_1=§cYou need someone to play with? We have a TeamSpeak! OTHER_TELEPORT_SELF_2=§cBlocks left to travel: 0; ETA: 0:00 @@ -695,9 +629,9 @@ OTHER_TELEPORT_SELF_4=§cFor such a distance? OTHER_TIME_HELP=§8/§etime §8<§7Time 0=Morining§8, §76000=Midday§8, §718000=Midnight§8> - §7Sets the time on the Build OTHER_TIME_INVALID=§cPlease input a time between 0 and 24000 OTHER_TIME_RESULT=§7§oWhooosh -OTHER_TPS_HEAD = §7TPS: 1s 10s 1m 5m 10m -OTHER_TPS_MESSAGE = §7 §e{0}§7 §e{1}§7 §e{2}§7 §e{3}§7 §e{4} -OTHER_TPS_SINGLE = §8TPS: §e{0} +OTHER_TPS_HEAD=§7TPS: 1s 10s 1m 5m 10m +OTHER_TPS_MESSAGE=§7 §e{0}§7 §e{1}§7 §e{2}§7 §e{3}§7 §e{4} +OTHER_TPS_SINGLE=§8TPS: §e{0} OTHER_WORLDSPAWN_HELP=§8/§eworldspawn §8-§e Teleport to the spawn OTHER_BIND_HELP=§8/§ebind §8[§7Command§8] §8-§e Bind a command on item interaction OTHER_BIND_ERROR=§cInvalid or unknown command @@ -709,7 +643,7 @@ OTHER_BIND_MESSAGE_UNBIND=§7Unbound command DEBUG_STICK_COMMAND_HELP=§8/§edebugstick §8-§7 receive a debugstick DEBUG_STICK_NAME=§eDebugstick #Skull Gui -SKULL_GUI_ITEM_NAME = §ePlayer Heads +SKULL_GUI_ITEM_NAME=§ePlayer Heads ANVIL_INV_NAME=Player name # StructureVoid STRUCTURE_VOID_COMMAND_HELP=§8/§estructureVoid §8-§7 Receive a StructureVoid @@ -719,17 +653,16 @@ DRAGON_EGG_COMMAND_HELP=§8/§edragonegg §8-§7 Receive a Dragon Egg NIGHT_VISION_HELP=§8/§enightvision §8-§7 Toggel nightvision. NIGHT_VISION_OFF=§eNightvision deactivated NIGHT_VISION_ON=§eNightvision activated -NIGHT_VISION_ITEM_ON = §7Nightvision: §eActivated -NIGHT_VISION_ITEM_OFF = §7Nightvision: §eDeactivated - +NIGHT_VISION_ITEM_ON=§7Nightvision: §eActivated +NIGHT_VISION_ITEM_OFF=§7Nightvision: §eDeactivated #Navigation Wand NAVIGATION_WAND=§eNavigation Wand NAVIGATION_WAND_LEFT_CLICK=§eLeft click: jump to location NAVIGATION_WAND_RIGHT_CLICK=§eRight click: pass through walls # Material -MATERIAL_SEARCH_PROPERTY_TRUE = §aShould have -MATERIAL_SEARCH_PROPERTY_FALSE = §cShould not have -MATERIAL_SEARCH_PROPERTY_IGNORE = §eIgnore +MATERIAL_SEARCH_PROPERTY_TRUE=§aShould have +MATERIAL_SEARCH_PROPERTY_FALSE=§cShould not have +MATERIAL_SEARCH_PROPERTY_IGNORE=§eIgnore MATERIAL_INV_NAME=§eMaterial {0}/{1} MATERIAL_SEARCH=§eSearch MATERIAL_BACK=§eBack @@ -846,198 +779,171 @@ REGION_TNT_TB=§aTNT-Damage activated outside the building area REGION_TNT_BUILD=§aTNT-Damage activated outside the testblok area REGION_TNT_BUILD_DESTROY=§cAn explosion would have destroyed blocks in the building area REGION_TNT_TB_DESTROY=§cAn explosion would have destroyed blocks in the testblock area - AFK_KICK_MESSAGE=§cNothing happened on this server for 15 minutes. AFK_WARNING_MESSAGE=§cThis server will stop in one minute if you remain inactive - -SKIN_HELP = §8/§eskin §8[§7Shortform§8] §8[§7Creator§8|§epublic§8] §8[§7Name...§8] §8- §7Creates the skin schematic. Use 'public' as creator to have no creator, then copy the message to YoyoNow by clicking +SKIN_HELP=§8/§eskin §8[§7Shortform§8] §8[§7Creator§8|§epublic§8] §8[§7Name...§8] §8- §7Creates the skin schematic. Use 'public' as creator to have no creator, then copy the message to YoyoNow by clicking SKIN_NO_REGION=§7You are not in a region with a changealbe skin SKIN_ALREADY_EXISTS=§cThis skin already exists like this SKIN_MESSAGE=§7Skin created SKIN_MESSAGE_HOVER=§eClick to copy for YoyoNow and send - # Panzern -PANZERN_HELP = §8/§epanzern §8[§7Block§8] §8[§7Slab§8] §8- §7Armor your WorldEdit selection -PANZERN_PREPARE1 = §71. Check, if barrels reach until border of armor. -PANZERN_PREPARE2 = §72. Carpet on the floor in walkways helps with armoring. -PANZERN_PREPARE3 = §73. Shieldtechnology should be encased. -PANZERN_PREPARE4 = §74. Standing in the region that is being armored can improve armoring. -PANZERN_NO_WORLDEDIT = §cYou have no WorldEdit selcetion -PANZERN_PROGRESS = §e{0} §7Blocks left, §e{1} §7Blocks per second, §e{2} §7block delta -PANZERN_DONE = §aDone - +PANZERN_HELP=§8/§epanzern §8[§7Block§8] §8[§7Slab§8] §8- §7Armor your WorldEdit selection +PANZERN_PREPARE1=§71. Check, if barrels reach until border of armor. +PANZERN_PREPARE2=§72. Carpet on the floor in walkways helps with armoring. +PANZERN_PREPARE3=§73. Shieldtechnology should be encased. +PANZERN_PREPARE4=§74. Standing in the region that is being armored can improve armoring. +PANZERN_NO_WORLDEDIT=§cYou have no WorldEdit selcetion +PANZERN_PROGRESS=§e{0} §7Blocks left, §e{1} §7Blocks per second, §e{2} §7block delta +PANZERN_DONE=§aDone # Laufbau -LAUFBAU_HELP = §8/§elaufbau §8[§7smallest§8|§7blastresistant§8] §8- §7Build a barrel in your WorldEdit selection using the traces -LAUFBAU_HELP_SETTINGS = §8/§elaufbau settings §8- §7Opens the settings GUI -LAUFBAU_PREPARE1 = §71. Trace the cannons as often as necessary, in all modes. -LAUFBAU_PREPARE2 = §72. Try to delete all fails from the traces. -LAUFBAU_NO_WORLDEDIT = §cYou don't have a WorldEdit selection -LAUFBAU_STATE_FILTERING_TRACES = Filtering traces -LAUFBAU_STATE_PROCESSING_TRACES = Connnecting traces -LAUFBAU_STATE_CREATE_LAUF = Create Barrel -LAUFBAU_SIMPLE_PROGRESS = §e{0}§8: §e{1}§8/§e{2} §7Time left§8: §e{3} -LAUFBAU_DONE = §aDone - -LAUFBAU_SETTINGS_GUI_NAME = §eLaufbau -LAUFBAU_SETTINGS_ACTIVE = §aActive -LAUFBAU_SETTINGS_INACTIVE = §cInactive -LAUFBAU_SETTINGS_MIXED = §e{0}§8/§e{1} §aActive -LAUFBAU_SETTINGS_GUI_BACK = §eBack - -LAUFBAU_SETTINGS_TOGGLE = §eClick §8-§7 Toggle -LAUFBAU_SETTINGS_ADVANCED = §eMiddle-Click §8-§7 Advanced settings - -LAUFBAU_BLOCK_COBWEB = §eCobweb -LAUFBAU_BLOCK_GRASS_PATH = §eGrass Path -LAUFBAU_BLOCK_SOUL_SAND = §eSoul Sand -LAUFBAU_BLOCK_COCOA = §eCocoa -LAUFBAU_BLOCK_TURTLE_EGG = §eTurtle Eggs -LAUFBAU_BLOCK_CHEST = §eChest -LAUFBAU_BLOCK_SNOW = §eSnow Layer -LAUFBAU_BLOCK_PLAYER_WALL_HEAD = §ePlayer Wall Head -LAUFBAU_BLOCK_STONECUTTER = §eStonecutter -LAUFBAU_BLOCK_PLAYER_HEAD = §ePlayer Head -LAUFBAU_BLOCK_CAKE = §eCake -LAUFBAU_BLOCK_END_STONE_BRICK_SLAB = §eEndstone Brick Slabs -LAUFBAU_BLOCK_SEA_PICKLE = §eSea Pickles -LAUFBAU_BLOCK_CAMPFIRE = §eCampfire -LAUFBAU_BLOCK_FLOWER_POT = §eFlower Pot -LAUFBAU_BLOCK_IRON_TRAPDOOR = §eIron Trapdoor -LAUFBAU_BLOCK_LILY_PAD = §eLily Pad -LAUFBAU_BLOCK_WHITE_CARPET = §eCarpet -LAUFBAU_BLOCK_END_ROD = §eEnd Rod -LAUFBAU_BLOCK_LIGHTNING_ROD = §eLightning Rod -LAUFBAU_BLOCK_CONDUIT = §eConduit -LAUFBAU_BLOCK_BREWING_STAND = §eBrewing Stand -LAUFBAU_BLOCK_BELL = §eBell -LAUFBAU_BLOCK_GRINDSTONE = §eGrindstone -LAUFBAU_BLOCK_HOPPER = §eHopper -LAUFBAU_BLOCK_LANTERN = §eLantern -LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS = §eEndstone Brick Stairs -LAUFBAU_BLOCK_CHORUS_PLANT = §eChorus Plant -LAUFBAU_BLOCK_NETHER_BRICK_FENCE = §eNether Brick Fence -LAUFBAU_BLOCK_IRON_BARS = §eIron Bars -LAUFBAU_BLOCK_END_STONE_BRICK_WALL = §eEndstone Brick Walls -LAUFBAU_BLOCK_SMALL_AMETHYST_BUD = §eSmall Amethyst Bud -LAUFBAU_BLOCK_MEDIUM_AMETHYST_BUD = §eMedium Amethyst Bud -LAUFBAU_BLOCK_LARGE_AMETHYST_BUD = §eLarge Amethyst Bud -LAUFBAU_BLOCK_AMETHYST_CLUSTER = §eAmethyst Cluster -LAUFBAU_BLOCK_CHAIN = §eChain -LAUFBAU_BLOCK_BIG_DRIP_LEAF = §eBig Drip Leaf -LAUFBAU_BLOCK_DRAGON_EGG = §eDragon Egg -LAUFBAU_BLOCK_AZALEA = §eAzalea -LAUFBAU_BLOCK_CANDLE = §eCandle -LAUFBAU_BLOCK_CANDLE_CAKE = §eCake with Candle -LAUFBAU_BLOCK_LECTERN = §eLectern - -LAUFBAU_FACING_NORTH = §8-§7 Facing North -LAUFBAU_FACING_SOUTH = §8-§7 Facing South -LAUFBAU_FACING_WEST = §8-§7 Facing West -LAUFBAU_FACING_EAST = §8-§7 Facing East -LAUFBAU_FACING_UP = §8-§7 Facing Up -LAUFBAU_FACING_DOWN = §8-§7 Facing Down - -LAUFBAU_COUNT_1 = §8-§7 Count 1 -LAUFBAU_COUNT_2 = §8-§7 Count 2 -LAUFBAU_COUNT_3 = §8-§7 Count 3 -LAUFBAU_COUNT_4 = §8-§7 Count 4 - -LAUFBAU_LAYERS_8 = §8-§7 Layers 8 -LAUFBAU_LAYERS_7 = §8-§7 Layers 7 -LAUFBAU_LAYERS_6 = §8-§7 Layers 6 -LAUFBAU_LAYERS_3 = §8-§7 Layers 3 -LAUFBAU_LAYERS_2 = §8-§7 Layers 2 - -LAUFBAU_TYPE_BOTTOM = §8-§7 Type bottom -LAUFBAU_TYPE_TOP = §8-§7 Type top - -LAUFBAU_HALF_BOTTOM = §8-§7 Half bottom -LAUFBAU_HALF_TOP = §8-§7 Half top - -LAUFBAU_OPEN = §8-§7 Opened - -LAUFBAU_ATTACHMENT_CEILING = §8-§7 Attachment Ceiling -LAUFBAU_ATTACHMENT_FLOOR = §8-§7 Attachment Floor -LAUFBAU_ATTACHMENT_DOUBLE_WALL = §8-§7 Attachment double Wall -LAUFBAU_ATTACHMENT_SINGLE_WALL = §8-§7 Attachment single Wall -LAUFBAU_ATTACHMENT_WALL = §8-§7 Attachment Wall - -LAUFBAU_CONNECTION_FLOOR = §8-§7 Connection Floor -LAUFBAU_CONNECTION_NORTH = §8-§7 Connection North -LAUFBAU_CONNECTION_SOUTH = §8-§7 Connection South -LAUFBAU_CONNECTION_EAST = §8-§7 Connection East -LAUFBAU_CONNECTION_WEST = §8-§7 Connection West -LAUFBAU_CONNECTION_DOWN = §8-§7 Connection Bottom -LAUFBAU_CONNECTION_UP = §8-§7 Connection Top - -LAUFBAU_HANGING = §8-§7 hanging - -LAUFBAU_SHAPE_STRAIGHT = §8-§7 Shape straight -LAUFBAU_SHAPE_OUTER_LEFT = §8-§7 Shape outer links -LAUFBAU_SHAPE_INNER_LEFT = §8-§7 Shape inner left - -LAUFBAU_TILT_NONE = §8-§7 Tilt none -LAUFBAU_TILT_PARTIAL = §8-§7 Tilt partial - +LAUFBAU_HELP=§8/§elaufbau §8[§7smallest§8|§7blastresistant§8] §8- §7Build a barrel in your WorldEdit selection using the traces +LAUFBAU_HELP_SETTINGS=§8/§elaufbau settings §8- §7Opens the settings GUI +LAUFBAU_PREPARE1=§71. Trace the cannons as often as necessary, in all modes. +LAUFBAU_PREPARE2=§72. Try to delete all fails from the traces. +LAUFBAU_NO_WORLDEDIT=§cYou don't have a WorldEdit selection +LAUFBAU_STATE_FILTERING_TRACES=Filtering traces +LAUFBAU_STATE_PROCESSING_TRACES=Connnecting traces +LAUFBAU_STATE_CREATE_LAUF=Create Barrel +LAUFBAU_SIMPLE_PROGRESS=§e{0}§8: §e{1}§8/§e{2} §7Time left§8: §e{3} +LAUFBAU_DONE=§aDone +LAUFBAU_SETTINGS_GUI_NAME=§eLaufbau +LAUFBAU_SETTINGS_ACTIVE=§aActive +LAUFBAU_SETTINGS_INACTIVE=§cInactive +LAUFBAU_SETTINGS_MIXED=§e{0}§8/§e{1} §aActive +LAUFBAU_SETTINGS_GUI_BACK=§eBack +LAUFBAU_SETTINGS_TOGGLE=§eClick §8-§7 Toggle +LAUFBAU_SETTINGS_ADVANCED=§eMiddle-Click §8-§7 Advanced settings +LAUFBAU_BLOCK_COBWEB=§eCobweb +LAUFBAU_BLOCK_GRASS_PATH=§eGrass Path +LAUFBAU_BLOCK_SOUL_SAND=§eSoul Sand +LAUFBAU_BLOCK_COCOA=§eCocoa +LAUFBAU_BLOCK_TURTLE_EGG=§eTurtle Eggs +LAUFBAU_BLOCK_CHEST=§eChest +LAUFBAU_BLOCK_SNOW=§eSnow Layer +LAUFBAU_BLOCK_PLAYER_WALL_HEAD=§ePlayer Wall Head +LAUFBAU_BLOCK_STONECUTTER=§eStonecutter +LAUFBAU_BLOCK_PLAYER_HEAD=§ePlayer Head +LAUFBAU_BLOCK_CAKE=§eCake +LAUFBAU_BLOCK_END_STONE_BRICK_SLAB=§eEndstone Brick Slabs +LAUFBAU_BLOCK_SEA_PICKLE=§eSea Pickles +LAUFBAU_BLOCK_CAMPFIRE=§eCampfire +LAUFBAU_BLOCK_FLOWER_POT=§eFlower Pot +LAUFBAU_BLOCK_IRON_TRAPDOOR=§eIron Trapdoor +LAUFBAU_BLOCK_LILY_PAD=§eLily Pad +LAUFBAU_BLOCK_WHITE_CARPET=§eCarpet +LAUFBAU_BLOCK_END_ROD=§eEnd Rod +LAUFBAU_BLOCK_LIGHTNING_ROD=§eLightning Rod +LAUFBAU_BLOCK_CONDUIT=§eConduit +LAUFBAU_BLOCK_BREWING_STAND=§eBrewing Stand +LAUFBAU_BLOCK_BELL=§eBell +LAUFBAU_BLOCK_GRINDSTONE=§eGrindstone +LAUFBAU_BLOCK_HOPPER=§eHopper +LAUFBAU_BLOCK_LANTERN=§eLantern +LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS=§eEndstone Brick Stairs +LAUFBAU_BLOCK_CHORUS_PLANT=§eChorus Plant +LAUFBAU_BLOCK_NETHER_BRICK_FENCE=§eNether Brick Fence +LAUFBAU_BLOCK_IRON_BARS=§eIron Bars +LAUFBAU_BLOCK_END_STONE_BRICK_WALL=§eEndstone Brick Walls +LAUFBAU_BLOCK_SMALL_AMETHYST_BUD=§eSmall Amethyst Bud +LAUFBAU_BLOCK_MEDIUM_AMETHYST_BUD=§eMedium Amethyst Bud +LAUFBAU_BLOCK_LARGE_AMETHYST_BUD=§eLarge Amethyst Bud +LAUFBAU_BLOCK_AMETHYST_CLUSTER=§eAmethyst Cluster +LAUFBAU_BLOCK_CHAIN=§eChain +LAUFBAU_BLOCK_BIG_DRIP_LEAF=§eBig Drip Leaf +LAUFBAU_BLOCK_DRAGON_EGG=§eDragon Egg +LAUFBAU_BLOCK_AZALEA=§eAzalea +LAUFBAU_BLOCK_CANDLE=§eCandle +LAUFBAU_BLOCK_CANDLE_CAKE=§eCake with Candle +LAUFBAU_BLOCK_LECTERN=§eLectern +LAUFBAU_FACING_NORTH=§8-§7 Facing North +LAUFBAU_FACING_SOUTH=§8-§7 Facing South +LAUFBAU_FACING_WEST=§8-§7 Facing West +LAUFBAU_FACING_EAST=§8-§7 Facing East +LAUFBAU_FACING_UP=§8-§7 Facing Up +LAUFBAU_FACING_DOWN=§8-§7 Facing Down +LAUFBAU_COUNT_1=§8-§7 Count 1 +LAUFBAU_COUNT_2=§8-§7 Count 2 +LAUFBAU_COUNT_3=§8-§7 Count 3 +LAUFBAU_COUNT_4=§8-§7 Count 4 +LAUFBAU_LAYERS_8=§8-§7 Layers 8 +LAUFBAU_LAYERS_7=§8-§7 Layers 7 +LAUFBAU_LAYERS_6=§8-§7 Layers 6 +LAUFBAU_LAYERS_3=§8-§7 Layers 3 +LAUFBAU_LAYERS_2=§8-§7 Layers 2 +LAUFBAU_TYPE_BOTTOM=§8-§7 Type bottom +LAUFBAU_TYPE_TOP=§8-§7 Type top +LAUFBAU_HALF_BOTTOM=§8-§7 Half bottom +LAUFBAU_HALF_TOP=§8-§7 Half top +LAUFBAU_OPEN=§8-§7 Opened +LAUFBAU_ATTACHMENT_CEILING=§8-§7 Attachment Ceiling +LAUFBAU_ATTACHMENT_FLOOR=§8-§7 Attachment Floor +LAUFBAU_ATTACHMENT_DOUBLE_WALL=§8-§7 Attachment double Wall +LAUFBAU_ATTACHMENT_SINGLE_WALL=§8-§7 Attachment single Wall +LAUFBAU_ATTACHMENT_WALL=§8-§7 Attachment Wall +LAUFBAU_CONNECTION_FLOOR=§8-§7 Connection Floor +LAUFBAU_CONNECTION_NORTH=§8-§7 Connection North +LAUFBAU_CONNECTION_SOUTH=§8-§7 Connection South +LAUFBAU_CONNECTION_EAST=§8-§7 Connection East +LAUFBAU_CONNECTION_WEST=§8-§7 Connection West +LAUFBAU_CONNECTION_DOWN=§8-§7 Connection Bottom +LAUFBAU_CONNECTION_UP=§8-§7 Connection Top +LAUFBAU_HANGING=§8-§7 hanging +LAUFBAU_SHAPE_STRAIGHT=§8-§7 Shape straight +LAUFBAU_SHAPE_OUTER_LEFT=§8-§7 Shape outer links +LAUFBAU_SHAPE_INNER_LEFT=§8-§7 Shape inner left +LAUFBAU_TILT_NONE=§8-§7 Tilt none +LAUFBAU_TILT_PARTIAL=§8-§7 Tilt partial # UTILS -SELECT_HELP = §8/§eselect §8[§7RegionsTyp§8] §8- §7Select a region type -SELECT_EXTENSION_HELP = §8/§eselect §8[§7RegionsTyp§8] §8[§7Extension§8] §8- §7Select a region type with or without extension -SELECT_GLOBAL_REGION = §cThe global region cannot be selected -SELECT_NO_TYPE = §cThis region has no {0} -SELECT_NO_EXTENSION = §cThis region has no extension -SELECT_MESSAGE = §7WorldEdit selection set to {0}, {1}, {2} and {3}, {4}, {5} - -SKULL_HELP = §8/§eskull §8[§eplayer§8] §8-§7 Receive a player head -SKULL_INVALID = §cInvalid player name -SKULL_ITEM = §e{0}§8s Head - -SPEED_HELP = §8/§espeed §8[§71§8-§710§8|§edefault§8] §8-§7 Set your flight and walking speed. -SPEED_CURRENT = §7Current speed§8: §e{0} -SPEED_TOO_SMALL = §c{0} is too small -SPEED_TOO_HIGH = §c{0} is too big -SPEED_ITEM = §eSpeed -SPEED_ITEM_LORE = §7Currently: §e -SPEED_TAB_NAME = Input speed - -WORLDEDIT_WAND = WorldEdit Wand -WORLDEDIT_LEFTCLICK = Left click: select pos #1 -WORLDEDIT_RIGHTCLICK = Right click: select pos #2 - -TNT_CLICK_HEADER = §8---=== §eTNT §8===--- -TNT_CLICK_ORDER = §eEntity Order§8: §e{0} -TNT_CLICK_FUSE_TIME = §eFuseTime§8: §e{0} -TNT_CLICK_POSITION_X = §7Position §eX§8: §e{0} -TNT_CLICK_POSITION_Y = §7Position §eY§8: §e{0} -TNT_CLICK_POSITION_Z = §7Position §eZ§8: §e{0} -TNT_CLICK_VELOCITY_X = §7Velocity §eX§8: §e{0} -TNT_CLICK_VELOCITY_Y = §7Velocity §eY§8: §e{0} -TNT_CLICK_VELOCITY_Z = §7Velocity §eZ§8: §e{0} -TNT_CLICK_COUNT = §7Count §8: §e{0} -TNT_CLICK_ISOLATE = §eIsolate - -SELECT_ITEM_CHOOSE_EXTENSION = Choose extension -SELECT_ITEM_CHOOSE_SELECTION = Choose selection -SELECT_ITEM_NORMAL_EXTENSION = §eNormal -SELECT_ITEM_EXTENDED_EXTENSION= §eExtension -SELECT_ITEM_SELECT= §eSelect -SELECT_ITEM_AUSWAHL= §7Selection: §7{0} {1} +SELECT_HELP=§8/§eselect §8[§7RegionsTyp§8] §8- §7Select a region type +SELECT_EXTENSION_HELP=§8/§eselect §8[§7RegionsTyp§8] §8[§7Extension§8] §8- §7Select a region type with or without extension +SELECT_GLOBAL_REGION=§cThe global region cannot be selected +SELECT_NO_TYPE=§cThis region has no {0} +SELECT_NO_EXTENSION=§cThis region has no extension +SELECT_MESSAGE=§7WorldEdit selection set to {0}, {1}, {2} and {3}, {4}, {5} +SKULL_HELP=§8/§eskull §8[§eplayer§8] §8-§7 Receive a player head +SKULL_INVALID=§cInvalid player name +SKULL_ITEM=§e{0}§8s Head +SPEED_HELP=§8/§espeed §8[§71§8-§710§8|§edefault§8] §8-§7 Set your flight and walking speed. +SPEED_CURRENT=§7Current speed§8: §e{0} +SPEED_TOO_SMALL=§c{0} is too small +SPEED_TOO_HIGH=§c{0} is too big +SPEED_ITEM=§eSpeed +SPEED_ITEM_LORE=§7Currently: §e +SPEED_TAB_NAME=Input speed +WORLDEDIT_WAND=WorldEdit Wand +WORLDEDIT_LEFTCLICK=Left click: select pos #1 +WORLDEDIT_RIGHTCLICK=Right click: select pos #2 +TNT_CLICK_HEADER=§8---=== §eTNT §8===--- +TNT_CLICK_ORDER=§eEntity Order§8: §e{0} +TNT_CLICK_FUSE_TIME=§eFuseTime§8: §e{0} +TNT_CLICK_POSITION_X=§7Position §eX§8: §e{0} +TNT_CLICK_POSITION_Y=§7Position §eY§8: §e{0} +TNT_CLICK_POSITION_Z=§7Position §eZ§8: §e{0} +TNT_CLICK_VELOCITY_X=§7Velocity §eX§8: §e{0} +TNT_CLICK_VELOCITY_Y=§7Velocity §eY§8: §e{0} +TNT_CLICK_VELOCITY_Z=§7Velocity §eZ§8: §e{0} +TNT_CLICK_COUNT=§7Count §8: §e{0} +TNT_CLICK_ISOLATE=§eIsolate +SELECT_ITEM_CHOOSE_EXTENSION=Choose extension +SELECT_ITEM_CHOOSE_SELECTION=Choose selection +SELECT_ITEM_NORMAL_EXTENSION=§eNormal +SELECT_ITEM_EXTENDED_EXTENSION=§eExtension +SELECT_ITEM_SELECT=§eSelect +SELECT_ITEM_AUSWAHL=§7Selection: §7{0} {1} SELECT_ITEM_RIGHT_CLICK=§7Right-Click to change SELECT_ITEM_BAURAHMEN=§eBuild area SELECT_ITEM_BAUPLATTFORM=§eBuild platform SELECT_ITEM_TESTBLOCK=§eDummy - -CHESTFILLER_FILLED = §eChest filled -CHESTFILLER_COUNT = §7{0}§8: §e§l{1} - -PISTON_HELP_1 = §7Right click on piston with a slime ball to calculate the moved blocks. -PISTON_HELP_2 = §7Count is red, if one unmoveable block is present. -PISTON_HELP_3 = §7Count is yellow, if too many blocks are present. -PISTON_INFO = §7Moved Blocks {0}{1}§8/§712 - +CHESTFILLER_FILLED=§eChest filled +CHESTFILLER_COUNT=§7{0}§8: §e§l{1} +PISTON_HELP_1=§7Right click on piston with a slime ball to calculate the moved blocks. +PISTON_HELP_2=§7Count is red, if one unmoveable block is present. +PISTON_HELP_3=§7Count is yellow, if too many blocks are present. +PISTON_INFO=§7Moved Blocks {0}{1}§8/§712 # Warp -WARP_LOC_X = §7X§8: §e{0} -WARP_LOC_Y = §7Y§8: §e{0} -WARP_LOC_Z = §7Z§8: §e{0} +WARP_LOC_X=§7X§8: §e{0} +WARP_LOC_Y=§7Y§8: §e{0} +WARP_LOC_Z=§7Z§8: §e{0} WARP_EXISTS=§7The warp with the name §e{0} §7already exists WARP_NAME_RESERVED=§7You can not use §c{0} §7as name for a warp WARP_CREATED=§7The warp §e{0} §7was created @@ -1057,30 +963,22 @@ WARP_HELP_INFO=§8/§ewarp info §8[§7name§8] §8- §7Information regarding on WARP_HELP_DELETE=§8/§ewarp delete §8[§7name§8] §8- §7Delete a warp WARP_HELP_GUI=§8/§ewarp gui §8- §7Open the Warp-GUI WARP_HELP_LIST=§8/§ewarp list §8- §7List all warps - # WORLD -STOP_HELP = §8/§estop §8- §7Stops the server -STOP_MESSAGE = §eServer is stopping - -KICKALL_HELP = §8/§ekickall §8- §7Kick all players from the server except the owner - +STOP_HELP=§8/§estop §8- §7Stops the server +STOP_MESSAGE=§eServer is stopping +KICKALL_HELP=§8/§ekickall §8- §7Kick all players from the server except the owner # Techhider -TECHHIDER_HELP = §8/§etechhider §8- §7Toggle Techhider -TECHHIDER_GLOBAL = §cNo techhider in global region -TECHHIDER_ON = §aTechhider activated -TECHHIDER_OFF = §cTechhider deactivated - +TECHHIDER_HELP=§8/§etechhider §8- §7Toggle Techhider +TECHHIDER_GLOBAL=§cNo techhider in global region +TECHHIDER_ON=§aTechhider activated +TECHHIDER_OFF=§cTechhider deactivated # XRAY -XRAY_HELP = §8/§exray §8- §7Toggle Xray -XRAY_GLOBAL = §cNo xray in global region -XRAY_ON = §aXray activated -XRAY_OFF = §cXray deactivated - - +XRAY_HELP=§8/§exray §8- §7Toggle Xray +XRAY_GLOBAL=§cNo xray in global region +XRAY_ON=§aXray activated +XRAY_OFF=§cXray deactivated # WorldEdit -COLORREPLACE_HELP = §8//§ecolorreplace §8[§7color§8] §8[§7color§8] §8- §7Replace all blocks of one color with another - -TYPEREPLACE_HELP = §8//§etyreplace §8[§7type§8] §8[§7type§8] §8- §7Replace all blocks of one type with another - +COLORREPLACE_HELP=§8//§ecolorreplace §8[§7color§8] §8[§7color§8] §8- §7Replace all blocks of one color with another +TYPEREPLACE_HELP=§8//§etyreplace §8[§7type§8] §8[§7type§8] §8- §7Replace all blocks of one type with another # Schematic SCHEMATIC_GUI_ITEM=§eSchematics diff --git a/BauSystem_Main/src/BauSystem_de.properties b/BauSystem_Main/src/BauSystem_de.properties index 0c33a977..4c2b2f7c 100644 --- a/BauSystem_Main/src/BauSystem_de.properties +++ b/BauSystem_Main/src/BauSystem_de.properties @@ -16,108 +16,89 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # - -PREFIX = §eBau§8System§8» -TIME = HH:mm:ss +PREFIX=§eBau§8System§8» +TIME=HH:mm:ss DATE=........ COMMAND_HELP_HEAD=§7---=== (§e{0}§7) ===--- ONLY_SCHEMS=§cDu kannst hier keinen Ordner angeben - PAGE_LIST=§e Seite ({0}/{1}) »» LIST_PREVIOUS_PAGE=§eVorherige Seite LIST_NEXT_PAGE=§eNächste Seite - # Permission -NO_PERMISSION = Du darfst dies hier nicht nutzen -SPECTATOR = §fZuschauer - +NO_PERMISSION=Du darfst dies hier nicht nutzen +SPECTATOR=§fZuschauer # Scoreboard -SCOREBOARD_TIME = Uhrzeit -SCOREBOARD_REGION = Region -SCOREBOARD_TRACE = Trace -SCOREBOARD_LOADER = Loader -SCOREBOARD_TPS = TPS -SCOREBOARD_TPS_FROZEN = §eEingefroren - -SCOREBOARD_TRACE_TICKS = Ticks - -SCOREBOARD_TECHHIDER = TechHider§8: §aAn -SCOREBOARD_XRAY = XRay§8: §aAn - -SCOREBOARD_LOCK_TEAM = Bau Lock§8: §eTeam -SCOREBOARD_LOCK_TEAM_AND_SERVERTEAM = Bau Lock§8: §e(Server-) Team -SCOREBOARD_LOCK_SERVERTEAM = Bau Lock§8: §eServerteam -SCOREBOARD_LOCK_NOBODY = Bau Lock§8: §cNiemand - +SCOREBOARD_TIME=Uhrzeit +SCOREBOARD_REGION=Region +SCOREBOARD_TRACE=Trace +SCOREBOARD_LOADER=Loader +SCOREBOARD_TPS=TPS +SCOREBOARD_TPS_FROZEN=§eEingefroren +SCOREBOARD_TRACE_TICKS=Ticks +SCOREBOARD_TECHHIDER=TechHider§8: §aAn +SCOREBOARD_XRAY=XRay§8: §aAn +SCOREBOARD_LOCK_TEAM=Bau Lock§8: §eTeam +SCOREBOARD_LOCK_TEAM_AND_SERVERTEAM=Bau Lock§8: §e(Server-) Team +SCOREBOARD_LOCK_SERVERTEAM=Bau Lock§8: §eServerteam +SCOREBOARD_LOCK_NOBODY=Bau Lock§8: §cNiemand # Flags -FLAG_COLOR = Color -FLAG_TNT = TNT -FLAG_FIRE = Fire -FLAG_FREEZE = Freeze -FLAG_PROTECT = Protect -FLAG_ITEMS = Items - -FLAG_FIRE_ALLOW = §can -FLAG_FIRE_DENY = §aaus - -FLAG_FREEZE_ACTIVE = §aan -FLAG_FREEZE_INACTIVE = §caus - -FLAG_PROTECT_ACTIVE = §aan -FLAG_PROTECT_INACTIVE = §caus - -FLAG_TNT_ALLOW = §aan -FLAG_TNT_DENY = §caus -FLAG_TNT_ONLY_TB = §7Kein §eBaurahmen -FLAG_TNT_ONLY_BUILD = §7Kein §eTestblock - -FLAG_ITEMS_ACTIVE = §aan -FLAG_ITEMS_INACTIVE = §caus - -FLAG_COLOR_WHITE = §fWeiß -FLAG_COLOR_ORANGE = §6Orange -FLAG_COLOR_MAGENTA = §dMagenta -FLAG_COLOR_LIGHT_BLUE = §bHellblau -FLAG_COLOR_YELLOW = §eGelb -FLAG_COLOR_LIME = §aHellgrün +FLAG_COLOR=Color +FLAG_TNT=TNT +FLAG_FIRE=Fire +FLAG_FREEZE=Freeze +FLAG_PROTECT=Protect +FLAG_ITEMS=Items +FLAG_FIRE_ALLOW=§can +FLAG_FIRE_DENY=§aaus +FLAG_FREEZE_ACTIVE=§aan +FLAG_FREEZE_INACTIVE=§caus +FLAG_PROTECT_ACTIVE=§aan +FLAG_PROTECT_INACTIVE=§caus +FLAG_TNT_ALLOW=§aan +FLAG_TNT_DENY=§caus +FLAG_TNT_ONLY_TB=§7Kein §eBaurahmen +FLAG_TNT_ONLY_BUILD=§7Kein §eTestblock +FLAG_ITEMS_ACTIVE=§aan +FLAG_ITEMS_INACTIVE=§caus +FLAG_COLOR_WHITE=§fWeiß +FLAG_COLOR_ORANGE=§6Orange +FLAG_COLOR_MAGENTA=§dMagenta +FLAG_COLOR_LIGHT_BLUE=§bHellblau +FLAG_COLOR_YELLOW=§eGelb +FLAG_COLOR_LIME=§aHellgrün ## This cannot be converted -FLAG_COLOR_PINK = §ePink -FLAG_COLOR_GRAY = §8Grau -FLAG_COLOR_LIGHT_GRAY = §7Hellgrau -FLAG_COLOR_CYAN = §3Cyan -FLAG_COLOR_PURPLE = §5Lila -FLAG_COLOR_BLUE = §1Blau +FLAG_COLOR_PINK=§ePink +FLAG_COLOR_GRAY=§8Grau +FLAG_COLOR_LIGHT_GRAY=§7Hellgrau +FLAG_COLOR_CYAN=§3Cyan +FLAG_COLOR_PURPLE=§5Lila +FLAG_COLOR_BLUE=§1Blau ## This cannot be converted -FLAG_COLOR_BROWN = §eBraun -FLAG_COLOR_GREEN = §2Grün -FLAG_COLOR_RED = §cRot -FLAG_COLOR_BLACK = §0Schwarz - +FLAG_COLOR_BROWN=§eBraun +FLAG_COLOR_GREEN=§2Grün +FLAG_COLOR_RED=§cRot +FLAG_COLOR_BLACK=§0Schwarz # Region -REGION_TYPE_NORMAL = Normal -REGION_TYPE_BUILD = Baubereich -REGION_TYPE_ONLY_TB = Testblock - +REGION_TYPE_NORMAL=Normal +REGION_TYPE_BUILD=Baubereich +REGION_TYPE_ONLY_TB=Testblock # AttributesCopy -ATTRIBUTES_CANT_COPY = §cDu musst den Item Type in der Hand halten wo du auch drauf guckst. -ATTRIBUTES_NO_COPY = §cKeine Attribute kopiert. -ATTRIBUTES_COPIED = §eAttribute kopiert. - -ATTRIBUTE_REMOVE_ALL = §eAlle Attribute entfernt. -ATTRIBUTE_REMOVE_SINGLE = §eAttribut §7{0}§e entfernt. -ATTRIBUTE_REMOVE_NOT_FOUND = §cAttribut nicht gefunden - +ATTRIBUTES_CANT_COPY=§cDu musst den Item Type in der Hand halten wo du auch drauf guckst. +ATTRIBUTES_NO_COPY=§cKeine Attribute kopiert. +ATTRIBUTES_COPIED=§eAttribute kopiert. +ATTRIBUTE_REMOVE_ALL=§eAlle Attribute entfernt. +ATTRIBUTE_REMOVE_SINGLE=§eAttribut §7{0}§e entfernt. +ATTRIBUTE_REMOVE_NOT_FOUND=§cAttribut nicht gefunden # AutoStart -AUTOSTART_COMMAND_HELP = §8/§etimer §8- §7Legt den AutostartTimer ins Inventar -AUTOSTART_ITEM_NAME = §eAutostartTimer -AUTOSTART_ITEM_LORE = §eRechtsklick Block §8- §7Starte den Timer -AUTOSTART_MESSAGE_NO_REGION = §cDu befindest dich derzeit in keiner Region -AUTOSTART_MESSAGE_RESET = §eDer AutostartTimer wurde zurückgesetzt -AUTOSTART_MESSAGE_START = §eAutostartTimer gestartet -AUTOSTART_MESSAGE_RESULT1 = §eZeit §7bis zur §eExplosion §7am Gegner§8:§e {0}§7 in game ticks -AUTOSTART_MESSAGE_RESULT2 = §7Zeitdifferenz in §egame ticks §7bis {0} Sekunden§8:§e {1} -AUTOSTART_MESSAGE_RESULT3 = §7Positiv, wenn zu wenig, negativ wenn zu viel - +AUTOSTART_COMMAND_HELP=§8/§etimer §8- §7Legt den AutostartTimer ins Inventar +AUTOSTART_ITEM_NAME=§eAutostartTimer +AUTOSTART_ITEM_LORE=§eRechtsklick Block §8- §7Starte den Timer +AUTOSTART_MESSAGE_NO_REGION=§cDu befindest dich derzeit in keiner Region +AUTOSTART_MESSAGE_RESET=§eDer AutostartTimer wurde zurückgesetzt +AUTOSTART_MESSAGE_START=§eAutostartTimer gestartet +AUTOSTART_MESSAGE_RESULT1=§eZeit §7bis zur §eExplosion §7am Gegner§8:§e {0}§7 in game ticks +AUTOSTART_MESSAGE_RESULT2=§7Zeitdifferenz in §egame ticks §7bis {0} Sekunden§8:§e {1} +AUTOSTART_MESSAGE_RESULT3=§7Positiv, wenn zu wenig, negativ wenn zu viel # Backup BACKUP_HELP_CREATE=§8/§ebackup create §8- §7Erstelle ein Backup der Region BACKUP_HELP_LOAD=§8/§ebackup load §8[§7BackupName§8] §8- §7 Lade ein Backup @@ -134,44 +115,38 @@ BACKUP_LOAD=§7Backup geladen BACKUP_INV_NAME=§eBackup BACKUP_ITEM_NAME=§eBackup §7von §e{0} BACKUP_LORE=§eKlicken zum Laden - # Bau -BAU_COMMAND_HELP_INFO = §8/§ebau info §8- §7Alias für §8/§ebauinfo - -BAU_INFO_ITEM_NAME = §eBau-Management +BAU_COMMAND_HELP_INFO=§8/§ebau info §8- §7Alias für §8/§ebauinfo +BAU_INFO_ITEM_NAME=§eBau-Management ## This is used in BauInfoBauGuiItem.java -BAU_INFO_ITEM_LORE_TNT = §7TNT§8: §e{0} -BAU_INFO_ITEM_LORE_FREEZE = §7Freeze§8: §e{0} -BAU_INFO_ITEM_LORE_DAMAGE = §7Damage§8: §e{0} -BAU_INFO_ITEM_LORE_FIRE = §7Feuer§8: §e{0} -BAU_INFO_ITEM_LORE_COLOR = §7Farbe§8: §e{0} -BAU_INFO_ITEM_LORE_PROTECT = §7Protect§8: §e{0} - -BAU_INFO_COMMAND_HELP = §8/§ebauinfo §8- §7Gibt Informationen über den Bau -BAU_INFO_COMMAND_OWNER = §7Besitzer§8: §e{0} -BAU_INFO_COMMAND_MEMBER = §7{0} §8[§7{1}§8]§8: §e{2} -BAU_INFO_COMMAND_FLAG = §7{0}§8: §7{1} -BAU_INFO_COMMAND_TPS = §7TPS§8:§e - +BAU_INFO_ITEM_LORE_TNT=§7TNT§8: §e{0} +BAU_INFO_ITEM_LORE_FREEZE=§7Freeze§8: §e{0} +BAU_INFO_ITEM_LORE_DAMAGE=§7Damage§8: §e{0} +BAU_INFO_ITEM_LORE_FIRE=§7Feuer§8: §e{0} +BAU_INFO_ITEM_LORE_COLOR=§7Farbe§8: §e{0} +BAU_INFO_ITEM_LORE_PROTECT=§7Protect§8: §e{0} +BAU_INFO_COMMAND_HELP=§8/§ebauinfo §8- §7Gibt Informationen über den Bau +BAU_INFO_COMMAND_OWNER=§7Besitzer§8: §e{0} +BAU_INFO_COMMAND_MEMBER=§7{0} §8[§7{1}§8]§8: §e{2} +BAU_INFO_COMMAND_FLAG=§7{0}§8: §7{1} +BAU_INFO_COMMAND_TPS=§7TPS§8:§e # Countingwand -COUNTINGWAND_COMMAND_HELP = §8/§ecountingwand §8- §7Gibt dir ein CountingWand -COUNTINGWAND_ITEM_NAME = §eZollstock -COUNTINGWAND_ITEM_LORE1 = §eLinksklick §8- §7Setzt die 1. Position -COUNTINGWAND_ITEM_LORE2 = §eRechtsklick §8- §7Setzt die 2. Position -COUNTINGWAND_MESSAGE_RCLICK = §7Erste Position bei: §8[§7{0}§8, §7{1}§8, §7{2}§8] ({3}§8) ({4}§8) -COUNTINGWAND_MESSAGE_LCLICK = §7Zweite Position bei: §8[§7{0}§8, §7{1}§8, §7{2}§8] ({3}§8) ({4}§8) -COUNTINGWAND_MESSAGE_VOLUME = §e{0} -COUNTINGWAND_MESSAGE_DIMENSION = §e{0}§8, §e{1}§8, §e{2} - +COUNTINGWAND_COMMAND_HELP=§8/§ecountingwand §8- §7Gibt dir ein CountingWand +COUNTINGWAND_ITEM_NAME=§eZollstock +COUNTINGWAND_ITEM_LORE1=§eLinksklick §8- §7Setzt die 1. Position +COUNTINGWAND_ITEM_LORE2=§eRechtsklick §8- §7Setzt die 2. Position +COUNTINGWAND_MESSAGE_RCLICK=§7Erste Position bei: §8[§7{0}§8, §7{1}§8, §7{2}§8] ({3}§8) ({4}§8) +COUNTINGWAND_MESSAGE_LCLICK=§7Zweite Position bei: §8[§7{0}§8, §7{1}§8, §7{2}§8] ({3}§8) ({4}§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 End Stone im Design -DESIGN_ENDSTONE_REGION_ERROR = §cDiese Region hat keinen Baubereich -DESIGN_ENDSTONE_ENABLE = §aEndstone im Design ist angezeigt -DESIGN_ENDSTONE_DISABLE = §cEndstone im Design ist versteckt - +DESIGN_ENDSTONE_COMMAND_HELP=§8/§edesign endstone §8- §7Zeige End Stone im Design +DESIGN_ENDSTONE_REGION_ERROR=§cDiese Region hat keinen Baubereich +DESIGN_ENDSTONE_ENABLE=§aEndstone im Design ist angezeigt +DESIGN_ENDSTONE_DISABLE=§cEndstone im Design ist versteckt # Detonator -DETONATOR_LOC_REMOVE = §e{0} entfernt -DETONATOR_LOC_ADD = §e{0} hinzugefügt +DETONATOR_LOC_REMOVE=§e{0} entfernt +DETONATOR_LOC_ADD=§e{0} hinzugefügt DETONATOR_BUTTON_SWITCH=Hebel DETONATOR_BUTTON_WOOD_BUTTON=Knopf DETONATOR_BUTTON_STONE_BUTTON=Knopf @@ -218,287 +193,254 @@ GUI_EDITOR_ITEM_TRASH_LORE=§7Item hier rein Legen GUI_EDITOR_ITEM_MORE=§eMehr Items GUI_EDITOR_ITEM_CLOSE=§eSchließen GUI_EDITOR_TITLE_MORE=Item auswählen - # Script ## CustomScript -SCRIPT_HOTKEY_ITEM_NAME = §7Hotkey§8: §e{0} -SCRIPT_EVENT_ITEM_NAME = §7Event§8: §e{0} -SCRIPT_COMMAND_ITEM_NAME = §7Befehl§8: §e/{0} +SCRIPT_HOTKEY_ITEM_NAME=§7Hotkey§8: §e{0} +SCRIPT_EVENT_ITEM_NAME=§7Event§8: §e{0} +SCRIPT_COMMAND_ITEM_NAME=§7Befehl§8: §e/{0} SCRIPT_ERROR_ONLY_IN_GLOBAL=§cDieses Skript kann nur als globales Skript ausgeführt werden - ## Script Menu GUI -SCRIPT_MENU_GUI_ITEM_LORE_1 = §7Klicke zum rausnehmen -SCRIPT_MENU_GUI_ITEM_LORE_2 = §7Shiftklick zum kopieren -SCRIPT_MENU_GUI_ITEM_LORE_3 = §7Rechtsklick zum editieren -SCRIPT_MENU_GUI_ITEM_LORE_4 = §7Mittelklick zum anschauen -SCRIPT_MENU_GUI_NAME = §eSkript-Menü -SCRIPT_MENU_GUI_ITEM_ADD_NAME = §eHinzufügen -SCRIPT_MENU_GUI_ITEM_ADD_LORE = §7Klicke mit einem Buch zum hinzufügen +SCRIPT_MENU_GUI_ITEM_LORE_1=§7Klicke zum rausnehmen +SCRIPT_MENU_GUI_ITEM_LORE_2=§7Shiftklick zum kopieren +SCRIPT_MENU_GUI_ITEM_LORE_3=§7Rechtsklick zum editieren +SCRIPT_MENU_GUI_ITEM_LORE_4=§7Mittelklick zum anschauen +SCRIPT_MENU_GUI_NAME=§eSkript-Menü +SCRIPT_MENU_GUI_ITEM_ADD_NAME=§eHinzufügen +SCRIPT_MENU_GUI_ITEM_ADD_LORE=§7Klicke mit einem Buch zum hinzufügen SCRIPT_DEPRECATED=§cDie Funktion §e{0}§c ist veraltet und wird demnächst entfernt. Bitte benutze §e{1}§c. - # Shield Printing -SHIELD_PRINTING_HELP_START = §8/§eshieldprinting start §8- §7Starte das Schild drucken -SHIELD_PRINTING_HELP_COPY = §8/§eshieldprinting copy §8- §7Kopiert die Schilder -SHIELD_PRINTING_HELP_APPLY = §8/§eshieldprinting apply §8- §7Wendet die Schilder an -SHIELD_PRINTING_HELP_STOP = §8/§eshieldprinting stop §8- §7Stoppt das Schild drucken -SHIELD_PRINTING_HELP_STEP_1 = §81. §7Füge die Schematic in die Welt ein -SHIELD_PRINTING_HELP_STEP_2 = §82. §7Starte das Schild drucken mit §8/§eshieldprinting start -SHIELD_PRINTING_HELP_STEP_3 = §83. §7Warte bis alle Schilde ausgefahren sind -SHIELD_PRINTING_HELP_STEP_4 = §84. §7Editiere die Schilde wenn nötig -SHIELD_PRINTING_HELP_STEP_5 = §85. §7Kopiere das gedruckte mit §8/§eshieldprinting copy -SHIELD_PRINTING_HELP_STEP_6 = §86. §7Füge die originale Schematic wieder ein -SHIELD_PRINTING_HELP_STEP_7 = §87. §7Wende das gedruckte mit §8/§eshieldprinting apply§7 an - -SHIELD_PRINTING_NO_REGION = §cDu bist in keiner Region. -SHIELD_PRINTING_NOT_RUNNING = §cShield printing ist nicht aktiv. -SHIELD_PRINTING_BOSSBAR = §fBewegungen: {0} -SHIELD_PRINTING_BOSSBAR_COPIED = §fBewegungen: {0} Kopiert: {1} - -SHIELD_PRINTING_GUI_NAME = §7Schild Drucken -SHIELD_PRINTING_GUI_APPLY = §aAnwenden -SHIELD_PRINTING_GUI_STATE_PREVIOUS = §7R-Click§8: §7Vorherige -SHIELD_PRINTING_GUI_STATE_NEXT = §7L-Click§8: §7Nächste -SHIELD_PRINTING_GUI_STATE_ACTIVE = §e> §7{0} -SHIELD_PRINTING_GUI_STATE_INACTIVE = §8> §7{0} -SHIELD_PRINTING_GUI_STATE_FROM_ORIGINAL = Original -SHIELD_PRINTING_GUI_STATE_FROM_COPY = Kopie -SHIELD_PRINTING_GUI_STATE_ALWAYS_ON = An -SHIELD_PRINTING_GUI_STATE_ALWAYS_OFF = Aus -SHIELD_PRINTING_GUI_STATE_ALWAYS_OPEN = Offen -SHIELD_PRINTING_GUI_STATE_ALWAYS_CLOSED = Geschlossen -SHIELD_PRINTING_GUI_STATE_FENCE = §7{0} §fZaun Verbindungen -SHIELD_PRINTING_GUI_STATE_OPENABLE = §7{0} §fGeöffnet -SHIELD_PRINTING_GUI_STATE_PISTON = §7{0} §fAusgefahren -SHIELD_PRINTING_GUI_STATE_POWERABLE = §7{0} §fAktiviert -SHIELD_PRINTING_GUI_STATE_WALL = §7{0} §fWand Verbindungen - -SHIELD_PRINTING_START = §aShield printing wurde gestartet. -SHIELD_PRINTING_COPY = §aSchilde wurden kopiert. -SHIELD_PRINTING_APPLY = §aSchilde wurden angewendet. -SHIELD_PRINTING_STOP = §aShield printing wurde gestoppt. - +SHIELD_PRINTING_HELP_START=§8/§eshieldprinting start §8- §7Starte das Schild drucken +SHIELD_PRINTING_HELP_COPY=§8/§eshieldprinting copy §8- §7Kopiert die Schilder +SHIELD_PRINTING_HELP_APPLY=§8/§eshieldprinting apply §8- §7Wendet die Schilder an +SHIELD_PRINTING_HELP_STOP=§8/§eshieldprinting stop §8- §7Stoppt das Schild drucken +SHIELD_PRINTING_HELP_STEP_1=§81. §7Füge die Schematic in die Welt ein +SHIELD_PRINTING_HELP_STEP_2=§82. §7Starte das Schild drucken mit §8/§eshieldprinting start +SHIELD_PRINTING_HELP_STEP_3=§83. §7Warte bis alle Schilde ausgefahren sind +SHIELD_PRINTING_HELP_STEP_4=§84. §7Editiere die Schilde wenn nötig +SHIELD_PRINTING_HELP_STEP_5=§85. §7Kopiere das gedruckte mit §8/§eshieldprinting copy +SHIELD_PRINTING_HELP_STEP_6=§86. §7Füge die originale Schematic wieder ein +SHIELD_PRINTING_HELP_STEP_7=§87. §7Wende das gedruckte mit §8/§eshieldprinting apply§7 an +SHIELD_PRINTING_NO_REGION=§cDu bist in keiner Region. +SHIELD_PRINTING_NOT_RUNNING=§cShield printing ist nicht aktiv. +SHIELD_PRINTING_BOSSBAR=§fBewegungen: {0} +SHIELD_PRINTING_BOSSBAR_COPIED=§fBewegungen: {0} Kopiert: {1} +SHIELD_PRINTING_GUI_NAME=§7Schild Drucken +SHIELD_PRINTING_GUI_APPLY=§aAnwenden +SHIELD_PRINTING_GUI_STATE_PREVIOUS=§7R-Click§8: §7Vorherige +SHIELD_PRINTING_GUI_STATE_NEXT=§7L-Click§8: §7Nächste +SHIELD_PRINTING_GUI_STATE_ACTIVE=§e> §7{0} +SHIELD_PRINTING_GUI_STATE_INACTIVE=§8> §7{0} +SHIELD_PRINTING_GUI_STATE_FROM_ORIGINAL=Original +SHIELD_PRINTING_GUI_STATE_FROM_COPY=Kopie +SHIELD_PRINTING_GUI_STATE_ALWAYS_ON=An +SHIELD_PRINTING_GUI_STATE_ALWAYS_OFF=Aus +SHIELD_PRINTING_GUI_STATE_ALWAYS_OPEN=Offen +SHIELD_PRINTING_GUI_STATE_ALWAYS_CLOSED=Geschlossen +SHIELD_PRINTING_GUI_STATE_FENCE=§7{0} §fZaun Verbindungen +SHIELD_PRINTING_GUI_STATE_OPENABLE=§7{0} §fGeöffnet +SHIELD_PRINTING_GUI_STATE_PISTON=§7{0} §fAusgefahren +SHIELD_PRINTING_GUI_STATE_POWERABLE=§7{0} §fAktiviert +SHIELD_PRINTING_GUI_STATE_WALL=§7{0} §fWand Verbindungen +SHIELD_PRINTING_START=§aShield printing wurde gestartet. +SHIELD_PRINTING_COPY=§aSchilde wurden kopiert. +SHIELD_PRINTING_APPLY=§aSchilde wurden angewendet. +SHIELD_PRINTING_STOP=§aShield printing wurde gestoppt. # Unsign Book UNSIGN_HELP=§8/§eunsign §8- §7Mache ein Buch beschreibbar - # Simulator -SIMULATOR_HELP = §8/§esimulator §8-§7 Legt dir den Simulatorstab ins Inventar -SIMULATOR_CREATE_HELP = §8/§esimulator create §8[§7name§8] §8-§7 Erstelle einen neuen Simulator -SIMULATOR_CHANGE_HELP = §8/§esimulator change §8-§7 Wechsel zu einem anderen Simulator -SIMULATOR_DELETE_HELP = §8/§esimulator delete §8[§7name§8] §8-§7 Löscht den Simulator -SIMULATOR_START_HELP = §8/§esimulator start §8[§7name§8] §8-§7 Startet die Simulation -SIMULATOR_COPY_HELP = §8/§esimulator copy §8[§7to-copy§8] §8[§7name§8] §8-§7 Kopiert einen Simulator - -SIMULATOR_GUI_ITEM_NAME = §eTNT Simulator - -SIMULATOR_NO_SIM_IN_HAND = §cKein Simulator Item gewählt -SIMULATOR_GUI_SELECT_SIM = Simulator wählen -SIMULATOR_GUI_CREATE_SIM = §eSimulator erstellen -SIMULATOR_GUI_CREATE_SIM_GUI = Simulator erstellen -SIMULATOR_NAME_ALREADY_EXISTS = §cSimulator existiert bereits -SIMULATOR_NAME_INVALID = §cUngültiger Name -SIMULATOR_ERROR_COPY = §cFehler beim kopieren -SIMULATOR_NOT_EXISTS = §cSimulator existiert nicht -SIMULATOR_CREATE = §aSimulator erstellt -SIMULATOR_EDIT_LOCATION = §7Editiere Positionen -SIMULATOR_EDIT_PROPERTIES = §7Editiere Eigenschaften -SIMULATOR_EDIT_OTHER = §7Editiere Andere -SIMULATOR_EDIT_GROUP = §7Editiere Gruppe - -SIMULATOR_EDIT_GROUP_MENU = §eEditiere Gruppe - -SIMULATOR_WAND_NAME = §eKanonensimulator -SIMULATOR_WAND_NAME_SELECTED = §7Kanonensimulator §8- §e{0} -SIMULATOR_WAND_LORE_1 = §eRechtsklick §8- §7Füge eine Position hinzu -SIMULATOR_WAND_LORE_2 = §eSneaken §8- §7Freie Bewegung -SIMULATOR_WAND_LORE_3 = §eLinksklick §8- §7Starte die Simulation -SIMULATOR_WAND_LORE_4 = §eRechtsklick Luft §8- §7Öffne die GUI -SIMULATOR_WAND_LORE_5 = §eDoppel Shift §8- §7Wechsel zwischen TNT und Redstone Block - -SIMULATOR_REGION_FROZEN = §cSimulator kann nicht in eingefrorenen Regionen genutzt werden - +SIMULATOR_HELP=§8/§esimulator §8-§7 Legt dir den Simulatorstab ins Inventar +SIMULATOR_CREATE_HELP=§8/§esimulator create §8[§7name§8] §8-§7 Erstelle einen neuen Simulator +SIMULATOR_CHANGE_HELP=§8/§esimulator change §8-§7 Wechsel zu einem anderen Simulator +SIMULATOR_DELETE_HELP=§8/§esimulator delete §8[§7name§8] §8-§7 Löscht den Simulator +SIMULATOR_START_HELP=§8/§esimulator start §8[§7name§8] §8-§7 Startet die Simulation +SIMULATOR_COPY_HELP=§8/§esimulator copy §8[§7to-copy§8] §8[§7name§8] §8-§7 Kopiert einen Simulator +SIMULATOR_GUI_ITEM_NAME=§eTNT Simulator +SIMULATOR_NO_SIM_IN_HAND=§cKein Simulator Item gewählt +SIMULATOR_GUI_SELECT_SIM=Simulator wählen +SIMULATOR_GUI_CREATE_SIM=§eSimulator erstellen +SIMULATOR_GUI_CREATE_SIM_GUI=Simulator erstellen +SIMULATOR_NAME_ALREADY_EXISTS=§cSimulator existiert bereits +SIMULATOR_NAME_INVALID=§cUngültiger Name +SIMULATOR_ERROR_COPY=§cFehler beim kopieren +SIMULATOR_NOT_EXISTS=§cSimulator existiert nicht +SIMULATOR_CREATE=§aSimulator erstellt +SIMULATOR_EDIT_LOCATION=§7Editiere Positionen +SIMULATOR_EDIT_PROPERTIES=§7Editiere Eigenschaften +SIMULATOR_EDIT_OTHER=§7Editiere Andere +SIMULATOR_EDIT_GROUP=§7Editiere Gruppe +SIMULATOR_EDIT_GROUP_MENU=§eEditiere Gruppe +SIMULATOR_WAND_NAME=§eKanonensimulator +SIMULATOR_WAND_NAME_SELECTED=§7Kanonensimulator §8- §e{0} +SIMULATOR_WAND_LORE_1=§eRechtsklick §8- §7Füge eine Position hinzu +SIMULATOR_WAND_LORE_2=§eSneaken §8- §7Freie Bewegung +SIMULATOR_WAND_LORE_3=§eLinksklick §8- §7Starte die Simulation +SIMULATOR_WAND_LORE_4=§eRechtsklick Luft §8- §7Öffne die GUI +SIMULATOR_WAND_LORE_5=§eDoppel Shift §8- §7Wechsel zwischen TNT und Redstone Block +SIMULATOR_REGION_FROZEN=§cSimulator kann nicht in eingefrorenen Regionen genutzt werden ## Other -SIMULATOR_PLUS_ONE = §7+1 -SIMULATOR_PLUS_PIXEL_SHIFT = §eShift §7Click für §e+0,0625 -SIMULATOR_PLUS_FIVE_SHIFT = §eShift §7Click für §e+5 -SIMULATOR_MINUS_ONE = §7-1 -SIMULATOR_MINUS_PIXEL_SHIFT = §eShift §7Click für §e-0,0625 -SIMULATOR_MINUS_FIVE_SHIFT = §eShift §7Click für §e-5 -SIMULATOR_POSITION_X = §7x-Position -SIMULATOR_POSITION_Y = §7y-Position -SIMULATOR_POSITION_Z = §7z-Position -SIMULATOR_BACK = §eZurück - -SIMULATOR_GUI_TOTAL_TNT = §7Gesamt TNT§8: §e{0} - -SIMULATOR_DELETED = §cSimulator gelöscht - +SIMULATOR_PLUS_ONE=§7+1 +SIMULATOR_PLUS_PIXEL_SHIFT=§eShift §7Click für §e+0,0625 +SIMULATOR_PLUS_FIVE_SHIFT=§eShift §7Click für §e+5 +SIMULATOR_MINUS_ONE=§7-1 +SIMULATOR_MINUS_PIXEL_SHIFT=§eShift §7Click für §e-0,0625 +SIMULATOR_MINUS_FIVE_SHIFT=§eShift §7Click für §e-5 +SIMULATOR_POSITION_X=§7x-Position +SIMULATOR_POSITION_Y=§7y-Position +SIMULATOR_POSITION_Z=§7z-Position +SIMULATOR_BACK=§eZurück +SIMULATOR_GUI_TOTAL_TNT=§7Gesamt TNT§8: §e{0} +SIMULATOR_DELETED=§cSimulator gelöscht ## GUI -SIMULATOR_POSITION_EDIT = §ePosition bearbeiten -SIMULATOR_POSITION_ADD = §ePosition setzen -SIMULATOR_GUI_TNT_SPAWN_NAME = §eTNT -SIMULATOR_GUI_TNT_SPAWN_LORE_1 = §7TNT-Anzahl§8: §e{0} -SIMULATOR_GUI_TNT_SPAWN_LORE_3 = §7Lebensdauer§8: §e{0} -SIMULATOR_GUI_TNT_GROUP_NAME = §eTNT Gruppe -SIMULATOR_GUI_TNT_GROUP_LORE_1 = §7Elementanzahl§8: §e{0} -SIMULATOR_GUI_TNT_DISABLED = §cDisabled -SIMULATOR_GUI_NAME = Kanonensimulator -SIMULATOR_GUI_DELETE = §cTNT löschen -SIMULATOR_GUI_AUTO_TRACE = §eAutoTrace§8: §7{0} -SIMULATOR_GUI_MOVE_ALL = §eAlle Verschieben - -SIMULATOR_ALIGNMENT_CENTER = §7Verschiebung§8: §eMitte -SIMULATOR_ALIGNMENT_POSITIVE_X = §7Verschiebung§8: §ePositive X -SIMULATOR_ALIGNMENT_NEGATIVE_X = §7Verschiebung§8: §eNegative X -SIMULATOR_ALIGNMENT_POSITIVE_Z = §7Verschiebung§8: §ePositive Z -SIMULATOR_ALIGNMENT_NEGATIVE_Z = §7Verschiebung§8: §eNegative Z - -SIMULATOR_MOVE_ALL_GUI_NAME = TNT Verschieben - -SIMULATOR_TNT_SPAWN_GUI_NAME = TNT konfigurieren {0} -SIMULATOR_TNT_SPAWN_LORE = §eZum Ändern klicken -SIMULATOR_TNT_SPAWN_COUNT = §7TNT-Anzahl §8- §e{0} -SIMULATOR_TNT_SPAWN_COUNT_ANVIL_GUI_NAME = Anzahl TNT -SIMULATOR_TNT_SPAWN_TICK = §7Tick §8- §e{0} -SIMULATOR_TNT_SPAWN_TICK_ANVIL_GUI_NAME = Tick Offset -SIMULATOR_TNT_SPAWN_FUSE = §7Lebensdauer §8- §e{0} -SIMULATOR_TNT_SPAWN_FUSE_ANVIL_GUI_NAME = Fuse-Ticks -SIMULATOR_TNT_SPAWN_VELOCITY_NAME = §7TNT -SIMULATOR_TNT_SPAWN_VELOCITY_X = §7TNT §eSprung X §8- {0} -SIMULATOR_TNT_SPAWN_VELOCITY_Y = §7TNT §eSprung Y §8- {0} -SIMULATOR_TNT_SPAWN_VELOCITY_Z = §7TNT §eSprung Z §8- {0} -SIMULATOR_TNT_SPAWN_VELOCITY_ON = §aan -SIMULATOR_TNT_SPAWN_VELOCITY_OFF = §caus -SIMULATOR_TNT_SPAWN_POSITION_X = §7x-Position §8- §e{0} -SIMULATOR_TNT_SPAWN_POSITION_Y = §7y-Position §8- §e{0} -SIMULATOR_TNT_SPAWN_POSITION_Z = §7z-Position §8- §e{0} -SIMULATOR_TNT_SPAWN_ACTIVATED_WITH = §7Gezündet durch §8- §e{0} -SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_COMPARATOR = Comparator -SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_REPEATER = Repeater -SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_OBSERVER = Observer -SIMULATOR_TNT_SPAWN_MATERIAL = §eMaterial -SIMULATOR_TNT_SPAWN_MATERIAL_LORE_1 = §7Jetziges Material§8: §e{0} -SIMULATOR_TNT_SPAWN_MATERIAL_LORE_2 = §eLink-Click §7Zum ändern -SIMULATOR_TNT_SPAWN_MATERIAL_LORE_3 = §eRechts-Click §7Zum zurücksetzten -SIMULATOR_MATERIAL_GUI_NAME = Material ändern -SIMULATOR_MATERIAL_CLICK = §eKlicken zum wählen -SIMULATOR_TNT_SPAWN_ADD_IGNITION_PHASE = §eZündphase hinzufügen -SIMULATOR_TNT_SPAWN_ADD_TNT = §eTNT hinzufügen -SIMULATOR_TNT_SPAWN_REMOVE_TNT = §cEntfernen -SIMULATOR_TNT_SPAWN_POSITION_ANVIL_GUI_NAME = Position - +SIMULATOR_POSITION_EDIT=§ePosition bearbeiten +SIMULATOR_POSITION_ADD=§ePosition setzen +SIMULATOR_GUI_TNT_SPAWN_NAME=§eTNT +SIMULATOR_GUI_TNT_SPAWN_LORE_1=§7TNT-Anzahl§8: §e{0} +SIMULATOR_GUI_TNT_SPAWN_LORE_3=§7Lebensdauer§8: §e{0} +SIMULATOR_GUI_TNT_GROUP_NAME=§eTNT Gruppe +SIMULATOR_GUI_TNT_GROUP_LORE_1=§7Elementanzahl§8: §e{0} +SIMULATOR_GUI_TNT_DISABLED=§cDisabled +SIMULATOR_GUI_NAME=Kanonensimulator +SIMULATOR_GUI_DELETE=§cTNT löschen +SIMULATOR_GUI_AUTO_TRACE=§eAutoTrace§8: §7{0} +SIMULATOR_GUI_MOVE_ALL=§eAlle Verschieben +SIMULATOR_ALIGNMENT_CENTER=§7Verschiebung§8: §eMitte +SIMULATOR_ALIGNMENT_POSITIVE_X=§7Verschiebung§8: §ePositive X +SIMULATOR_ALIGNMENT_NEGATIVE_X=§7Verschiebung§8: §eNegative X +SIMULATOR_ALIGNMENT_POSITIVE_Z=§7Verschiebung§8: §ePositive Z +SIMULATOR_ALIGNMENT_NEGATIVE_Z=§7Verschiebung§8: §eNegative Z +SIMULATOR_MOVE_ALL_GUI_NAME=TNT Verschieben +SIMULATOR_TNT_SPAWN_GUI_NAME=TNT konfigurieren {0} +SIMULATOR_TNT_SPAWN_LORE=§eZum Ändern klicken +SIMULATOR_TNT_SPAWN_COUNT=§7TNT-Anzahl §8- §e{0} +SIMULATOR_TNT_SPAWN_COUNT_ANVIL_GUI_NAME=Anzahl TNT +SIMULATOR_TNT_SPAWN_TICK=§7Tick §8- §e{0} +SIMULATOR_TNT_SPAWN_TICK_ANVIL_GUI_NAME=Tick Offset +SIMULATOR_TNT_SPAWN_FUSE=§7Lebensdauer §8- §e{0} +SIMULATOR_TNT_SPAWN_FUSE_ANVIL_GUI_NAME=Fuse-Ticks +SIMULATOR_TNT_SPAWN_VELOCITY_NAME=§7TNT +SIMULATOR_TNT_SPAWN_VELOCITY_X=§7TNT §eSprung X §8- {0} +SIMULATOR_TNT_SPAWN_VELOCITY_Y=§7TNT §eSprung Y §8- {0} +SIMULATOR_TNT_SPAWN_VELOCITY_Z=§7TNT §eSprung Z §8- {0} +SIMULATOR_TNT_SPAWN_VELOCITY_ON=§aan +SIMULATOR_TNT_SPAWN_VELOCITY_OFF=§caus +SIMULATOR_TNT_SPAWN_POSITION_X=§7x-Position §8- §e{0} +SIMULATOR_TNT_SPAWN_POSITION_Y=§7y-Position §8- §e{0} +SIMULATOR_TNT_SPAWN_POSITION_Z=§7z-Position §8- §e{0} +SIMULATOR_TNT_SPAWN_ACTIVATED_WITH=§7Gezündet durch §8- §e{0} +SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_COMPARATOR=Comparator +SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_REPEATER=Repeater +SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_OBSERVER=Observer +SIMULATOR_TNT_SPAWN_MATERIAL=§eMaterial +SIMULATOR_TNT_SPAWN_MATERIAL_LORE_1=§7Jetziges Material§8: §e{0} +SIMULATOR_TNT_SPAWN_MATERIAL_LORE_2=§eLink-Click §7Zum ändern +SIMULATOR_TNT_SPAWN_MATERIAL_LORE_3=§eRechts-Click §7Zum zurücksetzten +SIMULATOR_MATERIAL_GUI_NAME=Material ändern +SIMULATOR_MATERIAL_CLICK=§eKlicken zum wählen +SIMULATOR_TNT_SPAWN_ADD_IGNITION_PHASE=§eZündphase hinzufügen +SIMULATOR_TNT_SPAWN_ADD_TNT=§eTNT hinzufügen +SIMULATOR_TNT_SPAWN_REMOVE_TNT=§cEntfernen +SIMULATOR_TNT_SPAWN_POSITION_ANVIL_GUI_NAME=Position # SmartPlace -SMART_PLACE_HELP = §8/§esmartplace §8-§7 Toggled SmartPlace -SMART_PLACE_INFO = §7Plaziert rotierbare Blöcke beim §esneaken§7 von dir §eweg§7. -SMART_PLACE_ENABLE = §aSmartPlace aktiviert -SMART_PLACE_DISABLE = §cSmartPlace deaktiviert - +SMART_PLACE_HELP=§8/§esmartplace §8-§7 Toggled SmartPlace +SMART_PLACE_INFO=§7Plaziert rotierbare Blöcke beim §esneaken§7 von dir §eweg§7. +SMART_PLACE_ENABLE=§aSmartPlace aktiviert +SMART_PLACE_DISABLE=§cSmartPlace deaktiviert # InventoryFiller -INVENTORY_FILL_HELP = §8/§einventoryfill §8- §7Toggled InventoryFill -INVENTORY_FILL_INFO = §7Hilft dir, Behälter zu füllen, indem du sie beim sneaken ansiehst und den Gegenstand fallen lässt. Oder scrolle einfach auf einen Behälter, um die Menge des gehaltenen Gegenstandes darin zu ändern. -INVENTORY_FILL_ENABLE = §aInventoryFiller activated -INVENTORY_FILL_DISABLE = §cInventoryFiller deactivated - +INVENTORY_FILL_HELP=§8/§einventoryfill §8- §7Toggled InventoryFill +INVENTORY_FILL_INFO=§7Hilft dir, Behälter zu füllen, indem du sie beim sneaken ansiehst und den Gegenstand fallen lässt. Oder scrolle einfach auf einen Behälter, um die Menge des gehaltenen Gegenstandes darin zu ändern. +INVENTORY_FILL_ENABLE=§aInventoryFiller activated +INVENTORY_FILL_DISABLE=§cInventoryFiller deactivated # Killchecker -KILLCHECKER_HELP_ENABLE = §8/§ekillchecker enable §8- §7Aktiviert Killchecker / Berechnet kills neu -KILLCHECKER_HELP_DISABLE = §8/§ekillchecker disable §8- §7Deaktiviert Killchecker -KILLCHECKER_INFO = §7Zeigt Ãœberlappungen der Kanonen Kills im Baubereich an. -KILLCHECKER_INFO2 = §7Nur farbige Blöcke wie Wolle, Terracotta, Stained Glass und Concrete wird gezählt. -KILLCHECKER_ENABLE = §aKillchecker aktiviert -KILLCHECKER_DISABLE = §cKillchecker deaktiviert -KILLCHECKER_BOSSBAR = §e§l{0} §7(§e{1}%§7) §e§l{2}§7 Kanonnen - +KILLCHECKER_HELP_ENABLE=§8/§ekillchecker enable §8- §7Aktiviert Killchecker / Berechnet kills neu +KILLCHECKER_HELP_DISABLE=§8/§ekillchecker disable §8- §7Deaktiviert Killchecker +KILLCHECKER_INFO=§7Zeigt Ãœberlappungen der Kanonen Kills im Baubereich an. +KILLCHECKER_INFO2=§7Nur farbige Blöcke wie Wolle, Terracotta, Stained Glass und Concrete wird gezählt. +KILLCHECKER_ENABLE=§aKillchecker aktiviert +KILLCHECKER_DISABLE=§cKillchecker deaktiviert +KILLCHECKER_BOSSBAR=§e§l{0} §7(§e{1}%§7) §e§l{2}§7 Kanonnen # BlockCounter -BLOCK_COUNTER_HELP_TOGGLE = §8/§eblockcounter §8- §7Wechsel zwischen an und aus -BLOCK_COUNTER_HELP_ENABLE = §8/§eblockcounter enable §8- §7Schalte den BlockCounter an -BLOCK_COUNTER_HELP_DISABLE = §8/§eblockcounter disable §8- §7Schalte den BlockCounter aus -BLOCK_COUNTER_MESSAGE = §7Schaden §8> §e{0} §7Blöcke §e{1} §7TNT §e{2} §7Blöcke/TNT §e{3} §7Blöcke/tick -BLOCK_COUNTER_MESSAGE_SECOND = §7Schaden §8> §e{0} §7Blöcke §e{1} §7TNT §e{2} §7Blöcke/TNT §e{3} §7Blöcke/s -BLOCK_COUNTER_ENABLE = §7BlockCounter angemacht -BLOCK_COUNTER_DISABLE = §7BlockCounter ausgemacht - +BLOCK_COUNTER_HELP_TOGGLE=§8/§eblockcounter §8- §7Wechsel zwischen an und aus +BLOCK_COUNTER_HELP_ENABLE=§8/§eblockcounter enable §8- §7Schalte den BlockCounter an +BLOCK_COUNTER_HELP_DISABLE=§8/§eblockcounter disable §8- §7Schalte den BlockCounter aus +BLOCK_COUNTER_MESSAGE=§7Schaden §8> §e{0} §7Blöcke §e{1} §7TNT §e{2} §7Blöcke/TNT §e{3} §7Blöcke/tick +BLOCK_COUNTER_MESSAGE_SECOND=§7Schaden §8> §e{0} §7Blöcke §e{1} §7TNT §e{2} §7Blöcke/TNT §e{3} §7Blöcke/s +BLOCK_COUNTER_ENABLE=§7BlockCounter angemacht +BLOCK_COUNTER_DISABLE=§7BlockCounter ausgemacht # DepthCounter -DEPTH_COUNTER_MESSAGE = §7Tiefe §8> §7 - +DEPTH_COUNTER_MESSAGE=§7Tiefe §8> §7 # TPSLimit -TPSLIMIT_FREEZE_HELP = §8/§etpslimit 0 §8-§7 Friere TPS ein -TPSLIMIT_LIMIT_HELP = §8/§etpslimit §8[§720>x>0.5§8] §8-§7 Verlangsame die TPS -TPSLIMIT_WARP_HELP = §8/§etpslimit §8[§7x>20§8] §8-§7 Beschleunige die TPS -TPSLIMIT_DEFAULT_HELP = §8/§etpslimit default §8-§7 Setze die TPS auf 20 -TPSLIMIT_HELP = §8/§etpslimit §8-§7 Zeige die jetzige TPS - -TICK_FREEZE_HELP = §8/§etick rate 0 §8-§7 Friere TPS ein -TICK_FREEZE_HELP_2 = §8/§etick freeze §8-§7 Friere TPS ein -TICK_UNFREEZE_HELP = §8/§etick unfreeze §8-§7 Setze die TPS auf 20 -TICK_LIMIT_HELP = §8/§etick rate §8[§720>x>0.5§8] §8-§7 Verlangsame die TPS -TICK_WARP_HELP = §8/§etick rate §8[§7x>20§8] §8-§7 Beschleunige die TPS -TICK_DEFAULT_HELP = §8/§etick rate default §8-§7 Setze die TPS auf 20 -TICK_HELP = §8/§etick rate §8-§7 Zeige die jetzige TPS - -TICK_STEPPING_HELP = §8/§etick step §8<§7Ticks§8> §8-§7 Spule n ticks oder 1 vor -TICK_WARPING_HELP = §8/§etick warp §8<§7Ticks§8> §8<§7TPS§8> §8-§7 Warpe n ticks oder 1 vor - -TICK_BOSSBAR = §e{0}§8/§7{1} gesprungen -TPSLIMIT_GUI_ITEM_NAME = §eTPS Limiter -TPSLIMIT_GUI_ITEM_LORE = §7Aktuell: §e{0} -TPSLIMIT_ANVIL_GUI = Neues TPS Limit -TPSLIMIT_CURRENT = §7Jetziges TPS limit§8: §e{0} -TPSLIMIT_SET = §eTPS limit auf {0} gesetzt. -TPSLIMIT_FROZEN = §eTPS eingefroren. - +TPSLIMIT_FREEZE_HELP=§8/§etpslimit 0 §8-§7 Friere TPS ein +TPSLIMIT_LIMIT_HELP=§8/§etpslimit §8[§720>x>0.5§8] §8-§7 Verlangsame die TPS +TPSLIMIT_WARP_HELP=§8/§etpslimit §8[§7x>20§8] §8-§7 Beschleunige die TPS +TPSLIMIT_DEFAULT_HELP=§8/§etpslimit default §8-§7 Setze die TPS auf 20 +TPSLIMIT_HELP=§8/§etpslimit §8-§7 Zeige die jetzige TPS +TICK_FREEZE_HELP=§8/§etick rate 0 §8-§7 Friere TPS ein +TICK_FREEZE_HELP_2=§8/§etick freeze §8-§7 Friere TPS ein +TICK_UNFREEZE_HELP=§8/§etick unfreeze §8-§7 Setze die TPS auf 20 +TICK_LIMIT_HELP=§8/§etick rate §8[§720>x>0.5§8] §8-§7 Verlangsame die TPS +TICK_WARP_HELP=§8/§etick rate §8[§7x>20§8] §8-§7 Beschleunige die TPS +TICK_DEFAULT_HELP=§8/§etick rate default §8-§7 Setze die TPS auf 20 +TICK_HELP=§8/§etick rate §8-§7 Zeige die jetzige TPS +TICK_STEPPING_HELP=§8/§etick step §8<§7Ticks§8> §8-§7 Spule n ticks oder 1 vor +TICK_WARPING_HELP=§8/§etick warp §8<§7Ticks§8> §8<§7TPS§8> §8-§7 Warpe n ticks oder 1 vor +TICK_BOSSBAR=§e{0}§8/§7{1} gesprungen +TPSLIMIT_GUI_ITEM_NAME=§eTPS Limiter +TPSLIMIT_GUI_ITEM_LORE=§7Aktuell: §e{0} +TPSLIMIT_ANVIL_GUI=Neues TPS Limit +TPSLIMIT_CURRENT=§7Jetziges TPS limit§8: §e{0} +TPSLIMIT_SET=§eTPS limit auf {0} gesetzt. +TPSLIMIT_FROZEN=§eTPS eingefroren. # Trace TRACE_RECORD=§aan TRACE_HAS_TRACES=§ehat Traces -TRACE_MESSAGE_AUTO_IDLE_IGNITE = §aAuto-Tracer ignite gestartet -TRACE_MESSAGE_AUTO_DELETE_INVALID = §cAuto delete kann aktuell nicht genutzt werden -TRACE_MESSAGE_AUTO_DELETE_ALWAYS = §7Der letzte Schuss wird §eimmer§7 gelöscht -TRACE_MESSAGE_AUTO_DELETE_NEVER = §7Der letzte Schuss wird §enie§7 gelöscht -TRACE_MESSAGE_AUTO_DELETE_NO_BUILD_DESTROY = §7Der letzte Schuss wird gelöscht, wenn §ekein§7 Block aus dem §eBaubereich§7 zerstört wurde -TRACE_MESSAGE_AUTO_DELETE_BUILD_DESTROY = §7Der letzte Schuss wird gelöscht, wenn §eein§7 Block aus dem §eBaubereich§7 zerstört wurde -TRACE_MESSAGE_AUTO_DELETE_NO_TESTBLOCK_DESTROY = §7Der letzte Schuss wird gelöscht, wenn §ekein§7 Block aus dem §eTestblock§7 zerstört wurde -TRACE_MESSAGE_AUTO_DELETE_TESTBLOCK_DESTROY = §7Der letzte Schuss wird gelöscht, wenn §eein§7 Block aus dem §eTestblock§7 zerstört wurde -TRACE_MESSAGE_START = §aTNT-Tracer gestartet -TRACE_MESSAGE_SINGLE = §aSingle-Tracer gestartet -TRACE_MESSAGE_STOP = §cTNT-Tracer gestoppt +TRACE_MESSAGE_AUTO_IDLE_IGNITE=§aAuto-Tracer ignite gestartet +TRACE_MESSAGE_AUTO_DELETE_INVALID=§cAuto delete kann aktuell nicht genutzt werden +TRACE_MESSAGE_AUTO_DELETE_ALWAYS=§7Der letzte Schuss wird §eimmer§7 gelöscht +TRACE_MESSAGE_AUTO_DELETE_NEVER=§7Der letzte Schuss wird §enie§7 gelöscht +TRACE_MESSAGE_AUTO_DELETE_NO_BUILD_DESTROY=§7Der letzte Schuss wird gelöscht, wenn §ekein§7 Block aus dem §eBaubereich§7 zerstört wurde +TRACE_MESSAGE_AUTO_DELETE_BUILD_DESTROY=§7Der letzte Schuss wird gelöscht, wenn §eein§7 Block aus dem §eBaubereich§7 zerstört wurde +TRACE_MESSAGE_AUTO_DELETE_NO_TESTBLOCK_DESTROY=§7Der letzte Schuss wird gelöscht, wenn §ekein§7 Block aus dem §eTestblock§7 zerstört wurde +TRACE_MESSAGE_AUTO_DELETE_TESTBLOCK_DESTROY=§7Der letzte Schuss wird gelöscht, wenn §eein§7 Block aus dem §eTestblock§7 zerstört wurde +TRACE_MESSAGE_START=§aTNT-Tracer gestartet +TRACE_MESSAGE_SINGLE=§aSingle-Tracer gestartet +TRACE_MESSAGE_STOP=§cTNT-Tracer gestoppt TRACE_MESSAGE_CLEAR=§cAlle TNT-Positionen gelöscht -TRACE_MESSAGE_SHOW = §aAlle TNT-Positionen angezeigt -TRACE_MESSAGE_HIDE = §cAlle TNT-Positionen ausgeblendet -TRACE_MESSAGE_DISALLOWED = §cDu darfst hier nicht den TNT-Tracer nutzen +TRACE_MESSAGE_SHOW=§aAlle TNT-Positionen angezeigt +TRACE_MESSAGE_HIDE=§cAlle TNT-Positionen ausgeblendet +TRACE_MESSAGE_CLICK_ISOLATE=§eKlicken zum §aisolieren§8/§causblenden +TRACE_MESSAGE_DISALLOWED=§cDu darfst hier nicht den TNT-Tracer nutzen TRACE_MESSAGE_SHOW_AT=§aTNT-positions angezeigt bei {0} TRACE_MESSAGE_SHOW_FROM=§aAll TNT-positions angezeigt von {0} TRACE_MESSAGE_SHOW_FROM_TO=§aAll TNT-positions angezeigt von {0} bis {1} -TRACE_MESSAGE_SHOW_TO_SMALLER = §cBis muss größer als von sein - -TRACE_COMMAND_HELP_START = §8/§etrace start §8- §7Startet die Aufnahme aller TNT-Positionen -TRACE_COMMAND_HELP_SINGLE = §8/§etrace single §8- §7Startet eine einzelne Aufnahme aller TNT-Positionen -TRACE_COMMAND_HELP_STOP = §8/§etrace stop §8- §7Stoppt den TNT-Tracer -TRACE_COMMAND_HELP_AUTO = §8/§etrace toggleauto §8- §7Automatischer Aufnahmenstart -TRACE_COMMAND_HELP_AUTO_REMOVE = §8/§etrace autoremove §8<§eParameter§8> §8- §7Löscht den letzten Trace automatisch -TRACE_COMMAND_HELP_SHOW = §8/§etrace show §8<§eParameter§8> - §7Zeigt alle TNT-Positionen -TRACE_COMMAND_HELP_SHOW_AT = §8/§etrace show §8(§etime§8|§7fuse§8) §7at §8<§eTIME§8> - §7Zeigt alle TNT-Positionen bei §8<§eTIME§8> an -TRACE_COMMAND_HELP_SHOW_FROM = §8/§etrace show §8(§etime§8|§7fuse§8) §7from §8<§eFROM§8> - §7Zeigt alle TNT-Positionen von §8<§eFROM§8> -TRACE_COMMAND_HELP_SHOW_FROM_TO = §8/§etrace show §8(§etime§8|§7fuse§8) §7from §8<§eFROM§8> §7to §8<§eTO§8> - §7Zeigt alle TNT-Positionen zwischen §8<§eFROM§8> und §8<§eTO§8> -TRACE_COMMAND_HELP_HIDE = §8/§etrace hide §8- §7Versteckt alle TNT-Positionen -TRACE_COMMAND_HELP_DELETE = §8/§etrace delete §8- §7Löscht alle TNT-Positionen - -TRACE_GUI_ITEM_NAME = §eTracer -TRACE_GUI_ITEM_LORE = §7Status§8: {0} -TRACE_GUI_NAME = Tracer Gui -TRACE_GUI_TRACE_INACTIVE = §eTracer Starten -TRACE_GUI_TRACE_ACTIVE = §eTracer Stoppen -TRACE_GUI_TRACE_ACTIVE_AUTO = §eAuto-Trace ist Aktiv -TRACE_GUI_AUTO_TRACE_INACTIVE = §eAuto-Tracer Aktivieren -TRACE_GUI_AUTO_TRACE_ACTIVE = §eAuto-Tracer Deaktivieren -TRACE_GUI_DELETE = §eTrace Löschen - +TRACE_MESSAGE_SHOW_TO_SMALLER=§cBis muss größer als von sein +TRACE_COMMAND_HELP_START=§8/§etrace start §8- §7Startet die Aufnahme aller TNT-Positionen +TRACE_COMMAND_HELP_SINGLE=§8/§etrace single §8- §7Startet eine einzelne Aufnahme aller TNT-Positionen +TRACE_COMMAND_HELP_STOP=§8/§etrace stop §8- §7Stoppt den TNT-Tracer +TRACE_COMMAND_HELP_AUTO=§8/§etrace toggleauto §8- §7Automatischer Aufnahmenstart +TRACE_COMMAND_HELP_AUTO_REMOVE=§8/§etrace autoremove §8<§eParameter§8> §8- §7Löscht den letzten Trace automatisch +TRACE_COMMAND_HELP_SHOW=§8/§etrace show §8<§eParameter§8> - §7Zeigt alle TNT-Positionen +TRACE_COMMAND_HELP_SHOW_AT=§8/§etrace show §8(§etime§8|§7fuse§8) §7at §8<§eTIME§8> - §7Zeigt alle TNT-Positionen bei §8<§eTIME§8> an +TRACE_COMMAND_HELP_SHOW_FROM=§8/§etrace show §8(§etime§8|§7fuse§8) §7from §8<§eFROM§8> - §7Zeigt alle TNT-Positionen von §8<§eFROM§8> +TRACE_COMMAND_HELP_SHOW_FROM_TO=§8/§etrace show §8(§etime§8|§7fuse§8) §7from §8<§eFROM§8> §7to §8<§eTO§8> - §7Zeigt alle TNT-Positionen zwischen §8<§eFROM§8> und §8<§eTO§8> +TRACE_COMMAND_HELP_HIDE=§8/§etrace hide §8- §7Versteckt alle TNT-Positionen +TRACE_COMMAND_HELP_DELETE=§8/§etrace delete §8- §7Löscht alle TNT-Positionen +TRACE_GUI_ITEM_NAME=§eTracer +TRACE_GUI_ITEM_LORE=§7Status§8: {0} +TRACE_GUI_NAME=Tracer Gui +TRACE_GUI_TRACE_INACTIVE=§eTracer Starten +TRACE_GUI_TRACE_ACTIVE=§eTracer Stoppen +TRACE_GUI_TRACE_ACTIVE_AUTO=§eAuto-Trace ist Aktiv +TRACE_GUI_AUTO_TRACE_INACTIVE=§eAuto-Tracer Aktivieren +TRACE_GUI_AUTO_TRACE_ACTIVE=§eAuto-Tracer Deaktivieren +TRACE_GUI_DELETE=§eTrace Löschen # Loader -LOADER_SETUP = §eEinrichtung -LOADER_RUNNING = §aLaufend -LOADER_PAUSE = §7Pausiert -LOADER_END = §8Beendet +LOADER_SETUP=§eEinrichtung +LOADER_RUNNING=§aLaufend +LOADER_PAUSE=§7Pausiert +LOADER_END=§8Beendet LOADER_SINGLE=§aEinmal - -LOADER_MESSAGE_INTERACT = §e{0} hinzugefügt {1} -LOADER_BUTTON_TNT = TNT +LOADER_MESSAGE_INTERACT=§e{0} hinzugefügt {1} +LOADER_BUTTON_TNT=TNT LOADER_BUTTON_SWITCH=Hebel LOADER_BUTTON_WOOD_BUTTON=Holzknopf LOADER_BUTTON_STONE_BUTTON=Steinknopf @@ -513,7 +455,6 @@ LOADER_BUTTON_LECTERN=Lectern LOADER_BUTTON_TRAPDOOR=Trapdoor LOADER_BUTTON_DOOR=Door LOADER_BUTTON_FENCEGATE=Fencegate - LOADER_HELP_SETUP=§8/§eloader setup §8- §7Startet die Aufnahme der Aktionen LOADER_SETUP_STOP_FIRST=§cBitte stoppe zuerst den Loader LOADER_HELP_START=§8/§eloader start §8- §7Spielt die zuvor aufgenommenen Aktionen ab @@ -533,7 +474,6 @@ LOADER_PAUSED=§7Der Loader ist nun pausiert. LOADER_SMALL_TIME=§cDie Wartezeit ist zu klein LOADER_NEW_TIME=§7Die Schusswartezeit ist nun: {0} LOADER_NEW_LOAD_TIME=§7Die Setzwartezeit ist nun: {0} - LOADER_NOTHING_RECORDED=§cEs wurden keine Elemente aufgenommen! LOADER_GUI_TITLE=Loader Einstellungen LOADER_GUI_SHOW_ALL=Zeige alles @@ -550,7 +490,6 @@ LOADER_GUI_SETTINGS_COPY=§7Kopieren LOADER_GUI_SETTINGS_DELETE=§cLöschen LOADER_GUI_WAIT_TITLE=Wartezeit LOADER_GUI_WAIT_BACK=§8Zurück - LOADER_GUI_CLICK_TO_EDIT=§7Klicke zum editieren LOADER_GUI_ITEM_NAME=§7{0}§8: §e{1} LOADER_SETTING_NAME=§7{0} @@ -585,7 +524,6 @@ LOADER_INTERACTION_OPEN=Geöffnet LOADER_INTERACTION_CLOSED=Geschlossen LOADER_INTERACTION_COMPARE=Vergleichen LOADER_INTERACTION_SUBTRACT=Subtrahieren - # Loadtimer LOADTIMER_HELP_OVERVIEW=§7Messe dich und deine Freunde beim Beladen einer Kanone und bekomme informationen über die Kanone LOADTIMER_HELP_START_1=§8/§eloadtimer start §8-§7 Startet den einfachen Loadtimer @@ -607,27 +545,25 @@ LOADTIMER_SUMARY_PLAYERTABLE_HEAD=§7Spieler: §eTNT §7(§eTNT/s§7) LOADTIMER_SUMARY_PLAYERTABLE_PLAYER=§7{0}: §e{1} §7(§e{2}/s§7) LOADTIMER_SUMARY_PLAYERTABLE_ALL=Insgesamt LOADTIMER_SUMARY_TIMES_HEAD=§7Zeiten: §eSekunden §7(§eTicks§7) -LOADTIMER_SUMARY_TIMES_START = §7 || §7Start! -LOADTIMER_SUMARY_TIMES_ACTIVATION = §7 || Aktivierung: §e{0}s §7(§e{1}t§7) -LOADTIMER_SUMARY_TIMES_IGNITION = §7 || Zündung: §e{0}s §7(§e{1}t§7) -LOADTIMER_SUMARY_TIMES_EXPLOSION = §7 || Explosion: §e{0}s §7(§e{1}t§7) +LOADTIMER_SUMARY_TIMES_START=§7 || §7Start! +LOADTIMER_SUMARY_TIMES_ACTIVATION=§7 || Aktivierung: §e{0}s §7(§e{1}t§7) +LOADTIMER_SUMARY_TIMES_IGNITION=§7 || Zündung: §e{0}s §7(§e{1}t§7) +LOADTIMER_SUMARY_TIMES_EXPLOSION=§7 || Explosion: §e{0}s §7(§e{1}t§7) LOADTIMER_SUMARY_TIMES_LAST=§7\\/ LOADTIMER_SUMARY_STATS_HEAD=§7Kanonen-Stats§8: LOADTIMER_SUMARY_STATS_TNT=§7TNT: §e{0} LOADTIMER_SUMARY_STATS_FREQ=§7Belade Frequenz: §e{0}/m§8, §7Schuss Frequenz: §e{1}/m - # Observer -OBSERVER_HELP = §7Rechts-Klicke einen Observer um den Trace zu bekommen. Hierfür müssen Flammenpartikel an sein. Die Partikel werden im Block angezeigt. -OBSERVER_HELP_ENABLE = §8/§eobserver enable §8-§7 Aktiviere den Observer Tracer -OBSERVER_HELP_DISABLE = §8/§eobserver disable §8-§7 Deaktiviere den Observer Tracer -OBSERVER_HELP_DELETE = §8/§eobserver delete §8-§7 Lösche den Observer Tracer -OBSERVER_HELP_RETRACE = §8/§eobserver retrace §8-§7 Retrace den Observer Tracer -OBSERVER_ENABLE = §7Observer Trace gestartet -OBSERVER_DISABLE = §7Observer Trace gestoppt -OBSERVER_DELETE = §7Observer Trace gelöscht -OBSERVER_RETRACE_DONE = §7Observer Trace neu berechnet -OBSERVER_RETRACE_NO_TRACE = §7Kein Observer Trace zum neu berechnen - +OBSERVER_HELP=§7Rechts-Klicke einen Observer um den Trace zu bekommen. Hierfür müssen Flammenpartikel an sein. Die Partikel werden im Block angezeigt. +OBSERVER_HELP_ENABLE=§8/§eobserver enable §8-§7 Aktiviere den Observer Tracer +OBSERVER_HELP_DISABLE=§8/§eobserver disable §8-§7 Deaktiviere den Observer Tracer +OBSERVER_HELP_DELETE=§8/§eobserver delete §8-§7 Lösche den Observer Tracer +OBSERVER_HELP_RETRACE=§8/§eobserver retrace §8-§7 Retrace den Observer Tracer +OBSERVER_ENABLE=§7Observer Trace gestartet +OBSERVER_DISABLE=§7Observer Trace gestoppt +OBSERVER_DELETE=§7Observer Trace gelöscht +OBSERVER_RETRACE_DONE=§7Observer Trace neu berechnet +OBSERVER_RETRACE_NO_TRACE=§7Kein Observer Trace zum neu berechnen # Other OTHER_ITEMS_TELEPORT_NAME=§eTeleporter OTHER_ITEMS_TELEPORT_GUI_NAME=Teleportieren @@ -644,8 +580,8 @@ OTHER_ITEMS_INVENTORY_FILL_LORE_ACTIVE=§aAktiviert OTHER_ITEMS_INVENTORY_FILL_LORE_INACTIVE=§aDeaktiviert OTHER_SLOT_INVALID_SLOT=§cInvalider Slot OTHER_NOCLIP_SLOT_INFO=§7Mit /slot kannst du den ausgewählten Slot ändern und einen anderen Block in den Slot nehmen. -OTHER_NOCLIP_SLOT_HELP_PICK = §8/§eslot pick §8-§7 Lege den angeguckten Block ins Inventar -OTHER_NOCLIP_SLOT_HELP_DROP = §8/§eslot drop §8-§7 Cleared deinen Slot +OTHER_NOCLIP_SLOT_HELP_PICK=§8/§eslot pick §8-§7 Lege den angeguckten Block ins Inventar +OTHER_NOCLIP_SLOT_HELP_DROP=§8/§eslot drop §8-§7 Cleared deinen Slot OTHER_CLEAR_HELP_SELF=§8/§eclear §8- §7Leere dein Inventar OTHER_CLEAR_HELP_PLAYER=§8/§eclear §8[§7Player§8] §8- §7Leere ein Spieler Inventar OTHER_CLEAR_CLEARED=Dein Inventar wurde geleert. @@ -659,7 +595,7 @@ OTHER_KILLALL_HELP_SELF=§8/§ekillall §8- §7Entferne alle Entities aus deiner OTHER_KILLALL_HELP_ALL=§8/§ekillall §8[§7Global§8/Local§7] §8- §7Entferne alle Entities aus deiner Region oder global OTHER_KILLALL_REGION=§a{0} Entities aus der Region entfernt OTHER_KILLALL_GLOBAL=§a{0} Entities aus der Welt entfernt -OTHER_TELEPORT_HELP = §8/§etp §8[§7Player§8] §8-§7 Teleportiere dich zu einem Spieler +OTHER_TELEPORT_HELP=§8/§etp §8[§7Player§8] §8-§7 Teleportiere dich zu einem Spieler OTHER_TELEPORT_SELF_0=§cSei eins mit dir selbst! OTHER_TELEPORT_SELF_1=§cDu brauchst Leute zum spielen? Wir haben auch einen TeamSpeak! OTHER_TELEPORT_SELF_2=§cNoch zu reisende Blöcke: 0; ETA: 0:00 @@ -668,9 +604,9 @@ OTHER_TELEPORT_SELF_4=§cFür eine solche Distanz? OTHER_TIME_HELP=§8/§etime §8<§7Zeit 0=Morgen§8, §76000=Mittag§8, §718000=Mitternacht§8> - §7Setzt die Zeit auf dem Bau OTHER_TIME_INVALID=§cBitte gib eine Zahl zwischen 0 und 24000 an OTHER_TIME_RESULT=§7§oWhooosh -OTHER_TPS_HEAD = §7TPS: 1s 10s 1m 5m 10m -OTHER_TPS_MESSAGE = §7 §e{0}§7 §e{1}§7 §e{2}§7 §e{3}§7 §e{4} -OTHER_TPS_SINGLE = §8TPS: §e{0} +OTHER_TPS_HEAD=§7TPS: 1s 10s 1m 5m 10m +OTHER_TPS_MESSAGE=§7 §e{0}§7 §e{1}§7 §e{2}§7 §e{3}§7 §e{4} +OTHER_TPS_SINGLE=§8TPS: §e{0} OTHER_BIND_HELP=§8/§ebind §8[§7Command§8] §8-§e Binde ein Befehl auf Item Interaktion OTHER_BIND_ERROR=§cFalscher oder unbekannter Befehl OTHER_BIND_UNBINDABLE=§cBefehl konnte nicht gebunden werden @@ -680,7 +616,7 @@ OTHER_BIND_MESSAGE_UNBIND=§7Befehl entbunden DEBUG_STICK_COMMAND_HELP=§8/§edebugstick §8-§7 Erhalte einen DebugStick DEBUG_STICK_NAME=§eDebugstick #Skull Gui -SKULL_GUI_ITEM_NAME = §eSpieler Köpfe +SKULL_GUI_ITEM_NAME=§eSpieler Köpfe ANVIL_INV_NAME=Spieler name # StructureVoid STRUCTURE_VOID_COMMAND_HELP=§8/§estructureVoid §8-§7 Erhalte ein StructureVoid @@ -690,17 +626,16 @@ DRAGON_EGG_COMMAND_HELP=§8/§edragonegg §8-§7 Erhalte ein Drachenei NIGHT_VISION_HELP=§8/§enightvision §8-§7 Schalte Nightvision an oder aus. NIGHT_VISION_OFF=§eNightvision deaktiviert NIGHT_VISION_ON=§eNightvision aktiviert -NIGHT_VISION_ITEM_ON = §7Nightvision: §eAktiviert -NIGHT_VISION_ITEM_OFF = §7Nightvision: §eDeaktiviert - +NIGHT_VISION_ITEM_ON=§7Nightvision: §eAktiviert +NIGHT_VISION_ITEM_OFF=§7Nightvision: §eDeaktiviert #Navigation Wand NAVIGATION_WAND=§eNavigation Wand NAVIGATION_WAND_LEFT_CLICK=§eLeft click: jump to location NAVIGATION_WAND_RIGHT_CLICK=§eRight click: pass through walls # Material -MATERIAL_SEARCH_PROPERTY_TRUE = §aHat -MATERIAL_SEARCH_PROPERTY_FALSE = §cHat nicht -MATERIAL_SEARCH_PROPERTY_IGNORE = §eEgal +MATERIAL_SEARCH_PROPERTY_TRUE=§aHat +MATERIAL_SEARCH_PROPERTY_FALSE=§cHat nicht +MATERIAL_SEARCH_PROPERTY_IGNORE=§eEgal MATERIAL_INV_NAME=§eMaterial {0}/{1} MATERIAL_SEARCH=§eSuchen MATERIAL_BACK=§eZurück @@ -816,189 +751,164 @@ REGION_TNT_BUILD_DESTROY=§cEine Explosion hätte Blöcke im Baubereich zerstör REGION_TNT_TB_DESTROY=§cEine Explosion hätte Blöcke im Testblockbereich zerstört AFK_KICK_MESSAGE=§cAuf diesem Server ist seit 15 Minuten nichts passiert. AFK_WARNING_MESSAGE=§cDieser Server wird bei weiterer Inaktivität in einer Minute gestoppt - -SKIN_HELP = §8/§eskin §8[§7Kuerzel§8] §8[§7Creator§8|§epublic§8] §8[§7Name...§8] §8- §7Erstellt die Skin Schematics. 'public' als Creator nutzen für keinen Creator, danach die nachricht an YoyoNow kopieren (mit Click kopieren) +SKIN_HELP=§8/§eskin §8[§7Kuerzel§8] §8[§7Creator§8|§epublic§8] §8[§7Name...§8] §8- §7Erstellt die Skin Schematics. 'public' als Creator nutzen für keinen Creator, danach die nachricht an YoyoNow kopieren (mit Click kopieren) SKIN_NO_REGION=§7Du steht in keiner Region, welche mit einem Skin versehen werden kann SKIN_ALREADY_EXISTS=§cDieser Skin existiert in der Form bereits SKIN_MESSAGE=§7Skin erstellt SKIN_MESSAGE_HOVER=§eKlicken zum kopieren für YoyoNow und an diesen senden - # Panzern -PANZERN_HELP = §8/§epanzern §8[§7Block§8] §8[§7Slab§8] §8- §7Panzer deine WorldEdit Auswahl -PANZERN_PREPARE1 = §71. Gucke nochmal nach, ob Läufe auch bis zur Panzergrenze führen. -PANZERN_PREPARE2 = §72. Teppich in Gänge auf dem Boden vereinfacht das panzern. -PANZERN_PREPARE3 = §73. Schildtechnik sollte explizit eingeschlossen sein. -PANZERN_PREPARE4 = §74. Innerhalb der zu panzernden Region zu stehen, beim Befehlausführen kann das Panzern verbessern. -PANZERN_NO_WORLDEDIT = §cDu hast keine WorldEdit Selection -PANZERN_PROGRESS = §e{0} §7Blöcke übrig, §e{1} §7Blöcke pro Sekunde, §e{2} §7Block Delta -PANZERN_DONE = §aZuende gepanzert - +PANZERN_HELP=§8/§epanzern §8[§7Block§8] §8[§7Slab§8] §8- §7Panzer deine WorldEdit Auswahl +PANZERN_PREPARE1=§71. Gucke nochmal nach, ob Läufe auch bis zur Panzergrenze führen. +PANZERN_PREPARE2=§72. Teppich in Gänge auf dem Boden vereinfacht das panzern. +PANZERN_PREPARE3=§73. Schildtechnik sollte explizit eingeschlossen sein. +PANZERN_PREPARE4=§74. Innerhalb der zu panzernden Region zu stehen, beim Befehlausführen kann das Panzern verbessern. +PANZERN_NO_WORLDEDIT=§cDu hast keine WorldEdit Selection +PANZERN_PROGRESS=§e{0} §7Blöcke übrig, §e{1} §7Blöcke pro Sekunde, §e{2} §7Block Delta +PANZERN_DONE=§aZuende gepanzert # Laufbau -LAUFBAU_HELP = §8/§elaufbau §8[§7smallest§8|§7blastresistant§8] §8- §7Baue einen Lauf in deiner WorldEdit Auswahl mit den Traces -LAUFBAU_HELP_SETTINGS = §8/§elaufbau settings §8- §7Öffnet die Settings GUI -LAUFBAU_PREPARE1 = §71. Trace die Kanonen so oft wie nötig, in allen Modi. -LAUFBAU_PREPARE2 = §72. Versuche alle Fails aus dem Trace zu löschen. -LAUFBAU_NO_WORLDEDIT = §cDu hast keine WorldEdit Selection -LAUFBAU_STATE_FILTERING_TRACES = Traces filtern -LAUFBAU_STATE_PROCESSING_TRACES = Traces verbinden -LAUFBAU_STATE_CREATE_LAUF = Lauf erstellen -LAUFBAU_SIMPLE_PROGRESS = §e{0}§8: §e{1}§8/§e{2} §7Ãœbrige Zeit §8: §e{3} -LAUFBAU_DONE = §aZuende gebaut - -LAUFBAU_SETTINGS_GUI_NAME = §eLaufbau -LAUFBAU_SETTINGS_ACTIVE = §aAktiv -LAUFBAU_SETTINGS_INACTIVE = §cInaktiv -LAUFBAU_SETTINGS_MIXED = §e{0}§8/§e{1} §aAktiv -LAUFBAU_SETTINGS_GUI_BACK = §eBack - -LAUFBAU_SETTINGS_TOGGLE = §eClick §8-§7 Toggle -LAUFBAU_SETTINGS_ADVANCED = §eMiddle-Click §8-§7 Erweiterte Einstellung - -LAUFBAU_BLOCK_COBWEB = §eCobweb -LAUFBAU_BLOCK_GRASS_PATH = §eGrass Path -LAUFBAU_BLOCK_SOUL_SAND = §eSoul Sand -LAUFBAU_BLOCK_COCOA = §eCocoa -LAUFBAU_BLOCK_TURTLE_EGG = §eTurtle Eggs -LAUFBAU_BLOCK_CHEST = §eChest -LAUFBAU_BLOCK_SNOW = §eSnow Layer -LAUFBAU_BLOCK_PLAYER_WALL_HEAD = §ePlayer Wall Head -LAUFBAU_BLOCK_STONECUTTER = §eStonecutter -LAUFBAU_BLOCK_PLAYER_HEAD = §ePlayer Head -LAUFBAU_BLOCK_CAKE = §eCake -LAUFBAU_BLOCK_END_STONE_BRICK_SLAB = §eEndstone Brick Slabs -LAUFBAU_BLOCK_SEA_PICKLE = §eSea Pickles -LAUFBAU_BLOCK_CAMPFIRE = §eCampfire -LAUFBAU_BLOCK_FLOWER_POT = §eFlower Pot -LAUFBAU_BLOCK_IRON_TRAPDOOR = §eIron Trapdoor -LAUFBAU_BLOCK_LILY_PAD = §eLily Pad -LAUFBAU_BLOCK_WHITE_CARPET = §eCarpet -LAUFBAU_BLOCK_END_ROD = §eEnd Rod -LAUFBAU_BLOCK_LIGHTNING_ROD = §eLightning Rod -LAUFBAU_BLOCK_CONDUIT = §eConduit -LAUFBAU_BLOCK_BREWING_STAND = §eBrewing Stand -LAUFBAU_BLOCK_BELL = §eBell -LAUFBAU_BLOCK_GRINDSTONE = §eGrindstone -LAUFBAU_BLOCK_HOPPER = §eHopper -LAUFBAU_BLOCK_LANTERN = §eLantern -LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS = §eEndstone Brick Stairs -LAUFBAU_BLOCK_CHORUS_PLANT = §eChorus Plant -LAUFBAU_BLOCK_NETHER_BRICK_FENCE = §eNether Brick Fence -LAUFBAU_BLOCK_IRON_BARS = §eIron Bars -LAUFBAU_BLOCK_END_STONE_BRICK_WALL = §eEndstone Brick Walls -LAUFBAU_BLOCK_CHAIN = §eChain -LAUFBAU_BLOCK_BIG_DRIP_LEAF = §eBig Drip Leaf -LAUFBAU_BLOCK_DRAGON_EGG = §eDragon Egg -LAUFBAU_BLOCK_AZALEA = §eAzalea -LAUFBAU_BLOCK_CANDLE = §eKerze -LAUFBAU_BLOCK_CANDLE_CAKE = §eKuchen mit Kerze -LAUFBAU_BLOCK_LECTERN = §eLectern - -LAUFBAU_FACING_NORTH = §8-§7 Richtung Norden -LAUFBAU_FACING_SOUTH = §8-§7 Richtung Süden -LAUFBAU_FACING_WEST = §8-§7 Richtung Westen -LAUFBAU_FACING_EAST = §8-§7 Richtung Osten -LAUFBAU_FACING_UP = §8-§7 Richtung Oben -LAUFBAU_FACING_DOWN = §8-§7 Richtung Unten - -LAUFBAU_COUNT_1 = §8-§7 Anzahl 1 -LAUFBAU_COUNT_2 = §8-§7 Anzahl 2 -LAUFBAU_COUNT_3 = §8-§7 Anzahl 3 -LAUFBAU_COUNT_4 = §8-§7 Anzahl 4 - -LAUFBAU_LAYERS_8 = §8-§7 Ebenen 8 -LAUFBAU_LAYERS_7 = §8-§7 Ebenen 7 -LAUFBAU_LAYERS_6 = §8-§7 Ebenen 6 -LAUFBAU_LAYERS_3 = §8-§7 Ebenen 3 -LAUFBAU_LAYERS_2 = §8-§7 Ebenen 2 - -LAUFBAU_TYPE_BOTTOM = §8-§7 Type Unten -LAUFBAU_TYPE_TOP = §8-§7 Type Oben - -LAUFBAU_HALF_BOTTOM = §8-§7 Hälfte Unten -LAUFBAU_HALF_TOP = §8-§7 Hälfte Oben - -LAUFBAU_OPEN = §8-§7 Geöffnet - -LAUFBAU_ATTACHMENT_CEILING = §8-§7 Befestigung Decke -LAUFBAU_ATTACHMENT_FLOOR = §8-§7 Befestigung Boden -LAUFBAU_ATTACHMENT_DOUBLE_WALL = §8-§7 Befestigung beidseitige Wand -LAUFBAU_ATTACHMENT_SINGLE_WALL = §8-§7 Befestigung einseitige Wand -LAUFBAU_ATTACHMENT_WALL = §8-§7 Befestigung Wand - -LAUFBAU_CONNECTION_FLOOR = §8-§7 Verbindung Boden -LAUFBAU_CONNECTION_NORTH = §8-§7 Verbindung Norden -LAUFBAU_CONNECTION_SOUTH = §8-§7 Verbindung Süden -LAUFBAU_CONNECTION_EAST = §8-§7 Verbindung Osten -LAUFBAU_CONNECTION_WEST = §8-§7 Verbindung Westen -LAUFBAU_CONNECTION_DOWN = §8-§7 Verbindung Unten -LAUFBAU_CONNECTION_UP = §8-§7 Verbindung Oben - -LAUFBAU_HANGING = §8-§7 hängend - -LAUFBAU_SHAPE_STRAIGHT = §8-§7 Form gerade -LAUFBAU_SHAPE_OUTER_LEFT = §8-§7 Form äußere links -LAUFBAU_SHAPE_INNER_LEFT = §8-§7 Form innere links - -LAUFBAU_TILT_NONE = §8-§7 Neigung keine -LAUFBAU_TILT_PARTIAL = §8-§7 Neigung teilweise - +LAUFBAU_HELP=§8/§elaufbau §8[§7smallest§8|§7blastresistant§8] §8- §7Baue einen Lauf in deiner WorldEdit Auswahl mit den Traces +LAUFBAU_HELP_SETTINGS=§8/§elaufbau settings §8- §7Öffnet die Settings GUI +LAUFBAU_PREPARE1=§71. Trace die Kanonen so oft wie nötig, in allen Modi. +LAUFBAU_PREPARE2=§72. Versuche alle Fails aus dem Trace zu löschen. +LAUFBAU_NO_WORLDEDIT=§cDu hast keine WorldEdit Selection +LAUFBAU_STATE_FILTERING_TRACES=Traces filtern +LAUFBAU_STATE_PROCESSING_TRACES=Traces verbinden +LAUFBAU_STATE_CREATE_LAUF=Lauf erstellen +LAUFBAU_SIMPLE_PROGRESS=§e{0}§8: §e{1}§8/§e{2} §7Ãœbrige Zeit §8: §e{3} +LAUFBAU_DONE=§aZuende gebaut +LAUFBAU_SETTINGS_GUI_NAME=§eLaufbau +LAUFBAU_SETTINGS_ACTIVE=§aAktiv +LAUFBAU_SETTINGS_INACTIVE=§cInaktiv +LAUFBAU_SETTINGS_MIXED=§e{0}§8/§e{1} §aAktiv +LAUFBAU_SETTINGS_GUI_BACK=§eBack +LAUFBAU_SETTINGS_TOGGLE=§eClick §8-§7 Toggle +LAUFBAU_SETTINGS_ADVANCED=§eMiddle-Click §8-§7 Erweiterte Einstellung +LAUFBAU_BLOCK_COBWEB=§eCobweb +LAUFBAU_BLOCK_GRASS_PATH=§eGrass Path +LAUFBAU_BLOCK_SOUL_SAND=§eSoul Sand +LAUFBAU_BLOCK_COCOA=§eCocoa +LAUFBAU_BLOCK_TURTLE_EGG=§eTurtle Eggs +LAUFBAU_BLOCK_CHEST=§eChest +LAUFBAU_BLOCK_SNOW=§eSnow Layer +LAUFBAU_BLOCK_PLAYER_WALL_HEAD=§ePlayer Wall Head +LAUFBAU_BLOCK_STONECUTTER=§eStonecutter +LAUFBAU_BLOCK_PLAYER_HEAD=§ePlayer Head +LAUFBAU_BLOCK_CAKE=§eCake +LAUFBAU_BLOCK_END_STONE_BRICK_SLAB=§eEndstone Brick Slabs +LAUFBAU_BLOCK_SEA_PICKLE=§eSea Pickles +LAUFBAU_BLOCK_CAMPFIRE=§eCampfire +LAUFBAU_BLOCK_FLOWER_POT=§eFlower Pot +LAUFBAU_BLOCK_IRON_TRAPDOOR=§eIron Trapdoor +LAUFBAU_BLOCK_LILY_PAD=§eLily Pad +LAUFBAU_BLOCK_WHITE_CARPET=§eCarpet +LAUFBAU_BLOCK_END_ROD=§eEnd Rod +LAUFBAU_BLOCK_LIGHTNING_ROD=§eLightning Rod +LAUFBAU_BLOCK_CONDUIT=§eConduit +LAUFBAU_BLOCK_BREWING_STAND=§eBrewing Stand +LAUFBAU_BLOCK_BELL=§eBell +LAUFBAU_BLOCK_GRINDSTONE=§eGrindstone +LAUFBAU_BLOCK_HOPPER=§eHopper +LAUFBAU_BLOCK_LANTERN=§eLantern +LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS=§eEndstone Brick Stairs +LAUFBAU_BLOCK_CHORUS_PLANT=§eChorus Plant +LAUFBAU_BLOCK_NETHER_BRICK_FENCE=§eNether Brick Fence +LAUFBAU_BLOCK_IRON_BARS=§eIron Bars +LAUFBAU_BLOCK_END_STONE_BRICK_WALL=§eEndstone Brick Walls +LAUFBAU_BLOCK_CHAIN=§eChain +LAUFBAU_BLOCK_BIG_DRIP_LEAF=§eBig Drip Leaf +LAUFBAU_BLOCK_DRAGON_EGG=§eDragon Egg +LAUFBAU_BLOCK_AZALEA=§eAzalea +LAUFBAU_BLOCK_CANDLE=§eKerze +LAUFBAU_BLOCK_CANDLE_CAKE=§eKuchen mit Kerze +LAUFBAU_BLOCK_LECTERN=§eLectern +LAUFBAU_FACING_NORTH=§8-§7 Richtung Norden +LAUFBAU_FACING_SOUTH=§8-§7 Richtung Süden +LAUFBAU_FACING_WEST=§8-§7 Richtung Westen +LAUFBAU_FACING_EAST=§8-§7 Richtung Osten +LAUFBAU_FACING_UP=§8-§7 Richtung Oben +LAUFBAU_FACING_DOWN=§8-§7 Richtung Unten +LAUFBAU_COUNT_1=§8-§7 Anzahl 1 +LAUFBAU_COUNT_2=§8-§7 Anzahl 2 +LAUFBAU_COUNT_3=§8-§7 Anzahl 3 +LAUFBAU_COUNT_4=§8-§7 Anzahl 4 +LAUFBAU_LAYERS_8=§8-§7 Ebenen 8 +LAUFBAU_LAYERS_7=§8-§7 Ebenen 7 +LAUFBAU_LAYERS_6=§8-§7 Ebenen 6 +LAUFBAU_LAYERS_3=§8-§7 Ebenen 3 +LAUFBAU_LAYERS_2=§8-§7 Ebenen 2 +LAUFBAU_TYPE_BOTTOM=§8-§7 Type Unten +LAUFBAU_TYPE_TOP=§8-§7 Type Oben +LAUFBAU_HALF_BOTTOM=§8-§7 Hälfte Unten +LAUFBAU_HALF_TOP=§8-§7 Hälfte Oben +LAUFBAU_OPEN=§8-§7 Geöffnet +LAUFBAU_ATTACHMENT_CEILING=§8-§7 Befestigung Decke +LAUFBAU_ATTACHMENT_FLOOR=§8-§7 Befestigung Boden +LAUFBAU_ATTACHMENT_DOUBLE_WALL=§8-§7 Befestigung beidseitige Wand +LAUFBAU_ATTACHMENT_SINGLE_WALL=§8-§7 Befestigung einseitige Wand +LAUFBAU_ATTACHMENT_WALL=§8-§7 Befestigung Wand +LAUFBAU_CONNECTION_FLOOR=§8-§7 Verbindung Boden +LAUFBAU_CONNECTION_NORTH=§8-§7 Verbindung Norden +LAUFBAU_CONNECTION_SOUTH=§8-§7 Verbindung Süden +LAUFBAU_CONNECTION_EAST=§8-§7 Verbindung Osten +LAUFBAU_CONNECTION_WEST=§8-§7 Verbindung Westen +LAUFBAU_CONNECTION_DOWN=§8-§7 Verbindung Unten +LAUFBAU_CONNECTION_UP=§8-§7 Verbindung Oben +LAUFBAU_HANGING=§8-§7 hängend +LAUFBAU_SHAPE_STRAIGHT=§8-§7 Form gerade +LAUFBAU_SHAPE_OUTER_LEFT=§8-§7 Form äußere links +LAUFBAU_SHAPE_INNER_LEFT=§8-§7 Form innere links +LAUFBAU_TILT_NONE=§8-§7 Neigung keine +LAUFBAU_TILT_PARTIAL=§8-§7 Neigung teilweise # UTILS -SELECT_HELP = §8/§eselect §8[§7RegionsTyp§8] §8- §7Wähle einen RegionsTyp aus -SELECT_EXTENSION_HELP = §8/§eselect §8[§7RegionsTyp§8] §8[§7Extension§8] §8- §7Wähle einen RegionsTyp aus mit oder ohne Extension -SELECT_GLOBAL_REGION = §cDie globale Region kannst du nicht auswählen -SELECT_NO_TYPE = §cDiese Region hat keinen {0} -SELECT_NO_EXTENSION = §cDiese Region hat keine Ausfahrmaße -SELECT_MESSAGE = §7WorldEdit auswahl auf {0}, {1}, {2} und {3}, {4}, {5} gesetzt - -SKULL_HELP = §8/§eskull §8[§eSpieler§8] §8-§7 Gibt einen SpielerKopf -SKULL_INVALID = §cUngültiger Spieler -SKULL_ITEM = §e{0}§8s Kopf - -SPEED_HELP = §8/§espeed §8[§71§8-§710§8|§edefault§8] §8-§7 Setzte deine Flug- und Laufgeschindigkeit. -SPEED_CURRENT = §7Aktuelle geschwindigkeit§8: §e{0} -SPEED_TOO_SMALL = §c{0} ist zu klein -SPEED_TOO_HIGH = §c{0} ist zu hoch -SPEED_ITEM = §eGeschwindigkeit -SPEED_ITEM_LORE = §7Aktuell: §e -SPEED_TAB_NAME = Geschwindigkeit eingeben - -WORLDEDIT_WAND = WorldEdit Wand -WORLDEDIT_LEFTCLICK = Left click: select pos #1 -WORLDEDIT_RIGHTCLICK = Right click: select pos #2 - -TNT_CLICK_HEADER = §8---=== §eTNT §8===--- -TNT_CLICK_ORDER = §eEntity Order§8: §e{0} -TNT_CLICK_FUSE_TIME = §eFuseTime§8: §e{0} -TNT_CLICK_POSITION_X = §7Position §eX§8: §e{0} -TNT_CLICK_POSITION_Y = §7Position §eY§8: §e{0} -TNT_CLICK_POSITION_Z = §7Position §eZ§8: §e{0} -TNT_CLICK_VELOCITY_X = §7Velocity §eX§8: §e{0} -TNT_CLICK_VELOCITY_Y = §7Velocity §eY§8: §e{0} -TNT_CLICK_VELOCITY_Z = §7Velocity §eZ§8: §e{0} -TNT_CLICK_COUNT = §7Anzahl §8: §e{0} +SELECT_HELP=§8/§eselect §8[§7RegionsTyp§8] §8- §7Wähle einen RegionsTyp aus +SELECT_EXTENSION_HELP=§8/§eselect §8[§7RegionsTyp§8] §8[§7Extension§8] §8- §7Wähle einen RegionsTyp aus mit oder ohne Extension +SELECT_GLOBAL_REGION=§cDie globale Region kannst du nicht auswählen +SELECT_NO_TYPE=§cDiese Region hat keinen {0} +SELECT_NO_EXTENSION=§cDiese Region hat keine Ausfahrmaße +SELECT_MESSAGE=§7WorldEdit auswahl auf {0}, {1}, {2} und {3}, {4}, {5} gesetzt +SKULL_HELP=§8/§eskull §8[§eSpieler§8] §8-§7 Gibt einen SpielerKopf +SKULL_INVALID=§cUngültiger Spieler +SKULL_ITEM=§e{0}§8s Kopf +SPEED_HELP=§8/§espeed §8[§71§8-§710§8|§edefault§8] §8-§7 Setzte deine Flug- und Laufgeschindigkeit. +SPEED_CURRENT=§7Aktuelle geschwindigkeit§8: §e{0} +SPEED_TOO_SMALL=§c{0} ist zu klein +SPEED_TOO_HIGH=§c{0} ist zu hoch +SPEED_ITEM=§eGeschwindigkeit +SPEED_ITEM_LORE=§7Aktuell: §e +SPEED_TAB_NAME=Geschwindigkeit eingeben +WORLDEDIT_WAND=WorldEdit Wand +WORLDEDIT_LEFTCLICK=Left click: select pos #1 +WORLDEDIT_RIGHTCLICK=Right click: select pos #2 +TNT_CLICK_HEADER=§8---=== §eTNT §8===--- +TNT_CLICK_ORDER=§eEntity Order§8: §e{0} +TNT_CLICK_FUSE_TIME=§eFuseTime§8: §e{0} +TNT_CLICK_POSITION_X=§7Position §eX§8: §e{0} +TNT_CLICK_POSITION_Y=§7Position §eY§8: §e{0} +TNT_CLICK_POSITION_Z=§7Position §eZ§8: §e{0} +TNT_CLICK_VELOCITY_X=§7Velocity §eX§8: §e{0} +TNT_CLICK_VELOCITY_Y=§7Velocity §eY§8: §e{0} +TNT_CLICK_VELOCITY_Z=§7Velocity §eZ§8: §e{0} +TNT_CLICK_COUNT=§7Anzahl §8: §e{0} TNT_CLICK_ISOLATE=§eIsolieren -SELECT_ITEM_CHOOSE_EXTENSION = Extension auswählen -SELECT_ITEM_CHOOSE_SELECTION = Auswahl auswählen -SELECT_ITEM_NORMAL_EXTENSION = §eNormal -SELECT_ITEM_EXTENDED_EXTENSION= §eAusgefahren -SELECT_ITEM_SELECT= §eSelect -SELECT_ITEM_AUSWAHL= §7Auswahl: §7{0} {1} +SELECT_ITEM_CHOOSE_EXTENSION=Extension auswählen +SELECT_ITEM_CHOOSE_SELECTION=Auswahl auswählen +SELECT_ITEM_NORMAL_EXTENSION=§eNormal +SELECT_ITEM_EXTENDED_EXTENSION=§eAusgefahren +SELECT_ITEM_SELECT=§eSelect +SELECT_ITEM_AUSWAHL=§7Auswahl: §7{0} {1} SELECT_ITEM_RIGHT_CLICK=§7Rechtklick zum ändern SELECT_ITEM_BAURAHMEN=§eBaurahmen SELECT_ITEM_BAUPLATTFORM=§eBauplattform SELECT_ITEM_TESTBLOCK=§eTestblock - -CHESTFILLER_FILLED = §eKiste gefüllt - -PISTON_HELP_1 = §7Rechts Klick auf Piston mit einem Slime Ball berechnet dir die bewegten Blöcke. -PISTON_HELP_2 = §7Die Anzahl ist Rot, wenn ein unmovable Block vorhanden ist. -PISTON_HELP_3 = §7Die Anzahl ist Gelb, wenn zu viele Blöcke vorhanden sind. -PISTON_INFO = §7Bewegte Blöcke {0}{1}§8/§712 - +CHESTFILLER_FILLED=§eKiste gefüllt +PISTON_HELP_1=§7Rechts Klick auf Piston mit einem Slime Ball berechnet dir die bewegten Blöcke. +PISTON_HELP_2=§7Die Anzahl ist Rot, wenn ein unmovable Block vorhanden ist. +PISTON_HELP_3=§7Die Anzahl ist Gelb, wenn zu viele Blöcke vorhanden sind. +PISTON_INFO=§7Bewegte Blöcke {0}{1}§8/§712 # Warp -WARP_LOC_X = §7X§8: §e{0} -WARP_LOC_Y = §7Y§8: §e{0} -WARP_LOC_Z = §7Z§8: §e{0} +WARP_LOC_X=§7X§8: §e{0} +WARP_LOC_Y=§7Y§8: §e{0} +WARP_LOC_Z=§7Z§8: §e{0} WARP_EXISTS=§7Ein Warp mit dem namen §e{0} §7existiert bereits WARP_NAME_RESERVED=§7Du kannst nicht §c{0} §7als name für einen Warp nutzen WARP_CREATED=§7Der Warp §e{0} §7wurde erstellt @@ -1018,30 +928,22 @@ WARP_HELP_INFO=§8/§ewarp info §8[§7Name§8] §8- §7Infos zu einem Punkt WARP_HELP_DELETE=§8/§ewarp delete §8[§7Name§8] §8- §7Lösche einen Warp WARP_HELP_GUI=§8/§ewarp gui §8- §7Öffne die Warp-GUI WARP_HELP_LIST=§8/§ewarp list §8- §7Liste alle Warp-Punkt auf - # WORLD -STOP_HELP = §8/§estop §8- §7Stoppt den Server -STOP_MESSAGE = §eDer Server wird gestoppt - -KICKALL_HELP = §8/§ekickall §8- §7Kickt alle Spieler vom Server außer den Owner - +STOP_HELP=§8/§estop §8- §7Stoppt den Server +STOP_MESSAGE=§eDer Server wird gestoppt +KICKALL_HELP=§8/§ekickall §8- §7Kickt alle Spieler vom Server außer den Owner # Techhider -TECHHIDER_HELP = §8/§etechhider §8- §7Techhider umschalten -TECHHIDER_GLOBAL = §cKein Techhider in der globalen region -TECHHIDER_ON = §aTechhider aktiviert -TECHHIDER_OFF = §cTechHider deaktiviert - +TECHHIDER_HELP=§8/§etechhider §8- §7Techhider umschalten +TECHHIDER_GLOBAL=§cKein Techhider in der globalen region +TECHHIDER_ON=§aTechhider aktiviert +TECHHIDER_OFF=§cTechHider deaktiviert # XRAY -XRAY_HELP = §8/§exray §8- §7Xray umschalten -XRAY_GLOBAL = §cKein Xray in der globalen region -XRAY_ON = §aXray aktiviert -XRAY_OFF = §cXray deaktiviert - - +XRAY_HELP=§8/§exray §8- §7Xray umschalten +XRAY_GLOBAL=§cKein Xray in der globalen region +XRAY_ON=§aXray aktiviert +XRAY_OFF=§cXray deaktiviert # WorldEdit -COLORREPLACE_HELP = §8//§ecolorreplace §8[§7color§8] §8[§7color§8] §8- §7Ersetzt eine Farbe mit einer anderen - -TYPEREPLACE_HELP = §8//§etyreplace §8[§7type§8] §8[§7type§8] §8- §7Ersetzt einen Blockgruppe mit einer anderen - +COLORREPLACE_HELP=§8//§ecolorreplace §8[§7color§8] §8[§7color§8] §8- §7Ersetzt eine Farbe mit einer anderen +TYPEREPLACE_HELP=§8//§etyreplace §8[§7type§8] §8[§7type§8] §8- §7Ersetzt einen Blockgruppe mit einer anderen # Schematics SCHEMATIC_GUI_ITEM=§eSchematics diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java index 273d9ecc..49117dd8 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java @@ -27,12 +27,14 @@ import de.steamwar.entity.REntity; import de.steamwar.entity.REntityServer; import de.steamwar.techhider.BlockIds; import lombok.Getter; +import net.md_5.bungee.api.chat.ClickEvent; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import java.util.List; +import java.util.stream.Collectors; /** * Wrapper for the rendering of a record bundle @@ -47,10 +49,13 @@ public class TraceEntity extends REntity { @Getter private final List records; + private final String uniqueTntIdsString; + public TraceEntity(REntityServer server, Location location, boolean isExplosion, List records) { super(server, EntityType.FALLING_BLOCK, location, BlockIds.impl.materialToId(isExplosion ? Material.RED_STAINED_GLASS : Material.TNT) >> (Core.getVersion() <= 12 ? 4 : 0)); setNoGravity(true); this.records = records; + uniqueTntIdsString = records.stream().map(TNTPoint::getTntId).distinct().map(Object::toString).collect(Collectors.joining(" ")); addEntityMethod.invoke(server, this); } @@ -70,6 +75,7 @@ public class TraceEntity extends REntity { BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_X", player, representative.getVelocity().getX() + ""); BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_Y", player, representative.getVelocity().getY() + ""); BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_Z", player, representative.getVelocity().getZ() + ""); + BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_ISOLATE", player, BauSystem.MESSAGE.parse("TRACE_MESSAGE_CLICK_ISOLATE", player), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/trace isolate " + uniqueTntIdsString)); } @Override -- 2.39.5 From d0a08bc33116f51ae93134c5933159fef4cd93c2 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Sun, 21 Apr 2024 15:21:12 +0200 Subject: [PATCH 104/111] Fix isolate click message --- .../de/steamwar/bausystem/features/tracer/Trace.java | 2 +- .../bausystem/features/tracer/TraceCommand.java | 2 +- .../bausystem/features/tracer/TraceManager.java | 12 ++++++++++++ .../features/tracer/rendering/TraceEntity.java | 12 ++++++++++-- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index fd2c9cf4..b2145e1a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -217,7 +217,7 @@ public class Trace { List entities = new LinkedList<>(); for (List bundle : bundles) { - entities.add(new TraceEntity(entityServer, bundle.get(0).getLocation(), bundle.get(0).isExplosion(), bundle)); + entities.add(new TraceEntity(entityServer, bundle.get(0).getLocation(), bundle.get(0).isExplosion(), bundle, this)); } // Apply modifiers diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index 26ded08b..828ab9a0 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -149,7 +149,7 @@ public class TraceCommand extends SWCommand { @Register(value = "isolate", description = "TRACE_COMMAND_HELP_ISOLATE") public void isolate(@Validator Player player, Trace trace, @ErrorMessage("TRACE_RECORD_ID_INVALID") TNTPoint... records) { TraceManager.instance.isolate(player, records); - // TODO: Add Message! + BauSystem.MESSAGE.send("TRACE_MESSAGE_ISOLATE", player); } @Register(value = "share", description = "TRACE_COMMAND_HELP_SHARE") diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index e6dd941c..b4715b79 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -97,6 +97,18 @@ public class TraceManager implements Listener { return nextOpenId; } + /** + * Get the id of the given trace + * + * @param trace + */ + public int getId(Trace trace) { + for (Map.Entry entry : traces.entrySet()) { + if (entry.getValue() == trace) return entry.getKey(); + } + return -1; + } + /** * Renders only the given records to the specified trace * diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java index 49117dd8..dc056a2e 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java @@ -22,6 +22,8 @@ package de.steamwar.bausystem.features.tracer.rendering; import com.comphenix.tinyprotocol.Reflection; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.tracer.TNTPoint; +import de.steamwar.bausystem.features.tracer.Trace; +import de.steamwar.bausystem.features.tracer.TraceManager; import de.steamwar.core.Core; import de.steamwar.entity.REntity; import de.steamwar.entity.REntityServer; @@ -49,13 +51,19 @@ public class TraceEntity extends REntity { @Getter private final List records; + /** + * A string of all unique tnt records + */ private final String uniqueTntIdsString; - public TraceEntity(REntityServer server, Location location, boolean isExplosion, List records) { + private final Trace trace; + + public TraceEntity(REntityServer server, Location location, boolean isExplosion, List records, Trace trace) { super(server, EntityType.FALLING_BLOCK, location, BlockIds.impl.materialToId(isExplosion ? Material.RED_STAINED_GLASS : Material.TNT) >> (Core.getVersion() <= 12 ? 4 : 0)); setNoGravity(true); this.records = records; uniqueTntIdsString = records.stream().map(TNTPoint::getTntId).distinct().map(Object::toString).collect(Collectors.joining(" ")); + this.trace = trace; addEntityMethod.invoke(server, this); } @@ -75,7 +83,7 @@ public class TraceEntity extends REntity { BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_X", player, representative.getVelocity().getX() + ""); BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_Y", player, representative.getVelocity().getY() + ""); BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_Z", player, representative.getVelocity().getZ() + ""); - BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_ISOLATE", player, BauSystem.MESSAGE.parse("TRACE_MESSAGE_CLICK_ISOLATE", player), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/trace isolate " + uniqueTntIdsString)); + BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_ISOLATE", player, BauSystem.MESSAGE.parse("TRACE_MESSAGE_CLICK_ISOLATE", player), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/trace isolate " + TraceManager.instance.getId(trace) + " " + uniqueTntIdsString)); } @Override -- 2.39.5 From 143ba020edf5493e55eb20e972f75892333503b3 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Sun, 21 Apr 2024 15:27:14 +0200 Subject: [PATCH 105/111] Add message --- BauSystem_Main/src/BauSystem.properties | 27 +++++++++++----------- BauSystem_Main/src/BauSystem_de.properties | 11 ++++----- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index 3525a993..1e937214 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -423,10 +423,10 @@ TPSLIMIT_FROZEN=§eTPS frozen TRACE_RECORD=§aon TRACE_HAS_TRACES=§ehas Traces TRACE_IDLE_AUTO=§eauto -TRACE_MESSAGE_START = §aTNT-Tracer started +TRACE_MESSAGE_START=§aTNT-Tracer started TRACE_MESSAGE_AUTO_START=§eAuto TNT-Tracer started TRACE_MESSAGE_AUTO_STOP=§cAuto TNT-Tracer stopped -TRACE_MESSAGE_STOP = §cTNT-Tracer stopped +TRACE_MESSAGE_STOP=§cTNT-Tracer stopped TRACE_MESSAGE_CLEAR=§cAll TNT-positions deleted TRACE_MESSAGE_DELETE=§cTrace TNT-positions deleted TRACE_MESSAGE_SHOW=§aAll TNT-positions shown @@ -435,7 +435,7 @@ TRACE_MESSAGE_SHOW_AT=§aTNT-positions shown at {0} TRACE_MESSAGE_SHOW_FROM=§aAll TNT-positions shown from {0} TRACE_MESSAGE_SHOW_FROM_TO=§aAll TNT-positions shown from {0} to {1} TRACE_MESSAGE_SHOW_TO_SMALLER=§cTo must be bigger then from -TRACE_MESSAGE_CLICK_ISOLATE=§eClick to §aisolate§8/§cunisolate +TRACE_MESSAGE_CLICK_ISOLATE=�eClick to �aisolate�8/�cunisolate TRACE_COMMAND_HELP_START=§8/§etrace start §8- §7Starts recording of all TNT-positions TRACE_COMMAND_HELP_STOP=§8/§etrace stop §8- §7Stops the TNT-Tracer TRACE_COMMAND_HELP_AUTO=§8/§etrace toggleauto §8- §7Automatic start of recording @@ -454,20 +454,19 @@ TRACE_COMMAND_HELP_SHOW_FROM_TO_WITH=§8/§etrace show §7from §8<§eFROM§8> TRACE_COMMAND_HELP_HIDE=§8/§etrace hide §8- §7Hides all TNT-positions TRACE_COMMAND_HELP_DELETE=§8/§etrace delete §8[§eTrace§8] §8- §7Deletes all TNT-positions or a Trace TRACE_COMMAND_HELP_ISOLATE=§8/§etrace isolate §8[§eTrace§8] §8[§eTNT§8] §8- §7Isolates specific TNTs from the Trace +TRACE_MESSAGE_ISOLATE=§e TNT Positions have been isolated TRACE_COMMAND_HELP_SHARE=§8/§etrace share §8- §7Share your current Trace show state with others TRACE_COMMAND_HELP_FOLLOW=§8/§etrace follow §8[§ePlayer§8] §8- §7Follow a players Trace show state TRACE_COMMAND_HELP_UNFOLLOW=§8/§etrace unfollow §8- §7Unfollow the Trace show state - -TRACE_GUI_ITEM_NAME = §eTracer -TRACE_GUI_ITEM_LORE = §7Status§8: {0} -TRACE_GUI_NAME = Trace Gui -TRACE_GUI_TRACE_INACTIVE = §eStart Tracer -TRACE_GUI_TRACE_ACTIVE = §eStop Tracer -TRACE_GUI_TRACE_ACTIVE_AUTO = §eAuto-Trace is active -TRACE_GUI_AUTO_TRACE_INACTIVE = §eacitvate Auto-Tracer -TRACE_GUI_AUTO_TRACE_ACTIVE = §edeactivate Auto-Tracer -TRACE_GUI_DELETE = §eDelete trace - +TRACE_GUI_ITEM_NAME=§eTracer +TRACE_GUI_ITEM_LORE=§7Status§8: {0} +TRACE_GUI_NAME=Trace Gui +TRACE_GUI_TRACE_INACTIVE=§eStart Tracer +TRACE_GUI_TRACE_ACTIVE=§eStop Tracer +TRACE_GUI_TRACE_ACTIVE_AUTO=§eAuto-Trace is active +TRACE_GUI_AUTO_TRACE_INACTIVE=§eacitvate Auto-Tracer +TRACE_GUI_AUTO_TRACE_ACTIVE=§edeactivate Auto-Tracer +TRACE_GUI_DELETE=§eDelete trace # Loader LOADER_SETUP=§eSetup LOADER_RUNNING=§aRunning diff --git a/BauSystem_Main/src/BauSystem_de.properties b/BauSystem_Main/src/BauSystem_de.properties index d9eaaadc..413aec73 100644 --- a/BauSystem_Main/src/BauSystem_de.properties +++ b/BauSystem_Main/src/BauSystem_de.properties @@ -393,10 +393,10 @@ TPSLIMIT_FROZEN=§eTPS eingefroren. # Trace TRACE_RECORD=§aan TRACE_HAS_TRACES=§ehat Traces -TRACE_MESSAGE_START = §aTNT-Tracer gestartet +TRACE_MESSAGE_START=§aTNT-Tracer gestartet TRACE_MESSAGE_AUTO_START=§eAuto TNT-Tracer gestartet TRACE_MESSAGE_AUTO_STOP=§cAuto TNT-Tracer gestoppt -TRACE_MESSAGE_STOP = §cTNT-Tracer gestoppt +TRACE_MESSAGE_STOP=§cTNT-Tracer gestoppt TRACE_MESSAGE_AUTO_IDLE_IGNITE=§aAuto-Tracer ignite gestartet TRACE_MESSAGE_AUTO_DELETE_INVALID=§cAuto delete kann aktuell nicht genutzt werden TRACE_MESSAGE_AUTO_DELETE_ALWAYS=§7Der letzte Schuss wird §eimmer§7 gelöscht @@ -407,8 +407,9 @@ TRACE_MESSAGE_AUTO_DELETE_NO_TESTBLOCK_DESTROY=§7Der letzte Schuss wird gelösc TRACE_MESSAGE_AUTO_DELETE_TESTBLOCK_DESTROY=§7Der letzte Schuss wird gelöscht, wenn §eein§7 Block aus dem §eTestblock§7 zerstört wurde TRACE_MESSAGE_SINGLE=§aSingle-Tracer gestartet TRACE_MESSAGE_CLEAR=§cAlle TNT-Positionen gelöscht -TRACE_MESSAGE_CLICK_ISOLATE=§eKlicken zum §aisolieren§8/§causblenden +TRACE_MESSAGE_CLICK_ISOLATE=�eKlicken zum �aisolieren�8/�causblenden TRACE_MESSAGE_DISALLOWED=§cDu darfst hier nicht den TNT-Tracer nutzen +TRACE_COMMAND_HELP_ISOLATE=§8/§etrace isolate §8[§eTrace§8] §8[§eTNT§8] §8- §7Isoliert spezifische TNTs des Traces TRACE_MESSAGE_SHOW_AT=§aTNT-positions angezeigt bei {0} TRACE_MESSAGE_SHOW_FROM=§aAll TNT-positions angezeigt von {0} TRACE_MESSAGE_SHOW_FROM_TO=§aAll TNT-positions angezeigt von {0} bis {1} @@ -417,17 +418,15 @@ TRACE_MESSAGE_SHARE_HOVER=§eZum Ansehen klicken. TRACE_MESSAGE_FOLLOW=§aSie folgen nun {0} Trace show state TRACE_MESSAGE_FOLLOW_SELF=§cSie können sich selbst nicht folgen! TRACE_MESSAGE_UNFOLLOW=§eSie folgen nicht mehr dem Status einer Trace-Show - TRACE_COMMAND_HELP_SHARE=§8/§etrace share §8- §7Teilt den aktuellen Trace-Show-Status mit anderen TRACE_COMMAND_HELP_FOLLOW=§8/§etrace follow §8[§ePlayer§8] §8- §7Verfolgen eines Spielers Status anzeigen TRACE_COMMAND_HELP_UNFOLLOW=§8/§etrace unfollow §8- §7Den Status der Trace-Anzeige aufheben - - TRACE_MESSAGE_SHOW_TO_SMALLER=§cBis muss größer als von sein TRACE_COMMAND_HELP_START=§8/§etrace start §8- §7Startet die Aufnahme aller TNT-Positionen TRACE_COMMAND_HELP_SINGLE=§8/§etrace single §8- §7Startet eine einzelne Aufnahme aller TNT-Positionen TRACE_COMMAND_HELP_STOP=§8/§etrace stop §8- §7Stoppt den TNT-Tracer TRACE_COMMAND_HELP_AUTO=§8/§etrace toggleauto §8- §7Automatischer Aufnahmenstart +TRACE_MESSAGE_ISOLATE=§eTNT Positionen wurden isoliert TRACE_COMMAND_HELP_AUTO_REMOVE=§8/§etrace autoremove §8<§eParameter§8> §8- §7Löscht den letzten Trace automatisch TRACE_COMMAND_HELP_SHOW=§8/§etrace show §8<§eParameter§8> - §7Zeigt alle TNT-Positionen TRACE_COMMAND_HELP_SHOW_AT=§8/§etrace show §8(§etime§8|§7fuse§8) §7at §8<§eTIME§8> - §7Zeigt alle TNT-Positionen bei §8<§eTIME§8> an -- 2.39.5 From 69b629d72e07bf9eea62b5a4949f3e58fdae788e Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 21 Apr 2024 15:30:12 +0200 Subject: [PATCH 106/111] Fix messages --- BauSystem_Main/src/BauSystem.properties | 4 ++-- BauSystem_Main/src/BauSystem_de.properties | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index 1e937214..a6af06f0 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -435,7 +435,7 @@ TRACE_MESSAGE_SHOW_AT=§aTNT-positions shown at {0} TRACE_MESSAGE_SHOW_FROM=§aAll TNT-positions shown from {0} TRACE_MESSAGE_SHOW_FROM_TO=§aAll TNT-positions shown from {0} to {1} TRACE_MESSAGE_SHOW_TO_SMALLER=§cTo must be bigger then from -TRACE_MESSAGE_CLICK_ISOLATE=�eClick to �aisolate�8/�cunisolate +TRACE_MESSAGE_CLICK_ISOLATE=§eClick to §aisolate§8/§cunisolate TRACE_COMMAND_HELP_START=§8/§etrace start §8- §7Starts recording of all TNT-positions TRACE_COMMAND_HELP_STOP=§8/§etrace stop §8- §7Stops the TNT-Tracer TRACE_COMMAND_HELP_AUTO=§8/§etrace toggleauto §8- §7Automatic start of recording @@ -454,7 +454,7 @@ TRACE_COMMAND_HELP_SHOW_FROM_TO_WITH=§8/§etrace show §7from §8<§eFROM§8> TRACE_COMMAND_HELP_HIDE=§8/§etrace hide §8- §7Hides all TNT-positions TRACE_COMMAND_HELP_DELETE=§8/§etrace delete §8[§eTrace§8] §8- §7Deletes all TNT-positions or a Trace TRACE_COMMAND_HELP_ISOLATE=§8/§etrace isolate §8[§eTrace§8] §8[§eTNT§8] §8- §7Isolates specific TNTs from the Trace -TRACE_MESSAGE_ISOLATE=§e TNT Positions have been isolated +TRACE_MESSAGE_ISOLATE=§eTNT Positions have been isolated TRACE_COMMAND_HELP_SHARE=§8/§etrace share §8- §7Share your current Trace show state with others TRACE_COMMAND_HELP_FOLLOW=§8/§etrace follow §8[§ePlayer§8] §8- §7Follow a players Trace show state TRACE_COMMAND_HELP_UNFOLLOW=§8/§etrace unfollow §8- §7Unfollow the Trace show state diff --git a/BauSystem_Main/src/BauSystem_de.properties b/BauSystem_Main/src/BauSystem_de.properties index 413aec73..96fc285b 100644 --- a/BauSystem_Main/src/BauSystem_de.properties +++ b/BauSystem_Main/src/BauSystem_de.properties @@ -407,7 +407,7 @@ TRACE_MESSAGE_AUTO_DELETE_NO_TESTBLOCK_DESTROY=§7Der letzte Schuss wird gelösc TRACE_MESSAGE_AUTO_DELETE_TESTBLOCK_DESTROY=§7Der letzte Schuss wird gelöscht, wenn §eein§7 Block aus dem §eTestblock§7 zerstört wurde TRACE_MESSAGE_SINGLE=§aSingle-Tracer gestartet TRACE_MESSAGE_CLEAR=§cAlle TNT-Positionen gelöscht -TRACE_MESSAGE_CLICK_ISOLATE=�eKlicken zum �aisolieren�8/�causblenden +TRACE_MESSAGE_CLICK_ISOLATE=§eKlicken zum §aisolieren§8/§causblenden TRACE_MESSAGE_DISALLOWED=§cDu darfst hier nicht den TNT-Tracer nutzen TRACE_COMMAND_HELP_ISOLATE=§8/§etrace isolate §8[§eTrace§8] §8[§eTNT§8] §8- §7Isoliert spezifische TNTs des Traces TRACE_MESSAGE_SHOW_AT=§aTNT-positions angezeigt bei {0} -- 2.39.5 From 86cf7e8ca5235d42ceeebf4ea1d92f19e4fa354f Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 21 Apr 2024 15:31:45 +0200 Subject: [PATCH 107/111] Fix messages --- BauSystem_Main/src/BauSystem.properties | 10 +++++----- BauSystem_Main/src/BauSystem_de.properties | 18 +++--------------- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index a6af06f0..f399a7ab 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -436,15 +436,16 @@ TRACE_MESSAGE_SHOW_FROM=§aAll TNT-positions shown from {0} TRACE_MESSAGE_SHOW_FROM_TO=§aAll TNT-positions shown from {0} to {1} TRACE_MESSAGE_SHOW_TO_SMALLER=§cTo must be bigger then from TRACE_MESSAGE_CLICK_ISOLATE=§eClick to §aisolate§8/§cunisolate -TRACE_COMMAND_HELP_START=§8/§etrace start §8- §7Starts recording of all TNT-positions -TRACE_COMMAND_HELP_STOP=§8/§etrace stop §8- §7Stops the TNT-Tracer -TRACE_COMMAND_HELP_AUTO=§8/§etrace toggleauto §8- §7Automatic start of recording -TRACE_COMMAND_HELP_SHOW=§8/§etrace show §8<§eParameter§8> - §7Shows all TNT-positions +TRACE_MESSAGE_ISOLATE=§eTNT Positions have been isolated TRACE_MESSAGE_SHARE=§e{0} shared his trace show state. TRACE_MESSAGE_SHARE_HOVER=§eClick to view TRACE_MESSAGE_FOLLOW=§aYou are now following {0} Trace show state TRACE_MESSAGE_FOLLOW_SELF=§cYou cannot follow yourself! TRACE_MESSAGE_UNFOLLOW=§eYou are no longer following a Trace show state +TRACE_COMMAND_HELP_START=§8/§etrace start §8- §7Starts recording of all TNT-positions +TRACE_COMMAND_HELP_STOP=§8/§etrace stop §8- §7Stops the TNT-Tracer +TRACE_COMMAND_HELP_AUTO=§8/§etrace toggleauto §8- §7Automatic start of recording +TRACE_COMMAND_HELP_SHOW=§8/§etrace show §8<§eParameter§8> - §7Shows all TNT-positions TRACE_COMMAND_HELP_SHOW_AT=§8/§etrace show §7at §8<§eTIME§8> - §7Shows all Trace Positions at §8<§eTIME§8> TRACE_COMMAND_HELP_SHOW_AT_WITH=§8/§etrace show §7at §8<§eTIME§8> §7with §8<§eParameter§8> - §7Shows all Trace Positions at §8<§eTIME§8> TRACE_COMMAND_HELP_SHOW_FROM=§8/§etrace show §7from §8<§eFROM§8> - §7Shows all Trace Positions from §8<§eFROM§8> @@ -454,7 +455,6 @@ TRACE_COMMAND_HELP_SHOW_FROM_TO_WITH=§8/§etrace show §7from §8<§eFROM§8> TRACE_COMMAND_HELP_HIDE=§8/§etrace hide §8- §7Hides all TNT-positions TRACE_COMMAND_HELP_DELETE=§8/§etrace delete §8[§eTrace§8] §8- §7Deletes all TNT-positions or a Trace TRACE_COMMAND_HELP_ISOLATE=§8/§etrace isolate §8[§eTrace§8] §8[§eTNT§8] §8- §7Isolates specific TNTs from the Trace -TRACE_MESSAGE_ISOLATE=§eTNT Positions have been isolated TRACE_COMMAND_HELP_SHARE=§8/§etrace share §8- §7Share your current Trace show state with others TRACE_COMMAND_HELP_FOLLOW=§8/§etrace follow §8[§ePlayer§8] §8- §7Follow a players Trace show state TRACE_COMMAND_HELP_UNFOLLOW=§8/§etrace unfollow §8- §7Unfollow the Trace show state diff --git a/BauSystem_Main/src/BauSystem_de.properties b/BauSystem_Main/src/BauSystem_de.properties index 96fc285b..057c63da 100644 --- a/BauSystem_Main/src/BauSystem_de.properties +++ b/BauSystem_Main/src/BauSystem_de.properties @@ -397,19 +397,8 @@ TRACE_MESSAGE_START=§aTNT-Tracer gestartet TRACE_MESSAGE_AUTO_START=§eAuto TNT-Tracer gestartet TRACE_MESSAGE_AUTO_STOP=§cAuto TNT-Tracer gestoppt TRACE_MESSAGE_STOP=§cTNT-Tracer gestoppt -TRACE_MESSAGE_AUTO_IDLE_IGNITE=§aAuto-Tracer ignite gestartet -TRACE_MESSAGE_AUTO_DELETE_INVALID=§cAuto delete kann aktuell nicht genutzt werden -TRACE_MESSAGE_AUTO_DELETE_ALWAYS=§7Der letzte Schuss wird §eimmer§7 gelöscht -TRACE_MESSAGE_AUTO_DELETE_NEVER=§7Der letzte Schuss wird §enie§7 gelöscht -TRACE_MESSAGE_AUTO_DELETE_NO_BUILD_DESTROY=§7Der letzte Schuss wird gelöscht, wenn §ekein§7 Block aus dem §eBaubereich§7 zerstört wurde -TRACE_MESSAGE_AUTO_DELETE_BUILD_DESTROY=§7Der letzte Schuss wird gelöscht, wenn §eein§7 Block aus dem §eBaubereich§7 zerstört wurde -TRACE_MESSAGE_AUTO_DELETE_NO_TESTBLOCK_DESTROY=§7Der letzte Schuss wird gelöscht, wenn §ekein§7 Block aus dem §eTestblock§7 zerstört wurde -TRACE_MESSAGE_AUTO_DELETE_TESTBLOCK_DESTROY=§7Der letzte Schuss wird gelöscht, wenn §eein§7 Block aus dem §eTestblock§7 zerstört wurde -TRACE_MESSAGE_SINGLE=§aSingle-Tracer gestartet TRACE_MESSAGE_CLEAR=§cAlle TNT-Positionen gelöscht TRACE_MESSAGE_CLICK_ISOLATE=§eKlicken zum §aisolieren§8/§causblenden -TRACE_MESSAGE_DISALLOWED=§cDu darfst hier nicht den TNT-Tracer nutzen -TRACE_COMMAND_HELP_ISOLATE=§8/§etrace isolate §8[§eTrace§8] §8[§eTNT§8] §8- §7Isoliert spezifische TNTs des Traces TRACE_MESSAGE_SHOW_AT=§aTNT-positions angezeigt bei {0} TRACE_MESSAGE_SHOW_FROM=§aAll TNT-positions angezeigt von {0} TRACE_MESSAGE_SHOW_FROM_TO=§aAll TNT-positions angezeigt von {0} bis {1} @@ -418,22 +407,21 @@ TRACE_MESSAGE_SHARE_HOVER=§eZum Ansehen klicken. TRACE_MESSAGE_FOLLOW=§aSie folgen nun {0} Trace show state TRACE_MESSAGE_FOLLOW_SELF=§cSie können sich selbst nicht folgen! TRACE_MESSAGE_UNFOLLOW=§eSie folgen nicht mehr dem Status einer Trace-Show +TRACE_MESSAGE_SHOW_TO_SMALLER=§cBis muss größer als von sein +TRACE_MESSAGE_ISOLATE=§eTNT Positionen wurden isoliert TRACE_COMMAND_HELP_SHARE=§8/§etrace share §8- §7Teilt den aktuellen Trace-Show-Status mit anderen TRACE_COMMAND_HELP_FOLLOW=§8/§etrace follow §8[§ePlayer§8] §8- §7Verfolgen eines Spielers Status anzeigen TRACE_COMMAND_HELP_UNFOLLOW=§8/§etrace unfollow §8- §7Den Status der Trace-Anzeige aufheben -TRACE_MESSAGE_SHOW_TO_SMALLER=§cBis muss größer als von sein TRACE_COMMAND_HELP_START=§8/§etrace start §8- §7Startet die Aufnahme aller TNT-Positionen -TRACE_COMMAND_HELP_SINGLE=§8/§etrace single §8- §7Startet eine einzelne Aufnahme aller TNT-Positionen TRACE_COMMAND_HELP_STOP=§8/§etrace stop §8- §7Stoppt den TNT-Tracer TRACE_COMMAND_HELP_AUTO=§8/§etrace toggleauto §8- §7Automatischer Aufnahmenstart -TRACE_MESSAGE_ISOLATE=§eTNT Positionen wurden isoliert -TRACE_COMMAND_HELP_AUTO_REMOVE=§8/§etrace autoremove §8<§eParameter§8> §8- §7Löscht den letzten Trace automatisch TRACE_COMMAND_HELP_SHOW=§8/§etrace show §8<§eParameter§8> - §7Zeigt alle TNT-Positionen TRACE_COMMAND_HELP_SHOW_AT=§8/§etrace show §8(§etime§8|§7fuse§8) §7at §8<§eTIME§8> - §7Zeigt alle TNT-Positionen bei §8<§eTIME§8> an TRACE_COMMAND_HELP_SHOW_FROM=§8/§etrace show §8(§etime§8|§7fuse§8) §7from §8<§eFROM§8> - §7Zeigt alle TNT-Positionen von §8<§eFROM§8> TRACE_COMMAND_HELP_SHOW_FROM_TO=§8/§etrace show §8(§etime§8|§7fuse§8) §7from §8<§eFROM§8> §7to §8<§eTO§8> - §7Zeigt alle TNT-Positionen zwischen §8<§eFROM§8> und §8<§eTO§8> TRACE_COMMAND_HELP_HIDE=§8/§etrace hide §8- §7Versteckt alle TNT-Positionen TRACE_COMMAND_HELP_DELETE=§8/§etrace delete §8- §7Löscht alle TNT-Positionen +TRACE_COMMAND_HELP_ISOLATE=§8/§etrace isolate §8[§eTrace§8] §8[§eTNT§8] §8- §7Isoliert spezifische TNTs des Traces TRACE_GUI_ITEM_NAME=§eTracer TRACE_GUI_ITEM_LORE=§7Status§8: {0} TRACE_GUI_NAME=Tracer Gui -- 2.39.5 From b64e06479fcd973f369a1660f92e7b72f6d46d72 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 21 Apr 2024 15:36:12 +0200 Subject: [PATCH 108/111] Disable IsolateFlag if no isolation is active --- BauSystem_Main/src/BauSystem.properties | 2 +- BauSystem_Main/src/BauSystem_de.properties | 2 +- .../features/tracer/rendering/dynamicflags/IsolateFlag.java | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index f399a7ab..0911d917 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -441,7 +441,7 @@ TRACE_MESSAGE_SHARE=§e{0} shared his trace show state. TRACE_MESSAGE_SHARE_HOVER=§eClick to view TRACE_MESSAGE_FOLLOW=§aYou are now following {0} Trace show state TRACE_MESSAGE_FOLLOW_SELF=§cYou cannot follow yourself! -TRACE_MESSAGE_UNFOLLOW=§eYou are no longer following a Trace show state +TRACE_MESSAGE_UNFOLLOW=§cYou are no longer following a Trace show state TRACE_COMMAND_HELP_START=§8/§etrace start §8- §7Starts recording of all TNT-positions TRACE_COMMAND_HELP_STOP=§8/§etrace stop §8- §7Stops the TNT-Tracer TRACE_COMMAND_HELP_AUTO=§8/§etrace toggleauto §8- §7Automatic start of recording diff --git a/BauSystem_Main/src/BauSystem_de.properties b/BauSystem_Main/src/BauSystem_de.properties index 057c63da..57df12df 100644 --- a/BauSystem_Main/src/BauSystem_de.properties +++ b/BauSystem_Main/src/BauSystem_de.properties @@ -406,7 +406,7 @@ TRACE_MESSAGE_SHARE=§e{0} teilte seinen Trace-Show-Status. TRACE_MESSAGE_SHARE_HOVER=§eZum Ansehen klicken. TRACE_MESSAGE_FOLLOW=§aSie folgen nun {0} Trace show state TRACE_MESSAGE_FOLLOW_SELF=§cSie können sich selbst nicht folgen! -TRACE_MESSAGE_UNFOLLOW=§eSie folgen nicht mehr dem Status einer Trace-Show +TRACE_MESSAGE_UNFOLLOW=§cSie folgen nicht mehr dem Status einer Trace-Show TRACE_MESSAGE_SHOW_TO_SMALLER=§cBis muss größer als von sein TRACE_MESSAGE_ISOLATE=§eTNT Positionen wurden isoliert TRACE_COMMAND_HELP_SHARE=§8/§etrace share §8- §7Teilt den aktuellen Trace-Show-Status mit anderen diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/IsolateFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/IsolateFlag.java index 723e7d9c..f92d14d9 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/IsolateFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/IsolateFlag.java @@ -54,6 +54,7 @@ public class IsolateFlag extends ViewFlag { @Override public List filter(List records) { + if (tntToIsolate.isEmpty()) return records; return records.stream() .filter(record -> tntToIsolate.contains(record.getTntId())) .collect(Collectors.toList()); -- 2.39.5 From e931d7157e2c90f2708b252c2ebbe3d76697e9d9 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 21 Apr 2024 15:47:18 +0200 Subject: [PATCH 109/111] Rewrite ViewFlag.filter with Stream API to reduce copies of lists --- .../bausystem/features/tracer/Trace.java | 6 ++- .../features/tracer/rendering/ViewFlag.java | 39 ++++++++----------- .../tracer/rendering/dynamicflags/AtFlag.java | 9 ++--- .../rendering/dynamicflags/IsolateFlag.java | 9 ++--- 4 files changed, 26 insertions(+), 37 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index b2145e1a..c46a1df3 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -35,6 +35,7 @@ import java.io.*; import java.lang.ref.SoftReference; import java.util.*; import java.util.stream.Collectors; +import java.util.stream.Stream; import java.util.zip.GZIPInputStream; public class Trace { @@ -202,13 +203,14 @@ public class Trace { return; } - List workingRecords = new ArrayList<>(records); Set flagList = playerTraceShowData.getEffectiveViewFlags(); // Apply filters + Stream workingRecordsStream = records.stream(); for (ViewFlag flag : flagList) { - workingRecords = flag.filter(workingRecords); + workingRecordsStream = flag.filter(workingRecordsStream); } + List workingRecords = workingRecordsStream.collect(Collectors.toList()); // Bundle records at unique positions List> bundles = bundleRecords(workingRecords, playerTraceShowData.getBundleFilter()); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java index d8910c4e..83ad005d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java @@ -31,6 +31,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.stream.Collectors; +import java.util.stream.Stream; /** * A settable flag that changes how a trace is rendered @@ -48,52 +49,44 @@ public abstract class ViewFlag { public static ViewFlag EXPLOSION = new ViewFlag(true, false, "explosion", "e") { @Override - public List filter(List records) { - return records.stream() - .filter(TNTPoint::isExplosion) - .collect(Collectors.toList()); + public Stream filter(Stream records) { + return records.filter(TNTPoint::isExplosion); } }; public static ViewFlag IGNITE = new ViewFlag(true, true, "ignite", "i") { @Override - public List filter(List records) { - return records.stream() - .filter(record -> record.isAfterFirstExplosion()) - .collect(Collectors.toList()); + public Stream filter(Stream records) { + return records.filter(record -> record.isAfterFirstExplosion()); } }; public static ViewFlag SOURCE = new ViewFlag(true, false, IGNITE, "source", "s") { @Override - public List filter(List records) { - return records.stream() - .filter(record -> record.getFuse() == 80) - .collect(Collectors.toList()); + public Stream filter(Stream records) { + return records.filter(record -> record.getFuse() == 80); } }; public static ViewFlag BUILD_DESTROY_ONLY = new ViewFlag(true, false, "build-destroy-only") { @Override - public List filter(List records) { - return records.stream() - .filter(record -> record.getHistory().get(record.getHistory().size() - 1).isDestroyedBuildArea()) - .collect(Collectors.toList()); + public Stream filter(Stream records) { + return records.filter(record -> record.getHistory().get(record.getHistory().size() - 1).isDestroyedBuildArea()); } }; public static ViewFlag TESTBLOCK_DESTROY_ONLY = new ViewFlag(true, false, "testblock-destroy-only") { @Override - public List filter(List records) { - return records.stream() - .filter(record -> record.getHistory().get(record.getHistory().size() - 1).isDestroyedTestBlock()) - .collect(Collectors.toList()); + public Stream filter(Stream records) { + return records.filter(record -> record.getHistory().get(record.getHistory().size() - 1).isDestroyedTestBlock()); } }; public static ViewFlag MICROMOTION = new ViewFlag(true, false, "micromotion", "m") { @Override - public List filter(List records) { + public Stream filter(Stream stream) { + List records = stream.collect(Collectors.toList()); + ; Set seen = new HashSet<>(); Set toRemove = new HashSet<>(); @@ -119,7 +112,7 @@ public abstract class ViewFlag { records.removeAll(record.getHistory()); } - return records; + return records.stream(); } }; @@ -239,7 +232,7 @@ public abstract class ViewFlag { * @param records Records to be filtered * @return Filtered records */ - public List filter(List records) { + public Stream filter(Stream records) { return records; } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/AtFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/AtFlag.java index 5ad1157b..776eead4 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/AtFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/AtFlag.java @@ -22,8 +22,7 @@ package de.steamwar.bausystem.features.tracer.rendering.dynamicflags; import de.steamwar.bausystem.features.tracer.TNTPoint; import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; -import java.util.List; -import java.util.stream.Collectors; +import java.util.stream.Stream; /** * A view flag for rendering a trace only in a given time intervall @@ -56,9 +55,7 @@ public class AtFlag extends ViewFlag { } @Override - public List filter(List records) { - return records.stream() - .filter(record -> record.getTicksSinceStart() >= start && record.getTicksSinceStart() <= end) - .collect(Collectors.toList()); + public Stream filter(Stream records) { + return records.filter(record -> record.getTicksSinceStart() >= start && record.getTicksSinceStart() <= end); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/IsolateFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/IsolateFlag.java index f92d14d9..4ee99408 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/IsolateFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/dynamicflags/IsolateFlag.java @@ -23,9 +23,8 @@ import de.steamwar.bausystem.features.tracer.TNTPoint; import de.steamwar.bausystem.features.tracer.rendering.ViewFlag; import java.util.HashSet; -import java.util.List; import java.util.Set; -import java.util.stream.Collectors; +import java.util.stream.Stream; /** * A flag for rendering only the records of specific tnts @@ -53,10 +52,8 @@ public class IsolateFlag extends ViewFlag { } @Override - public List filter(List records) { + public Stream filter(Stream records) { if (tntToIsolate.isEmpty()) return records; - return records.stream() - .filter(record -> tntToIsolate.contains(record.getTntId())) - .collect(Collectors.toList()); + return records.filter(record -> tntToIsolate.contains(record.getTntId())); } } -- 2.39.5 From 5595f3177ccb34ac958ccbd83902108a8fbfd98d Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 21 Apr 2024 15:55:26 +0200 Subject: [PATCH 110/111] Remove redundancy in data storage --- .../features/tracer/TraceManager.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index b4715b79..d735fe8d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -33,6 +33,7 @@ import org.bukkit.event.player.PlayerQuitEvent; import java.io.File; import java.util.*; +import java.util.stream.Collectors; @Linked public class TraceManager implements Listener { @@ -64,8 +65,6 @@ public class TraceManager implements Listener { /** * List of all current traces */ - private final Map traces = new HashMap<>(); - private final Map> tracesByRegion = new HashMap<>(); private final Map> showDataPerRegionPerPlayer = new HashMap<>(); @@ -91,7 +90,6 @@ public class TraceManager implements Listener { }); }); - traces.put(nextOpenId, trace); tracesByRegion.computeIfAbsent(trace.getRegion(), region -> new HashMap<>()).put(nextOpenId, trace); nextOpenId++; return nextOpenId; @@ -103,7 +101,7 @@ public class TraceManager implements Listener { * @param trace */ public int getId(Trace trace) { - for (Map.Entry entry : traces.entrySet()) { + for (Map.Entry entry : tracesByRegion.getOrDefault(trace.getRegion(), Collections.emptyMap()).entrySet()) { if (entry.getValue() == trace) return entry.getKey(); } return -1; @@ -134,6 +132,7 @@ public class TraceManager implements Listener { * @param trace the trace to be removed */ public boolean remove(Trace trace) { + Map traces = tracesByRegion.getOrDefault(trace.getRegion(), Collections.emptyMap()); Integer traceId = traces.entrySet().stream() .filter(entry -> entry.getValue() == trace) .map(Map.Entry::getKey) @@ -141,7 +140,6 @@ public class TraceManager implements Listener { .orElse(null); if (traceId == null) return false; traces.remove(traceId); - tracesByRegion.getOrDefault(trace.getRegion(), Collections.emptyMap()).remove(traceId); trace.hide(); return true; } @@ -154,7 +152,7 @@ public class TraceManager implements Listener { .keySet() .forEach(player -> { Set players = followerMap.getOrDefault(player, Collections.emptySet()); - traces.values().forEach(trace -> { + tracesByRegion.get(region).values().forEach(trace -> { trace.hide(player); players.forEach(trace::hide); }); @@ -162,7 +160,6 @@ public class TraceManager implements Listener { tracesByRegion.getOrDefault(region, new HashMap<>()) .forEach((i, trace) -> { if (trace.getRegion() != region) return; - traces.remove(i); trace.getMetadataSaveFile().delete(); trace.getRecordsSaveFile().delete(); }); @@ -186,7 +183,12 @@ public class TraceManager implements Listener { * @return the trace with given id */ public Optional get(int index) { - return Optional.ofNullable(traces.get(index)); + for (Map.Entry> intermediate : tracesByRegion.entrySet()) { + if (intermediate.getValue().containsKey(index)) { + return Optional.ofNullable(intermediate.getValue().get(index)); + } + } + return Optional.empty(); } /** @@ -195,14 +197,14 @@ public class TraceManager implements Listener { * @return internal list of all current traces */ public Collection getAll() { - return traces.values(); + return tracesByRegion.values().stream().map(Map::values).flatMap(Collection::stream).collect(Collectors.toList()); } /** * @return all ids of active traces */ public Set getAllIds() { - return traces.keySet(); + return tracesByRegion.values().stream().map(Map::keySet).flatMap(Collection::stream).collect(Collectors.toSet()); } /** -- 2.39.5 From 7e96d1c846fb83fc13bd1796b4e29d219d1d68eb Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 21 Apr 2024 16:00:34 +0200 Subject: [PATCH 111/111] Fix TraceRecordingWrapper.startTick --- .../bausystem/features/tracer/TraceRecordingWrapper.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java index 48f00569..783cec84 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRecordingWrapper.java @@ -32,7 +32,6 @@ import java.util.ArrayList; import java.util.List; import java.util.zip.GZIPOutputStream; -//TODO Rename ? public class TraceRecordingWrapper { @Getter @@ -49,7 +48,7 @@ public class TraceRecordingWrapper { @SneakyThrows public TraceRecordingWrapper(Region region) { - startTick = TPSUtils.currentTick.get(); + startTick = TPSUtils.currentRealTick.get(); recordsToAdd = new ArrayList<>(); recordList = new ArrayList<>(); -- 2.39.5