You've already forked Arcturus-Morningstar-Extended
mirror of
https://github.com/duckietm/Arcturus-Morningstar-Extended.git
synced 2026-06-19 23:16:19 +00:00
🆙 Security and fixes update 03-02-2026
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.eu.habbo</groupId>
|
||||
<artifactId>Habbo</artifactId>
|
||||
<version>4.0.3</version>
|
||||
<version>4.0.5</version>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
@@ -38,7 +38,7 @@ public final class Emulator {
|
||||
|
||||
public final static int MAJOR = 4;
|
||||
public final static int MINOR = 0;
|
||||
public final static int BUILD = 3;
|
||||
public final static int BUILD = 5;
|
||||
public final static String PREVIEW = "";
|
||||
|
||||
public static final String version = "Arcturus Morningstar" + " " + MAJOR + "." + MINOR + "." + BUILD + " " + PREVIEW;
|
||||
@@ -229,70 +229,30 @@ public final class Emulator {
|
||||
|
||||
LOGGER.info("Stopping Arcturus Morningstar {}", version);
|
||||
|
||||
try {
|
||||
if (Emulator.getPluginManager() != null)
|
||||
Emulator.getPluginManager().fireEvent(new EmulatorStartShutdownEvent());
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
try {
|
||||
if (Emulator.cameraClient != null)
|
||||
Emulator.cameraClient.disconnect();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
try {
|
||||
if (Emulator.rconServer != null)
|
||||
Emulator.rconServer.stop();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
try {
|
||||
if (Emulator.gameEnvironment != null)
|
||||
Emulator.gameEnvironment.dispose();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
try {
|
||||
if (Emulator.getPluginManager() != null)
|
||||
Emulator.getPluginManager().fireEvent(new EmulatorStoppedEvent());
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
try {
|
||||
if (Emulator.pluginManager != null)
|
||||
Emulator.pluginManager.dispose();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
try {
|
||||
if (Emulator.config != null) {
|
||||
Emulator.config.saveToDatabase();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
try {
|
||||
if (Emulator.gameServer != null)
|
||||
Emulator.gameServer.stop();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
if (Emulator.pluginManager != null)
|
||||
tryShutdown(() -> Emulator.pluginManager.fireEvent(new EmulatorStartShutdownEvent()));
|
||||
if (Emulator.cameraClient != null) tryShutdown(() -> Emulator.cameraClient.disconnect());
|
||||
if (Emulator.rconServer != null) tryShutdown(() -> Emulator.rconServer.stop());
|
||||
if (Emulator.gameEnvironment != null) tryShutdown(() -> Emulator.gameEnvironment.dispose());
|
||||
if (Emulator.pluginManager != null)
|
||||
tryShutdown(() -> Emulator.pluginManager.fireEvent(new EmulatorStoppedEvent()));
|
||||
if (Emulator.pluginManager != null) tryShutdown(() -> Emulator.pluginManager.dispose());
|
||||
if (Emulator.config != null) tryShutdown(() -> Emulator.config.saveToDatabase());
|
||||
if (Emulator.gameServer != null) tryShutdown(() -> Emulator.gameServer.stop());
|
||||
|
||||
LOGGER.info("Stopped Arcturus Morningstar {}", version);
|
||||
|
||||
if (Emulator.database != null) {
|
||||
Emulator.getDatabase().dispose();
|
||||
}
|
||||
if (Emulator.database != null) tryShutdown(() -> Emulator.database.dispose());
|
||||
if (Emulator.threading != null) tryShutdown(() -> Emulator.threading.shutDown());
|
||||
|
||||
Emulator.stopped = true;
|
||||
}
|
||||
|
||||
// if (osName.startsWith("Windows") && (!classPath.contains("idea_rt.jar"))) {
|
||||
// AnsiConsole.systemUninstall();
|
||||
// }
|
||||
private static void tryShutdown(Runnable action) {
|
||||
try {
|
||||
if (Emulator.threading != null)
|
||||
|
||||
Emulator.threading.shutDown();
|
||||
action.run();
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error during shutdown", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+12
-7
@@ -120,7 +120,7 @@ public class MarketPlace {
|
||||
if (maxPrice > 0 && maxPrice > minPrice) {
|
||||
query += " AND CEIL(price + (price / 100)) <= " + maxPrice;
|
||||
}
|
||||
if (search.length() > 0) {
|
||||
if (!search.isEmpty()) {
|
||||
query += " AND ( bi.public_name LIKE ? OR ci.catalog_name LIKE ? ) ";
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ public class MarketPlace {
|
||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement(query)) {
|
||||
statement.setInt(1, Emulator.getIntUnixTimestamp() - 172800);
|
||||
statement.setInt(2, Emulator.getIntUnixTimestamp() - 172800);
|
||||
if (search.length() > 0) {
|
||||
if (!search.isEmpty()) {
|
||||
statement.setString(3, "%" + search + "%");
|
||||
statement.setString(4, "%" + search + "%");
|
||||
}
|
||||
@@ -257,11 +257,6 @@ public class MarketPlace {
|
||||
} else if ((MARKETPLACE_CURRENCY == 0 && price > client.getHabbo().getHabboInfo().getCredits()) || (MARKETPLACE_CURRENCY > 0 && price > client.getHabbo().getHabboInfo().getCurrencyAmount(MARKETPLACE_CURRENCY))) {
|
||||
client.sendResponse(new MarketplaceBuyErrorComposer(MarketplaceBuyErrorComposer.NOT_ENOUGH_CREDITS, 0, offerId, price));
|
||||
} else {
|
||||
try (PreparedStatement updateOffer = connection.prepareStatement("UPDATE marketplace_items SET state = 2, sold_timestamp = ? WHERE id = ?")) {
|
||||
updateOffer.setInt(1, Emulator.getIntUnixTimestamp());
|
||||
updateOffer.setInt(2, offerId);
|
||||
updateOffer.execute();
|
||||
}
|
||||
Habbo habbo = Emulator.getGameServer().getGameClientManager().getHabbo(set.getInt("user_id"));
|
||||
HabboItem item = Emulator.getGameEnvironment().getItemManager().loadHabboItem(itemSet);
|
||||
|
||||
@@ -269,6 +264,16 @@ public class MarketPlace {
|
||||
if (Emulator.getPluginManager().fireEvent(event).isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
try (PreparedStatement updateOffer = connection.prepareStatement("UPDATE marketplace_items SET state = 2, sold_timestamp = ? WHERE id = ? AND state = 1")) {
|
||||
updateOffer.setInt(1, Emulator.getIntUnixTimestamp());
|
||||
updateOffer.setInt(2, offerId);
|
||||
int updated = updateOffer.executeUpdate();
|
||||
if (updated == 0) {
|
||||
sendErrorMessage(client, set.getInt("item_id"), offerId);
|
||||
return;
|
||||
}
|
||||
}
|
||||
event.price = calculateCommision(event.price);
|
||||
|
||||
item.setUserId(client.getHabbo().getHabboInfo().getId());
|
||||
|
||||
@@ -3,11 +3,7 @@ package com.eu.habbo.habbohotel.pets;
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionNest;
|
||||
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionPetDrink;
|
||||
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionPetFood;
|
||||
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionPetToy;
|
||||
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionPetTrampoline;
|
||||
import com.eu.habbo.habbohotel.items.interactions.pets.*;
|
||||
import com.eu.habbo.habbohotel.pets.actions.*;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||
@@ -332,19 +328,13 @@ public class PetManager {
|
||||
}
|
||||
|
||||
public THashSet<PetRace> getBreeds(String petName) {
|
||||
if (!petName.startsWith("a0 pet")) {
|
||||
LOGGER.error("Pet {} not found. Make sure it matches the pattern \"a0 pet<pet_id>\"!", petName);
|
||||
if (!petName.matches("a0 pet\\d{1,3}")) {
|
||||
LOGGER.error("Pet data '{}' not found. Expected format: a0 pet<0-999>", petName);
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
int petId = Integer.parseInt(petName.split("t")[1]);
|
||||
return this.petRaces.get(petId);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Caught exception", e);
|
||||
}
|
||||
|
||||
return null;
|
||||
final int petId = Integer.parseInt(petName.substring(6));
|
||||
return this.petRaces.get(petId);
|
||||
}
|
||||
|
||||
public TIntObjectHashMap<ArrayList<PetBreedingReward>> getBreedingRewards(int petType) {
|
||||
|
||||
+5
@@ -37,6 +37,11 @@ import java.util.Calendar;
|
||||
public class CatalogBuyItemAsGiftEvent extends MessageHandler {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(CatalogBuyItemAsGiftEvent.class);
|
||||
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
if (Emulator.getIntUnixTimestamp() - this.client.getHabbo().getHabboStats().lastGiftTimestamp >= CatalogManager.PURCHASE_COOLDOWN) {
|
||||
|
||||
+28
-32
@@ -20,10 +20,9 @@ import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
|
||||
import com.eu.habbo.messages.outgoing.generic.alerts.HotelWillCloseInMinutesComposer;
|
||||
import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer;
|
||||
import com.eu.habbo.messages.outgoing.navigator.CanCreateRoomComposer;
|
||||
import com.eu.habbo.messages.outgoing.users.*;
|
||||
import com.eu.habbo.messages.outgoing.users.AddUserBadgeComposer;
|
||||
import com.eu.habbo.threading.runnables.ShutdownEmulator;
|
||||
import gnu.trove.map.hash.THashMap;
|
||||
import gnu.trove.procedure.TObjectProcedure;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import static com.eu.habbo.messages.incoming.catalog.CheckPetNameEvent.PET_NAME_LENGTH_MAXIMUM;
|
||||
@@ -31,6 +30,10 @@ import static com.eu.habbo.messages.incoming.catalog.CheckPetNameEvent.PET_NAME_
|
||||
|
||||
public class CatalogBuyItemEvent extends MessageHandler {
|
||||
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 250;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
@@ -61,13 +64,11 @@ public class CatalogBuyItemEvent extends MessageHandler {
|
||||
if (pageId == -12345678 || pageId == -1) {
|
||||
CatalogItem searchedItem = Emulator.getGameEnvironment().getCatalogManager().getCatalogItem(itemId);
|
||||
|
||||
if (searchedItem.getOfferId() > 0) {
|
||||
if (searchedItem != null && searchedItem.getOfferId() > 0) {
|
||||
page = Emulator.getGameEnvironment().getCatalogManager().getCatalogPage(searchedItem.getPageId());
|
||||
|
||||
if(page != null) {
|
||||
if (page.getCatalogItem(itemId).getOfferId() <= 0) {
|
||||
page = null;
|
||||
} else if (page.getRank() > this.client.getHabbo().getHabboInfo().getRank().getId()) {
|
||||
if (page.getRank() > this.client.getHabbo().getHabboInfo().getRank().getId()) {
|
||||
page = null;
|
||||
} else if (page.getLayout() != null && page.getLayout().equalsIgnoreCase(CatalogPageLayouts.club_gift.name())) {
|
||||
page = null;
|
||||
@@ -83,12 +84,9 @@ public class CatalogBuyItemEvent extends MessageHandler {
|
||||
|
||||
if (page instanceof RoomBundleLayout) {
|
||||
final CatalogItem[] item = new CatalogItem[1];
|
||||
page.getCatalogItems().forEachValue(new TObjectProcedure<CatalogItem>() {
|
||||
@Override
|
||||
public boolean execute(CatalogItem object) {
|
||||
item[0] = object;
|
||||
return false;
|
||||
}
|
||||
page.getCatalogItems().forEachValue(object -> {
|
||||
item[0] = object;
|
||||
return false;
|
||||
});
|
||||
|
||||
CatalogItem roomBundleItem = item[0];
|
||||
@@ -100,20 +98,19 @@ public class CatalogBuyItemEvent extends MessageHandler {
|
||||
int maxRooms = this.client.getHabbo().getHabboStats().hasActiveClub() ? RoomManager.MAXIMUM_ROOMS_HC : RoomManager.MAXIMUM_ROOMS_USER;
|
||||
|
||||
if (roomCount >= maxRooms) { // checks if a user has the maximum rooms
|
||||
this.client.sendResponse(new CanCreateRoomComposer(roomCount, maxRooms)); // if so throws the max room error.
|
||||
this.client.sendResponse(new PurchaseOKComposer(null)); // Send this so the alert disappears, not sure if this is how it should be handled :S
|
||||
return;
|
||||
this.client.sendResponse(new CanCreateRoomComposer(roomCount, maxRooms)); // if so throws the max room error.
|
||||
this.client.sendResponse(new PurchaseOKComposer(null)); // Send this so the alert disappears, not sure if this is how it should be handled :S
|
||||
return;
|
||||
}
|
||||
((RoomBundleLayout) page).buyRoom(this.client.getHabbo());
|
||||
if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_CREDITS)) { //if the player has this perm disabled
|
||||
this.client.getHabbo().giveCredits(-roomBundleItem.getCredits()); // takes their credits away
|
||||
}
|
||||
if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_POINTS)) { //if the player has this perm disabled
|
||||
this.client.getHabbo().givePoints(roomBundleItem.getPointsType(), -roomBundleItem.getPoints()); // takes their points away
|
||||
}
|
||||
this.client.sendResponse(new PurchaseOKComposer()); // Sends the composer to close the window.
|
||||
((RoomBundleLayout) page).buyRoom(this.client.getHabbo());
|
||||
if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_CREDITS)) { //if the player has this perm disabled
|
||||
this.client.getHabbo().giveCredits(-roomBundleItem.getCredits()); // takes their credits away
|
||||
}
|
||||
if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_POINTS)) { //if the player has this perm disabled
|
||||
this.client.getHabbo().givePoints(roomBundleItem.getPointsType(), -roomBundleItem.getPoints()); // takes their points away
|
||||
}
|
||||
this.client.sendResponse(new PurchaseOKComposer()); // Sends the composer to close the window.
|
||||
|
||||
final boolean[] badgeFound = {false};
|
||||
item[0].getBaseItems().stream().filter(i -> i.getType() == FurnitureType.BADGE).forEach(i -> {
|
||||
if (!this.client.getHabbo().getInventory().getBadgesComponent().hasBadge(i.getName())) {
|
||||
HabboBadge badge = new HabboBadge(0, i.getName(), 0, this.client.getHabbo());
|
||||
@@ -124,9 +121,7 @@ public class CatalogBuyItemEvent extends MessageHandler {
|
||||
keys.put("display", "BUBBLE");
|
||||
keys.put("image", "${image.library.url}album1584/" + badge.getCode() + ".gif");
|
||||
keys.put("message", Emulator.getTexts().getValue("commands.generic.cmd_badge.received"));
|
||||
this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.RECEIVED_BADGE.key, keys)); //:test 1992 s:npc.gift.received i:2 s:npc_name s:Admin s:image s:${image.library.url}album1584/ADM.gif);
|
||||
} else {
|
||||
badgeFound[0] = true;
|
||||
this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.RECEIVED_BADGE.key, keys));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -191,7 +186,7 @@ public class CatalogBuyItemEvent extends MessageHandler {
|
||||
|
||||
this.client.sendResponse(new PurchaseOKComposer(null));
|
||||
this.client.sendResponse(new InventoryRefreshComposer());
|
||||
|
||||
|
||||
this.client.getHabbo().getHabboStats().run();
|
||||
}
|
||||
return;
|
||||
@@ -211,15 +206,16 @@ public class CatalogBuyItemEvent extends MessageHandler {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (page instanceof PetsLayout) { // checks it's the petlayout
|
||||
if (page instanceof PetsLayout) {
|
||||
if (!this.client.getHabbo().hasPermission(Permission.ACC_UNLIMITED_PETS) && this.client.getHabbo().getInventory().getPetsComponent().getPets().size() >= PetManager.MAXIMUM_PET_INVENTORY_SIZE) {
|
||||
this.client.getHabbo().alert(Emulator.getTexts().getValue("error.pets.max.inventory").replace("%amount%", PetManager.MAXIMUM_PET_INVENTORY_SIZE + ""));
|
||||
return;
|
||||
}
|
||||
String[] check = extraData.split("\n"); // splits the extradata
|
||||
if ((check.length != 3) || (check[0].length() < PET_NAME_LENGTH_MINIMUM) || (check[0].length() > PET_NAME_LENGTH_MAXIMUM) || (!StringUtils.isAlphanumeric(check[0])))// checks if there's 3 parts (always is with pets, if not it fucks them off)
|
||||
return; // if it does it fucks off.
|
||||
String[] check = extraData.split("\n");
|
||||
if ((check.length != 3) || (check[0].length() < PET_NAME_LENGTH_MINIMUM) || (check[0].length() > PET_NAME_LENGTH_MAXIMUM) || (!StringUtils.isAlphanumeric(check[0]))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Emulator.getGameEnvironment().getCatalogManager().purchaseItem(page, item, this.client.getHabbo(), count, extraData, false);
|
||||
|
||||
|
||||
+3
-2
@@ -11,16 +11,17 @@ public class PurchaseTargetOfferEvent extends MessageHandler {
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int offerId = this.packet.readInt();
|
||||
final int offerId = this.packet.readInt();
|
||||
int amount = this.packet.readInt();
|
||||
|
||||
if (amount <= 0) return;
|
||||
if (amount <= 0 || offerId <= 0) return;
|
||||
|
||||
|
||||
if (Emulator.getIntUnixTimestamp() - this.client.getHabbo().getHabboStats().lastPurchaseTimestamp >= CatalogManager.PURCHASE_COOLDOWN) {
|
||||
this.client.getHabbo().getHabboStats().lastPurchaseTimestamp = Emulator.getIntUnixTimestamp();
|
||||
|
||||
TargetOffer offer = Emulator.getGameEnvironment().getCatalogManager().getTargetOffer(offerId);
|
||||
if (offer == null) return;
|
||||
|
||||
HabboOfferPurchase purchase = HabboOfferPurchase.getOrCreate(this.client.getHabbo(), offerId);
|
||||
|
||||
|
||||
@@ -7,6 +7,11 @@ import com.eu.habbo.messages.outgoing.generic.alerts.HotelWillCloseInMinutesComp
|
||||
import com.eu.habbo.threading.runnables.ShutdownEmulator;
|
||||
|
||||
public class RedeemVoucherEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
if (ShutdownEmulator.timestamp > 0) {
|
||||
|
||||
+7
-2
@@ -5,9 +5,14 @@ import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.catalog.PetBreedsComposer;
|
||||
|
||||
public class RequestPetBreedsEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
String petName = this.packet.readString();
|
||||
final String petName = this.packet.readString();
|
||||
this.client.sendResponse(new PetBreedsComposer(petName, Emulator.getGameEnvironment().getPetManager().getBreeds(petName)));
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
@@ -13,6 +13,11 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
public class RequestOffersEvent extends MessageHandler {
|
||||
public final static Map<Integer, ServerMessage> cachedResults = new ConcurrentHashMap<>(0);
|
||||
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int min = this.packet.readInt();
|
||||
@@ -20,6 +25,11 @@ public class RequestOffersEvent extends MessageHandler {
|
||||
String query = this.packet.readString();
|
||||
int type = this.packet.readInt();
|
||||
|
||||
if (query.length() > 30) {
|
||||
query = query.substring(0, 30);
|
||||
}
|
||||
|
||||
|
||||
boolean tryCache = min == -1 && max == -1 && query.isEmpty();
|
||||
|
||||
if (tryCache) {
|
||||
|
||||
+9
-3
@@ -13,6 +13,11 @@ import org.slf4j.LoggerFactory;
|
||||
public class SellItemEvent extends MessageHandler {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SellItemEvent.class);
|
||||
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
if (!MarketPlace.MARKETPLACE_ENABLED) {
|
||||
@@ -20,10 +25,11 @@ public class SellItemEvent extends MessageHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
int credits = this.packet.readInt();
|
||||
final int credits = this.packet.readInt();
|
||||
final int furniType = this.packet.readInt(); // 1 = FLOOR_TYPE, 2 = WALL_TYPE
|
||||
final int itemId = this.packet.readInt();
|
||||
|
||||
this.packet.readInt(); // unknown - not used
|
||||
int itemId = this.packet.readInt();
|
||||
if (furniType != 1 && furniType != 2) return;
|
||||
|
||||
HabboItem item = this.client.getHabbo().getInventory().getItemsComponent().getHabboItem(itemId);
|
||||
if (item != null) {
|
||||
|
||||
+3
-3
@@ -22,11 +22,11 @@ public class OpenRecycleBoxEvent extends MessageHandler {
|
||||
if (room == null)
|
||||
return;
|
||||
|
||||
if (room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER)) {
|
||||
if (room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER) || room.hasRights(this.client.getHabbo())) {
|
||||
HabboItem item = room.getHabboItem(this.packet.readInt());
|
||||
|
||||
if (item == null)
|
||||
return;
|
||||
if (item == null) return;
|
||||
if (item.getUserId() != this.client.getHabbo().getHabboInfo().getId()) return;
|
||||
|
||||
if (item instanceof InteractionGift) {
|
||||
if (item.getBaseItem().getName().contains("present_wrap")) {
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public class RecycleEvent extends MessageHandler {
|
||||
THashSet<HabboItem> items = new THashSet<>();
|
||||
|
||||
int count = this.packet.readInt();
|
||||
if (count < Emulator.getConfig().getInt("recycler.value", 8)) return;
|
||||
if (count != Emulator.getConfig().getInt("recycler.value", 8)) return;
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
HabboItem item = this.client.getHabbo().getInventory().getItemsComponent().getHabboItem(this.packet.readInt());
|
||||
|
||||
+10
-2
@@ -12,12 +12,20 @@ import com.eu.habbo.messages.outgoing.generic.alerts.GenericAlertComposer;
|
||||
import com.eu.habbo.messages.outgoing.rooms.ForwardToRoomComposer;
|
||||
import gnu.trove.set.hash.THashSet;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
public class FloorPlanEditorSaveEvent extends MessageHandler {
|
||||
public static int MAXIMUM_FLOORPLAN_WIDTH_LENGTH = 64;
|
||||
public static int MAXIMUM_FLOORPLAN_SIZE = 64 * 64;
|
||||
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
if (!this.client.getHabbo().hasPermission(Permission.ACC_FLOORPLAN_EDITOR)) {
|
||||
@@ -56,7 +64,7 @@ public class FloorPlanEditorSaveEvent extends MessageHandler {
|
||||
}
|
||||
|
||||
if (mapRows.length > MAXIMUM_FLOORPLAN_WIDTH_LENGTH) errors.add("${notification.floorplan_editor.error.message.too_large_height}");
|
||||
else if (Arrays.stream(mapRows).anyMatch(l -> l.length() > MAXIMUM_FLOORPLAN_WIDTH_LENGTH || l.length() == 0)) errors.add("${notification.floorplan_editor.error.message.too_large_width}");
|
||||
else if (Arrays.stream(mapRows).anyMatch(l -> l.length() > MAXIMUM_FLOORPLAN_WIDTH_LENGTH || l.isEmpty())) errors.add("${notification.floorplan_editor.error.message.too_large_width}");
|
||||
|
||||
if (errors.length() > 0) {
|
||||
this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FLOORPLAN_EDITOR_ERROR.key, errors.toString()));
|
||||
|
||||
+7
-1
@@ -19,9 +19,15 @@ import static com.eu.habbo.habbohotel.users.HabboManager.getOfflineHabboInfo;
|
||||
public class AcceptFriendRequestEvent extends MessageHandler {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AcceptFriendRequestEvent.class);
|
||||
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int count = this.packet.readInt();
|
||||
int count = Math.min(this.packet.readInt(), 100);
|
||||
int userId;
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
|
||||
+7
-2
@@ -19,6 +19,11 @@ import java.sql.SQLException;
|
||||
public class FriendRequestEvent extends MessageHandler {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(FriendRequestEvent.class);
|
||||
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
String username = this.packet.readString();
|
||||
@@ -65,13 +70,13 @@ public class FriendRequestEvent extends MessageHandler {
|
||||
}
|
||||
|
||||
// You can only have x friends
|
||||
if (this.client.getHabbo().getMessenger().getFriends().values().size() >= this.client.getHabbo().getHabboStats().maxFriends && !this.client.getHabbo().hasPermission("acc_infinite_friends")) {
|
||||
if (this.client.getHabbo().getMessenger().getFriends().size() >= this.client.getHabbo().getHabboStats().maxFriends && !this.client.getHabbo().hasPermission("acc_infinite_friends")) {
|
||||
this.client.sendResponse(new FriendRequestErrorComposer(FriendRequestErrorComposer.FRIEND_LIST_OWN_FULL));
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if targets friendlist is full
|
||||
if (targetHabbo.getMessenger().getFriends().values().size() >= targetHabbo.getHabboStats().maxFriends && !targetHabbo.hasPermission("acc_infinite_friends")) {
|
||||
if (targetHabbo.getMessenger().getFriends().size() >= targetHabbo.getHabboStats().maxFriends && !targetHabbo.hasPermission("acc_infinite_friends")) {
|
||||
this.client.sendResponse(new FriendRequestErrorComposer(FriendRequestErrorComposer.FRIEND_LIST_TARGET_FULL));
|
||||
return;
|
||||
}
|
||||
|
||||
+12
-1
@@ -6,10 +6,18 @@ import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.friends.RoomInviteComposer;
|
||||
|
||||
public class InviteFriendsEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
if (this.client.getHabbo().getHabboStats().allowTalk()) {
|
||||
int[] userIds = new int[this.packet.readInt()];
|
||||
final int count = this.packet.readInt();
|
||||
if (count <= 0 || count > 100) return;
|
||||
|
||||
final int[] userIds = new int[count];
|
||||
|
||||
for (int i = 0; i < userIds.length; i++) {
|
||||
userIds[i] = this.packet.readInt();
|
||||
@@ -23,6 +31,9 @@ public class InviteFriendsEvent extends MessageHandler {
|
||||
if (i == 0)
|
||||
continue;
|
||||
|
||||
if (!this.client.getHabbo().getMessenger().getFriends().containsKey(i))
|
||||
continue;
|
||||
|
||||
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(i);
|
||||
|
||||
if (habbo != null) {
|
||||
|
||||
+5
@@ -14,6 +14,11 @@ import com.eu.habbo.messages.outgoing.guilds.GuildRefreshMembersListComposer;
|
||||
import com.eu.habbo.plugin.events.guilds.GuildAcceptedMembershipEvent;
|
||||
|
||||
public class GuildAcceptMembershipEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int guildId = this.packet.readInt();
|
||||
|
||||
+5
@@ -8,6 +8,11 @@ import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.plugin.events.guilds.GuildChangedBadgeEvent;
|
||||
|
||||
public class GuildChangeBadgeEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int guildId = this.packet.readInt();
|
||||
|
||||
+5
@@ -8,6 +8,11 @@ import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.plugin.events.guilds.GuildChangedColorsEvent;
|
||||
|
||||
public class GuildChangeColorsEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int guildId = this.packet.readInt();
|
||||
|
||||
+8
-1
@@ -8,6 +8,11 @@ import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.plugin.events.guilds.GuildChangedNameEvent;
|
||||
|
||||
public class GuildChangeNameDescEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int guildId = this.packet.readInt();
|
||||
@@ -16,7 +21,9 @@ public class GuildChangeNameDescEvent extends MessageHandler {
|
||||
|
||||
if (guild != null) {
|
||||
if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) {
|
||||
GuildChangedNameEvent nameEvent = new GuildChangedNameEvent(guild, this.packet.readString(), this.packet.readString());
|
||||
String newName = Emulator.getGameEnvironment().getWordFilter().filter(this.packet.readString(), this.client.getHabbo());
|
||||
String newDesc = Emulator.getGameEnvironment().getWordFilter().filter(this.packet.readString(), this.client.getHabbo());
|
||||
GuildChangedNameEvent nameEvent = new GuildChangedNameEvent(guild, newName, newDesc);
|
||||
Emulator.getPluginManager().fireEvent(nameEvent);
|
||||
|
||||
if (nameEvent.isCancelled())
|
||||
|
||||
+5
@@ -9,6 +9,11 @@ import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.plugin.events.guilds.GuildChangedSettingsEvent;
|
||||
|
||||
public class GuildChangeSettingsEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int guildId = this.packet.readInt();
|
||||
|
||||
+6
-2
@@ -4,12 +4,16 @@ 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.permissions.Permission;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.guilds.GuildConfirmRemoveMemberComposer;
|
||||
|
||||
public class GuildConfirmRemoveMemberEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int guildId = this.packet.readInt();
|
||||
@@ -19,7 +23,7 @@ public class GuildConfirmRemoveMemberEvent extends MessageHandler {
|
||||
|
||||
if (guild != null) {
|
||||
GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, this.client.getHabbo());
|
||||
if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || (member != null && member.getRank().equals(GuildRank.OWNER) || member.getRank().equals(GuildRank.ADMIN)) || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) {
|
||||
if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || (member != null && member.getRank().equals(GuildRank.OWNER) || (member != null && (member.getRank().equals(GuildRank.OWNER) || member.getRank().equals(GuildRank.ADMIN))))) {
|
||||
Room room = Emulator.getGameEnvironment().getRoomManager().loadRoom(guild.getRoomId());
|
||||
int count = 0;
|
||||
if (room != null) {
|
||||
|
||||
+6
-1
@@ -14,6 +14,11 @@ import com.eu.habbo.messages.outgoing.guilds.GuildRefreshMembersListComposer;
|
||||
import com.eu.habbo.plugin.events.guilds.GuildDeclinedMembershipEvent;
|
||||
|
||||
public class GuildDeclineMembershipEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int guildId = this.packet.readInt();
|
||||
@@ -23,7 +28,7 @@ public class GuildDeclineMembershipEvent extends MessageHandler {
|
||||
|
||||
if (guild != null) {
|
||||
GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, this.client.getHabbo());
|
||||
if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().equals(GuildRank.ADMIN)|| member.getRank().equals(GuildRank.OWNER) || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) {
|
||||
if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || (member != null && (member.getRank().equals(GuildRank.ADMIN) || member.getRank().equals(GuildRank.OWNER))) || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) {
|
||||
guild.decreaseRequestCount();
|
||||
Emulator.getGameEnvironment().getGuildManager().removeMember(guild, userId);
|
||||
this.client.sendResponse(new GuildMembersComposer(guild, Emulator.getGameEnvironment().getGuildManager().getGuildMembers(guild, 0, 0, ""), this.client.getHabbo(), 0, 0, "", true, Emulator.getGameEnvironment().getGuildManager().getGuildMembersCount(guild, 0, 0, "")));
|
||||
|
||||
@@ -13,6 +13,11 @@ import com.eu.habbo.plugin.events.guilds.GuildDeletedEvent;
|
||||
import gnu.trove.set.hash.THashSet;
|
||||
|
||||
public class GuildDeleteEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int guildId = this.packet.readInt();
|
||||
|
||||
+5
@@ -12,6 +12,11 @@ import com.eu.habbo.messages.outgoing.guilds.GuildMemberUpdateComposer;
|
||||
import com.eu.habbo.plugin.events.guilds.GuildRemovedAdminEvent;
|
||||
|
||||
public class GuildRemoveAdminEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int guildId = this.packet.readInt();
|
||||
|
||||
+5
@@ -8,6 +8,11 @@ import com.eu.habbo.messages.outgoing.users.UserProfileComposer;
|
||||
import com.eu.habbo.plugin.events.guilds.GuildRemovedFavoriteEvent;
|
||||
|
||||
public class GuildRemoveFavoriteEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int guildId = this.packet.readInt();
|
||||
|
||||
+5
@@ -14,6 +14,11 @@ import com.eu.habbo.messages.outgoing.guilds.GuildRefreshMembersListComposer;
|
||||
import com.eu.habbo.plugin.events.guilds.GuildRemovedMemberEvent;
|
||||
|
||||
public class GuildRemoveMemberEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int guildId = this.packet.readInt();
|
||||
|
||||
+3
-1
@@ -20,15 +20,17 @@ public class GuildSetAdminEvent extends MessageHandler {
|
||||
|
||||
if (guild != null) {
|
||||
if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) {
|
||||
Emulator.getGameEnvironment().getGuildManager().setAdmin(guild, userId);
|
||||
|
||||
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId);
|
||||
|
||||
GuildGivenAdminEvent adminEvent = new GuildGivenAdminEvent(guild, userId, habbo, this.client.getHabbo());
|
||||
Emulator.getPluginManager().fireEvent(adminEvent);
|
||||
|
||||
if (adminEvent.isCancelled())
|
||||
return;
|
||||
|
||||
Emulator.getGameEnvironment().getGuildManager().setAdmin(guild, userId);
|
||||
|
||||
if (habbo != null) {
|
||||
Room room = habbo.getHabboInfo().getCurrentRoom();
|
||||
if (room != null) {
|
||||
|
||||
+5
@@ -9,6 +9,11 @@ import com.eu.habbo.messages.outgoing.users.UserProfileComposer;
|
||||
import com.eu.habbo.plugin.events.guilds.GuildFavoriteSetEvent;
|
||||
|
||||
public class GuildSetFavoriteEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int guildId = this.packet.readInt();
|
||||
|
||||
+20
-16
@@ -20,12 +20,23 @@ public class RequestGuildBuyEvent extends MessageHandler {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(RequestGuildBuyEvent.class);
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
String name = Emulator.getGameEnvironment().getWordFilter().filter(this.packet.readString(), this.client.getHabbo());
|
||||
String description = Emulator.getGameEnvironment().getWordFilter().filter(this.packet.readString(), this.client.getHabbo());
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
if(name.length() > 29 || description.length() > 254)
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
final String name = Emulator.getGameEnvironment().getWordFilter().filter(this.packet.readString(), this.client.getHabbo());
|
||||
final String description = Emulator.getGameEnvironment().getWordFilter().filter(this.packet.readString(), this.client.getHabbo());
|
||||
|
||||
if(name.length() > 29){
|
||||
this.client.sendResponse(new GuildEditFailComposer(GuildEditFailComposer.INVALID_GUILD_NAME));
|
||||
return;
|
||||
}
|
||||
if(description.length() > 254){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (Emulator.getConfig().getBoolean("catalog.guild.hc_required", true) && !this.client.getHabbo().getHabboStats().hasActiveClub()) {
|
||||
this.client.sendResponse(new GuildEditFailComposer(GuildEditFailComposer.HC_REQUIRED));
|
||||
@@ -59,7 +70,7 @@ public class RequestGuildBuyEvent extends MessageHandler {
|
||||
|
||||
int count = this.packet.readInt();
|
||||
|
||||
String badge = "";
|
||||
StringBuilder badge = new StringBuilder();
|
||||
|
||||
byte base = 1;
|
||||
|
||||
@@ -69,24 +80,17 @@ public class RequestGuildBuyEvent extends MessageHandler {
|
||||
int pos = this.packet.readInt();
|
||||
|
||||
if (base == 1) {
|
||||
badge += "b";
|
||||
badge.append("b");
|
||||
} else {
|
||||
badge += "s";
|
||||
badge.append("s");
|
||||
}
|
||||
|
||||
badge += (id < 100 ? "0" : "") + (id < 10 ? "0" : "") + id + (color < 10 ? "0" : "") + color + "" + pos;
|
||||
badge.append(id < 100 ? "0" : "").append(id < 10 ? "0" : "").append(id).append(color < 10 ? "0" : "").append(color).append(pos);
|
||||
|
||||
base += 3;
|
||||
}
|
||||
|
||||
if(name.length() > 29){
|
||||
this.client.sendResponse(new GuildEditFailComposer(GuildEditFailComposer.INVALID_GUILD_NAME));
|
||||
return;
|
||||
}
|
||||
if(description.length() > 254){
|
||||
return;
|
||||
}
|
||||
Guild guild = Emulator.getGameEnvironment().getGuildManager().createGuild(this.client.getHabbo(), roomId, r.getName(), name, description, badge, colorOne, colorTwo);
|
||||
Guild guild = Emulator.getGameEnvironment().getGuildManager().createGuild(this.client.getHabbo(), roomId, r.getName(), name, description, badge.toString(), colorOne, colorTwo);
|
||||
|
||||
r.setGuild(guild.getId());
|
||||
r.removeAllRights();
|
||||
|
||||
+5
@@ -7,6 +7,11 @@ import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.guilds.GuildFurniWidgetComposer;
|
||||
|
||||
public class RequestGuildFurniWidgetEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int itemId = this.packet.readInt();
|
||||
|
||||
+5
@@ -6,6 +6,11 @@ import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.guilds.GuildInfoComposer;
|
||||
|
||||
public class RequestGuildInfoEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int guildId = this.packet.readInt();
|
||||
|
||||
+5
@@ -9,6 +9,11 @@ import com.eu.habbo.messages.outgoing.guilds.GuildInfoComposer;
|
||||
import com.eu.habbo.messages.outgoing.guilds.GuildJoinErrorComposer;
|
||||
|
||||
public class RequestGuildJoinEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int guildId = this.packet.readInt();
|
||||
|
||||
+47
-5
@@ -2,14 +2,56 @@ package com.eu.habbo.messages.incoming.guilds;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.guilds.Guild;
|
||||
import com.eu.habbo.habbohotel.guilds.GuildManager;
|
||||
import com.eu.habbo.habbohotel.guilds.GuildMember;
|
||||
import com.eu.habbo.habbohotel.guilds.GuildRank;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.users.HabboInfo;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.guilds.GuildManageComposer;
|
||||
|
||||
public class RequestGuildManageEvent extends MessageHandler {
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(this.packet.readInt());
|
||||
private static final String ACC_GUILD_ADMIN = "acc_guild_admin";
|
||||
|
||||
this.client.sendResponse(new GuildManageComposer(guild));
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() {
|
||||
final Habbo habbo = this.client.getHabbo();
|
||||
if (habbo == null) return;
|
||||
|
||||
final HabboInfo habboInfo = habbo.getHabboInfo();
|
||||
if (habboInfo == null) return;
|
||||
|
||||
final int guildId = this.packet.readInt();
|
||||
if (guildId <= 0) return;
|
||||
|
||||
final GuildManager guildManager = Emulator.getGameEnvironment().getGuildManager();
|
||||
final Guild guild = guildManager.getGuild(guildId);
|
||||
|
||||
if (guild == null) return;
|
||||
|
||||
if (!habbo.hasPermission(ACC_GUILD_ADMIN)) {
|
||||
Room room = habboInfo.getCurrentRoom();
|
||||
|
||||
if (room == null || room.getId() != guild.getRoomId()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.hasManageRights(guildManager, guild, habbo)) {
|
||||
this.client.sendResponse(new GuildManageComposer(guild));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasManageRights(GuildManager guildManager, Guild guild, Habbo habbo) {
|
||||
if (habbo.hasPermission(ACC_GUILD_ADMIN) || habbo.getHabboInfo().getId() == guild.getOwnerId()) return true;
|
||||
|
||||
final GuildMember member = guildManager.getGuildMember(guild, habbo);
|
||||
return member != null && member.getRank() == GuildRank.ADMIN;
|
||||
}
|
||||
}
|
||||
+5
@@ -9,6 +9,11 @@ import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.guilds.GuildMembersComposer;
|
||||
|
||||
public class RequestGuildMembersEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int groupId = this.packet.readInt();
|
||||
|
||||
+5
@@ -7,6 +7,11 @@ import com.eu.habbo.messages.outgoing.guilds.GuildListComposer;
|
||||
import gnu.trove.set.hash.THashSet;
|
||||
|
||||
public class RequestOwnGuildsEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
THashSet<Guild> guilds = new THashSet<Guild>();
|
||||
|
||||
+7
-2
@@ -6,14 +6,19 @@ import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.guilds.forums.GuildForumDataComposer;
|
||||
|
||||
public class GuildForumDataEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int guildId = packet.readInt();
|
||||
|
||||
Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId);
|
||||
|
||||
if (guild == null)
|
||||
return;
|
||||
if (guild == null) return;
|
||||
if (!guild.hasForum()) return;
|
||||
|
||||
this.client.sendResponse(new GuildForumDataComposer(guild, this.client.getHabbo()));
|
||||
|
||||
|
||||
+5
@@ -16,6 +16,11 @@ import java.sql.SQLException;
|
||||
import java.util.Set;
|
||||
|
||||
public class GuildForumListEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(GuildForumListEvent.class);
|
||||
|
||||
@Override
|
||||
|
||||
+5
@@ -16,6 +16,11 @@ import com.eu.habbo.messages.outgoing.handshake.ConnectionErrorComposer;
|
||||
|
||||
|
||||
public class GuildForumModerateMessageEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int guildId = packet.readInt();
|
||||
|
||||
+10
-4
@@ -16,6 +16,11 @@ import com.eu.habbo.messages.outgoing.handshake.ConnectionErrorComposer;
|
||||
|
||||
|
||||
public class GuildForumModerateThreadEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int guildId = packet.readInt();
|
||||
@@ -33,14 +38,15 @@ public class GuildForumModerateThreadEvent extends MessageHandler {
|
||||
}
|
||||
|
||||
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));
|
||||
boolean hasStaffPerms = this.client.getHabbo().hasPermission(Permission.ACC_MODTOOL_TICKET_Q);
|
||||
|
||||
|
||||
if (member == null) {
|
||||
if (member == null && !hasStaffPerms && guild.getOwnerId() != this.client.getHabbo().getHabboInfo().getId()) {
|
||||
this.client.sendResponse(new ConnectionErrorComposer(401));
|
||||
return;
|
||||
}
|
||||
|
||||
boolean isGuildAdmin = (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || (member != null && member.getRank().equals(GuildRank.ADMIN)));
|
||||
|
||||
if (!isGuildAdmin && !hasStaffPerms) {
|
||||
this.client.sendResponse(new ConnectionErrorComposer(403));
|
||||
return;
|
||||
|
||||
+6
-1
@@ -15,6 +15,11 @@ import com.eu.habbo.messages.outgoing.guilds.forums.ThreadUpdatedMessageComposer
|
||||
import com.eu.habbo.messages.outgoing.handshake.ConnectionErrorComposer;
|
||||
|
||||
public class GuildForumThreadUpdateEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int guildId = this.packet.readInt();
|
||||
@@ -40,7 +45,7 @@ public class GuildForumThreadUpdateEvent extends MessageHandler {
|
||||
|
||||
boolean isAdmin = (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().type < GuildRank.MEMBER.type);
|
||||
|
||||
if ((guild.canModForum() == SettingsState.OWNER && guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() && !isStaff) || (guild.canModForum() == SettingsState.ADMINS && !isAdmin && !isStaff)) {
|
||||
if ((guild.canModForum() == SettingsState.OWNER && guild.getOwnerId() != this.client.getHabbo().getHabboInfo().getId() && !isStaff) || (guild.canModForum() == SettingsState.ADMINS && !isAdmin && !isStaff)) {
|
||||
this.client.sendResponse(new ConnectionErrorComposer(403));
|
||||
return;
|
||||
}
|
||||
|
||||
+6
-1
@@ -8,6 +8,11 @@ import com.eu.habbo.messages.outgoing.guilds.forums.GuildForumThreadsComposer;
|
||||
import com.eu.habbo.messages.outgoing.handshake.ConnectionErrorComposer;
|
||||
|
||||
public class GuildForumThreadsEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int guildId = packet.readInt();
|
||||
@@ -15,7 +20,7 @@ public class GuildForumThreadsEvent extends MessageHandler {
|
||||
|
||||
Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId);
|
||||
|
||||
if (guild == null) {
|
||||
if (guild == null || !guild.hasForum()) {
|
||||
this.client.sendResponse(new ConnectionErrorComposer(404));
|
||||
return;
|
||||
}
|
||||
|
||||
+7
-2
@@ -17,6 +17,11 @@ import com.eu.habbo.messages.outgoing.handshake.ConnectionErrorComposer;
|
||||
|
||||
|
||||
public class GuildForumThreadsMessagesEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int guildId = packet.readInt();
|
||||
@@ -28,12 +33,12 @@ public class GuildForumThreadsMessagesEvent extends MessageHandler {
|
||||
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) {
|
||||
if (guild == null || thread == null || !guild.hasForum()) {
|
||||
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));
|
||||
boolean isGuildAdministrator = (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || (member != null && member.getRank().equals(GuildRank.ADMIN)));
|
||||
|
||||
if (thread.getState() != ForumThreadState.HIDDEN_BY_GUILD_ADMIN || hasStaffPermissions || isGuildAdministrator) {
|
||||
this.client.sendResponse(new GuildForumCommentsComposer(guildId, threadId, index, thread.getComments(limit, index)));
|
||||
|
||||
+5
@@ -10,6 +10,11 @@ import com.eu.habbo.messages.outgoing.guilds.forums.GuildForumDataComposer;
|
||||
import com.eu.habbo.messages.outgoing.handshake.ConnectionErrorComposer;
|
||||
|
||||
public class GuildForumUpdateSettingsEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int guildId = packet.readInt();
|
||||
|
||||
+9
-6
@@ -19,18 +19,18 @@ import com.eu.habbo.messages.outgoing.gamecenter.GameCenterGameListComposer;
|
||||
import com.eu.habbo.messages.outgoing.generic.alerts.GenericAlertComposer;
|
||||
import com.eu.habbo.messages.outgoing.generic.alerts.MessagesForYouComposer;
|
||||
import com.eu.habbo.messages.outgoing.habboway.nux.NewUserIdentityComposer;
|
||||
import com.eu.habbo.messages.outgoing.handshake.EnableNotificationsComposer;
|
||||
import com.eu.habbo.messages.outgoing.handshake.SecureLoginOKComposer;
|
||||
import com.eu.habbo.messages.outgoing.handshake.AvailabilityStatusMessageComposer;
|
||||
import com.eu.habbo.messages.outgoing.handshake.EnableNotificationsComposer;
|
||||
import com.eu.habbo.messages.outgoing.handshake.PingComposer;
|
||||
import com.eu.habbo.messages.outgoing.handshake.SecureLoginOKComposer;
|
||||
import com.eu.habbo.messages.outgoing.inventory.InventoryAchievementsComposer;
|
||||
import com.eu.habbo.messages.outgoing.inventory.UserEffectsListComposer;
|
||||
import com.eu.habbo.messages.outgoing.modtool.CfhTopicsMessageComposer;
|
||||
import com.eu.habbo.messages.outgoing.modtool.ModToolComposer;
|
||||
import com.eu.habbo.messages.outgoing.modtool.ModToolSanctionInfoComposer;
|
||||
import com.eu.habbo.messages.outgoing.navigator.*;
|
||||
import com.eu.habbo.messages.outgoing.unknown.BuildersClubExpiredComposer;
|
||||
import com.eu.habbo.messages.outgoing.mysterybox.MysteryBoxKeysComposer;
|
||||
import com.eu.habbo.messages.outgoing.navigator.NewNavigatorSavedSearchesComposer;
|
||||
import com.eu.habbo.messages.outgoing.unknown.BuildersClubExpiredComposer;
|
||||
import com.eu.habbo.messages.outgoing.users.*;
|
||||
import com.eu.habbo.plugin.events.emulator.SSOAuthenticationEvent;
|
||||
import com.eu.habbo.plugin.events.users.UserLoginEvent;
|
||||
@@ -45,7 +45,10 @@ import java.util.Date;
|
||||
public class SecureLoginEvent extends MessageHandler {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SecureLoginEvent.class);
|
||||
|
||||
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
@@ -159,7 +162,7 @@ public class SecureLoginEvent extends MessageHandler {
|
||||
THashMap<Integer, ArrayList<ModToolSanctionItem>> modToolSanctionItemsHashMap = Emulator.getGameEnvironment().getModToolSanctions().getSanctions(habbo.getHabboInfo().getId());
|
||||
ArrayList<ModToolSanctionItem> modToolSanctionItems = modToolSanctionItemsHashMap.get(habbo.getHabboInfo().getId());
|
||||
|
||||
if (modToolSanctionItems != null && modToolSanctionItems.size() > 0) {
|
||||
if (modToolSanctionItems != null && !modToolSanctionItems.isEmpty()) {
|
||||
ModToolSanctionItem item = modToolSanctionItems.get(modToolSanctionItems.size() - 1);
|
||||
|
||||
if (item.sanctionLevel > 0 && item.probationTimestamp != 0 && item.probationTimestamp > Emulator.getIntUnixTimestamp()) {
|
||||
|
||||
+12
-6
@@ -4,17 +4,23 @@ import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.hotelview.HotelViewSecondsUntilComposer;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeParseException;
|
||||
|
||||
public class HotelViewRequestSecondsUntilEvent extends MessageHandler {
|
||||
private static DateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd hh:mm");
|
||||
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
String date = this.packet.readString();
|
||||
int secondsUntil = Math.max(0, (int) (dateFormat.parse(date).getTime() / 1000) - Emulator.getIntUnixTimestamp());
|
||||
final String date = this.packet.readString();
|
||||
|
||||
this.client.sendResponse(new HotelViewSecondsUntilComposer(date, secondsUntil));
|
||||
try {
|
||||
LocalDateTime dt = LocalDateTime.parse(date, formatter);
|
||||
int secondsUntil = Math.max(0, (int) dt.atZone(ZoneId.systemDefault()).toEpochSecond() - Emulator.getIntUnixTimestamp());
|
||||
this.client.sendResponse(new HotelViewSecondsUntilComposer(date, secondsUntil));
|
||||
} catch (DateTimeParseException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-1
@@ -14,6 +14,11 @@ import java.util.NoSuchElementException;
|
||||
public class RequestInventoryItemsEvent extends MessageHandler {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(RequestInventoryItemsEvent.class);
|
||||
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int totalItems = this.client.getHabbo().getInventory().getItemsComponent().getItems().size();
|
||||
@@ -59,7 +64,7 @@ public class RequestInventoryItemsEvent extends MessageHandler {
|
||||
}
|
||||
}
|
||||
|
||||
if(count > 0 && items.size() > 0) this.client.sendResponse(new InventoryItemsComposer(fragmentNumber, totalFragments, items));
|
||||
if(count > 0 && !items.isEmpty()) this.client.sendResponse(new InventoryItemsComposer(fragmentNumber, totalFragments, items));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -35,13 +35,13 @@ public class ReportFriendPrivateChatEvent extends MessageHandler {
|
||||
info = HabboManager.getOfflineHabboInfo(userId);
|
||||
}
|
||||
|
||||
if (info != null) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
int chatUserId = this.packet.readInt();
|
||||
String username = this.packet.readInt() == info.getId() ? info.getUsername() : this.client.getHabbo().getHabboInfo().getUsername();
|
||||
if (info == null) return;
|
||||
|
||||
chatLogs.add(new ModToolChatLog(0, chatUserId, username, this.packet.readString()));
|
||||
}
|
||||
for (int i = 0; i < Math.min(count, 100); i++) {
|
||||
int chatUserId = this.packet.readInt();
|
||||
String username = this.packet.readInt() == info.getId() ? info.getUsername() : this.client.getHabbo().getHabboInfo().getUsername();
|
||||
|
||||
chatLogs.add(new ModToolChatLog(0, chatUserId, username, this.packet.readString()));
|
||||
}
|
||||
|
||||
ModToolIssue issue = new ModToolIssue(this.client.getHabbo().getHabboInfo().getId(), this.client.getHabbo().getHabboInfo().getUsername(), userId, info.getUsername(), 0, message, ModToolTicketType.IM);
|
||||
|
||||
+5
@@ -23,6 +23,11 @@ import java.util.List;
|
||||
public class RequestDeleteRoomEvent extends MessageHandler {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(RequestDeleteRoomEvent.class);
|
||||
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int roomId = this.packet.readInt();
|
||||
|
||||
+28
-8
@@ -7,12 +7,30 @@ import com.eu.habbo.messages.ServerMessage;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.navigator.PrivateRoomsComposer;
|
||||
import com.eu.habbo.plugin.events.navigator.NavigatorSearchResultEvent;
|
||||
import gnu.trove.map.hash.THashMap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class SearchRoomsEvent extends MessageHandler {
|
||||
public final static THashMap<Rank, THashMap<String, ServerMessage>> cachedResults = new THashMap<>(4);
|
||||
private static final int MAX_CACHE_SIZE = 200;
|
||||
public final static Map<Rank, Map<String, ServerMessage>> cachedResults = new ConcurrentHashMap<>(4);
|
||||
|
||||
private static Map<String, ServerMessage> createLRUCache() {
|
||||
return Collections.synchronizedMap(new LinkedHashMap<String, ServerMessage>(MAX_CACHE_SIZE, 0.75f, true) {
|
||||
@Override
|
||||
protected boolean removeEldestEntry(Map.Entry<String, ServerMessage> eldest) {
|
||||
return size() > MAX_CACHE_SIZE;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
@@ -23,10 +41,12 @@ public class SearchRoomsEvent extends MessageHandler {
|
||||
ArrayList<Room> rooms;
|
||||
|
||||
ServerMessage message = null;
|
||||
if (cachedResults.containsKey(this.client.getHabbo().getHabboInfo().getRank())) {
|
||||
message = cachedResults.get(this.client.getHabbo().getHabboInfo().getRank()).get((name + "\t" + query).toLowerCase());
|
||||
Map<String, ServerMessage> rankCache = cachedResults.get(this.client.getHabbo().getHabboInfo().getRank());
|
||||
if (rankCache != null) {
|
||||
message = rankCache.get((name + "\t" + query).toLowerCase());
|
||||
} else {
|
||||
cachedResults.put(this.client.getHabbo().getHabboInfo().getRank(), new THashMap<>());
|
||||
rankCache = createLRUCache();
|
||||
cachedResults.put(this.client.getHabbo().getHabboInfo().getRank(), rankCache);
|
||||
}
|
||||
|
||||
if (message == null) {
|
||||
@@ -47,10 +67,10 @@ public class SearchRoomsEvent extends MessageHandler {
|
||||
}
|
||||
|
||||
message = new PrivateRoomsComposer(rooms).compose();
|
||||
THashMap<String, ServerMessage> map = cachedResults.get(this.client.getHabbo().getHabboInfo().getRank());
|
||||
Map<String, ServerMessage> map = cachedResults.get(this.client.getHabbo().getHabboInfo().getRank());
|
||||
|
||||
if (map == null) {
|
||||
map = new THashMap<>(1);
|
||||
map = createLRUCache();
|
||||
}
|
||||
|
||||
map.put((name + "\t" + query).toLowerCase(), message);
|
||||
@@ -64,4 +84,4 @@ public class SearchRoomsEvent extends MessageHandler {
|
||||
|
||||
this.client.sendResponse(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-3
@@ -1,6 +1,7 @@
|
||||
package com.eu.habbo.messages.incoming.rooms;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.rooms.RoomSettingsComposer;
|
||||
@@ -8,11 +9,13 @@ import com.eu.habbo.messages.outgoing.rooms.RoomSettingsComposer;
|
||||
public class RequestRoomSettingsEvent extends MessageHandler {
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int roomId = this.packet.readInt();
|
||||
final int roomId = this.packet.readInt();
|
||||
|
||||
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(roomId);
|
||||
if (room == null) return;
|
||||
if (!room.hasRights(this.client.getHabbo()) || !this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER)) return;
|
||||
|
||||
if (room != null)
|
||||
this.client.sendResponse(new RoomSettingsComposer(room));
|
||||
this.client.sendResponse(new RoomSettingsComposer(room));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+12
-2
@@ -1,13 +1,23 @@
|
||||
package com.eu.habbo.messages.incoming.rooms;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
|
||||
public class RoomRemoveRightsEvent extends MessageHandler {
|
||||
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 250;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int roomId = this.packet.readInt();
|
||||
final int roomId = this.packet.readInt();
|
||||
|
||||
Emulator.getGameEnvironment().getRoomManager().getRoom(roomId).removeRights(this.client.getHabbo().getHabboInfo().getId());
|
||||
final Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(roomId);
|
||||
if (room == null) return;
|
||||
|
||||
room.removeRights(this.client.getHabbo().getHabboInfo().getId());
|
||||
}
|
||||
}
|
||||
+6
-4
@@ -2,6 +2,7 @@ package com.eu.habbo.messages.incoming.rooms;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.rooms.RoomBannedUsersComposer;
|
||||
@@ -9,14 +10,15 @@ import com.eu.habbo.messages.outgoing.rooms.RoomBannedUsersComposer;
|
||||
public class RoomRequestBannedUsersEvent extends MessageHandler {
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int roomId = this.packet.readInt();
|
||||
final int roomId = this.packet.readInt();
|
||||
|
||||
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(roomId);
|
||||
if (room == null) return;
|
||||
if (!room.hasRights(this.client.getHabbo()) || !this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER)) return;
|
||||
|
||||
if (room != null) {
|
||||
this.client.sendResponse(new RoomBannedUsersComposer(room));
|
||||
}
|
||||
this.client.sendResponse(new RoomBannedUsersComposer(room));
|
||||
|
||||
if (!room.isOwner(this.client.getHabbo())) return;
|
||||
AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("SelfModChatFloodFilterSeen"));
|
||||
AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("SelfModChatHearRangeSeen"));
|
||||
AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("SelfModChatScrollSpeedSeen"));
|
||||
|
||||
+2
@@ -8,6 +8,8 @@ public class JukeBoxRemoveSoundTrackEvent extends MessageHandler {
|
||||
public void handle() throws Exception {
|
||||
int index = this.packet.readInt();
|
||||
|
||||
if (this.client.getHabbo().getHabboInfo().getCurrentRoom() == null) return;
|
||||
|
||||
InteractionMusicDisc musicDisc = this.client.getHabbo().getHabboInfo().getCurrentRoom().getTraxManager().getSongs().get(index);
|
||||
|
||||
if (musicDisc != null) {
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ public class UpdateRoomPromotionEvent extends MessageHandler {
|
||||
|
||||
Room room = Emulator.getGameEnvironment().getRoomManager().loadRoom(id);
|
||||
|
||||
if (room == null || room.getOwnerId() != this.client.getHabbo().getHabboInfo().getId() || !this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER)) {
|
||||
if (room == null || (room.getOwnerId() != this.client.getHabbo().getHabboInfo().getId() && !this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+9
@@ -6,6 +6,12 @@ import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.plugin.events.users.UserRespectedEvent;
|
||||
|
||||
public class RoomUserGiveRespectEvent extends MessageHandler {
|
||||
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 250;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int userId = this.packet.readInt();
|
||||
@@ -15,7 +21,10 @@ public class RoomUserGiveRespectEvent extends MessageHandler {
|
||||
}
|
||||
|
||||
if (this.client.getHabbo().getHabboStats().respectPointsToGive > 0) {
|
||||
if (this.client.getHabbo().getHabboInfo().getCurrentRoom() == null) return;
|
||||
|
||||
Habbo target = this.client.getHabbo().getHabboInfo().getCurrentRoom().getHabbo(userId);
|
||||
if (target == null) return;
|
||||
|
||||
if (Emulator.getPluginManager().isRegistered(UserRespectedEvent.class, false)) {
|
||||
if (Emulator.getPluginManager().fireEvent(new UserRespectedEvent(target, this.client.getHabbo())).isCancelled())
|
||||
|
||||
+2
@@ -9,6 +9,8 @@ public class TradeCancelOfferItemEvent extends MessageHandler {
|
||||
public void handle() throws Exception {
|
||||
int itemId = this.packet.readInt();
|
||||
|
||||
if (this.client.getHabbo().getHabboInfo().getCurrentRoom() == null) return;
|
||||
|
||||
RoomTrade trade = this.client.getHabbo().getHabboInfo().getCurrentRoom().getActiveTradeForHabbo(this.client.getHabbo());
|
||||
if (trade != null) {
|
||||
HabboItem item = trade.getRoomTradeUserForHabbo(this.client.getHabbo()).getItem(itemId);
|
||||
|
||||
@@ -8,6 +8,8 @@ public class TradeConfirmEvent extends MessageHandler {
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
Habbo habbo = this.client.getHabbo();
|
||||
if (habbo == null || habbo.getHabboInfo().getCurrentRoom() == null) return;
|
||||
|
||||
RoomTrade trade = habbo.getHabboInfo().getCurrentRoom().getActiveTradeForHabbo(habbo);
|
||||
|
||||
if (trade == null || !trade.getRoomTradeUserForHabbo(habbo).getAccepted())
|
||||
|
||||
@@ -9,9 +9,12 @@ import com.eu.habbo.plugin.events.users.UserSavedWardrobeEvent;
|
||||
public class SaveWardrobeEvent extends MessageHandler {
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int slotId = this.packet.readInt();
|
||||
String look = this.packet.readString();
|
||||
String gender = this.packet.readString();
|
||||
final int slotId = this.packet.readInt();
|
||||
final String look = this.packet.readString();
|
||||
final String gender = this.packet.readString();
|
||||
|
||||
if (slotId < 0 || slotId > 8 || look.isEmpty()) return;
|
||||
if (!gender.equals("M") && !gender.equals("F")) return;
|
||||
|
||||
WardrobeComponent.WardrobeItem wardrobeItem;
|
||||
if (this.client.getHabbo().getInventory().getWardrobeComponent().getLooks().containsKey(slotId)) {
|
||||
|
||||
@@ -5,17 +5,21 @@ import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
|
||||
public class UserActivityEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 250;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
String type = this.packet.readString();
|
||||
String value = this.packet.readString();
|
||||
String action = this.packet.readString();
|
||||
|
||||
switch (type) {
|
||||
case "Quiz":
|
||||
if (value.equalsIgnoreCase("7")) {
|
||||
AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("SafetyQuizGraduate"));
|
||||
}
|
||||
if (type.equals("Quiz")) {
|
||||
if (value.equalsIgnoreCase("7")) {
|
||||
AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("SafetyQuizGraduate"));
|
||||
}
|
||||
}
|
||||
|
||||
switch (action) {
|
||||
|
||||
@@ -9,6 +9,11 @@ import com.eu.habbo.messages.outgoing.users.UserBadgesComposer;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class UserWearBadgeEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 250;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
BadgesComponent.resetSlots(this.client.getHabbo());
|
||||
@@ -22,7 +27,7 @@ public class UserWearBadgeEvent extends MessageHandler {
|
||||
|
||||
String badgeId = this.packet.readString();
|
||||
|
||||
if (badgeId.length() == 0)
|
||||
if (badgeId.isEmpty())
|
||||
continue;
|
||||
|
||||
HabboBadge badge = this.client.getHabbo().getInventory().getBadgesComponent().getBadge(badgeId);
|
||||
|
||||
Reference in New Issue
Block a user