Skip to content

Commit

Permalink
SignatureSign - added timestamp delimiter options.
Browse files Browse the repository at this point in the history
  • Loading branch information
0xTas committed Mar 12, 2024
1 parent 5c5fc82 commit c0ec843
Showing 1 changed file with 61 additions and 25 deletions.
86 changes: 61 additions & 25 deletions src/main/java/dev/stardust/modules/SignatureSign.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ public class SignatureSign extends Module {

public static final String[] lineModes = {"Custom", "Empty", "File", "Username",
"Username was here", "Timestamp", "Stardust", "Oasis", "Base64", "Hex", "0xHex", "ROT13"};

public static final String[] timestampTypes = {"MM/DD/YY", "MM/DD/YYYY", "DD/MM/YY", "DD/MM/YYYY",
"YYYY/MM/DD", "YYYY/DD/MM", "Day Month Year", "Month Day Year", "Month Year", "Year", "Day Month", "Month Day",
"Unix Epoch"};
public static final String[] timestampDelimiters = {"/", "//", "\\", "\\\\", "|", "||", "-", "_", "~", ".", ",", "x", "•", "✨"};

private final SettingGroup sgMode = settings.createGroup("Module Mode");
private final SettingGroup sgLine1 = settings.createGroup("Line 1");
Expand Down Expand Up @@ -120,6 +120,15 @@ public class SignatureSign extends Module {
.build()
);

private final Setting<String> line1TimestampDelim = sgLine1.add(
new ProvidedStringSetting.Builder()
.name("Line 1 Timestamp Delimiter")
.defaultValue("/")
.supplier(() -> timestampDelimiters)
.visible(() -> !storyMode.get() && line1Mode.get().equals("Timestamp") && line1TimestampType.get().contains("/"))
.build()
);

private final Setting<String> line2Mode = sgLine2.add(
new ProvidedStringSetting.Builder()
.name("Line 2 Mode")
Expand Down Expand Up @@ -170,6 +179,15 @@ public class SignatureSign extends Module {
.build()
);

private final Setting<String> line2TimestampDelim = sgLine2.add(
new ProvidedStringSetting.Builder()
.name("Line 2 Timestamp Delimiter")
.defaultValue("/")
.supplier(() -> timestampDelimiters)
.visible(() -> !storyMode.get() && line2Mode.get().equals("Timestamp") && line2TimestampType.get().contains("/"))
.build()
);

private final Setting<String> line3Mode = sgLine3.add(
new ProvidedStringSetting.Builder()
.name("Line 3 Mode")
Expand Down Expand Up @@ -220,6 +238,15 @@ public class SignatureSign extends Module {
.build()
);

private final Setting<String> line3TimestampDelim = sgLine3.add(
new ProvidedStringSetting.Builder()
.name("Line 3 Timestamp Delimiter")
.defaultValue("/")
.supplier(() -> timestampDelimiters)
.visible(() -> !storyMode.get() && line3Mode.get().equals("Timestamp") && line3TimestampType.get().contains("/"))
.build()
);

private final Setting<String> line4Mode = sgLine4.add(
new ProvidedStringSetting.Builder()
.name("Line 4 Mode")
Expand Down Expand Up @@ -270,6 +297,15 @@ public class SignatureSign extends Module {
.build()
);

private final Setting<String> line4TimestampDelim = sgLine4.add(
new ProvidedStringSetting.Builder()
.name("Line 4 Timestamp Delimiter")
.defaultValue("/")
.supplier(() -> timestampDelimiters)
.visible(() -> !storyMode.get() && line4Mode.get().equals("Timestamp") && line4TimestampType.get().contains("/"))
.build()
);

private final Setting<Boolean> autoConfirm = settings.getDefaultGroup().add(
new BoolSetting.Builder()
.name("Auto Confirm")
Expand Down Expand Up @@ -643,12 +679,12 @@ private String getTimestamp(int line) {
switch (line) {
case 1 -> {
return switch (line1TimestampType.get()) {
case "MM/DD/YY" -> currentDate.format(mmddyy);
case "MM/DD/YYYY" -> currentDate.format(mmddyyyy);
case "DD/MM/YY" -> currentDate.format(ddmmyy);
case "DD/MM/YYYY" -> currentDate.format(ddmmyyyy);
case "YYYY/MM/DD" -> currentDate.format(yyyymmdd);
case "YYYY/DD/MM" -> currentDate.format(yyyyddmm);
case "MM/DD/YY" -> currentDate.format(mmddyy).replace("/", line1TimestampDelim.get());
case "MM/DD/YYYY" -> currentDate.format(mmddyyyy).replace("/", line1TimestampDelim.get());
case "DD/MM/YY" -> currentDate.format(ddmmyy).replace("/", line1TimestampDelim.get());
case "DD/MM/YYYY" -> currentDate.format(ddmmyyyy).replace("/", line1TimestampDelim.get());
case "YYYY/MM/DD" -> currentDate.format(yyyymmdd).replace("/", line1TimestampDelim.get());
case "YYYY/DD/MM" -> currentDate.format(yyyyddmm).replace("/", line1TimestampDelim.get());
case "Day Month Year" ->
dayOfMonthSuffix(currentDate.getDayOfMonth()) + " " + currentMonth + " " + currentDate.getYear();
case "Month Day Year" ->
Expand All @@ -662,12 +698,12 @@ private String getTimestamp(int line) {
}
case 2 -> {
return switch (line2TimestampType.get()) {
case "MM/DD/YY" -> currentDate.format(mmddyy);
case "MM/DD/YYYY" -> currentDate.format(mmddyyyy);
case "DD/MM/YY" -> currentDate.format(ddmmyy);
case "DD/MM/YYYY" -> currentDate.format(ddmmyyyy);
case "YYYY/MM/DD" -> currentDate.format(yyyymmdd);
case "YYYY/DD/MM" -> currentDate.format(yyyyddmm);
case "MM/DD/YY" -> currentDate.format(mmddyy).replace("/", line2TimestampDelim.get());
case "MM/DD/YYYY" -> currentDate.format(mmddyyyy).replace("/", line2TimestampDelim.get());
case "DD/MM/YY" -> currentDate.format(ddmmyy).replace("/", line2TimestampDelim.get());
case "DD/MM/YYYY" -> currentDate.format(ddmmyyyy).replace("/", line2TimestampDelim.get());
case "YYYY/MM/DD" -> currentDate.format(yyyymmdd).replace("/", line2TimestampDelim.get());
case "YYYY/DD/MM" -> currentDate.format(yyyyddmm).replace("/", line2TimestampDelim.get());
case "Day Month Year" ->
dayOfMonthSuffix(currentDate.getDayOfMonth()) + " " + currentMonth + " " + currentDate.getYear();
case "Month Day Year" ->
Expand All @@ -681,12 +717,12 @@ private String getTimestamp(int line) {
}
case 3 -> {
return switch (line3TimestampType.get()) {
case "MM/DD/YY" -> currentDate.format(mmddyy);
case "MM/DD/YYYY" -> currentDate.format(mmddyyyy);
case "DD/MM/YY" -> currentDate.format(ddmmyy);
case "DD/MM/YYYY" -> currentDate.format(ddmmyyyy);
case "YYYY/MM/DD" -> currentDate.format(yyyymmdd);
case "YYYY/DD/MM" -> currentDate.format(yyyyddmm);
case "MM/DD/YY" -> currentDate.format(mmddyy).replace("/", line3TimestampDelim.get());
case "MM/DD/YYYY" -> currentDate.format(mmddyyyy).replace("/", line3TimestampDelim.get());
case "DD/MM/YY" -> currentDate.format(ddmmyy).replace("/", line3TimestampDelim.get());
case "DD/MM/YYYY" -> currentDate.format(ddmmyyyy).replace("/", line3TimestampDelim.get());
case "YYYY/MM/DD" -> currentDate.format(yyyymmdd).replace("/", line3TimestampDelim.get());
case "YYYY/DD/MM" -> currentDate.format(yyyyddmm).replace("/", line3TimestampDelim.get());
case "Day Month Year" ->
dayOfMonthSuffix(currentDate.getDayOfMonth()) + " " + currentMonth + " " + currentDate.getYear();
case "Month Day Year" ->
Expand All @@ -700,12 +736,12 @@ private String getTimestamp(int line) {
}
case 4 -> {
return switch (line4TimestampType.get()) {
case "MM/DD/YY" -> currentDate.format(mmddyy);
case "MM/DD/YYYY" -> currentDate.format(mmddyyyy);
case "DD/MM/YY" -> currentDate.format(ddmmyy);
case "DD/MM/YYYY" -> currentDate.format(ddmmyyyy);
case "YYYY/MM/DD" -> currentDate.format(yyyymmdd);
case "YYYY/DD/MM" -> currentDate.format(yyyyddmm);
case "MM/DD/YY" -> currentDate.format(mmddyy).replace("/", line4TimestampDelim.get());
case "MM/DD/YYYY" -> currentDate.format(mmddyyyy).replace("/", line4TimestampDelim.get());
case "DD/MM/YY" -> currentDate.format(ddmmyy).replace("/", line4TimestampDelim.get());
case "DD/MM/YYYY" -> currentDate.format(ddmmyyyy).replace("/", line4TimestampDelim.get());
case "YYYY/MM/DD" -> currentDate.format(yyyymmdd).replace("/", line4TimestampDelim.get());
case "YYYY/DD/MM" -> currentDate.format(yyyyddmm).replace("/", line4TimestampDelim.get());
case "Day Month Year" ->
dayOfMonthSuffix(currentDate.getDayOfMonth()) + " " + currentMonth + " " + currentDate.getYear();
case "Month Day Year" ->
Expand Down

0 comments on commit c0ec843

Please sign in to comment.