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