Trace Refactor #233
@ -489,9 +489,7 @@ TPSLIMIT_FROZEN = §eTPS frozen
|
|||||||
TRACE_RECORD=§aon
|
TRACE_RECORD=§aon
|
||||||
TRACE_HAS_TRACES=§ehas Traces
|
TRACE_HAS_TRACES=§ehas Traces
|
||||||
TRACE_IDLE_SINGLE=§esingle
|
TRACE_IDLE_SINGLE=§esingle
|
||||||
TRACE_IDLE_AUTO_EXPLODE=§eauto §8(§7explode§8)
|
TRACE_IDLE_AUTO_IGNITE=§eauto
|
||||||
TRACE_IDLE_AUTO_IGNITE=§eauto §8(§7ignite§8)
|
|
||||||
TRACE_MESSAGE_AUTO_IDLE_EXPLODE = §aAuto-Tracer explode started
|
|
||||||
TRACE_MESSAGE_AUTO_IDLE_IGNITE = §aAuto-Tracer ignite started
|
TRACE_MESSAGE_AUTO_IDLE_IGNITE = §aAuto-Tracer ignite started
|
||||||
TRACE_MESSAGE_AUTO_DELETE_INVALID = §cAuto delete cannot be used currently
|
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_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_DELETE = §cAll TNT-positions deleted
|
||||||
TRACE_MESSAGE_SHOW = §aAll TNT-positions shown
|
TRACE_MESSAGE_SHOW = §aAll TNT-positions shown
|
||||||
TRACE_MESSAGE_HIDE = §cAll TNT-positions hidden
|
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_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_AT = §aTNT-positions shown with {0} at {1}
|
||||||
TRACE_MESSAGE_SHOW_FROM = §aAll TNT-positions shown with {0} from {1}
|
TRACE_MESSAGE_SHOW_FROM = §aAll TNT-positions shown with {0} from {1}
|
||||||
|
@ -460,7 +460,6 @@ TRACE_HAS_TRACES=§ehat Traces
|
|||||||
TRACE_IDLE_SINGLE=§esingle
|
TRACE_IDLE_SINGLE=§esingle
|
||||||
TRACE_IDLE_AUTO_EXPLODE=§eauto §8(§7explode§8)
|
TRACE_IDLE_AUTO_EXPLODE=§eauto §8(§7explode§8)
|
||||||
TRACE_IDLE_AUTO_IGNITE=§eauto §8(§7ignite§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_IDLE_IGNITE = §aAuto-Tracer ignite gestartet
|
||||||
TRACE_MESSAGE_AUTO_DELETE_INVALID = §cAuto delete kann aktuell nicht genutzt werden
|
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_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_DELETE = §cAlle TNT-Positionen gelöscht
|
||||||
TRACE_MESSAGE_SHOW = §aAlle TNT-Positionen angezeigt
|
TRACE_MESSAGE_SHOW = §aAlle TNT-Positionen angezeigt
|
||||||
TRACE_MESSAGE_HIDE = §cAlle TNT-Positionen ausgeblendet
|
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_DISALLOWED = §cDu darfst hier nicht den TNT-Tracer nutzen
|
||||||
TRACE_MESSAGE_SHOW_AT = §aTNT-positions angezeigt mit {0} bei {1}
|
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 = §aAll TNT-positions angezeigt mit {0} von {1}
|
||||||
|
@ -225,7 +225,7 @@ public class TNTSimulator {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (needsAutoTrace.get()) {
|
if (needsAutoTrace.get()) {
|
||||||
Recorder.INSTANCE.set(region, new SingleTraceRecorder(region));
|
Recorder.INSTANCE.set(region, new SingleTraceRecorder());
|
||||||
}
|
}
|
||||||
|
|
||||||
AtomicInteger maxTick = new AtomicInteger(0);
|
AtomicInteger maxTick = new AtomicInteger(0);
|
||||||
|
@ -86,7 +86,7 @@ public class ProcessingTracesState implements LaufbauState {
|
|||||||
} else {
|
} else {
|
||||||
Vector movement = location.clone().subtract(previousLocation);
|
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));
|
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(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));
|
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 {
|
} else {
|
||||||
|
@ -26,6 +26,8 @@ import lombok.Setter;
|
|||||||
import org.bukkit.entity.TNTPrimed;
|
import org.bukkit.entity.TNTPrimed;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import java.lang.instrument.Instrumentation;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public class TNTPosition extends Position {
|
public class TNTPosition extends Position {
|
||||||
|
|
||||||
@ -34,21 +36,21 @@ public class TNTPosition extends Position {
|
|||||||
private final long timeTicks;
|
private final long timeTicks;
|
||||||
private final Vector previousLocation;
|
private final Vector previousLocation;
|
||||||
private final Vector velocity;
|
private final Vector velocity;
|
||||||
private final Vector updateVelocity;
|
private final UpdateOrder updateOrder;
|
||||||
private final boolean source;
|
private final boolean source;
|
||||||
private final boolean exploded;
|
private final boolean exploded;
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
private boolean microMotion;
|
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());
|
super(entity.getLocation().toVector());
|
||||||
this.record = record;
|
this.record = record;
|
||||||
this.fuseTicks = entity.getFuseTicks();
|
this.fuseTicks = entity.getFuseTicks();
|
||||||
this.timeTicks = timeTicks;
|
this.timeTicks = timeTicks;
|
||||||
this.previousLocation = previousLocation;
|
this.previousLocation = previousLocation;
|
||||||
this.velocity = velocity;
|
this.velocity = velocity;
|
||||||
this.updateVelocity = updateVelocity;
|
this.updateOrder = updateOrder;
|
||||||
this.source = source;
|
this.source = source;
|
||||||
this.exploded = exploded;
|
this.exploded = exploded;
|
||||||
}
|
}
|
||||||
@ -59,4 +61,16 @@ public class TNTPosition extends Position {
|
|||||||
"location=" + super.getLocation() +
|
"location=" + super.getLocation() +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum UpdateOrder {
|
||||||
|
/**
|
||||||
|
* X is Bigger so comes later
|
||||||
|
*/
|
||||||
|
X,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Z is Bigger so comes later
|
||||||
|
*/
|
||||||
|
Z
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,11 @@ import de.steamwar.bausystem.BauSystem;
|
|||||||
import de.steamwar.bausystem.Permission;
|
import de.steamwar.bausystem.Permission;
|
||||||
import de.steamwar.bausystem.features.tracer.record.*;
|
import de.steamwar.bausystem.features.tracer.record.*;
|
||||||
import de.steamwar.bausystem.features.tracer.show.*;
|
import de.steamwar.bausystem.features.tracer.show.*;
|
||||||
|
import de.steamwar.bausystem.region.GlobalRegion;
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.bausystem.shared.ShowMode;
|
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.PreviousArguments;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.command.TypeMapper;
|
import de.steamwar.command.TypeMapper;
|
||||||
@ -32,6 +35,8 @@ import de.steamwar.command.TypeValidator;
|
|||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.LinkedInstance;
|
import de.steamwar.linkage.LinkedInstance;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.boss.BossBar;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -60,7 +65,7 @@ public class TraceCommand extends SWCommand {
|
|||||||
@Register(value = {"single"}, description = "TRACE_COMMAND_HELP_SINGLE")
|
@Register(value = {"single"}, description = "TRACE_COMMAND_HELP_SINGLE")
|
||||||
public void singleCommand(@Validator Player p) {
|
public void singleCommand(@Validator Player p) {
|
||||||
Region region = Region.getRegion(p.getLocation());
|
Region region = Region.getRegion(p.getLocation());
|
||||||
recorder.set(region, new SingleTraceRecorder(region));
|
recorder.set(region, new SingleTraceRecorder());
|
||||||
BauSystem.MESSAGE.send("TRACE_MESSAGE_SINGLE", p);
|
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(value = {"auto"}, description = "TRACE_COMMAND_HELP_AUTO")
|
||||||
@Register({"toggleauto"})
|
@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());
|
Region region = Region.getRegion(p.getLocation());
|
||||||
switch (type) {
|
recorder.set(region, new AutoIgniteTraceRecorder());
|
||||||
case "-explode":
|
BauSystem.MESSAGE.send("TRACE_MESSAGE_AUTO_IDLE_IGNITE", p);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register(value = {"autoremove"}, description = "TRACE_COMMAND_HELP_AUTO_REMOVE")
|
@Register(value = {"autoremove"}, description = "TRACE_COMMAND_HELP_AUTO_REMOVE")
|
||||||
@ -165,7 +160,7 @@ public class TraceCommand extends SWCommand {
|
|||||||
// /trace show at 0
|
// /trace show at 0
|
||||||
// /trace show raw -auto at 0
|
// /trace show raw -auto at 0
|
||||||
@Register(value = {"show"}, description = "TRACE_COMMAND_HELP_SHOW")
|
@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());
|
Region region = Region.getRegion(p.getLocation());
|
||||||
ShowModeParameter showModeParameter = new ShowModeParameter();
|
ShowModeParameter showModeParameter = new ShowModeParameter();
|
||||||
if (region.getWaterLevel() != 0) { // Enable Water by default for regions with WaterLevel e.g. WarShip
|
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);
|
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);
|
BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW", p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,14 +191,6 @@ public class TraceCommand extends SWCommand {
|
|||||||
BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE", p);
|
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<Player, ShowModeParameter, ShowMode<TNTPosition>> showModeBiFunction;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ClassMapper(value = ShowModeParameterType.class, local = true)
|
@ClassMapper(value = ShowModeParameterType.class, local = true)
|
||||||
public TypeMapper<ShowModeParameterType> showModeParameterTypesTypeMapper() {
|
public TypeMapper<ShowModeParameterType> showModeParameterTypesTypeMapper() {
|
||||||
Map<ShowModeParameterType, List<String>> showModeParameterTypeListMap = new EnumMap<>(ShowModeParameterType.class);
|
Map<ShowModeParameterType, List<String>> showModeParameterTypeListMap = new EnumMap<>(ShowModeParameterType.class);
|
||||||
|
@ -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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
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";
|
|
||||||
}
|
|
||||||
}
|
|
@ -26,11 +26,6 @@ public class AutoIgniteTraceRecorder extends AutoTraceRecorder implements Active
|
|||||||
return "TRACE_IDLE_AUTO_IGNITE";
|
return "TRACE_IDLE_AUTO_IGNITE";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean shouldStartRecording(StartType startType) {
|
|
||||||
return startType == StartType.IGNITE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getScriptState() {
|
protected String getScriptState() {
|
||||||
return "IDLE_AUTO_IGNITE";
|
return "IDLE_AUTO_IGNITE";
|
||||||
|
@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.tracer.record;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
|
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.Record;
|
||||||
import de.steamwar.bausystem.features.tracer.show.StoredRecords;
|
import de.steamwar.bausystem.features.tracer.show.StoredRecords;
|
||||||
import de.steamwar.bausystem.features.tracer.show.TraceShowManager;
|
import de.steamwar.bausystem.features.tracer.show.TraceShowManager;
|
||||||
@ -38,12 +39,11 @@ public abstract class AutoTraceRecorder implements TraceRecorder {
|
|||||||
|
|
||||||
protected boolean recording = false;
|
protected boolean recording = false;
|
||||||
private long startTime = TPSUtils.currentRealTick.get();
|
private long startTime = TPSUtils.currentRealTick.get();
|
||||||
private long lastExplosion = 0;
|
|
||||||
|
|
||||||
private final Map<TNTPrimed, Record.TNTRecord> recordMap = new HashMap<>();
|
private final Map<TNTPrimed, Record.TNTRecord> recordMap = new HashMap<>();
|
||||||
private Record record;
|
private Record record;
|
||||||
|
|
||||||
private Region region;
|
protected Region region;
|
||||||
private Supplier<Record> recordSupplier;
|
private Supplier<Record> recordSupplier;
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
@ -56,7 +56,6 @@ public abstract class AutoTraceRecorder implements TraceRecorder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected abstract String getInactivityMessage();
|
protected abstract String getInactivityMessage();
|
||||||
protected abstract boolean shouldStartRecording(StartType startType);
|
|
||||||
protected void stoppedRecording() {
|
protected void stoppedRecording() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +73,6 @@ public abstract class AutoTraceRecorder implements TraceRecorder {
|
|||||||
StoredRecords.remove(region, lastRecord);
|
StoredRecords.remove(region, lastRecord);
|
||||||
TraceShowManager.reshow(region);
|
TraceShowManager.reshow(region);
|
||||||
}
|
}
|
||||||
lastExplosion = 0;
|
|
||||||
startTime = TPSUtils.currentRealTick.get();
|
startTime = TPSUtils.currentRealTick.get();
|
||||||
record = recordSupplier.get();
|
record = recordSupplier.get();
|
||||||
recording = true;
|
recording = true;
|
||||||
@ -94,12 +92,10 @@ public abstract class AutoTraceRecorder implements TraceRecorder {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void spawn(TNTPrimed tntPrimed) {
|
public final void spawn(TNTPrimed tntPrimed) {
|
||||||
if (!recording && shouldStartRecording(StartType.IGNITE)) {
|
if (!recording) {
|
||||||
startRecording();
|
startRecording();
|
||||||
}
|
}
|
||||||
if (recording) {
|
getRecord(tntPrimed).source(tntPrimed);
|
||||||
getRecord(tntPrimed).source(tntPrimed);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -111,35 +107,22 @@ public abstract class AutoTraceRecorder implements TraceRecorder {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void explode(TNTPrimed tntPrimed, boolean inBuildRegion, boolean inTestblockRegion) {
|
public final void explode(TNTPrimed tntPrimed, boolean inBuildRegion, boolean inTestblockRegion) {
|
||||||
if (!recording && shouldStartRecording(StartType.EXPLODE)) {
|
|
||||||
startRecording();
|
|
||||||
}
|
|
||||||
if (recording) {
|
if (recording) {
|
||||||
Record.TNTRecord tntRecord = getRecord(tntPrimed);
|
Record.TNTRecord tntRecord = getRecord(tntPrimed);
|
||||||
if (inBuildRegion) tntRecord.setInBuildArea(true);
|
if (inBuildRegion) tntRecord.setInBuildArea(true);
|
||||||
if (inTestblockRegion) tntRecord.setInTestblockArea(true);
|
if (inTestblockRegion) tntRecord.setInTestblockArea(true);
|
||||||
tntRecord.explode(tntPrimed);
|
tntRecord.explode(tntPrimed);
|
||||||
}
|
recordMap.remove(tntPrimed);
|
||||||
lastExplosion = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
if (recordMap.isEmpty() || recordMap.keySet().stream().allMatch(TNTPrimed::isDead)) {
|
||||||
public final void tick() {
|
recording = false;
|
||||||
lastExplosion++;
|
lastRecord = record;
|
||||||
if (recording && lastExplosion > 80) {
|
record = null;
|
||||||
recording = false;
|
stoppedRecording();
|
||||||
recordMap.clear();
|
}
|
||||||
lastRecord = record;
|
|
||||||
record = null;
|
|
||||||
stoppedRecording();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected enum StartType {
|
|
||||||
IGNITE,
|
|
||||||
EXPLODE
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract String getScriptState();
|
protected abstract String getScriptState();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -35,7 +35,6 @@ import org.bukkit.event.Listener;
|
|||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -99,7 +98,7 @@ public class Recorder implements Listener {
|
|||||||
});
|
});
|
||||||
tntTraceRecorderMap.forEach((tntPrimed, rg) -> {
|
tntTraceRecorderMap.forEach((tntPrimed, rg) -> {
|
||||||
if (rg == region) {
|
if (rg == region) {
|
||||||
traceRecorder.spawn(tntPrimed);
|
traceRecorder.tick(tntPrimed);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -129,7 +128,6 @@ public class Recorder implements Listener {
|
|||||||
.filter(e -> !e.isValid())
|
.filter(e -> !e.isValid())
|
||||||
.collect(Collectors.toList())
|
.collect(Collectors.toList())
|
||||||
.forEach(tntTraceRecorderMap::remove);
|
.forEach(tntTraceRecorderMap::remove);
|
||||||
new ArrayList<>(regionTraceRecorderMap.values()).forEach(TraceRecorder::tick);
|
|
||||||
}, 1, 1);
|
}, 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));
|
boolean inTestblockRegion = event.blockList().stream().anyMatch(block -> region.inRegion(block.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.EXTENSION));
|
||||||
traceRecorder.explode((TNTPrimed) entity, inBuildRegion, inTestblockRegion);
|
traceRecorder.explode((TNTPrimed) entity, inBuildRegion, inTestblockRegion);
|
||||||
tntTraceRecorderMap.remove(entity);
|
tntTraceRecorderMap.remove(entity);
|
||||||
tick();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,26 +19,13 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.tracer.record;
|
package de.steamwar.bausystem.features.tracer.record;
|
||||||
|
|
||||||
import de.steamwar.bausystem.region.Region;
|
|
||||||
|
|
||||||
public class SingleTraceRecorder extends AutoTraceRecorder {
|
public class SingleTraceRecorder extends AutoTraceRecorder {
|
||||||
|
|
||||||
private Region region;
|
|
||||||
|
|
||||||
public SingleTraceRecorder(Region region) {
|
|
||||||
this.region = region;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getInactivityMessage() {
|
protected String getInactivityMessage() {
|
||||||
return "TRACE_IDLE_SINGLE";
|
return "TRACE_IDLE_SINGLE";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean shouldStartRecording(StartType startType) {
|
|
||||||
return startType == StartType.EXPLODE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void stoppedRecording() {
|
protected void stoppedRecording() {
|
||||||
Recorder.INSTANCE.remove(region);
|
Recorder.INSTANCE.remove(region);
|
||||||
|
@ -36,8 +36,6 @@ public interface TraceRecorder {
|
|||||||
void spawn(TNTPrimed tntPrimed);
|
void spawn(TNTPrimed tntPrimed);
|
||||||
void tick(TNTPrimed tntPrimed);
|
void tick(TNTPrimed tntPrimed);
|
||||||
void explode(TNTPrimed tntPrimed, boolean inBuildRegion, boolean inTestblockRegion);
|
void explode(TNTPrimed tntPrimed, boolean inBuildRegion, boolean inTestblockRegion);
|
||||||
default void tick() {
|
|
||||||
}
|
|
||||||
|
|
||||||
String scriptState();
|
String scriptState();
|
||||||
long scriptTime();
|
long scriptTime();
|
||||||
|
@ -34,6 +34,7 @@ import org.bukkit.util.Vector;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
public class EntityShowMode implements ShowMode<TNTPosition> {
|
public class EntityShowMode implements ShowMode<TNTPosition> {
|
||||||
@ -75,7 +76,6 @@ public class EntityShowMode implements ShowMode<TNTPosition> {
|
|||||||
BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_X", player, tntPosition.getVelocity().getX() + "");
|
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_Y", player, tntPosition.getVelocity().getY() + "");
|
||||||
BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_Z", player, tntPosition.getVelocity().getZ() + "");
|
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);
|
entityServer.addPlayer(player);
|
||||||
}
|
}
|
||||||
@ -219,10 +219,31 @@ public class EntityShowMode implements ShowMode<TNTPosition> {
|
|||||||
entity = createEntity(position, positionType);
|
entity = createEntity(position, positionType);
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
|
int nameShows = 0;
|
||||||
|
if (showModeParameter.isFuse()) nameShows++;
|
||||||
|
if (showModeParameter.isCount()) nameShows++;
|
||||||
|
if (showModeParameter.isEntityId()) nameShows++;
|
||||||
|
if (showModeParameter.isCalculationOrder()) nameShows++;
|
||||||
|
|
||||||
|
List<String> toShow = new ArrayList<>();
|
||||||
if (showModeParameter.isFuse()) {
|
if (showModeParameter.isFuse()) {
|
||||||
entity.setDisplayName(fuseTicks + "");
|
toShow.add((nameShows > 1 ? "F:" : "") + fuseTicks);
|
||||||
} else if (showModeParameter.isCount()) {
|
}
|
||||||
entity.setDisplayName(new HashSet<>(records).size() + "");
|
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<TNTPosition> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (interpolateXZ) {
|
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().setZ(position.getPreviousLocation().getZ())
|
||||||
: position.getLocation().clone().setX(position.getPreviousLocation().getX());
|
: position.getLocation().clone().setX(position.getPreviousLocation().getX());
|
||||||
if (!position.getLocation().equals(updatePointXZ)) {
|
if (!position.getLocation().equals(updatePointXZ)) {
|
||||||
|
@ -31,7 +31,6 @@ import org.bukkit.util.Vector;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class Record {
|
public class Record {
|
||||||
@ -81,7 +80,7 @@ public class Record {
|
|||||||
public static class TNTRecord {
|
public static class TNTRecord {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final UUID id = UUID.randomUUID();
|
private int entityId;
|
||||||
|
|
||||||
private Record record;
|
private Record record;
|
||||||
|
|
||||||
@ -89,7 +88,7 @@ public class Record {
|
|||||||
private final Region region;
|
private final Region region;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final List<TNTPosition> positions = new ArrayList<>(82);
|
private final List<TNTPosition> positions = new ArrayList<>();
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@ -121,13 +120,16 @@ public class Record {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void add(TNTPrimed tntPrimed, boolean source, boolean exploded) {
|
private void add(TNTPrimed tntPrimed, boolean source, boolean exploded) {
|
||||||
|
entityId = tntPrimed.getEntityId();
|
||||||
|
|
||||||
TNTPosition position;
|
TNTPosition position;
|
||||||
if (positions.isEmpty()) {
|
if (positions.isEmpty()) {
|
||||||
position = new TNTPosition(this, tntPrimed, TPSUtils.currentTick.get() - record.startTicks, null, tntPrimed.getVelocity(), null, source, exploded);
|
position = new TNTPosition(this, tntPrimed, TPSUtils.currentTick.get() - record.startTicks, null, tntPrimed.getVelocity(), null, source, exploded);
|
||||||
} else {
|
} else {
|
||||||
TNTPosition tntPosition = positions.get(positions.size() - 1);
|
TNTPosition tntPosition = positions.get(positions.size() - 1);
|
||||||
Vector lastVelocity = tntPrimed.getLocation().toVector().clone().subtract(tntPosition.getLocation());
|
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);
|
positions.add(position);
|
||||||
TraceShowManager.show(region, position);
|
TraceShowManager.show(region, position);
|
||||||
|
@ -34,6 +34,8 @@ public class ShowModeParameter {
|
|||||||
private boolean testblockDestroyOnly = false;
|
private boolean testblockDestroyOnly = false;
|
||||||
private boolean microMotion = false;
|
private boolean microMotion = false;
|
||||||
private boolean microMotionLocation = false;
|
private boolean microMotionLocation = false;
|
||||||
|
private boolean entityId = false;
|
||||||
|
private boolean calculationOrder = false;
|
||||||
|
|
||||||
public void enableWater() {
|
public void enableWater() {
|
||||||
this.water = true;
|
this.water = true;
|
||||||
@ -82,4 +84,12 @@ public class ShowModeParameter {
|
|||||||
public void enableMicroMotionLocation() {
|
public void enableMicroMotionLocation() {
|
||||||
this.microMotionLocation = true;
|
this.microMotionLocation = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void enableEntityId() {
|
||||||
|
entityId = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void enableCalculationOrder() {
|
||||||
|
calculationOrder = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,12 +38,14 @@ public enum ShowModeParameterType {
|
|||||||
}, Arrays.asList("-advanced", "-a"), "INTERPOLATE_Y", "INTERPOLATE_XZ"),
|
}, Arrays.asList("-advanced", "-a"), "INTERPOLATE_Y", "INTERPOLATE_XZ"),
|
||||||
SOURCE(ShowModeParameter::enableSourceOnly, Arrays.asList("-source", "-sourceonly", "-ignite"), "FUSE", "ADVANCED", "INTERPOLATE_Y", "INTERPOLATE_XZ", "WATER"),
|
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"),
|
EXPLODE(ShowModeParameter::enableExplodeOnly, Arrays.asList("-explode", "-explodeonly"), "FUSE", "ADVANCED", "INTERPOLATE_Y", "INTERPOLATE_XZ", "WATER"),
|
||||||
FUSE(ShowModeParameter::enableFuse, Arrays.asList("-fuse", "-f"), "EXPLODE", "SOURCE", "COUNT"),
|
FUSE(ShowModeParameter::enableFuse, Arrays.asList("-fuse", "-f"), "EXPLODE", "SOURCE"),
|
||||||
COUNT(ShowModeParameter::enableCount, Arrays.asList("-count", "-c"), "FUSE"),
|
COUNT(ShowModeParameter::enableCount, Arrays.asList("-count", "-c")),
|
||||||
BUILD_DESTROY_ONLY(ShowModeParameter::enableBuildDestroyOnly, Arrays.asList("-builddestroy", "-builddestoryonly"), "WATER", "TESTBLOCK_DESTROY_ONLY"),
|
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"),
|
TESTBLOCK_DESTROY_ONLY(ShowModeParameter::enableTestblockDestroyOnly, Arrays.asList("-testblockdestroy", "-testblockdestroyonly"), "WATER", "BUILD_DESTROY_ONLY"),
|
||||||
MICROMOTION(ShowModeParameter::enableMicroMotion, Arrays.asList("-micromotion", "-micro", "-m")),
|
MICROMOTION(ShowModeParameter::enableMicroMotion, Arrays.asList("-micromotion", "-micro", "-m")),
|
||||||
MICROMOTION_LOCATION(ShowModeParameter::enableMicroMotionLocation, Arrays.asList("-micromotionloc", "-microloc", "-mloc", "-micromotionlocation", "-microlocation", "-mlocation")),
|
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
|
@Getter
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren