Fix reference counting and repeated composer() calls.

This commit is contained in:
Mike 2020-05-09 21:29:49 +02:00
parent 95fab253d8
commit f9d81ea198
483 changed files with 582 additions and 522 deletions

View File

@ -19,7 +19,7 @@ public class RoomUserPetComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.RoomUsersComposer);
this.response.appendInt(1);
this.response.appendInt(this.habbo.getHabboInfo().getId());

View File

@ -6,7 +6,6 @@ import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.users.cache.HabboOfferPurchase;
import com.eu.habbo.messages.outgoing.generic.alerts.BotErrorComposer;
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer;
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;

View File

@ -87,14 +87,7 @@ public class GameClient {
}
public void sendResponse(MessageComposer composer) {
if (this.channel.isOpen()) {
try {
this.channel.write(composer.compose().retain(), this.channel.voidPromise());
this.channel.flush();
} catch (Exception e) {
LOGGER.error("Caught exception", e);
}
}
this.sendResponse(composer.compose());
}
public void sendResponse(ServerMessage response) {

View File

@ -5,7 +5,6 @@ import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.MessageComposer;
import com.eu.habbo.networking.gameserver.GameServerAttributes;
import io.netty.channel.*;
import io.netty.util.AttributeKey;
import java.util.ArrayList;
import java.util.List;

View File

@ -7,7 +7,6 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.HabboGender;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.users.inventory.EffectsComponent;
import com.eu.habbo.messages.outgoing.inventory.UserEffectsListComposer;
import com.eu.habbo.messages.outgoing.rooms.items.RemoveFloorItemComposer;
import com.eu.habbo.threading.runnables.QueryDeleteHabboItem;

View File

@ -11,7 +11,6 @@ import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer;
import gnu.trove.set.hash.THashSet;
import org.apache.commons.math3.util.Pair;
import java.sql.ResultSet;
import java.sql.SQLException;

View File

@ -9,9 +9,6 @@ import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Optional;
public class InteractionPuzzleBox extends HabboItem {
public InteractionPuzzleBox(ResultSet set, Item baseItem) throws SQLException {

View File

@ -16,8 +16,6 @@ import com.eu.habbo.util.pathfinding.Rotation;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;
public class InteractionVendingMachine extends HabboItem {

View File

@ -1,7 +1,6 @@
package com.eu.habbo.habbohotel.modtool;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.bots.BotManager;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room;

View File

@ -1,42 +1,43 @@
package com.eu.habbo.messages;
import com.eu.habbo.util.DebugUtils;
import com.eu.habbo.util.PacketUtils;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufOutputStream;
import io.netty.buffer.Unpooled;
import io.netty.util.IllegalReferenceCountException;
import io.netty.util.ReferenceCounted;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger;
public class ServerMessage implements ReferenceCounted {
private static final Logger LOGGER = LoggerFactory.getLogger(ServerMessage.class);
private boolean initialized;
private int header;
private AtomicInteger refs;
private ByteBufOutputStream stream;
private ByteBuf channelBuffer;
public ServerMessage() {
this.channelBuffer = Unpooled.buffer();
this.stream = new ByteBufOutputStream(this.channelBuffer);
}
public ServerMessage(int header) {
this.header = header;
this.channelBuffer = Unpooled.buffer();
this.stream = new ByteBufOutputStream(this.channelBuffer);
try {
this.stream.writeInt(0);
this.stream.writeShort(header);
} catch (Exception e) {
LOGGER.error("ServerMessage exception", e);
}
this.init(header);
}
public ServerMessage init(int id) {
if (this.initialized) {
throw new ServerMessageException("ServerMessage was already initialized.");
}
this.header = id;
this.refs = new AtomicInteger(0);
this.channelBuffer = Unpooled.buffer();
this.stream = new ByteBufOutputStream(this.channelBuffer);
@ -44,8 +45,9 @@ public class ServerMessage implements ReferenceCounted {
this.stream.writeInt(0);
this.stream.writeShort(id);
} catch (Exception e) {
LOGGER.error("ServerMessage exception", e);
throw new ServerMessageException(e);
}
return this;
}
@ -53,7 +55,7 @@ public class ServerMessage implements ReferenceCounted {
try {
this.stream.write(bytes);
} catch (IOException e) {
LOGGER.error("ServerMessage exception", e);
throw new ServerMessageException(e);
}
}
@ -68,7 +70,7 @@ public class ServerMessage implements ReferenceCounted {
this.stream.writeShort(data.length);
this.stream.write(data);
} catch (IOException e) {
LOGGER.error("ServerMessage exception", e);
throw new ServerMessageException(e);
}
}
@ -76,7 +78,7 @@ public class ServerMessage implements ReferenceCounted {
try {
this.stream.writeChar(obj);
} catch (IOException e) {
LOGGER.error("ServerMessage exception", e);
throw new ServerMessageException(e);
}
}
@ -84,7 +86,7 @@ public class ServerMessage implements ReferenceCounted {
try {
this.stream.writeChars(obj.toString());
} catch (IOException e) {
LOGGER.error("ServerMessage exception", e);
throw new ServerMessageException(e);
}
}
@ -92,7 +94,7 @@ public class ServerMessage implements ReferenceCounted {
try {
this.stream.writeInt(obj);
} catch (IOException e) {
LOGGER.error("ServerMessage exception", e);
throw new ServerMessageException(e);
}
}
@ -105,7 +107,7 @@ public class ServerMessage implements ReferenceCounted {
try {
this.stream.writeInt((int) obj);
} catch (IOException e) {
LOGGER.error("ServerMessage exception", e);
throw new ServerMessageException(e);
}
}
@ -113,7 +115,7 @@ public class ServerMessage implements ReferenceCounted {
try {
this.stream.writeInt(obj ? 1 : 0);
} catch (IOException e) {
LOGGER.error("ServerMessage exception", e);
throw new ServerMessageException(e);
}
}
@ -121,7 +123,7 @@ public class ServerMessage implements ReferenceCounted {
try {
this.stream.writeShort((short) obj);
} catch (IOException e) {
LOGGER.error("ServerMessage exception", e);
throw new ServerMessageException(e);
}
}
@ -129,7 +131,7 @@ public class ServerMessage implements ReferenceCounted {
try {
this.stream.writeByte(b);
} catch (IOException e) {
LOGGER.error("ServerMessage exception", e);
throw new ServerMessageException(e);
}
}
@ -137,7 +139,7 @@ public class ServerMessage implements ReferenceCounted {
try {
this.stream.writeBoolean(obj);
} catch (IOException e) {
LOGGER.error("ServerMessage exception", e);
throw new ServerMessageException(e);
}
}
@ -145,7 +147,7 @@ public class ServerMessage implements ReferenceCounted {
try {
this.stream.writeDouble(d);
} catch (IOException e) {
LOGGER.error("ServerMessage exception", e);
throw new ServerMessageException(e);
}
}
@ -153,7 +155,7 @@ public class ServerMessage implements ReferenceCounted {
try {
this.stream.writeDouble(obj);
} catch (IOException e) {
LOGGER.error("ServerMessage exception", e);
throw new ServerMessageException(e);
}
}
@ -161,7 +163,7 @@ public class ServerMessage implements ReferenceCounted {
try {
this.stream.write(obj.get().array());
} catch (IOException e) {
LOGGER.error("ServerMessage exception", e);
throw new ServerMessageException(e);
}
return this;
@ -187,40 +189,64 @@ public class ServerMessage implements ReferenceCounted {
@Override
public int refCnt() {
return this.channelBuffer.refCnt();
return this.refs.get();
}
@Override
public ReferenceCounted retain() {
this.channelBuffer.retain();
int result = this.refs.incrementAndGet();
if (this.header == 1167 || this.header == 2024 || this.header == 2505) {
System.out.printf("retain Packet: %d Count: %d From: %s%n", this.header, result, DebugUtils.getCallerCallerStacktrace());
}
return this;
}
@Override
public ReferenceCounted retain(int i) {
this.channelBuffer.retain(i);
int result = this.refs.addAndGet(i);
if (this.header == 1167 || this.header == 2024 || this.header == 2505) {
System.out.printf("retain Packet: %d Count: %d From: %s%n", this.header, result, DebugUtils.getCallerCallerStacktrace());
}
return this;
}
@Override
public ReferenceCounted touch() {
this.channelBuffer.touch();
return this;
}
@Override
public ReferenceCounted touch(Object o) {
this.channelBuffer.touch(o);
return this;
}
@Override
public boolean release() {
return this.channelBuffer.release();
return this.release(1);
}
@Override
public boolean release(int i) {
return this.channelBuffer.release(i);
int value = this.refs.addAndGet(-i);
if (this.header == 1167 || this.header == 2024 || this.header == 2505) {
System.out.printf("release Packet: %d Count: %d From: %s%n", this.header, value, DebugUtils.getCallerCallerStacktrace());
}
if (value < 0) {
throw new IllegalReferenceCountException("Decremented below 0 (packet " + this.header + " value " + value + ").");
}
if (value == 0) {
this.channelBuffer.release();
return true;
}
return false;
}
}

View File

@ -0,0 +1,20 @@
package com.eu.habbo.messages;
public class ServerMessageException extends RuntimeException {
public ServerMessageException() {
}
public ServerMessageException(String message) {
super(message);
}
public ServerMessageException(String message, Throwable cause) {
super(message, cause);
}
public ServerMessageException(Throwable cause) {
super(cause);
}
}

View File

@ -4,7 +4,6 @@ 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.GuildFavoriteRoomUserUpdateComposer;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUsersAddGuildBadgeComposer;
import com.eu.habbo.messages.outgoing.users.UserProfileComposer;
import com.eu.habbo.plugin.events.guilds.GuildRemovedFavoriteEvent;

View File

@ -12,7 +12,7 @@ public class IsFirstLoginOfDayComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.IsFirstLoginOfDayComposer);
this.response.appendBoolean(this.isFirstLoginOfDay);
return this.response;

View File

@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing;
public class UnknownComposer5 extends MessageComposer {
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.UnknownComposer5);
this.response.appendString(""); //Box color
this.response.appendString(""); //Key color

View File

@ -1,7 +1,6 @@
package com.eu.habbo.messages.incoming.rooms.items.youtube;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.YoutubeManager;
import com.eu.habbo.habbohotel.items.interactions.InteractionYoutubeTV;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room;

View File

@ -1,6 +1,5 @@
package com.eu.habbo.messages.incoming.rooms.users;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@ -8,7 +7,6 @@ import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer;
import com.eu.habbo.plugin.events.users.UserIdleEvent;
public class RoomUserLookAtPoint extends MessageHandler {
@Override

View File

@ -3,11 +3,23 @@ package com.eu.habbo.messages.outgoing;
import com.eu.habbo.messages.ServerMessage;
public abstract class MessageComposer {
private ServerMessage composed;
protected final ServerMessage response;
protected MessageComposer() {
this.composed = null;
this.response = new ServerMessage();
}
public abstract ServerMessage compose();
protected abstract ServerMessage composeInternal();
public ServerMessage compose() {
if (this.composed == null) {
this.composed = this.composeInternal();
}
return this.composed;
}
}

View File

@ -21,7 +21,7 @@ public class AchievementListComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.AchievementListComposer);
try {

View File

@ -18,7 +18,7 @@ public class AchievementProgressComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.AchievementProgressComposer);
int achievementProgress;

View File

@ -17,7 +17,7 @@ public class AchievementUnlockedComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.AchievementUnlockedComposer);
AchievementLevel level = this.achievement.getLevelForProgress(this.habbo.getHabboStats().getAchievementProgress(this.achievement));

View File

@ -17,7 +17,7 @@ public class TalentLevelUpdateComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.TalentLevelUpdateComposer);
this.response.appendString(this.talentTrackType.name());
this.response.appendInt(this.talentTrackLevel.level);

View File

@ -23,7 +23,7 @@ public class TalentTrackComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.TalentTrackComposer);
this.response.appendString(this.type.name().toLowerCase());

View File

@ -14,7 +14,7 @@ public class CameraCompetitionStatusComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.CameraCompetitionStatusComposer);
this.response.appendBoolean(this.unknownBoolean);
this.response.appendString(this.unknownString);

