SteamWar/BauSystem2.0
Archiviert
12
0

Changed auto trace toggle to setable
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
D4rkr34lm 2024-04-28 11:59:42 +02:00
Ursprung 2aec97304d
Commit 4568ceee36
2 geänderte Dateien mit 7 neuen und 19 gelöschten Zeilen

Datei anzeigen

@ -58,16 +58,18 @@ public class TraceCommand extends SWCommand {
Region region = Region.getRegion(player.getLocation());
TraceRecorder.instance.stopRecording(region);
BauSystem.MESSAGE.send("TRACE_MESSAGE_STOP", player);
if (TraceRecorder.instance.isAutoTraceEnabledInRegion(region)) {
TraceRecorder.instance.removeAutoTraceRegion(region);
BauSystem.MESSAGE.send("TRACE_MESSAGE_AUTO_STOP", player);
}
}
@Register(value = "auto", description = "TRACE_COMMAND_HELP_AUTO")
public void auto(@Validator Player player) {
Region region = Region.getRegion(player.getLocation());
if (TraceRecorder.instance.toggleAutoTrace(region)) {
BauSystem.MESSAGE.send("TRACE_MESSAGE_AUTO_START", player);
} else {
BauSystem.MESSAGE.send("TRACE_MESSAGE_AUTO_STOP", player);
}
TraceRecorder.instance.addAutoTraceRegion(region);
BauSystem.MESSAGE.send("TRACE_MESSAGE_AUTO_START", player);
}
@Register(value = "show", description = "TRACE_COMMAND_HELP_SHOW")

Datei anzeigen

@ -74,20 +74,6 @@ public class TraceRecorder implements Listener {
}, 0, 1);
}
/**
* Toggles auto trace for the given region
*
* @param region
*/
public boolean toggleAutoTrace(Region region) {
if (!autoTraceRegions.remove(region)) {
autoTraceRegions.add(region);
return true;
} else {
return false;
}
}
public void addAutoTraceRegion(Region region) {
autoTraceRegions.add(region);
}