Skip to content

Commit

Permalink
clean up configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianmakila committed Jan 6, 2025
1 parent df17458 commit 964c9cc
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 47 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package fi.fabianadrian.webhooklogger.common.config;

import fi.fabianadrian.webhooklogger.common.config.section.PlaceholderConfigSection;
import fi.fabianadrian.webhooklogger.common.event.EventType;
import fi.fabianadrian.webhooklogger.common.webhook.MessageStyle;
import space.arim.dazzleconf.annote.ConfComments;
import space.arim.dazzleconf.annote.ConfDefault;
import space.arim.dazzleconf.annote.SubSection;
import space.arim.dazzleconf.sorter.AnnotationBasedSorter;

import java.time.ZoneId;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -69,6 +69,37 @@ static Map<String, String> defaultTextReplacements() {
@ConfDefault.DefaultString("DEFAULT")
MessageStyle messageStyle();

@SubSection
interface PlaceholderConfigSection {

@AnnotationBasedSorter.Order(0)
@ConfDefault.DefaultString("HH:mm:ss")
@ConfComments({
"Format for the <timestamp> placeholder."
})
String timestampFormat();

@AnnotationBasedSorter.Order(1)
@ConfDefault.DefaultString("default")
@ConfComments({
"The timezone used in <timestamp> placeholder.",
"Set to 'default' to use the server timezone."
})
ZoneId timestampTimezone();

@AnnotationBasedSorter.Order(2)
@ConfDefault.DefaultString("[Cancelled] ")
@ConfComments("The text used in <cancelled> placeholder.")
String cancelled();

@AnnotationBasedSorter.Order(3)
@ConfDefault.DefaultString("x<x>, y<y>, z<z>")
@ConfComments({
"Format for the <location> placeholder."
})
String locationFormat();
}

interface Webhook {
@AnnotationBasedSorter.Order(0)
String url();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

public interface ChatEventConfig extends CancellableEventConfig {
@AnnotationBasedSorter.Order(0)
@ConfDefault.DefaultString("<cancelled>[<timestamp>] <audience_name>: <message>")
@ConfDefault.DefaultString("<cancelled>[<timestamp>] <name>: <message>")
@ConfComments({
"The webhook format for chat messages. Available placeholders:",
"<audience_name>, <audience_display_name>, <message>, <timestamp>, <cancelled>"
"<name>, <display_name>, <message>, <timestamp>, <cancelled>"
})
String format();
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

public interface CommandEventConfig extends CancellableEventConfig {
@AnnotationBasedSorter.Order(0)
@ConfDefault.DefaultString("<cancelled>[<timestamp>] <audience_display_name>: <command>")
@ConfDefault.DefaultString("<cancelled>[<timestamp>] <display_name>: <command>")
@ConfComments({
"The webhook format for executed commands. Available placeholders:",
"<audience_name>, <audience_display_name>, <command>, <timestamp>, <cancelled>"
"<name>, <display_name>, <command>, <timestamp>, <cancelled>"
})
String format();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public interface DeathEventConfig extends CancellableEventConfig {
@ConfDefault.DefaultString("<cancelled>[<timestamp>] <message> (<location>)")
@ConfComments({
"The webhook format for when a player dies. Available placeholders:",
"<audience_name>, <audience_display_name>, <message>, <timestamp>, <cancelled>, <location>"
"<name>, <display_name>, <message>, <timestamp>, <cancelled>, <location>"
})
String format();
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

public interface JoinEventConfig {
@AnnotationBasedSorter.Order(0)
@ConfDefault.DefaultString("[<timestamp>] <audience_name> joined the game")
@ConfDefault.DefaultString("[<timestamp>] <name> joined the game")
@ConfComments({
"The webhook format for when a player joins the server. Available placeholders:",
"<audience_name>, <audience_display_name>, <message>, <timestamp>, <address>"
"<name>, <display_name>, <message>, <timestamp>, <address>"
})
String format();
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

public interface QuitEventConfig {
@AnnotationBasedSorter.Order(0)
@ConfDefault.DefaultString("[<timestamp>] <audience_name> left the game")
@ConfDefault.DefaultString("[<timestamp>] <name> left the game")
@ConfComments({
"The webhook format for when a player leaves the server. Available placeholders:",
"<audience_name>, <audience_display_name>, <message>, <timestamp>"
"<name>, <display_name>, <message>, <timestamp>"
})
String format();
}

This file was deleted.

0 comments on commit 964c9cc

Please sign in to comment.