[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 // DO NOT REMOVE TRANSIENT HERE... OTHERWISE, THE STUPID CONFIG LIBRARY
// WILL TRY TO WRITE THESE TO THE CONFIG // WILL TRY TO WRITE THESE TO THE CONFIG
public transient static SDLinkConfig INSTANCE; public transient static SDLinkConfig INSTANCE;
public transient static int configVer = 12; public transient static int configVer = 13;
@Path("general") @Path("general")
@SpecComment("General Mod Config") @SpecComment("General Mod Config")

View File

@@ -18,13 +18,21 @@ public class MessageChannelConfig {
@SpecComment("Control where CHAT messages are delivered") @SpecComment("Control where CHAT messages are delivered")
public DestinationObject chat = DestinationObject.of(MessageDestination.CHAT, false, "default"); public DestinationObject chat = DestinationObject.of(MessageDestination.CHAT, false, "default");
@Path("startStop") @Path("start")
@SpecComment("Control where START/STOP messages are delivered") @SpecComment("Control where START messages are delivered")
public DestinationObject startStop = DestinationObject.of(MessageDestination.EVENT, false, "default"); public DestinationObject start = DestinationObject.of(MessageDestination.EVENT, false, "default");
@Path("joinLeave") @Path("stop")
@SpecComment("Control where JOIN/LEAVE messages are delivered") @SpecComment("Control where STOP messages are delivered")
public DestinationObject joinLeave = DestinationObject.of(MessageDestination.EVENT, false, "default"); 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") @Path("advancements")
@SpecComment("Control where ADVANCEMENT messages are delivered") @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; package com.hypherionmc.sdlink.core.discord.commands.slash.setup;
import com.hypherionmc.sdlink.core.config.SDLinkConfig; import com.hypherionmc.sdlink.core.config.SDLinkConfig;

View File

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

View File

@@ -191,16 +191,32 @@ public final class DiscordMessage {
chat chat
); );
} }
case START_STOP -> { case START -> {
MessageChannelConfig.DestinationObject startStop = SDLinkConfig.INSTANCE.messageDestinations.startStop; MessageChannelConfig.DestinationObject startStop = SDLinkConfig.INSTANCE.messageDestinations.start;
return Triple.of( return Triple.of(
ChannelManager.getDestinationChannel(startStop.channel), ChannelManager.getDestinationChannel(startStop.channel),
WebhookManager.getWebhookClient(startStop.channel), WebhookManager.getWebhookClient(startStop.channel),
startStop startStop
); );
} }
case JOIN_LEAVE -> { case STOP -> {
MessageChannelConfig.DestinationObject joinLeave = SDLinkConfig.INSTANCE.messageDestinations.joinLeave; 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( return Triple.of(
ChannelManager.getDestinationChannel(joinLeave.channel), ChannelManager.getDestinationChannel(joinLeave.channel),
WebhookManager.getWebhookClient(joinLeave.channel), WebhookManager.getWebhookClient(joinLeave.channel),