View File

@ -16,7 +16,7 @@ public class CameraPriceComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.CameraPriceComposer);
this.response.appendInt(this.credits);
this.response.appendInt(this.points);

View File

@ -16,7 +16,7 @@ public class CameraPublishWaitMessageComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.CameraPublishWaitMessageComposer);
this.response.appendBoolean(this.isOk);

View File

@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing;
public class CameraPurchaseSuccesfullComposer extends MessageComposer {
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.CameraPurchaseSuccesfullComposer);
return this.response;
}

View File

@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing;
public class CameraRoomThumbnailSavedComposer extends MessageComposer {
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.CameraRoomThumbnailSavedComposer);
return this.response;
}

View File

@ -12,7 +12,7 @@ public class CameraURLComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.CameraURLComposer);
this.response.appendString(this.URL);
return this.response;

View File

@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing;
public class AlertLimitedSoldOutComposer extends MessageComposer {
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.AlertLimitedSoldOutComposer);
return this.response;
}

View File

@ -15,7 +15,7 @@ public class AlertPurchaseFailedComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.AlertPurchaseFailedComposer);
this.response.appendInt(this.error);
return this.response;

View File

@ -15,7 +15,7 @@ public class AlertPurchaseUnavailableComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.AlertPurchaseUnavailableComposer);
this.response.appendInt(this.code);
return this.response;

View File

@ -12,7 +12,7 @@ public class CatalogModeComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.CatalogModeComposer);
this.response.appendInt(this.mode);
return this.response;

View File

@ -29,7 +29,7 @@ public class CatalogPageComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.CatalogPageComposer);
this.response.appendInt(this.page.getId());
this.response.appendString(this.mode);

View File

@ -25,7 +25,7 @@ public class CatalogPagesListComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
try {
List<CatalogPage> pages = Emulator.getGameEnvironment().getCatalogManager().getCatalogPages(-1, this.habbo);

View File

@ -13,7 +13,7 @@ public class CatalogSearchResultComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.CatalogSearchResultComposer);
this.item.serialize(this.response);
return this.response;

View File

@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing;
public class CatalogUpdatedComposer extends MessageComposer {
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.CatalogUpdatedComposer);
this.response.appendBoolean(false);
return this.response;

View File

@ -24,7 +24,7 @@ public class ClubCenterDataComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.ClubCenterDataComposer);
this.response.appendInt(this.streakDuration); //streakduration in days
this.response.appendString(this.joinDate); //joindate

View File

@ -20,7 +20,7 @@ public class ClubDataComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.ClubDataComposer);
List<ClubOffer> offers = Emulator.getGameEnvironment().getCatalogManager().getClubOffers();

