From 7083b58ffc95bb5771c711fbc49c80c5ef59fcf6 Mon Sep 17 00:00:00 2001 From: zontreck Date: Sat, 24 May 2025 23:30:58 -0700 Subject: [PATCH 1/3] Remove dart doc workaround --- Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 15ed2ec..9648362 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -24,10 +24,10 @@ pipeline { unset WORKSPACE_TMP rm -rf doc dart pub get - # dart doc - # Workaround for dart doc being broken at the moment - dart pub global activate dartdoc - dart pub global run dartdoc + dart doc + #(EDIT: Workaround is not currently required.) Workaround for dart doc being broken at the moment + #dart pub global activate dartdoc + #dart pub global run dartdoc tar -cvf docs.tgz doc/api/* From 88afaae298dede4c87561ef83605d5a881d11ac6 Mon Sep 17 00:00:00 2001 From: zontreck Date: Sat, 24 May 2025 23:31:50 -0700 Subject: [PATCH 2/3] Add feature: days to Time API --- lib/utils/TimeUtils.dart | 63 +++++++++++++++++++++++++++++++++------- 1 file changed, 53 insertions(+), 10 deletions(-) diff --git a/lib/utils/TimeUtils.dart b/lib/utils/TimeUtils.dart index 2fac648..f5cc233 100644 --- a/lib/utils/TimeUtils.dart +++ b/lib/utils/TimeUtils.dart @@ -1,14 +1,35 @@ -import '../nbt/Stream.dart'; +/// [Time] is used as a way to serialize and deserialize time based notations. +/// +/// When interacting with this, you can even parse Durations class Time { + int days; int hours; int minutes; int seconds; - Time({required this.hours, required this.minutes, required this.seconds}) { + Time( + {required this.days, + required this.hours, + required this.minutes, + required this.seconds}) { autofix(); } + static Time fromDuration(Duration duration) { + int days = duration.inDays; + int hours = duration.inHours.remainder(24); + int minutes = duration.inMinutes.remainder(60); + int seconds = duration.inSeconds.remainder(60); + + return Time(days: days, hours: hours, minutes: minutes, seconds: seconds); + } + + Duration toDuration() { + return Duration( + days: days, hours: hours, minutes: minutes, seconds: seconds); + } + int getTotalSeconds() { int current = 0; current += seconds; @@ -59,9 +80,13 @@ class Time { int totalSeconds = getTotalSeconds(); if (totalSeconds < 0) totalSeconds = 0; + int one_day = (1 * 60 * 60 * 24); int one_hour = (1 * 60 * 60); int one_minute = (1 * 60); + int days = (totalSeconds / 60 / 60 / 24).round(); + totalSeconds -= (days * one_day); + int hours = (totalSeconds / 60 / 60).round(); totalSeconds -= (hours * one_hour); @@ -70,27 +95,43 @@ class Time { int seconds = totalSeconds; + this.days = days; this.hours = hours; this.minutes = minutes; this.seconds = seconds; } Time copy() { - return Time(hours: hours, minutes: minutes, seconds: seconds); + return Time(days: days, hours: hours, minutes: minutes, seconds: seconds); } factory Time.copy(Time other) { return Time( - hours: other.hours, minutes: other.minutes, seconds: other.seconds); + days: other.days, + hours: other.hours, + minutes: other.minutes, + seconds: other.seconds); } factory Time.fromNotation(String notation) { + int days = 0; int hours = 0; int minutes = 0; int seconds = 0; List current = []; String val = notation; + if (val.indexOf('d') == -1) { + days = 0; + } else { + current = val.split('d'); + days = int.parse(current[0]); + + if (current.length == 2) { + val = current[1]; + } else + val = ""; + } if (val.indexOf('h') == -1) { hours = 0; } else { @@ -131,17 +172,19 @@ class Time { seconds += int.parse(val); } - return Time(hours: hours, minutes: minutes, seconds: seconds); + return Time(days: days, hours: hours, minutes: minutes, seconds: seconds); } @override String toString() { - StringBuilder builder = StringBuilder(); - if (hours > 0) builder.append("${hours}h"); - if (minutes > 0) builder.append("${minutes}m"); - if (seconds > 0) builder.append("${seconds}s"); + List parts = []; - return "${builder}"; + if (days > 0) parts.add('${days}d'); + if (hours > 0) parts.add('${hours}h'); + if (minutes > 0) parts.add('${minutes}m'); + if (seconds > 0) parts.add('${seconds}s'); + + return parts.join(' '); } } From 619c9ee329cc1e1e7b59fbedbe6af137499abf60 Mon Sep 17 00:00:00 2001 From: zontreck Date: Sat, 24 May 2025 23:33:21 -0700 Subject: [PATCH 3/3] Bump version number --- lib/consts.dart | 2 +- pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/consts.dart b/lib/consts.dart index d6914ad..9ad5b3e 100644 --- a/lib/consts.dart +++ b/lib/consts.dart @@ -1,5 +1,5 @@ class Constants { - static const VERSION = "1.4.020325+1215"; + static const VERSION = "1.4.052425+2332"; static const NBT_REVISION = "1.4.020325+1215"; static const ARGS_REVISION = "1.4.012225+0413"; } diff --git a/pubspec.yaml b/pubspec.yaml index 76a8a68..4fd91fa 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: libac_dart description: "Aria's Creations code library" -version: 1.4.020325+1215 +version: 1.4.052425+2332 homepage: "https://zontreck.com" environment: