diff --git a/Emulator/.idea/misc.xml b/Emulator/.idea/misc.xml index 526b4bf..b15a7ef 100644 --- a/Emulator/.idea/misc.xml +++ b/Emulator/.idea/misc.xml @@ -8,5 +8,5 @@ - + \ No newline at end of file diff --git a/Emulator/src/main/java/com/eu/habbo/core/Easter.java b/Emulator/src/main/java/com/eu/habbo/core/Easter.java index f358dbc..aa11082 100644 --- a/Emulator/src/main/java/com/eu/habbo/core/Easter.java +++ b/Emulator/src/main/java/com/eu/habbo/core/Easter.java @@ -9,7 +9,7 @@ import com.eu.habbo.messages.outgoing.rooms.users.RoomUserWhisperComposer; import com.eu.habbo.plugin.EventHandler; import com.eu.habbo.plugin.events.users.UserSavedMottoEvent; -public class Easter { +public final class Easter { @EventHandler public static void onUserChangeMotto(UserSavedMottoEvent event) { if (Emulator.getConfig().getBoolean("easter_eggs.enabled") && event.newMotto.equalsIgnoreCase("crickey!")) { diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java index 886e492..d77f05b 100644 --- a/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java +++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java @@ -470,16 +470,15 @@ public class CatalogManager { this.giftWrappers.clear(); this.giftFurnis.clear(); - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("SELECT * FROM gift_wrappers ORDER BY sprite_id DESC")) { + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); + Statement statement = connection.createStatement(); + ResultSet set = + statement.executeQuery("SELECT * FROM gift_wrappers ORDER BY sprite_id DESC")) { while (set.next()) { - switch (set.getString("type")) { - case "wrapper": - this.giftWrappers.put(set.getInt("sprite_id"), set.getInt("item_id")); - break; - - case "gift": - this.giftFurnis.put(set.getInt("sprite_id"), set.getInt("item_id")); - break; + if ("wrapper".equals(set.getString("type"))) { + this.giftWrappers.put(set.getInt("sprite_id"), set.getInt("item_id")); + } else if ("gift".equals(set.getString("type"))) { + this.giftFurnis.put(set.getInt("sprite_id"), set.getInt("item_id")); } } } catch (SQLException e) { @@ -489,6 +488,7 @@ public class CatalogManager { } } + private void loadClothing() { synchronized (this.clothing) { this.clothing.clear(); diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java index f4d9aef..f660354 100644 --- a/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java +++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java @@ -27,7 +27,7 @@ import java.util.ArrayList; import java.util.List; -public class MarketPlace { +public final class MarketPlace { private static final Logger LOGGER = LoggerFactory.getLogger(MarketPlace.class); //Configuration. Loaded from database & updated accordingly. @@ -143,10 +143,9 @@ public class MarketPlace { case 2: query += " ORDER BY minPrice ASC"; break; - default: case 1: + default: query += " ORDER BY minPrice DESC"; - break; } query += ")"; diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java index d5e6092..d35a9aa 100644 --- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java +++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java @@ -21,7 +21,6 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredHandler; -import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.incoming.wired.WiredSaveException; import gnu.trove.procedure.TObjectProcedure; @@ -32,6 +31,7 @@ import org.slf4j.LoggerFactory; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; @@ -42,45 +42,47 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect { private final THashSet items = new THashSet<>(); - private static final List> FORBIDDEN_TYPES = new ArrayList>() { - { - this.add(InteractionWired.class); - this.add(InteractionTeleport.class); - this.add(InteractionPushable.class); - this.add(InteractionTagPole.class); - this.add(InteractionTagField.class); - this.add(InteractionCrackable.class); - this.add(InteractionGameScoreboard.class); - this.add(InteractionGameGate.class); - this.add(InteractionFreezeTile.class); - this.add(InteractionFreezeBlock.class); - this.add(InteractionFreezeExitTile.class); - this.add(InteractionBattleBanzaiTeleporter.class); - this.add(InteractionBattleBanzaiTile.class); - this.add(InteractionMonsterPlantSeed.class); - this.add(InteractionPetBreedingNest.class); - this.add(InteractionPetDrink.class); - this.add(InteractionPetFood.class); - this.add(InteractionPetToy.class); - this.add(InteractionBadgeDisplay.class); - this.add(InteractionClothing.class); - this.add(InteractionVendingMachine.class); - this.add(InteractionGift.class); - this.add(InteractionPressurePlate.class); - this.add(InteractionMannequin.class); - this.add(InteractionGymEquipment.class); - this.add(InteractionHopper.class); - this.add(InteractionObstacle.class); - this.add(InteractionOneWayGate.class); - this.add(InteractionPuzzleBox.class); - this.add(InteractionRoller.class); - this.add(InteractionSwitch.class); - this.add(InteractionTent.class); - this.add(InteractionTrap.class); - this.add(InteractionTrophy.class); - this.add(InteractionWater.class); - } - }; + private static final List> FORBIDDEN_TYPES; + + static { + FORBIDDEN_TYPES = new ArrayList<>(Arrays.asList( + InteractionWired.class, + InteractionTeleport.class, + InteractionPushable.class, + InteractionTagPole.class, + InteractionTagField.class, + InteractionCrackable.class, + InteractionGameScoreboard.class, + InteractionGameGate.class, + InteractionFreezeTile.class, + InteractionFreezeBlock.class, + InteractionFreezeExitTile.class, + InteractionBattleBanzaiTeleporter.class, + InteractionBattleBanzaiTile.class, + InteractionMonsterPlantSeed.class, + InteractionPetBreedingNest.class, + InteractionPetDrink.class, + InteractionPetFood.class, + InteractionPetToy.class, + InteractionBadgeDisplay.class, + InteractionClothing.class, + InteractionVendingMachine.class, + InteractionGift.class, + InteractionPressurePlate.class, + InteractionMannequin.class, + InteractionGymEquipment.class, + InteractionHopper.class, + InteractionObstacle.class, + InteractionOneWayGate.class, + InteractionPuzzleBox.class, + InteractionRoller.class, + InteractionSwitch.class, + InteractionTent.class, + InteractionTrap.class, + InteractionTrophy.class, + InteractionWater.class + )); + } public WiredEffectToggleRandom(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem);