Fixed issues with merging remaining 3.5 features into 4.0 branch

This commit is contained in:
Harmonic 2022-04-21 15:13:51 -07:00
parent a5bc4f9c50
commit 717c7f313b
15 changed files with 30 additions and 32 deletions

View File

@ -367,7 +367,7 @@ public class AchievementManager {
HabboBadge b = new HabboBadge(0, badge, 0, habbo);
Emulator.getThreading().run(b);
habbo.getInventory().getBadgesComponent().addBadge(b);
habbo.getClient().sendResponse(new AddUserBadgeComposer(b));
habbo.getClient().sendResponse(new BadgeReceivedComposer(b));
}
}
}

View File

@ -38,7 +38,7 @@ import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.MessageComposer;
import com.eu.habbo.messages.outgoing.generic.alerts.HabboBroadcastMessageComposer;
import com.eu.habbo.messages.outgoing.generic.alerts.GenericErrorComposer;
import com.eu.habbo.messages.outgoing.guilds.GuildInfoComposer;
import com.eu.habbo.messages.outgoing.guilds.HabboGroupDetailsMessageComposer;
import com.eu.habbo.messages.outgoing.hotelview.CloseConnectionMessageComposer;
import com.eu.habbo.messages.outgoing.inventory.UnseenItemsComposer;
import com.eu.habbo.messages.outgoing.inventory.PetAddedToInventoryComposer;
@ -4285,7 +4285,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
if (!member.isPresent()) continue;
habbo.getClient().sendResponse(new GuildInfoComposer(guild, habbo.getClient(), false, member.get()));
habbo.getClient().sendResponse(new HabboGroupDetailsMessageComposer(guild, habbo.getClient(), false, member.get()));
}
}

View File

@ -9,7 +9,7 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.guilds.GuildMemberMgmtFailedMessageComposer;
import com.eu.habbo.messages.outgoing.guilds.GuildInfoComposer;
import com.eu.habbo.messages.outgoing.guilds.HabboGroupDetailsMessageComposer;
import com.eu.habbo.messages.outgoing.guilds.GuildMembershipRejectedMessageComposer;
import com.eu.habbo.plugin.events.guilds.GuildAcceptedMembershipEvent;
@ -27,13 +27,13 @@ public class GuildAcceptMembershipEvent extends MessageHandler {
if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || groupMember.getRank().equals(GuildRank.ADMIN) || groupMember.getRank().equals(GuildRank.OWNER) || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) {
if (habbo.getHabboStats().hasGuild(guild.getId())) {
if (habbo != null) {
this.client.sendResponse(new GuildAcceptMemberErrorComposer(guild.getId(), GuildAcceptMemberErrorComposer.ALREADY_ACCEPTED));
this.client.sendResponse(new GuildMemberMgmtFailedMessageComposer(guild.getId(), GuildMemberMgmtFailedMessageComposer.ALREADY_ACCEPTED));
return;
} else {
//Check the user has requested
GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, habbo);
if (member == null || member.getRank().type != GuildRank.REQUESTED.type) {
this.client.sendResponse(new GuildAcceptMemberErrorComposer(guild.getId(), GuildAcceptMemberErrorComposer.NO_LONGER_MEMBER));
this.client.sendResponse(new GuildMemberMgmtFailedMessageComposer(guild.getId(), GuildMemberMgmtFailedMessageComposer.NO_LONGER_MEMBER));
return;
} else {
GuildAcceptedMembershipEvent event = new GuildAcceptedMembershipEvent(guild, userId, habbo);
@ -43,11 +43,11 @@ public class GuildAcceptMembershipEvent extends MessageHandler {
Emulator.getGameEnvironment().getGuildManager().joinGuild(guild, this.client, habbo.getHabboInfo().getId(), true);
guild.decreaseRequestCount();
guild.increaseMemberCount();
this.client.sendResponse(new GuildRefreshMembersListComposer(guild));
this.client.sendResponse(new GuildMembershipRejectedMessageComposer(guild));
Room room = habbo.getHabboInfo().getCurrentRoom();
if (room != null) {
if (room.getGuildId() == guildId) {
habbo.getClient().sendResponse(new GuildInfoComposer(guild, habbo.getClient(), false, Emulator.getGameEnvironment().getGuildManager().getGuildMember(guildId, userId)));
habbo.getClient().sendResponse(new HabboGroupDetailsMessageComposer(guild, habbo.getClient(), false, Emulator.getGameEnvironment().getGuildManager().getGuildMember(guildId, userId)));
room.refreshRightsForHabbo(habbo);
}
}

View File

@ -8,7 +8,7 @@ import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.guilds.GuildInfoComposer;
import com.eu.habbo.messages.outgoing.guilds.HabboGroupDetailsMessageComposer;
import com.eu.habbo.messages.outgoing.guilds.GuildMembersComposer;
import com.eu.habbo.messages.outgoing.guilds.GuildMembershipRejectedMessageComposer;
import com.eu.habbo.plugin.events.guilds.GuildDeclinedMembershipEvent;
@ -36,7 +36,7 @@ public class GuildDeclineMembershipEvent extends MessageHandler {
Room room = habbo.getHabboInfo().getCurrentRoom();
if (room != null) {
if (room.getGuildId() == guildId) {
habbo.getClient().sendResponse(new GuildInfoComposer(guild, habbo.getClient(), false, null));
habbo.getClient().sendResponse(new HabboGroupDetailsMessageComposer(guild, habbo.getClient(), false, null));
}
}
}

View File

@ -7,7 +7,7 @@ import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.guilds.GuildInfoComposer;
import com.eu.habbo.messages.outgoing.guilds.HabboGroupDetailsMessageComposer;
import com.eu.habbo.messages.outgoing.guilds.GuildMembershipUpdatedMessageComposer;
import com.eu.habbo.plugin.events.guilds.GuildRemovedAdminEvent;
@ -34,7 +34,7 @@ public class GuildRemoveAdminEvent extends MessageHandler {
Emulator.getGameEnvironment().getGuildManager().removeAdmin(guild, userId);
if (habbo != null) {
habbo.getClient().sendResponse(new GuildInfoComposer(guild, this.client, false, Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild.getId(), userId)));
habbo.getClient().sendResponse(new HabboGroupDetailsMessageComposer(guild, this.client, false, Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild.getId(), userId)));
if (room != null && habbo.getHabboInfo().getCurrentRoom() != null && habbo.getHabboInfo().getCurrentRoom() == room) room.refreshRightsForHabbo(habbo);
}

View File

@ -9,7 +9,7 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.guilds.FavoriteMembershipUpdateMessageComposer;
import com.eu.habbo.messages.outgoing.guilds.GuildInfoComposer;
import com.eu.habbo.messages.outgoing.guilds.HabboGroupDetailsMessageComposer;
import com.eu.habbo.messages.outgoing.guilds.GuildMembershipRejectedMessageComposer;
import com.eu.habbo.plugin.events.guilds.GuildRemovedMemberEvent;
@ -52,7 +52,7 @@ public class GuildRemoveMemberEvent extends MessageHandler {
room.refreshRightsForHabbo(habbo);
}
habbo.getClient().sendResponse(new GuildInfoComposer(guild, habbo.getClient(), false, null));
habbo.getClient().sendResponse(new HabboGroupDetailsMessageComposer(guild, habbo.getClient(), false, null));
}
if (room != null) {

View File

@ -11,7 +11,7 @@ import com.eu.habbo.messages.outgoing.catalog.PurchaseErrorMessageComposer;
import com.eu.habbo.messages.outgoing.catalog.PurchaseOKMessageComposer;
import com.eu.habbo.messages.outgoing.guilds.GuildCreatedMessageComposer;
import com.eu.habbo.messages.outgoing.guilds.GuildEditFailedMessageComposer;
import com.eu.habbo.messages.outgoing.guilds.GuildInfoComposer;
import com.eu.habbo.messages.outgoing.guilds.HabboGroupDetailsMessageComposer;
import com.eu.habbo.plugin.events.guilds.GuildPurchasedEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -99,7 +99,7 @@ public class RequestGuildBuyEvent extends MessageHandler {
this.client.sendResponse(new PurchaseOKMessageComposer());
this.client.sendResponse(new GuildCreatedMessageComposer(guild));
for (Habbo habbo : r.getHabbos()) {
habbo.getClient().sendResponse(new GuildInfoComposer(guild, habbo.getClient(), false, null));
habbo.getClient().sendResponse(new HabboGroupDetailsMessageComposer(guild, habbo.getClient(), false, null));
}
r.refreshGuild(guild);

View File

@ -3,7 +3,7 @@ package com.eu.habbo.messages.incoming.guilds;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.guilds.Guild;
import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.guilds.GuildInfoComposer;
import com.eu.habbo.messages.outgoing.guilds.HabboGroupDetailsMessageComposer;
public class RequestGuildInfoEvent extends MessageHandler {
@Override
@ -14,7 +14,7 @@ public class RequestGuildInfoEvent extends MessageHandler {
Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId);
if (guild != null) {
this.client.sendResponse(new GuildInfoComposer(guild, this.client, newWindow, Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, this.client.getHabbo())));
this.client.sendResponse(new HabboGroupDetailsMessageComposer(guild, this.client, newWindow, Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, this.client.getHabbo())));
}
}
}

View File

@ -5,7 +5,7 @@ import com.eu.habbo.habbohotel.guilds.Guild;
import com.eu.habbo.habbohotel.guilds.GuildState;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.guilds.GuildInfoComposer;
import com.eu.habbo.messages.outgoing.guilds.HabboGroupDetailsMessageComposer;
import com.eu.habbo.messages.outgoing.guilds.HabboGroupJoinFailedMessageComposer;
public class RequestGuildJoinEvent extends MessageHandler {
@ -27,7 +27,7 @@ public class RequestGuildJoinEvent extends MessageHandler {
}
Emulator.getGameEnvironment().getGuildManager().joinGuild(guild, this.client, 0, false);
this.client.sendResponse(new GuildInfoComposer(guild, this.client, false, Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, this.client.getHabbo())));
this.client.sendResponse(new HabboGroupDetailsMessageComposer(guild, this.client, false, Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, this.client.getHabbo())));
Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom();

View File

@ -9,6 +9,7 @@ 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.BubbleAlertKeys;
import com.eu.habbo.messages.outgoing.guilds.forums.ThreadMessagesMessageComposer;
import com.eu.habbo.messages.outgoing.generic.alerts.NotificationDialogMessageComposer;
import com.eu.habbo.messages.outgoing.guilds.forums.ForumDataMessageComposer;
@ -37,8 +38,8 @@ public class GuildForumThreadsMessagesEvent extends MessageHandler {
if (thread.getState() != ForumThreadState.HIDDEN_BY_GUILD_ADMIN || hasStaffPermissions || isGuildAdministrator) {
this.client.sendResponse(new GuildForumCommentsComposer(guildId, threadId, index, thread.getComments(limit, index)));
this.client.sendResponse(new ThreadMessagesMessageComposer(guild, this.client.getHabbo()));
this.client.sendResponse(new ThreadMessagesMessageComposer(guildId, threadId, index, thread.getComments(limit, index)));
this.client.sendResponse(new ForumDataMessageComposer(guild, this.client.getHabbo()));
} else {
this.client.sendResponse(new NotificationDialogMessageComposer(BubbleAlertKeys.FORUMS_ACCESS_DENIED.key).compose());

View File

@ -19,7 +19,7 @@ public class RequestInventoryItemsEvent extends MessageHandler {
int totalItems = this.client.getHabbo().getInventory().getItemsComponent().getItems().size();
if (totalItems == 0) {
this.client.sendResponse(new InventoryItemsComposer(0, 1, new TIntObjectHashMap<>()));
this.client.sendResponse(new FurniListComposer(0, 1, new TIntObjectHashMap<>()));
return;
}

View File

@ -14,13 +14,13 @@ import com.eu.habbo.messages.outgoing.Outgoing;
import java.text.SimpleDateFormat;
import java.util.Date;
public class GuildInfoComposer extends MessageComposer {
public class HabboGroupDetailsMessageComposer extends MessageComposer {
private final Guild guild;
private final GameClient client;
private final boolean newWindow;
private final GuildMember member;
public GuildInfoComposer(Guild guild, GameClient client, boolean newWindow, GuildMember member) {
public HabboGroupDetailsMessageComposer(Guild guild, GameClient client, boolean newWindow, GuildMember member) {
this.guild = guild;
this.client = client;
this.newWindow = newWindow;
@ -30,7 +30,7 @@ public class GuildInfoComposer extends MessageComposer {
@Override
protected ServerMessage composeInternal() {
boolean adminPermissions = this.client.getHabbo().getHabboStats().hasGuild(this.guild.getId()) && this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN) || Emulator.getGameEnvironment().getGuildManager().getOnlyAdmins(guild).get(this.client.getHabbo().getHabboInfo().getId()) != null;
this.response.init(Outgoing.GuildInfoComposer);
this.response.init(Outgoing.HabboGroupDetailsMessageComposer);
this.response.appendInt(this.guild.getId());
this.response.appendBoolean(true);
this.response.appendInt(this.guild.getState().state);

View File

@ -16,7 +16,6 @@ public class IgnoredUsersMessageComposer extends MessageComposer {
@Override
protected ServerMessage composeInternal() {
}
this.response.init(Outgoing.IgnoredUsersMessageComposer);
this.response.appendInt(0);
return this.response;

View File

@ -2,9 +2,7 @@ package com.eu.habbo.messages.rcon;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.habbohotel.users.subscriptions.Subscription;
import com.eu.habbo.messages.outgoing.users.UserDataComposer;
import com.eu.habbo.messages.outgoing.users.UserObjectComposer;
import com.google.gson.Gson;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -37,7 +35,7 @@ public class ChangeUsername extends RCONMessage<ChangeUsername.JSON> {
habbo.alert(Emulator.getTexts().getValue("rcon.alert.user.change_username"));
habbo.getHabboStats().allowNameChange = json.canChange;
habbo.getClient().sendResponse(new UserDataComposer(habbo));
habbo.getClient().sendResponse(new UserObjectComposer(habbo));
} else {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) {
try (PreparedStatement statement = connection.prepareStatement("UPDATE users_settings SET allow_name_change = ? WHERE user_id = ? LIMIT 1")) {

View File

@ -24,6 +24,6 @@ class RemoveFloorItemTask implements Runnable {
this.room.removeHabboItem(this.item);
this.room.updateTile(tile);
this.room.sendComposer(new RemoveFloorItemComposer(this.item, true).compose());
this.room.sendComposer(new HeightMapUpdateMessageComposer(this.item.getX(), this.item.getY(), tile.relativeHeight()).compose());
this.room.sendComposer(new HeightMapUpdateMessageComposer(this.item.getX(), this.item.getY(), tile.z, tile.relativeHeight()).compose());
}
}