mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-26 08:20:51 +01:00
Normal group members can no longer view hidden posts & admins can now hide & unhide posts.
This commit is contained in:
parent
eb36d7018c
commit
eecb8ba8fa
@ -3,8 +3,8 @@ package com.eu.habbo.habbohotel.guilds.forums;
|
||||
public enum ForumThreadState {
|
||||
OPEN(0),
|
||||
CLOSED(1),
|
||||
HIDDEN_BY_ADMIN(10),
|
||||
HIDDEN_BY_STAFF(20);
|
||||
HIDDEN_BY_STAFF_MEMBER(10),
|
||||
HIDDEN_BY_GUILD_ADMIN(20);
|
||||
|
||||
private int stateId;
|
||||
|
||||
|
@ -37,7 +37,7 @@ public class GuildForumModerateMessageEvent extends MessageHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean isStaff = this.client.getHabbo().hasPermission(Permission.ACC_MODTOOL_TICKET_Q);
|
||||
boolean hasStaffPermissions = this.client.getHabbo().hasPermission(Permission.ACC_MODTOOL_TICKET_Q);
|
||||
|
||||
GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guildId, this.client.getHabbo().getHabboInfo().getId());
|
||||
if (member == null) {
|
||||
@ -45,14 +45,14 @@ public class GuildForumModerateMessageEvent extends MessageHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean isAdmin = (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().type < GuildRank.MEMBER.type);
|
||||
boolean isGuildAdministrator = (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().equals(GuildRank.ADMIN));
|
||||
|
||||
if (!isAdmin && !isStaff) {
|
||||
if (!isGuildAdministrator && !hasStaffPermissions) {
|
||||
this.client.sendResponse(new ConnectionErrorComposer(403));
|
||||
return;
|
||||
}
|
||||
|
||||
if (state == ForumThreadState.HIDDEN_BY_STAFF.getStateId() && !isStaff) {
|
||||
if (state == ForumThreadState.HIDDEN_BY_GUILD_ADMIN.getStateId() && !hasStaffPermissions) {
|
||||
this.client.sendResponse(new ConnectionErrorComposer(403));
|
||||
return;
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ public class GuildForumModerateThreadEvent extends MessageHandler {
|
||||
int guildId = packet.readInt();
|
||||
int threadId = packet.readInt();
|
||||
int state = packet.readInt();
|
||||
// STATE 20 - HIDDEN_BY_GUILD_ADMIN = HIDDEN BY GUILD ADMINS/ HOTEL MODERATORS
|
||||
// STATE 1 = VISIBLE THREAD
|
||||
|
||||
Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId);
|
||||
ForumThread thread = ForumThread.getById(threadId);
|
||||
@ -30,29 +32,21 @@ public class GuildForumModerateThreadEvent extends MessageHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean isStaff = this.client.getHabbo().hasPermission(Permission.ACC_MODTOOL_TICKET_Q);
|
||||
|
||||
GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guildId, this.client.getHabbo().getHabboInfo().getId());
|
||||
boolean hasStaffPerms = this.client.getHabbo().hasPermission(Permission.ACC_MODTOOL_TICKET_Q); // check for if they have staff perm
|
||||
boolean isGuildAdmin = (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().equals(GuildRank.ADMIN));
|
||||
|
||||
|
||||
if (member == null) {
|
||||
this.client.sendResponse(new ConnectionErrorComposer(401));
|
||||
return;
|
||||
}
|
||||
|
||||
boolean isAdmin = (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().type < GuildRank.MEMBER.type);
|
||||
|
||||
if (!isAdmin && !isStaff) {
|
||||
if (!isGuildAdmin && !hasStaffPerms) {
|
||||
this.client.sendResponse(new ConnectionErrorComposer(403));
|
||||
return;
|
||||
}
|
||||
|
||||
if (state == ForumThreadState.HIDDEN_BY_STAFF.getStateId() && !isStaff) {
|
||||
this.client.sendResponse(new ConnectionErrorComposer(403));
|
||||
return;
|
||||
}
|
||||
|
||||
thread.setState(ForumThreadState.fromValue(state));
|
||||
thread.setAdminId(this.client.getHabbo().getHabboInfo().getId());
|
||||
|
||||
thread.setState(ForumThreadState.fromValue(state)); // sets state as defined in the packet
|
||||
thread.run();
|
||||
|
||||
switch (state) {
|
||||
|
@ -2,14 +2,21 @@ package com.eu.habbo.messages.incoming.guilds.forums;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.guilds.Guild;
|
||||
import com.eu.habbo.habbohotel.guilds.GuildMember;
|
||||
import com.eu.habbo.habbohotel.guilds.GuildRank;
|
||||
import com.eu.habbo.habbohotel.guilds.GuildState;
|
||||
import com.eu.habbo.habbohotel.guilds.forums.ForumThread;
|
||||
import com.eu.habbo.habbohotel.guilds.forums.ForumThreadState;
|
||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||
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.GuildForumCommentsComposer;
|
||||
import com.eu.habbo.messages.outgoing.guilds.forums.GuildForumDataComposer;
|
||||
import com.eu.habbo.messages.outgoing.handshake.ConnectionErrorComposer;
|
||||
|
||||
|
||||
|
||||
public class GuildForumThreadsMessagesEvent extends MessageHandler {
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
@ -18,20 +25,23 @@ public class GuildForumThreadsMessagesEvent extends MessageHandler {
|
||||
int index = packet.readInt(); // 40
|
||||
int limit = packet.readInt(); // 20
|
||||
|
||||
|
||||
Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId);
|
||||
ForumThread thread = ForumThread.getById(threadId);
|
||||
|
||||
boolean hasStaffPermissions = this.client.getHabbo().hasPermission(Permission.ACC_MODTOOL_TICKET_Q);
|
||||
if (guild == null || thread == null) {
|
||||
this.client.sendResponse(new ConnectionErrorComposer(404));
|
||||
return;
|
||||
}
|
||||
GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guildId, this.client.getHabbo().getHabboInfo().getId());
|
||||
boolean isGuildAdministrator = (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().equals(GuildRank.ADMIN));
|
||||
|
||||
if ((thread.getState() == ForumThreadState.HIDDEN_BY_ADMIN || thread.getState() == ForumThreadState.HIDDEN_BY_STAFF) && guild.getOwnerId() != this.client.getHabbo().getHabboInfo().getId()) {
|
||||
this.client.sendResponse(new BubbleAlertComposer("oldforums.error.access_denied"));
|
||||
} else {
|
||||
if (thread.getState().getStateId() != 20 || hasStaffPermissions || isGuildAdministrator) {
|
||||
this.client.sendResponse(new GuildForumCommentsComposer(guildId, threadId, index, thread.getComments(limit, index)));
|
||||
this.client.sendResponse(new GuildForumDataComposer(guild, this.client.getHabbo()));
|
||||
}
|
||||
else {
|
||||
this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FORUMS_ACCESS_DENIED.key).compose());
|
||||
}
|
||||
|
||||
this.client.sendResponse(new GuildForumDataComposer(guild, this.client.getHabbo()));
|
||||
}
|
||||
}
|
@ -20,6 +20,7 @@ public enum BubbleAlertKeys {
|
||||
FORUMS_MESSAGE_HIDDEN("forums.message.hidden"),
|
||||
FORUMS_MESSAGE_RESTORED("forums.message.restored"),
|
||||
FORUMS_THREAD_HIDDEN("forums.thread.hidden"),
|
||||
FORUMS_ACCESS_DENIED("forums.error.access_denied"),
|
||||
FORUMS_THREAD_LOCKED("forums.thread.locked"),
|
||||
FORUMS_THREAD_PINNED("forums.thread.pinned"),
|
||||
FORUMS_THREAD_RESTORED("forums.thread.restored"),
|
||||
|
Loading…
Reference in New Issue
Block a user