View File

@ -12,7 +12,7 @@ import java.util.NoSuchElementException;
public class ClubGiftsComposer extends MessageComposer {
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.ClubGiftsComposer);
this.response.appendInt(0); //Days Until Next Gift

View File

@ -12,7 +12,7 @@ public class DiscountComposer extends MessageComposer {
public static int[] ADDITIONAL_DISCOUNT_THRESHOLDS = new int[]{40, 99};
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.DiscountComposer);
this.response.appendInt(MAXIMUM_ALLOWED_ITEMS);

View File

@ -9,7 +9,7 @@ import java.util.Map;
public class GiftConfigurationComposer extends MessageComposer {
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.GiftConfigurationComposer);
this.response.appendBoolean(true);
this.response.appendInt(Emulator.getConfig().getInt("hotel.gifts.special.price", 2));

View File

@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing;
public class GiftReceiverNotFoundComposer extends MessageComposer {
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.GiftReceiverNotFoundComposer);
return this.response;
}

View File

@ -16,7 +16,7 @@ public class NotEnoughPointsTypeComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.NotEnoughPointsTypeComposer);
this.response.appendBoolean(this.isCredits);
this.response.appendBoolean(this.isPixels);

View File

@ -15,7 +15,7 @@ public class PetBoughtNotificationComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.PetBoughtNotificationComposer);
this.response.appendBoolean(this.gift);
this.pet.serialize(this.response);

