From 90314d00fe765b547d2ea9445616e24673274fd0 Mon Sep 17 00:00:00 2001 From: duckietm Date: Fri, 8 May 2026 15:19:00 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=86=99=20Fix=20Guilds=20removal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../habbo/habbohotel/guilds/GuildManager.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/guilds/GuildManager.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/guilds/GuildManager.java index 171dc269..85349452 100644 --- a/Emulator/src/main/java/com/eu/habbo/habbohotel/guilds/GuildManager.java +++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/guilds/GuildManager.java @@ -2,11 +2,13 @@ package com.eu.habbo.habbohotel.guilds; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; +import com.eu.habbo.habbohotel.guilds.forums.ForumThread; import com.eu.habbo.habbohotel.guilds.forums.ForumView; import com.eu.habbo.habbohotel.items.interactions.InteractionGuildFurni; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.outgoing.guilds.GuildJoinErrorComposer; +import com.eu.habbo.messages.outgoing.guilds.forums.GuildForumDataComposer; import gnu.trove.TCollections; import gnu.trove.iterator.TIntObjectIterator; import gnu.trove.map.TIntObjectMap; @@ -142,12 +144,36 @@ public class GuildManager { deleteFavourite.execute(); } + try (PreparedStatement statement = connection.prepareStatement("DELETE FROM guild_forum_views WHERE guild_id = ?")) { + statement.setInt(1, guild.getId()); + statement.execute(); + } + + try (PreparedStatement statement = connection.prepareStatement("DELETE c FROM guilds_forums_comments c INNER JOIN guilds_forums_threads t ON c.thread_id = t.id WHERE t.guild_id = ?")) { + statement.setInt(1, guild.getId()); + statement.execute(); + } + + try (PreparedStatement statement = connection.prepareStatement("DELETE FROM guilds_forums_threads WHERE guild_id = ?")) { + statement.setInt(1, guild.getId()); + statement.execute(); + } try (PreparedStatement statement = connection.prepareStatement("DELETE FROM guilds_members WHERE guild_id = ?")) { statement.setInt(1, guild.getId()); statement.execute(); } + try (PreparedStatement statement = connection.prepareStatement("UPDATE rooms SET guild_id = 0 WHERE guild_id = ?")) { + statement.setInt(1, guild.getId()); + statement.execute(); + } + + try (PreparedStatement statement = connection.prepareStatement("UPDATE items SET guild_id = 0 WHERE guild_id = ?")) { + statement.setInt(1, guild.getId()); + statement.execute(); + } + try (PreparedStatement statement = connection.prepareStatement("DELETE FROM guilds WHERE id = ?")) { statement.setInt(1, guild.getId()); statement.execute(); @@ -161,6 +187,10 @@ public class GuildManager { } catch (SQLException e) { LOGGER.error("Caught SQL exception", e); } + + this.guilds.remove(guild.getId()); + ForumThread.clearCacheForGuild(guild.getId()); + GuildForumDataComposer.invalidateUnreadCache(guild.getId()); }