Integrated TraceRecorder with Simulator
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
Signed-off-by: D4rkr34lm <darth.m.frohn@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
e64c50b566
Commit
3755395eab
@ -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<Simulator> currentlyRunning = new HashSet<>();
|
||||
private static Map<Long, Map<Integer, List<SimulatorAction>>> tickStartActions = new HashMap<>();
|
||||
private static Map<Long, List<SimulatorAction>> 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;
|
||||
|
@ -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")
|
||||
|
@ -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<Region> autoTraceRegions = new HashSet<>();
|
||||
|
||||
public Recorder() {
|
||||
public TraceRecorder() {
|
||||
BauSystem.runTaskTimer(BauSystem.getInstance(), () -> {
|
||||
record();
|
||||
checkForAutoTraceFinish();
|
In neuem Issue referenzieren
Einen Benutzer sperren