View File

@ -16,7 +16,7 @@ public class PetBreedsComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
if (this.petRaces == null)
return null;
this.response.init(Outgoing.PetBreedsComposer);

View File

@ -20,7 +20,7 @@ public class PetNameErrorComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.PetNameErrorComposer);
this.response.appendInt(this.type);
this.response.appendString(this.value);

View File

@ -17,7 +17,7 @@ public class PurchaseOKComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.PurchaseOKComposer);
if (this.catalogItem != null) {
this.catalogItem.serialize(this.response);

View File

@ -15,7 +15,7 @@ public class RecyclerCompleteComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.RecyclerCompleteComposer);
this.response.appendInt(this.code);
this.response.appendInt(0); //prize ID.

View File

@ -11,7 +11,7 @@ import java.util.Map;
public class RecyclerLogicComposer extends MessageComposer {
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.RecyclerLogicComposer);
this.response.appendInt(Emulator.getGameEnvironment().getCatalogManager().prizes.size());
for (Map.Entry<Integer, THashSet<Item>> map : Emulator.getGameEnvironment().getCatalogManager().prizes.entrySet()) {

View File

@ -15,7 +15,7 @@ public class RedeemVoucherErrorComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.RedeemVoucherErrorComposer);
this.response.appendString(this.code + "");
return this.response;

View File

@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing;
public class RedeemVoucherOKComposer extends MessageComposer {
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.RedeemVoucherOKComposer);
this.response.appendString("");
this.response.appendString("");

View File

@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing;
public class ReloadRecyclerComposer extends MessageComposer {
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.ReloadRecyclerComposer);
this.response.appendInt(1);
this.response.appendInt(0);

View File

@ -17,7 +17,7 @@ public class TargetedOfferComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.TargetedOfferComposer);
HabboOfferPurchase purchase = HabboOfferPurchase.getOrCreate(this.habbo, this.offer.getId());
this.offer.serialize(this.response, purchase);

View File

@ -23,7 +23,7 @@ public class MarketplaceBuyErrorComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.MarketplaceBuyErrorComposer);
this.response.appendInt(this.errorCode); //result
this.response.appendInt(this.unknown); //newOfferId

View File

@ -15,7 +15,7 @@ public class MarketplaceCancelSaleComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.MarketplaceCancelSaleComposer);
this.response.appendInt(this.offer.getOfferId());
this.response.appendBoolean(this.success);

View File

@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing;
public class MarketplaceConfigComposer extends MessageComposer {
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.MarketplaceConfigComposer);
this.response.appendBoolean(true);
this.response.appendInt(1); //Commision Percentage.

View File

@ -13,7 +13,7 @@ public class MarketplaceItemInfoComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.MarketplaceItemInfoComposer);
MarketPlace.serializeItemInfo(this.itemId, this.response);
return this.response;

View File

@ -17,7 +17,7 @@ public class MarketplaceItemPostedComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.MarketplaceItemPostedComposer);
this.response.appendInt(this.code);
return this.response;

View File

@ -16,7 +16,7 @@ public class MarketplaceOffersComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.MarketplaceOffersComposer);
int total = 0;
this.response.appendInt(this.offers.size());

View File

@ -20,7 +20,7 @@ public class MarketplaceOwnItemsComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.MarketplaceOwnItemsComposer);
this.response.appendInt(this.habbo.getInventory().getSoldPriceTotal());
this.response.appendInt(this.habbo.getInventory().getMarketplaceItems().size());

View File

@ -20,7 +20,7 @@ public class MarketplaceSellItemComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.MarketplaceSellItemComposer);
this.response.appendInt(this.errorCode);
this.response.appendInt(this.valueA);

View File

@ -19,7 +19,7 @@ public class CraftableProductsComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.CraftableProductsComposer);
this.response.appendInt(this.recipes.size());

View File

@ -16,7 +16,7 @@ public class CraftingRecipeComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.CraftingRecipeComposer);
this.response.appendInt(this.recipe.getIngredients().size());

View File

@ -14,7 +14,7 @@ public class CraftingRecipesAvailableComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.CraftingComposerFour);
this.response.appendInt((this.found ? -1 : 0) + this.count);
this.response.appendBoolean(this.found);

View File

@ -20,7 +20,7 @@ public class CraftingResultComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.CraftingResultComposer);
this.response.appendBoolean(this.succes); //succes

View File

@ -22,7 +22,7 @@ public class AdventCalendarDataComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.AdventCalendarDataComposer);
this.response.appendString(this.eventName);
this.response.appendString("");

View File

@ -16,7 +16,7 @@ public class AdventCalendarProductComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.AdventCalendarProductComposer);
this.response.appendBoolean(this.visible);
this.response.appendString(this.rewardObject.getItem().getName());

View File

@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing;
public class MysticBoxCloseComposer extends MessageComposer {
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.MysticBoxCloseComposer);
return this.response;
}

View File

@ -14,7 +14,7 @@ public class MysticBoxPrizeComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.MysticBoxPrizeComposer);
this.response.appendString(this.type);
this.response.appendInt(this.itemId);

View File

@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing;
public class MysticBoxStartOpenComposer extends MessageComposer {
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.MysticBoxStartOpenComposer);
return this.response;
}

View File

@ -12,7 +12,7 @@ public class NewYearResolutionCompletedComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.NewYearResolutionCompletedComposer);
this.response.appendString(this.badge);
this.response.appendString(this.badge);

View File

@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing;
public class NewYearResolutionComposer extends MessageComposer {
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
//:test 817 i:230 i:1 i:1 i:1 s:NY2013RES i:3 i:0 i:60000000
this.response.init(Outgoing.NewYearResolutionComposer);

View File

@ -22,7 +22,7 @@ public class NewYearResolutionProgressComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.NewYearResolutionProgressComposer);
this.response.appendInt(this.stuffId);
this.response.appendInt(this.achievementId);

View File

@ -15,7 +15,7 @@ public class FloorPlanEditorBlockedTilesComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.FloorPlanEditorBlockedTilesComposer);
THashSet<RoomTile> tileList = this.room.getLockedTiles();

View File

@ -13,7 +13,7 @@ public class FloorPlanEditorDoorSettingsComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.FloorPlanEditorDoorSettingsComposer);
this.response.appendInt(this.room.getLayout().getDoorX());
this.response.appendInt(this.room.getLayout().getDoorY());

View File

@ -25,7 +25,7 @@ public class FriendChatMessageComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.FriendChatMessageComposer);
this.response.appendInt(this.toId);
this.response.appendString(this.message.getMessage());

View File

@ -15,7 +15,7 @@ public class FriendFindingRoomComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.FriendFindingRoomComposer);
this.response.appendInt(this.errorCode);
return this.response;

View File

@ -24,7 +24,7 @@ public class FriendNotificationComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.FriendToolbarNotificationComposer);
this.response.appendString(this.userId + "");
this.response.appendInt(this.type);

View File

@ -13,7 +13,7 @@ public class FriendRequestComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.FriendRequestComposer);
this.response.appendInt(this.habbo.getHabboInfo().getId());

View File

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

View File

@ -22,7 +22,7 @@ public class FriendsComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
try {
this.response.init(Outgoing.FriendsComposer);

View File

@ -14,7 +14,7 @@ public class LoadFriendRequestsComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.LoadFriendRequestsComposer);
synchronized (this.habbo.getMessenger().getFriendRequests()) {

View File

@ -14,7 +14,7 @@ public class MessengerInitComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.MessengerInitComposer);
if (this.habbo.hasPermission("acc_infinite_friends")) {
this.response.appendInt(Integer.MAX_VALUE);

View File

@ -18,7 +18,7 @@ public class RemoveFriendComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.UpdateFriendComposer);
this.response.appendInt(0);

View File

@ -14,7 +14,7 @@ public class RoomInviteComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.RoomInviteComposer);
this.response.appendInt(this.userId);
this.response.appendString(this.message);

View File

@ -17,7 +17,7 @@ public class RoomInviteErrorComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.RoomInviteErrorComposer);
this.response.appendInt(this.errorCode);
this.response.appendInt(this.buddies.size());

View File

@ -17,7 +17,7 @@ public class StalkErrorComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.StalkErrorComposer);
this.response.appendInt(this.errorCode);
return this.response;

View File

@ -22,7 +22,7 @@ public class UpdateFriendComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.UpdateFriendComposer);
if (this.buddy != null) {

View File

@ -25,7 +25,7 @@ public class UserSearchResultComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.UserSearchResultComposer);
List<MessengerBuddy> u = new ArrayList<>();

View File

@ -14,7 +14,7 @@ public class GameCenterAccountInfoComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.GameCenterAccountInfoComposer);
this.response.appendInt(this.gameId);
this.response.appendInt(this.gamesLeft);

View File

@ -5,7 +5,7 @@ import com.eu.habbo.messages.outgoing.MessageComposer;
public class GameCenterAchievementsConfigurationComposer extends MessageComposer {
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(2265);
this.response.appendInt(0);
this.response.appendInt(0);

View File

@ -17,7 +17,7 @@ public class GameCenterGameComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.GameCenterGameComposer);
this.response.appendInt(this.gameId);
this.response.appendInt(this.status);

View File

@ -7,7 +7,7 @@ import com.eu.habbo.messages.outgoing.Outgoing;
public class GameCenterGameListComposer extends MessageComposer {
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.GameCenterGameListComposer);
this.response.appendInt(2);//Count

View File

@ -12,7 +12,7 @@ public class BaseJumpJoinQueueComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.BaseJumpJoinQueueComposer);
this.response.appendInt(this.gameId);
return this.response;

View File

@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing;
public class BaseJumpLeaveQueueComposer extends MessageComposer {
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.BaseJumpLeaveQueueComposer);
this.response.appendInt(3);
return this.response;

View File

@ -18,7 +18,7 @@ public class BaseJumpLoadGameComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.BaseJumpLoadGameComposer);
if (this.game == 3) {

View File

@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing;
public class BaseJumpLoadGameURLComposer extends MessageComposer {
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.BaseJumpLoadGameURLComposer);
this.response.appendInt(4);
this.response.appendString("1351418858673");

View File

@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing;
public class BaseJumpUnloadGameComposer extends MessageComposer {
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.BaseJumpUnloadGameComposer);
this.response.appendInt(3);
this.response.appendString("basejump");

View File

@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing;
public class MinimailCountComposer extends MessageComposer {
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.MinimailCountComposer);
this.response.appendInt(0);
return this.response;

View File

@ -12,7 +12,7 @@ public class PickMonthlyClubGiftNotificationComposer extends MessageComposer {
}
@Override
public ServerMessage compose() {
protected ServerMessage composeInternal() {
this.response.init(Outgoing.PickMonthlyClubGiftNotificationComposer);
this.response.appendInt(this.count);
return this.response;

Some files were not shown because too many files have changed in this diff Show More