Skip to content

Commit

Permalink
Cleanup Config.java
Browse files Browse the repository at this point in the history
  • Loading branch information
yo56789 committed Mar 28, 2024
1 parent 0288147 commit 736e4f1
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 40 deletions.
41 changes: 1 addition & 40 deletions src/main/java/io/github/yo56789/mcdiscwbhk/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,7 @@
import io.github.yo56789.mcdiscwbhk.Main;

public class Config {
static final String defaultConfig = """
# Discord webhook URI
# How to get a webhook: https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks
webhook-uri=
# Server name
# Can be set to anything, and shows for server-related events
server-webhook-name=Server
# User avatar provider
# Replace the part where the UUID is located with %s
user-avatar-url=https://mc-heads.net/avatar/%s
# Webhook mode
# Type "message" or "embed"
# "message" only sends raw text messages. "embed" sends content in embeds
webhook-mode=message
# Events (Leave blank to ignore event)
# Server starting
event-server-starting=Server Starting!
# Server started
event-server-started=Server Started!
# Server stopping
event-server-stopping=Server Stopping!
# Server stopped
event-server-stopped=Server Stopped!
# Player join
event-player-join=%s joined!
# Player leave
event-player-leave=%s left!""";


static SimpleConfig config = SimpleConfig.of("mcdiscwbhk").provider((String name) -> defaultConfig).request();
static SimpleConfig config = SimpleConfig.of("mcdiscwbhk").provider((String name) -> DefaultConfig.DEFAULTCONFIG).request();

public static final String WEBHOOK_URI = config.getOrDefault("webhook-uri", "");
public static final String SERVER_NAME = config.getOrDefault("server-webhook-name", "Server");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package io.github.yo56789.mcdiscwbhk.config;

public class DefaultConfig {
public static final String DEFAULTCONFIG = """
# Discord webhook URI
# How to get a webhook: https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks
webhook-uri=https://discord.com/api/webhooks/1221539658421244157/MHFQu9KUiV7xpiXIMIqo8_hs6eLNdMCtMVx92w3XavozhDLUqbD4TaT-e16hcbweACx9
# Server name
# Can be set to anything, and shows for server-related events
server-webhook-name=Server
# User avatar provider
# Replace the part where the UUID is located with %s
user-avatar-url=https://mc-heads.net/avatar/%s
# Webhook mode
# Type "message" or "embed"
# "message" only sends raw text messages. "embed" sends content in embeds
webhook-mode=embed
# Events (Leave blank to ignore event)
# Server starting
event-server-starting=Server Starting!
# Server started
event-server-started=Server Started!
# Server stopping
event-server-stopping=Server Stopping!
# Server stopped
event-server-stopped=Server Stopped!
# Player join
event-player-join=%s joined!
# Player leave
event-player-leave=%s left!
""";
}

1 comment on commit 736e4f1

@yo56789
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to remove webhook url used for testing. The webhook url in the DefaultConfig.java of this commit is no longer valid using it will not work.

Please sign in to comment.