Commits vergleichen
2 Commits
163967483f
...
7a9a2283a9
Autor | SHA1 | Datum | |
---|---|---|---|
|
7a9a2283a9 | ||
|
d5d8c52862 |
@ -179,8 +179,13 @@ public class TNTPoint implements Externalizable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "TNTRecord{" +
|
return "TNTPoint{" +
|
||||||
"explosion=" + explosion +
|
"tntId=" + tntId +
|
||||||
|
", explosion=" + explosion +
|
||||||
|
", inWater=" + inWater +
|
||||||
|
", afterFirstExplosion=" + afterFirstExplosion +
|
||||||
|
", destroyedBuildArea=" + destroyedBuildArea +
|
||||||
|
", destroyedTestBlock=" + destroyedTestBlock +
|
||||||
", ticksSinceStart=" + ticksSinceStart +
|
", ticksSinceStart=" + ticksSinceStart +
|
||||||
", fuse=" + fuse +
|
", fuse=" + fuse +
|
||||||
", location=" + location +
|
", location=" + location +
|
||||||
|
@ -279,8 +279,6 @@ public class Trace {
|
|||||||
records.add((TNTPoint) inputStream.readObject());
|
records.add((TNTPoint) inputStream.readObject());
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("Loaded... " + records);
|
|
||||||
|
|
||||||
Map<Integer, List<TNTPoint>> histories = new HashMap<>();
|
Map<Integer, List<TNTPoint>> histories = new HashMap<>();
|
||||||
for (TNTPoint record : records) {
|
for (TNTPoint record : records) {
|
||||||
int tntId = record.getTntId();
|
int tntId = record.getTntId();
|
||||||
|
@ -68,7 +68,7 @@ public class TraceCommand extends SWCommand {
|
|||||||
|
|
||||||
@Register(value = "show", description = "TRACE_COMMAND_HELP_SHOW")
|
@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("STRICT") BundleFilter bundleFilter, ViewFlag... flags) {
|
||||||
showInternal(player, 0, Integer.MAX_VALUE, bundleFilter, flags);
|
showInternal(player, bundleFilter, flags);
|
||||||
BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW", player);
|
BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW", player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,11 +95,6 @@ public class TraceCommand extends SWCommand {
|
|||||||
BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_FROM_TO", player, from, to);
|
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) {
|
public void showAt(@Validator Player player, @Min(intValue = 0) int time) {
|
||||||
@ -119,6 +114,17 @@ public class TraceCommand extends SWCommand {
|
|||||||
BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_FROM_TO", 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")
|
@Register(value = "hide", description = "TRACE_COMMAND_HELP_HIDE")
|
||||||
public void hide(@Validator Player player) {
|
public void hide(@Validator Player player) {
|
||||||
TraceManager.instance.hide(player);
|
TraceManager.instance.hide(player);
|
||||||
|
@ -202,8 +202,7 @@ public class TraceManager implements Listener {
|
|||||||
unfollow(player);
|
unfollow(player);
|
||||||
|
|
||||||
Region region = Region.getRegion(player.getLocation());
|
Region region = Region.getRegion(player.getLocation());
|
||||||
PlayerTraceShowData previous = showDataPerRegionPerPlayer.getOrDefault(region, Collections.emptyMap())
|
PlayerTraceShowData previous = showDataPerRegionPerPlayer.getOrDefault(region, Collections.emptyMap()).remove(player);
|
||||||
.remove(player);
|
|
||||||
if (previous == null) return;
|
if (previous == null) return;
|
||||||
tracesByRegion.getOrDefault(player, Collections.emptyMap()).forEach((integer, trace) -> {
|
tracesByRegion.getOrDefault(player, Collections.emptyMap()).forEach((integer, trace) -> {
|
||||||
trace.hide(player);
|
trace.hide(player);
|
||||||
@ -221,9 +220,7 @@ public class TraceManager implements Listener {
|
|||||||
|
|
||||||
showDataPerRegionPerPlayer.forEach((region, playerPlayerTraceShowDataMap) -> {
|
showDataPerRegionPerPlayer.forEach((region, playerPlayerTraceShowDataMap) -> {
|
||||||
if (playerPlayerTraceShowDataMap.containsKey(follower)) {
|
if (playerPlayerTraceShowDataMap.containsKey(follower)) {
|
||||||
tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> {
|
tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> trace.hide(follower));
|
||||||
trace.hide(follower);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerTraceShowData playerTraceShowData = playerPlayerTraceShowDataMap.get(following);
|
PlayerTraceShowData playerTraceShowData = playerPlayerTraceShowDataMap.get(following);
|
||||||
|
@ -168,8 +168,7 @@ public class TraceRecorder implements Listener {
|
|||||||
}
|
}
|
||||||
boolean afterFirstExplosion = wrappedTrace.isExplosionRecorded();
|
boolean afterFirstExplosion = wrappedTrace.isExplosionRecorded();
|
||||||
|
|
||||||
TNTPoint record = new TNTPoint(tntID, tntPrimed, isExplosion, afterFirstExplosion,
|
TNTPoint record = new TNTPoint(tntID, tntPrimed, isExplosion, afterFirstExplosion, TPSUtils.currentTick.get() - wrappedTrace.getStartTick(), history, destroyedBlocks);
|
||||||
TPSUtils.currentTick.get() - wrappedTrace.getStartTick(), history, destroyedBlocks);
|
|
||||||
history.add(record);
|
history.add(record);
|
||||||
|
|
||||||
return record;
|
return record;
|
||||||
@ -199,8 +198,7 @@ public class TraceRecorder implements Listener {
|
|||||||
|
|
||||||
trackedTNT.get(region).add((TNTPrimed) event.getEntity());
|
trackedTNT.get(region).add((TNTPrimed) event.getEntity());
|
||||||
tntSpawnRegion.put((TNTPrimed) event.getEntity(), region);
|
tntSpawnRegion.put((TNTPrimed) event.getEntity(), region);
|
||||||
activeTraces.get(region).addRecord(
|
activeTraces.get(region).addRecord(record((TNTPrimed) event.getEntity(), activeTraces.get(region), Collections.emptyList()));
|
||||||
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());
|
trackedTNT.get(region).remove((TNTPrimed) event.getEntity());
|
||||||
tntSpawnRegion.remove((TNTPrimed) event.getEntity());
|
tntSpawnRegion.remove((TNTPrimed) event.getEntity());
|
||||||
|
|
||||||
activeTraces.get(region)
|
activeTraces.get(region).addRecord(record((TNTPrimed) event.getEntity(), activeTraces.get(region), event.blockList()));
|
||||||
.addRecord(record((TNTPrimed) event.getEntity(), activeTraces.get(region), event.blockList()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ public class TraceRecordingWrapper {
|
|||||||
private final long startTick;
|
private final long startTick;
|
||||||
private final List<TNTPoint> recordsToAdd;
|
private final List<TNTPoint> recordsToAdd;
|
||||||
private final List<TNTPoint> recordList;
|
private final List<TNTPoint> recordList;
|
||||||
private ObjectOutputStream recordsOutputStream;
|
private final ObjectOutputStream recordsOutputStream;
|
||||||
private int nextOpenRecordId = 0;
|
private int nextOpenRecordId = 0;
|
||||||
@Getter
|
@Getter
|
||||||
private boolean explosionRecorded = false;
|
private boolean explosionRecorded = false;
|
||||||
|
@ -30,7 +30,7 @@ public class PlayerTraceShowData {
|
|||||||
@Setter
|
@Setter
|
||||||
private BundleFilter bundleFilter;
|
private BundleFilter bundleFilter;
|
||||||
|
|
||||||
private Map<Class<? extends ViewFlag>, ViewFlag> viewFlags = new HashMap<>();
|
private final Map<Class<? extends ViewFlag>, ViewFlag> viewFlags = new HashMap<>();
|
||||||
|
|
||||||
public PlayerTraceShowData(BundleFilter bundleFilter, ViewFlag... viewFlags) {
|
public PlayerTraceShowData(BundleFilter bundleFilter, ViewFlag... viewFlags) {
|
||||||
this.bundleFilter = bundleFilter;
|
this.bundleFilter = bundleFilter;
|
||||||
@ -49,6 +49,8 @@ public class PlayerTraceShowData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.out.println(flagList);
|
||||||
|
|
||||||
// Manage inverse flags
|
// Manage inverse flags
|
||||||
ViewFlag.inverseFlags.forEach(viewFlag -> {
|
ViewFlag.inverseFlags.forEach(viewFlag -> {
|
||||||
if (!flagList.remove(viewFlag)) {
|
if (!flagList.remove(viewFlag)) {
|
||||||
@ -56,6 +58,8 @@ public class PlayerTraceShowData {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
System.out.println(flagList);
|
||||||
|
|
||||||
return flagList;
|
return flagList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ public abstract class ViewFlag {
|
|||||||
@Override
|
@Override
|
||||||
public List<TNTPoint> filter(List<TNTPoint> records) {
|
public List<TNTPoint> filter(List<TNTPoint> records) {
|
||||||
return records.stream()
|
return records.stream()
|
||||||
.filter(record -> !record.isAfterFirstExplosion())
|
.filter(record -> record.isAfterFirstExplosion())
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren