♻️ cleanup

This commit is contained in:
duckietm 2024-07-03 10:40:59 +02:00
parent b2ffaf5a7c
commit d6ce42e996
5 changed files with 55 additions and 54 deletions

View File

@ -8,5 +8,5 @@
</list> </list>
</option> </option>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_X" default="true" project-jdk-name="openjdk-21" project-jdk-type="JavaSDK" /> <component name="ProjectRootManager" version="2" languageLevel="JDK_18" default="true" project-jdk-name="openjdk-18" project-jdk-type="JavaSDK" />
</project> </project>

View File

@ -9,7 +9,7 @@ import com.eu.habbo.messages.outgoing.rooms.users.RoomUserWhisperComposer;
import com.eu.habbo.plugin.EventHandler; import com.eu.habbo.plugin.EventHandler;
import com.eu.habbo.plugin.events.users.UserSavedMottoEvent; import com.eu.habbo.plugin.events.users.UserSavedMottoEvent;
public class Easter { public final class Easter {
@EventHandler @EventHandler
public static void onUserChangeMotto(UserSavedMottoEvent event) { public static void onUserChangeMotto(UserSavedMottoEvent event) {
if (Emulator.getConfig().getBoolean("easter_eggs.enabled") && event.newMotto.equalsIgnoreCase("crickey!")) { if (Emulator.getConfig().getBoolean("easter_eggs.enabled") && event.newMotto.equalsIgnoreCase("crickey!")) {

View File

@ -470,16 +470,15 @@ public class CatalogManager {
this.giftWrappers.clear(); this.giftWrappers.clear();
this.giftFurnis.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()) { while (set.next()) {
switch (set.getString("type")) { if ("wrapper".equals(set.getString("type"))) {
case "wrapper": this.giftWrappers.put(set.getInt("sprite_id"), set.getInt("item_id"));
this.giftWrappers.put(set.getInt("sprite_id"), set.getInt("item_id")); } else if ("gift".equals(set.getString("type"))) {
break; this.giftFurnis.put(set.getInt("sprite_id"), set.getInt("item_id"));
case "gift":
this.giftFurnis.put(set.getInt("sprite_id"), set.getInt("item_id"));
break;
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
@ -489,6 +488,7 @@ public class CatalogManager {
} }
} }
private void loadClothing() { private void loadClothing() {
synchronized (this.clothing) { synchronized (this.clothing) {
this.clothing.clear(); this.clothing.clear();

View File

@ -27,7 +27,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class MarketPlace { public final class MarketPlace {
private static final Logger LOGGER = LoggerFactory.getLogger(MarketPlace.class); private static final Logger LOGGER = LoggerFactory.getLogger(MarketPlace.class);
//Configuration. Loaded from database & updated accordingly. //Configuration. Loaded from database & updated accordingly.
@ -143,10 +143,9 @@ public class MarketPlace {
case 2: case 2:
query += " ORDER BY minPrice ASC"; query += " ORDER BY minPrice ASC";
break; break;
default:
case 1: case 1:
default:
query += " ORDER BY minPrice DESC"; query += " ORDER BY minPrice DESC";
break;
} }
query += ")"; query += ")";

View File

@ -21,7 +21,6 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException; import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import gnu.trove.procedure.TObjectProcedure; import gnu.trove.procedure.TObjectProcedure;
@ -32,6 +31,7 @@ import org.slf4j.LoggerFactory;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -42,45 +42,47 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect {
private final THashSet<HabboItem> items = new THashSet<>(); private final THashSet<HabboItem> items = new THashSet<>();
private static final List<Class<? extends HabboItem>> FORBIDDEN_TYPES = new ArrayList<Class<? extends HabboItem>>() { private static final List<Class<? extends HabboItem>> FORBIDDEN_TYPES;
{
this.add(InteractionWired.class); static {
this.add(InteractionTeleport.class); FORBIDDEN_TYPES = new ArrayList<>(Arrays.asList(
this.add(InteractionPushable.class); InteractionWired.class,
this.add(InteractionTagPole.class); InteractionTeleport.class,
this.add(InteractionTagField.class); InteractionPushable.class,
this.add(InteractionCrackable.class); InteractionTagPole.class,
this.add(InteractionGameScoreboard.class); InteractionTagField.class,
this.add(InteractionGameGate.class); InteractionCrackable.class,
this.add(InteractionFreezeTile.class); InteractionGameScoreboard.class,
this.add(InteractionFreezeBlock.class); InteractionGameGate.class,
this.add(InteractionFreezeExitTile.class); InteractionFreezeTile.class,
this.add(InteractionBattleBanzaiTeleporter.class); InteractionFreezeBlock.class,
this.add(InteractionBattleBanzaiTile.class); InteractionFreezeExitTile.class,
this.add(InteractionMonsterPlantSeed.class); InteractionBattleBanzaiTeleporter.class,
this.add(InteractionPetBreedingNest.class); InteractionBattleBanzaiTile.class,
this.add(InteractionPetDrink.class); InteractionMonsterPlantSeed.class,
this.add(InteractionPetFood.class); InteractionPetBreedingNest.class,
this.add(InteractionPetToy.class); InteractionPetDrink.class,
this.add(InteractionBadgeDisplay.class); InteractionPetFood.class,
this.add(InteractionClothing.class); InteractionPetToy.class,
this.add(InteractionVendingMachine.class); InteractionBadgeDisplay.class,
this.add(InteractionGift.class); InteractionClothing.class,
this.add(InteractionPressurePlate.class); InteractionVendingMachine.class,
this.add(InteractionMannequin.class); InteractionGift.class,
this.add(InteractionGymEquipment.class); InteractionPressurePlate.class,
this.add(InteractionHopper.class); InteractionMannequin.class,
this.add(InteractionObstacle.class); InteractionGymEquipment.class,
this.add(InteractionOneWayGate.class); InteractionHopper.class,
this.add(InteractionPuzzleBox.class); InteractionObstacle.class,
this.add(InteractionRoller.class); InteractionOneWayGate.class,
this.add(InteractionSwitch.class); InteractionPuzzleBox.class,
this.add(InteractionTent.class); InteractionRoller.class,
this.add(InteractionTrap.class); InteractionSwitch.class,
this.add(InteractionTrophy.class); InteractionTent.class,
this.add(InteractionWater.class); InteractionTrap.class,
} InteractionTrophy.class,
}; InteractionWater.class
));
}
public WiredEffectToggleRandom(ResultSet set, Item baseItem) throws SQLException { public WiredEffectToggleRandom(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem); super(set, baseItem);