Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
5abd29056b
Commit
451c47d3ed
@ -489,6 +489,13 @@ 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
|
||||||
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_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_START = §aTNT-Tracer started
|
||||||
TRACE_MESSAGE_SINGLE = §aSingle-Tracer started
|
TRACE_MESSAGE_SINGLE = §aSingle-Tracer started
|
||||||
TRACE_MESSAGE_STOP = §cTNT-Tracer stopped
|
TRACE_MESSAGE_STOP = §cTNT-Tracer stopped
|
||||||
@ -502,6 +509,7 @@ TRACE_COMMAND_HELP_START = §8/§etrace start §8- §7Starts recording of all TN
|
|||||||
TRACE_COMMAND_HELP_SINGLE = §8/§etrace single §8- §7Starts a single 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_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 = §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 = §8/§etrace show §8<§eParameter§8> - §7Shows all TNT-positions
|
||||||
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- §7Deletes all TNT-positions
|
TRACE_COMMAND_HELP_DELETE = §8/§etrace delete §8- §7Deletes all TNT-positions
|
||||||
|
@ -458,6 +458,13 @@ 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
|
||||||
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_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_START = §aTNT-Tracer gestartet
|
||||||
TRACE_MESSAGE_SINGLE = §aSingle-Tracer gestartet
|
TRACE_MESSAGE_SINGLE = §aSingle-Tracer gestartet
|
||||||
TRACE_MESSAGE_STOP = §cTNT-Tracer gestoppt
|
TRACE_MESSAGE_STOP = §cTNT-Tracer gestoppt
|
||||||
@ -471,6 +478,7 @@ TRACE_COMMAND_HELP_START = §8/§etrace start §8- §7Startet die Aufnahme aller
|
|||||||
TRACE_COMMAND_HELP_SINGLE = §8/§etrace single §8- §7Startet eine einzelne 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_STOP = §8/§etrace stop §8- §7Stoppt den TNT-Tracer
|
||||||
TRACE_COMMAND_HELP_AUTO = §8/§etrace toggleauto §8- §7Automatischer Aufnahmenstart
|
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 = §8/§etrace show §8<§eParameter§8> - §7Zeigt alle TNT-Positionen
|
||||||
TRACE_COMMAND_HELP_HIDE = §8/§etrace hide §8- §7Versteckt alle TNT-Positionen
|
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_DELETE = §8/§etrace delete §8- §7Löscht alle TNT-Positionen
|
||||||
|
@ -89,6 +89,41 @@ public class TraceCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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")
|
@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, @OptionalValue("entity") ShowModeType showModeType, ShowModeParameterType... showModeParameterTypes) {
|
||||||
ShowModeParameter showModeParameter = new ShowModeParameter();
|
ShowModeParameter showModeParameter = new ShowModeParameter();
|
||||||
|
@ -22,6 +22,11 @@ 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.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.TraceShowManager;
|
||||||
|
import de.steamwar.bausystem.region.Region;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.TNTPrimed;
|
import org.bukkit.entity.TNTPrimed;
|
||||||
|
|
||||||
@ -37,8 +42,15 @@ public abstract class AutoTraceRecorder implements TraceRecorder {
|
|||||||
|
|
||||||
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;
|
||||||
private Supplier<Record> recordSupplier;
|
private Supplier<Record> recordSupplier;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
private TraceRecordAutoDeletion traceRecordAutoDeletion = TraceRecordAutoDeletion.NEVER;
|
||||||
|
private Record lastRecord;
|
||||||
|
|
||||||
private Record.TNTRecord getRecord(TNTPrimed tntPrimed) {
|
private Record.TNTRecord getRecord(TNTPrimed tntPrimed) {
|
||||||
return recordMap.computeIfAbsent(tntPrimed, __ -> record.spawn(TPSUtils.currentRealTick.get() - startTime));
|
return recordMap.computeIfAbsent(tntPrimed, __ -> record.spawn(TPSUtils.currentRealTick.get() - startTime));
|
||||||
}
|
}
|
||||||
@ -58,6 +70,10 @@ public abstract class AutoTraceRecorder implements TraceRecorder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void startRecording() {
|
private void startRecording() {
|
||||||
|
if (lastRecord != null && traceRecordAutoDeletion.test(lastRecord)) {
|
||||||
|
StoredRecords.remove(region, lastRecord);
|
||||||
|
TraceShowManager.reshow(region);
|
||||||
|
}
|
||||||
lastExplosion = 0;
|
lastExplosion = 0;
|
||||||
startTime = TPSUtils.currentRealTick.get();
|
startTime = TPSUtils.currentRealTick.get();
|
||||||
record = recordSupplier.get();
|
record = recordSupplier.get();
|
||||||
@ -65,7 +81,8 @@ public abstract class AutoTraceRecorder implements TraceRecorder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recordSupplier(Supplier<Record> recordSupplier) {
|
public void init(Region region, Supplier<Record> recordSupplier) {
|
||||||
|
this.region = region;
|
||||||
this.recordSupplier = recordSupplier;
|
this.recordSupplier = recordSupplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,6 +129,7 @@ public abstract class AutoTraceRecorder implements TraceRecorder {
|
|||||||
if (recording && lastExplosion > 80) {
|
if (recording && lastExplosion > 80) {
|
||||||
recording = false;
|
recording = false;
|
||||||
recordMap.clear();
|
recordMap.clear();
|
||||||
|
lastRecord = record;
|
||||||
record = null;
|
record = null;
|
||||||
stoppedRecording();
|
stoppedRecording();
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,6 @@ import de.steamwar.bausystem.region.Region;
|
|||||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||||
import de.steamwar.bausystem.region.utils.RegionType;
|
import de.steamwar.bausystem.region.utils.RegionType;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.TNTPrimed;
|
import org.bukkit.entity.TNTPrimed;
|
||||||
@ -80,12 +79,6 @@ public class Recorder implements Listener {
|
|||||||
}
|
}
|
||||||
private static final DisabledTracerRecorder DISABLED = new DisabledTracerRecorder();
|
private static final DisabledTracerRecorder DISABLED = new DisabledTracerRecorder();
|
||||||
|
|
||||||
static Recorder instance;
|
|
||||||
|
|
||||||
{
|
|
||||||
instance = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<Region, TraceRecorder> regionTraceRecorderMap = new HashMap<>();
|
private Map<Region, TraceRecorder> regionTraceRecorderMap = new HashMap<>();
|
||||||
private Map<TNTPrimed, Region> tntTraceRecorderMap = new HashMap<>();
|
private Map<TNTPrimed, Region> tntTraceRecorderMap = new HashMap<>();
|
||||||
|
|
||||||
@ -99,7 +92,7 @@ public class Recorder implements Listener {
|
|||||||
|
|
||||||
public void set(Region region, TraceRecorder traceRecorder) {
|
public void set(Region region, TraceRecorder traceRecorder) {
|
||||||
regionTraceRecorderMap.put(region, traceRecorder);
|
regionTraceRecorderMap.put(region, traceRecorder);
|
||||||
traceRecorder.recordSupplier(() -> {
|
traceRecorder.init(region, () -> {
|
||||||
Record record = new Record(region);
|
Record record = new Record(region);
|
||||||
StoredRecords.add(region, record);
|
StoredRecords.add(region, record);
|
||||||
return record;
|
return record;
|
||||||
|
@ -22,6 +22,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.show.Record;
|
import de.steamwar.bausystem.features.tracer.show.Record;
|
||||||
|
import de.steamwar.bausystem.region.Region;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.TNTPrimed;
|
import org.bukkit.entity.TNTPrimed;
|
||||||
|
|
||||||
@ -41,7 +42,7 @@ public class SimpleTraceRecorder implements TraceRecorder, ActiveTracer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recordSupplier(Supplier<Record> recordSupplier) {
|
public void init(Region region, Supplier<Record> recordSupplier) {
|
||||||
record = recordSupplier.get();
|
record = recordSupplier.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* 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 <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
@ -20,6 +20,7 @@
|
|||||||
package de.steamwar.bausystem.features.tracer.record;
|
package de.steamwar.bausystem.features.tracer.record;
|
||||||
|
|
||||||
import de.steamwar.bausystem.features.tracer.show.Record;
|
import de.steamwar.bausystem.features.tracer.show.Record;
|
||||||
|
import de.steamwar.bausystem.region.Region;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.TNTPrimed;
|
import org.bukkit.entity.TNTPrimed;
|
||||||
|
|
||||||
@ -28,7 +29,7 @@ import java.util.function.Supplier;
|
|||||||
public interface TraceRecorder {
|
public interface TraceRecorder {
|
||||||
|
|
||||||
String scoreboard(Player player);
|
String scoreboard(Player player);
|
||||||
default void recordSupplier(Supplier<Record> recordSupplier) {
|
default void init(Region region, Supplier<Record> recordSupplier) {
|
||||||
}
|
}
|
||||||
default void postClear() {
|
default void postClear() {
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren