Add SingleTraceRecorder
Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
399c86aa6d
Commit
ad8cd86338
@ -682,6 +682,7 @@ TPSLIMIT_INVALID_FROZEN = §c and '0'
|
|||||||
# Trace
|
# Trace
|
||||||
TRACE_RECORD=§aon
|
TRACE_RECORD=§aon
|
||||||
TRACE_IDLE=§coff
|
TRACE_IDLE=§coff
|
||||||
|
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 started
|
TRACE_MESSAGE_AUTO_IDLE_EXPLODE = §aAuto-Tracer explode started
|
||||||
|
@ -662,6 +662,7 @@ TPSLIMIT_INVALID_FROZEN = §c und '0'
|
|||||||
# Trace
|
# Trace
|
||||||
TRACE_RECORD=§aan
|
TRACE_RECORD=§aan
|
||||||
TRACE_IDLE=§caus
|
TRACE_IDLE=§caus
|
||||||
|
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_EXPLODE = §aAuto-Tracer explode gestartet
|
||||||
|
@ -27,8 +27,8 @@ import de.steamwar.bausystem.features.simulator.show.SimulatorEntityShowMode;
|
|||||||
import de.steamwar.bausystem.features.simulator.tnt.SimulatorElement;
|
import de.steamwar.bausystem.features.simulator.tnt.SimulatorElement;
|
||||||
import de.steamwar.bausystem.features.simulator.tnt.TNTElement;
|
import de.steamwar.bausystem.features.simulator.tnt.TNTElement;
|
||||||
import de.steamwar.bausystem.features.simulator.tnt.TNTGroup;
|
import de.steamwar.bausystem.features.simulator.tnt.TNTGroup;
|
||||||
import de.steamwar.bausystem.features.tracer.record.AutoExplodeTraceRecorder;
|
|
||||||
import de.steamwar.bausystem.features.tracer.record.Recorder;
|
import de.steamwar.bausystem.features.tracer.record.Recorder;
|
||||||
|
import de.steamwar.bausystem.features.tracer.record.SingleTraceRecorder;
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.bausystem.shared.Pair;
|
import de.steamwar.bausystem.shared.Pair;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@ -238,7 +238,7 @@ public class TNTSimulator {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (needsAutoTrace.get()) {
|
if (needsAutoTrace.get()) {
|
||||||
Recorder.INSTANCE.set(region, new AutoExplodeTraceRecorder());
|
Recorder.INSTANCE.set(region, new SingleTraceRecorder(region));
|
||||||
}
|
}
|
||||||
|
|
||||||
AtomicInteger maxTick = new AtomicInteger(0);
|
AtomicInteger maxTick = new AtomicInteger(0);
|
||||||
|
@ -22,10 +22,7 @@ package de.steamwar.bausystem.features.tracer;
|
|||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.Permission;
|
import de.steamwar.bausystem.Permission;
|
||||||
import de.steamwar.bausystem.features.tracer.gui.TraceGui;
|
import de.steamwar.bausystem.features.tracer.gui.TraceGui;
|
||||||
import de.steamwar.bausystem.features.tracer.record.AutoExplodeTraceRecorder;
|
import de.steamwar.bausystem.features.tracer.record.*;
|
||||||
import de.steamwar.bausystem.features.tracer.record.AutoIgniteTraceRecorder;
|
|
||||||
import de.steamwar.bausystem.features.tracer.record.Recorder;
|
|
||||||
import de.steamwar.bausystem.features.tracer.record.SimpleTraceRecorder;
|
|
||||||
import de.steamwar.bausystem.features.tracer.show.ShowModeParameter;
|
import de.steamwar.bausystem.features.tracer.show.ShowModeParameter;
|
||||||
import de.steamwar.bausystem.features.tracer.show.ShowModeParameterType;
|
import de.steamwar.bausystem.features.tracer.show.ShowModeParameterType;
|
||||||
import de.steamwar.bausystem.features.tracer.show.StoredRecords;
|
import de.steamwar.bausystem.features.tracer.show.StoredRecords;
|
||||||
@ -65,6 +62,13 @@ public class TraceCommand extends SWCommand {
|
|||||||
BauSystem.MESSAGE.send("TRACE_MESSAGE_START", p);
|
BauSystem.MESSAGE.send("TRACE_MESSAGE_START", p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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));
|
||||||
|
BauSystem.MESSAGE.send("TRACE_MESSAGE_SINGLE", p);
|
||||||
|
}
|
||||||
|
|
||||||
@Register(value = {"stop"}, description = "TRACE_COMMAND_HELP_STOP")
|
@Register(value = {"stop"}, description = "TRACE_COMMAND_HELP_STOP")
|
||||||
public void stopCommand(@Validator Player p) {
|
public void stopCommand(@Validator Player p) {
|
||||||
Region region = Region.getRegion(p.getLocation());
|
Region region = Region.getRegion(p.getLocation());
|
||||||
|
@ -45,6 +45,8 @@ public abstract class AutoTraceRecorder implements TraceRecorder {
|
|||||||
|
|
||||||
protected abstract String getInactivityMessage();
|
protected abstract String getInactivityMessage();
|
||||||
protected abstract boolean shouldStartRecording(StartType startType);
|
protected abstract boolean shouldStartRecording(StartType startType);
|
||||||
|
protected void stoppedRecording() {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final String scoreboard(Player player) {
|
public final String scoreboard(Player player) {
|
||||||
@ -108,6 +110,7 @@ public abstract class AutoTraceRecorder implements TraceRecorder {
|
|||||||
recording = false;
|
recording = false;
|
||||||
recordMap.clear();
|
recordMap.clear();
|
||||||
record = null;
|
record = null;
|
||||||
|
stoppedRecording();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
In neuem Issue referenzieren
Einen Benutzer sperren