[BREAK] Split Join/Leave and Start/Stop messages

This commit is contained in:
2023-11-21 18:33:59 +02:00
parent b3386ff6cc
commit 2dd2f3eb5c
5 changed files with 43 additions and 13 deletions

View File

@@ -24,7 +24,7 @@ public class SDLinkConfig extends ModuleConfig {
// DO NOT REMOVE TRANSIENT HERE... OTHERWISE, THE STUPID CONFIG LIBRARY
// WILL TRY TO WRITE THESE TO THE CONFIG
public transient static SDLinkConfig INSTANCE;
public transient static int configVer = 12;
public transient static int configVer = 13;
@Path("general")
@SpecComment("General Mod Config")

View File

@@ -18,13 +18,21 @@ public class MessageChannelConfig {
@SpecComment("Control where CHAT messages are delivered")
public DestinationObject chat = DestinationObject.of(MessageDestination.CHAT, false, "default");
@Path("startStop")
@SpecComment("Control where START/STOP messages are delivered")
public DestinationObject startStop = DestinationObject.of(MessageDestination.EVENT, false, "default");
@Path("start")
@SpecComment("Control where START messages are delivered")
public DestinationObject start = DestinationObject.of(MessageDestination.EVENT, false, "default");
@Path("joinLeave")
@SpecComment("Control where JOIN/LEAVE messages are delivered")
public DestinationObject joinLeave = DestinationObject.of(MessageDestination.EVENT, false, "default");
@Path("stop")
@SpecComment("Control where STOP messages are delivered")
public DestinationObject stop = DestinationObject.of(MessageDestination.EVENT, false, "default");
@Path("join")
@SpecComment("Control where JOIN messages are delivered")
public DestinationObject join = DestinationObject.of(MessageDestination.EVENT, false, "default");
@Path("leave")
@SpecComment("Control where LEAVE messages are delivered")
public DestinationObject leave = DestinationObject.of(MessageDestination.EVENT, false, "default");
@Path("advancements")
@SpecComment("Control where ADVANCEMENT messages are delivered")

View File

@@ -1,3 +1,7 @@
/*
* This file is part of sdlink-core, licensed under the MIT License (MIT).
* Copyright HypherionSA and Contributors
*/
package com.hypherionmc.sdlink.core.discord.commands.slash.setup;
import com.hypherionmc.sdlink.core.config.SDLinkConfig;

View File

@@ -10,8 +10,10 @@ package com.hypherionmc.sdlink.core.messaging;
*/
public enum MessageType {
CHAT,
START_STOP,
JOIN_LEAVE,
START,
STOP,
JOIN,
LEAVE,
ADVANCEMENT,
DEATH,
COMMAND,

View File

@@ -191,16 +191,32 @@ public final class DiscordMessage {
chat
);
}
case START_STOP -> {
MessageChannelConfig.DestinationObject startStop = SDLinkConfig.INSTANCE.messageDestinations.startStop;
case START -> {
MessageChannelConfig.DestinationObject startStop = SDLinkConfig.INSTANCE.messageDestinations.start;
return Triple.of(
ChannelManager.getDestinationChannel(startStop.channel),
WebhookManager.getWebhookClient(startStop.channel),
startStop
);
}
case JOIN_LEAVE -> {
MessageChannelConfig.DestinationObject joinLeave = SDLinkConfig.INSTANCE.messageDestinations.joinLeave;
case STOP -> {
MessageChannelConfig.DestinationObject startStop = SDLinkConfig.INSTANCE.messageDestinations.stop;
return Triple.of(
ChannelManager.getDestinationChannel(startStop.channel),
WebhookManager.getWebhookClient(startStop.channel),
startStop
);
}
case JOIN -> {
MessageChannelConfig.DestinationObject joinLeave = SDLinkConfig.INSTANCE.messageDestinations.join;
return Triple.of(
ChannelManager.getDestinationChannel(joinLeave.channel),
WebhookManager.getWebhookClient(joinLeave.channel),
joinLeave
);
}
case LEAVE -> {
MessageChannelConfig.DestinationObject joinLeave = SDLinkConfig.INSTANCE.messageDestinations.leave;
return Triple.of(
ChannelManager.getDestinationChannel(joinLeave.channel),
WebhookManager.getWebhookClient(joinLeave.channel),