Skip to content

Commit

Permalink
🐛 fix server stop bug
Browse files Browse the repository at this point in the history
  • Loading branch information
SerenModz21 committed Jul 6, 2022
1 parent 1d4dd7d commit 4a82aa8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .github/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 1.0.0-beta1.2

- Fixed issue of server getting stuck on "Thread Query Listener stopped"
- Close all connections that the mod makes

# 1.0.0-beta1.1

- Send player death messages
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ loader_version = 0.14.8

# Mod Properties
mod_name = Kings World
mod_version = 1.0.0-beta1.1
mod_version = 1.0.0-beta1.2
maven_group = me.seren
archives_base_name = kings-world

Expand Down
16 changes: 9 additions & 7 deletions src/main/java/me/seren/Events.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import club.minnced.discord.webhook.WebhookClient;
import me.seren.discord.Client;
import net.minecraft.advancement.Advancement;
import net.minecraft.advancement.AdvancementDisplay;
import net.minecraft.entity.Entity;
import net.minecraft.network.message.MessageType;
import net.minecraft.network.message.SignedMessage;
Expand All @@ -15,8 +13,6 @@

import javax.security.auth.login.LoginException;

import java.util.Objects;

import static me.seren.KingsWorld.*;

public final class Events {
Expand All @@ -38,12 +34,18 @@ public static void serverStarted(MinecraftServer server) {
Utils.sendDiscordMessage(":white_check_mark: The server has started!");
}

public static void serverStopped(MinecraftServer server) {
public static void serverStopping(MinecraftServer server) {
logger.info("Sending server stopped message to discord");
Utils.sendDiscordMessage(":octagonal_sign: The server has stopped!");
}

public static void serverStopping(MinecraftServer server) {
logger.info("Deleting all slash commands");
client.jda.updateCommands().queue();

logger.info("Closing the webhook connection");
webhook.close();

logger.info("Closing the JDA connection");
client.jda.shutdown();
}

public static void chatMessage(FilteredMessage<SignedMessage> message, ServerPlayerEntity sender, RegistryKey<MessageType> typeKey) {
Expand Down
1 change: 0 additions & 1 deletion src/main/java/me/seren/KingsWorld.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ private void registerEvents() {
// fabric-lifecycle-events-v1
ServerLifecycleEvents.SERVER_STARTING.register(Events::serverStarting);
ServerLifecycleEvents.SERVER_STARTED.register(Events::serverStarted);
ServerLifecycleEvents.SERVER_STOPPED.register(Events::serverStopped);
ServerLifecycleEvents.SERVER_STOPPING.register(Events::serverStopping);

// fabric-message-api-v1
Expand Down

0 comments on commit 4a82aa8

Please sign in to comment.