Clean up guild forums & ensure thread list is updated

This commit is contained in:
Alejandro 2020-01-27 22:08:25 +02:00
parent 70bc0f6bcb
commit 913ca752ba
3 changed files with 25 additions and 30 deletions

View File

@ -10,6 +10,7 @@ import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer;
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
import com.eu.habbo.messages.outgoing.guilds.forums.GuildForumThreadMessagesComposer;
import com.eu.habbo.messages.outgoing.guilds.forums.GuildForumThreadsComposer;
import com.eu.habbo.messages.outgoing.handshake.ConnectionErrorComposer;
@ -51,7 +52,7 @@ public class GuildForumModerateThreadEvent extends MessageHandler {
thread.setState(ForumThreadState.fromValue(state));
thread.setAdminId(this.client.getHabbo().getHabboInfo().getId());
Emulator.getThreading().run(thread);
thread.run();
switch (state) {
case 10:
@ -64,5 +65,6 @@ public class GuildForumModerateThreadEvent extends MessageHandler {
}
this.client.sendResponse(new GuildForumThreadMessagesComposer(thread));
this.client.sendResponse(new GuildForumThreadsComposer(guild, 0));
}
}

View File

@ -7,6 +7,8 @@ import com.eu.habbo.habbohotel.guilds.GuildRank;
import com.eu.habbo.habbohotel.guilds.SettingsState;
import com.eu.habbo.habbohotel.guilds.forums.ForumThread;
import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer;
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
import com.eu.habbo.messages.outgoing.guilds.forums.GuildForumThreadsComposer;
import com.eu.habbo.messages.outgoing.guilds.forums.ThreadUpdatedMessageComposer;
import com.eu.habbo.messages.outgoing.handshake.ConnectionErrorComposer;
@ -42,9 +44,24 @@ public class GuildForumThreadUpdateEvent extends MessageHandler {
return;
}
boolean pinChanged = isPinned != thread.isPinned();
if (pinChanged) {
this.client.sendResponse(new BubbleAlertComposer(isPinned ? BubbleAlertKeys.FORUMS_THREAD_PINNED.key : BubbleAlertKeys.FORUMS_THREAD_UNPINNED.key).compose());
}
if (isLocked != thread.isLocked()) {
this.client.sendResponse(new BubbleAlertComposer(isLocked ? BubbleAlertKeys.FORUMS_THREAD_LOCKED.key : BubbleAlertKeys.FORUMS_THREAD_UNLOCKED.key).compose());
}
thread.setPinned(isPinned);
thread.setLocked(isLocked);
thread.run();
this.client.sendResponse(new ThreadUpdatedMessageComposer(guild, thread, this.client.getHabbo(), isPinned, isLocked));
if (isPinned) {
if (pinChanged) {
this.client.sendResponse(new GuildForumThreadsComposer(guild, 0));
}
}

View File

@ -1,15 +1,11 @@
package com.eu.habbo.messages.outgoing.guilds.forums;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.guilds.Guild;
import com.eu.habbo.habbohotel.guilds.GuildRank;
import com.eu.habbo.habbohotel.guilds.forums.ForumThread;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.MessageComposer;
import com.eu.habbo.messages.outgoing.Outgoing;
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer;
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
public class ThreadUpdatedMessageComposer extends MessageComposer {
@ -33,30 +29,10 @@ public class ThreadUpdatedMessageComposer extends MessageComposer {
@Override
public ServerMessage compose() {
if (isPinned != thread.isPinned()) {
this.habbo.getClient().sendResponse(new BubbleAlertComposer(isPinned ? BubbleAlertKeys.FORUMS_THREAD_PINNED.key : BubbleAlertKeys.FORUMS_THREAD_UNPINNED.key).compose());
}
if (isLocked != thread.isLocked()) {
this.habbo.getClient().sendResponse(new BubbleAlertComposer(isLocked ? BubbleAlertKeys.FORUMS_THREAD_LOCKED.key : BubbleAlertKeys.FORUMS_THREAD_UNLOCKED.key).compose());
}
if (this.habbo.getHabboInfo().getId() != guild.getOwnerId() ||
guild.canModForum().state == 2 && (Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, habbo).getRank() == GuildRank.OWNER
|| Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, habbo).getRank() == GuildRank.ADMIN)
|| this.habbo.hasPermission("acc_modtool_ticket_q")) {
this.thread.setPinned(isPinned);
this.thread.setLocked(isLocked);
Emulator.getThreading().run(this.thread);
this.response.init(Outgoing.ThreadUpdateMessageComposer);
this.response.appendInt(this.thread.getGuildId());
this.thread.serialize(this.response);
return this.response;
}
return null;
}
}