mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-30 09:50:51 +01:00
Code optimisations and readability
This commit is contained in:
parent
c4b9e0546d
commit
f973f7885d
1
pom.xml
1
pom.xml
@ -36,7 +36,6 @@
|
||||
<configuration>
|
||||
<source>19</source>
|
||||
<target>19</target>
|
||||
<compilerArgs>--enable-preview</compilerArgs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.eu.habbo.habbohotel.bots;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.database.DatabaseConstants;
|
||||
import com.eu.habbo.habbohotel.rooms.*;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.users.HabboGender;
|
||||
@ -82,7 +83,7 @@ public class Bot implements Runnable {
|
||||
this.motto = set.getString("motto");
|
||||
this.figure = set.getString("figure");
|
||||
this.gender = HabboGender.valueOf(set.getString("gender"));
|
||||
this.ownerId = set.getInt("user_id");
|
||||
this.ownerId = set.getInt(DatabaseConstants.USER_ID);
|
||||
this.ownerName = set.getString("owner_name");
|
||||
this.chatAuto = set.getString("chat_auto").equals("1");
|
||||
this.chatRandom = set.getString("chat_random").equals("1");
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.eu.habbo.habbohotel.campaign;
|
||||
|
||||
import com.eu.habbo.database.DatabaseConstants;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@ -17,7 +18,7 @@ public class CalendarRewardClaimed {
|
||||
private final Timestamp timestamp;
|
||||
|
||||
public CalendarRewardClaimed(ResultSet set) throws SQLException {
|
||||
this.userId = set.getInt("user_id");
|
||||
this.userId = set.getInt(DatabaseConstants.USER_ID);
|
||||
this.campaignId = set.getInt("campaign_id");
|
||||
this.day = set.getInt("day");
|
||||
this.rewardId = set.getInt("reward_id");
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.eu.habbo.habbohotel.catalog;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.database.DatabaseConstants;
|
||||
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
||||
import com.eu.habbo.habbohotel.bots.Bot;
|
||||
import com.eu.habbo.habbohotel.catalog.layouts.*;
|
||||
@ -249,7 +250,7 @@ public class CatalogManager {
|
||||
|
||||
totals.adjustOrPutValue(set.getInt("catalog_item_id"), 1, 1);
|
||||
|
||||
if (set.getInt("user_id") == 0) {
|
||||
if (set.getInt(DatabaseConstants.USER_ID) == 0) {
|
||||
limiteds.get(set.getInt("catalog_item_id")).push(set.getInt("number"));
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.eu.habbo.habbohotel.catalog;
|
||||
|
||||
import com.eu.habbo.database.DatabaseConstants;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@ -17,7 +18,7 @@ public class VoucherHistoryEntry {
|
||||
|
||||
public VoucherHistoryEntry(ResultSet set) throws SQLException {
|
||||
this.voucherId = set.getInt("voucher_id");
|
||||
this.userId = set.getInt("user_id");
|
||||
this.userId = set.getInt(DatabaseConstants.USER_ID);
|
||||
this.timestamp = set.getInt("timestamp");
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.eu.habbo.habbohotel.catalog.marketplace;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.database.DatabaseConstants;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
@ -262,7 +263,7 @@ public class MarketPlace {
|
||||
updateOffer.setInt(2, offerId);
|
||||
updateOffer.execute();
|
||||
}
|
||||
Habbo habbo = Emulator.getGameServer().getGameClientManager().getHabbo(set.getInt("user_id"));
|
||||
Habbo habbo = Emulator.getGameServer().getGameClientManager().getHabbo(set.getInt(DatabaseConstants.USER_ID));
|
||||
HabboItem item = Emulator.getGameEnvironment().getItemManager().loadHabboItem(itemSet);
|
||||
|
||||
MarketPlaceItemSoldEvent event = new MarketPlaceItemSoldEvent(habbo, client.getHabbo(), item, set.getInt("price"));
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.eu.habbo.habbohotel.guilds;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.database.DatabaseConstants;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -65,7 +66,7 @@ public class Guild implements Runnable {
|
||||
|
||||
public Guild(ResultSet set) throws SQLException {
|
||||
this.id = set.getInt("id");
|
||||
this.ownerId = set.getInt("user_id");
|
||||
this.ownerId = set.getInt(DatabaseConstants.USER_ID);
|
||||
this.ownerName = set.getString("username");
|
||||
this.name = set.getString("name");
|
||||
this.description = set.getString("description");
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.eu.habbo.habbohotel.guilds;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.database.DatabaseConstants;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.guilds.forums.ForumView;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionGuildFurni;
|
||||
@ -433,7 +434,7 @@ public class GuildManager {
|
||||
statement.setInt(1, guild.getId());
|
||||
try (ResultSet set = statement.executeQuery()) {
|
||||
while (set.next()) {
|
||||
guildAdmins.put(set.getInt("user_id"), new GuildMember(set));
|
||||
guildAdmins.put(set.getInt(DatabaseConstants.USER_ID), new GuildMember(set));
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.eu.habbo.habbohotel.guilds;
|
||||
|
||||
import com.eu.habbo.database.DatabaseConstants;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@ -22,7 +23,7 @@ public class GuildMember implements Comparable<GuildMember> {
|
||||
private GuildRank rank;
|
||||
|
||||
public GuildMember(ResultSet set) throws SQLException {
|
||||
this.userId = set.getInt("user_id");
|
||||
this.userId = set.getInt(DatabaseConstants.USER_ID);
|
||||
this.username = set.getString("username");
|
||||
this.look = set.getString("look");
|
||||
this.joinDate = set.getInt("member_since");
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.eu.habbo.habbohotel.guilds.forums;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.database.DatabaseConstants;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.users.HabboInfo;
|
||||
import com.eu.habbo.messages.ISerialize;
|
||||
@ -50,7 +51,7 @@ public class ForumThreadComment implements Runnable, ISerialize {
|
||||
public ForumThreadComment(ResultSet set) throws SQLException {
|
||||
this.commentId = set.getInt("id");
|
||||
this.threadId = set.getInt("thread_id");
|
||||
this.userId = set.getInt("user_id");
|
||||
this.userId = set.getInt(DatabaseConstants.USER_ID);
|
||||
this.message = set.getString("message");
|
||||
this.createdAt = set.getInt("created_at");
|
||||
this.state = ForumThreadState.fromValue(set.getInt("state"));
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.eu.habbo.habbohotel.guilds.forums;
|
||||
|
||||
import com.eu.habbo.database.DatabaseConstants;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@ -16,7 +17,7 @@ public class ForumView {
|
||||
private final int timestamp;
|
||||
|
||||
public ForumView(ResultSet set) throws SQLException {
|
||||
this.userId = set.getInt("user_id");
|
||||
this.userId = set.getInt(DatabaseConstants.USER_ID);
|
||||
this.guildId = set.getInt("guild_id");
|
||||
this.timestamp = set.getInt("timestamp");
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public class InteractionMultiHeight extends HabboItem {
|
||||
Collection<RoomUnit> unitsOnItem = room.getRoomUnitsAt(room.getLayout().getTile(tile.getX(), tile.getY()));
|
||||
|
||||
for (RoomUnit unit : unitsOnItem) {
|
||||
if (unit.hasStatus(RoomUnitStatus.MOVE) && unit.getGoal() != tile)
|
||||
if (unit.hasStatus(RoomUnitStatus.MOVE) && unit.getGoalLocation() != tile)
|
||||
continue;
|
||||
|
||||
if (this.getBaseItem().allowSit() || unit.hasStatus(RoomUnitStatus.SIT)) {
|
||||
|
@ -83,7 +83,7 @@ public abstract class InteractionPushable extends InteractionDefault {
|
||||
boolean isDrag = false;
|
||||
RoomUserRotation direction;
|
||||
|
||||
if (this.getX() == roomUnit.getGoal().getX() && this.getY() == roomUnit.getGoal().getY()) //User clicked on the tile the ball is on, they want to kick it
|
||||
if (this.getX() == roomUnit.getGoalLocation().getX() && this.getY() == roomUnit.getGoalLocation().getY()) //User clicked on the tile the ball is on, they want to kick it
|
||||
{
|
||||
velocity = this.getWalkOnVelocity(roomUnit, room);
|
||||
direction = this.getWalkOnDirection(roomUnit, room);
|
||||
|
@ -69,7 +69,7 @@ public class InteractionFootball extends InteractionPushable {
|
||||
@Override
|
||||
public RoomUserRotation getWalkOffDirection(RoomUnit roomUnit, Room room) {
|
||||
RoomTile peek = roomUnit.getPath().peek();
|
||||
RoomTile nextWalkTile = peek != null ? room.getLayout().getTile(peek.getX(), peek.getY()) : roomUnit.getGoal();
|
||||
RoomTile nextWalkTile = peek != null ? room.getLayout().getTile(peek.getX(), peek.getY()) : roomUnit.getGoalLocation();
|
||||
return RoomUserRotation.values()[(RoomUserRotation.values().length + Rotation.Calculate(roomUnit.getX(), roomUnit.getY(), nextWalkTile.getX(), nextWalkTile.getY()) + 4) % 8];
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ public class InteractionPetBreedingNest extends HabboItem {
|
||||
Pet offspring = Emulator.getGameEnvironment().getPetManager().createPet(petOne.getPetData().getOffspringType(), (int) Math.min(Math.round(Math.max(1d, PetManager.getNormalDistributionForBreeding(petOne.getLevel(), petTwo.getLevel()).sample())), 20), name, habbo.getClient());
|
||||
|
||||
//habbo.getClient().sendResponse(new PetPackageNameValidationComposer(box.getId(), PetPackageNameValidationComposer.CLOSE_WIDGET, ""));
|
||||
habbo.getHabboInfo().getCurrentRoom().placePet(offspring, box.getX(), box.getY(), box.getZ(), box.getRotation());
|
||||
habbo.getHabboInfo().getCurrentRoom().placePet(offspring, box.getX(), box.getY(), box.getZ());
|
||||
offspring.needsUpdate = true;
|
||||
offspring.run();
|
||||
InteractionPetBreedingNest.this.freePets();
|
||||
|
@ -52,7 +52,7 @@ public class InteractionPetToy extends InteractionDefault {
|
||||
|
||||
Pet pet = room.getPet(roomUnit);
|
||||
|
||||
if (pet != null && pet.getPetData().haveToyItem(this.getBaseItem()) && this.getOccupyingTiles(room.getLayout()).contains(pet.getRoomUnit().getGoal())) {
|
||||
if (pet != null && pet.getPetData().haveToyItem(this.getBaseItem()) && this.getOccupyingTiles(room.getLayout()).contains(pet.getRoomUnit().getGoalLocation())) {
|
||||
if (pet.getEnergy() <= 35) {
|
||||
return;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class InteractionPetTrampoline extends InteractionDefault {
|
||||
|
||||
Pet pet = room.getPet(roomUnit);
|
||||
|
||||
if (pet != null && pet.getPetData().haveToyItem(this.getBaseItem()) && this.getOccupyingTiles(room.getLayout()).contains(pet.getRoomUnit().getGoal())) {
|
||||
if (pet != null && pet.getPetData().haveToyItem(this.getBaseItem()) && this.getOccupyingTiles(room.getLayout()).contains(pet.getRoomUnit().getGoalLocation())) {
|
||||
if (pet.getEnergy() <= 35) {
|
||||
return;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public class InteractionPetTree extends InteractionDefault {
|
||||
super.onWalkOn(roomUnit, room, objects);
|
||||
|
||||
Pet pet = room.getPet(roomUnit);
|
||||
if (pet != null && pet.getPetData().haveToyItem(this.getBaseItem()) && this.getOccupyingTiles(room.getLayout()).contains(pet.getRoomUnit().getGoal())) {
|
||||
if (pet != null && pet.getPetData().haveToyItem(this.getBaseItem()) && this.getOccupyingTiles(room.getLayout()).contains(pet.getRoomUnit().getGoalLocation())) {
|
||||
RoomUnitStatus task = switch (pet.getTask()) {
|
||||
case RING_OF_FIRE -> RoomUnitStatus.RINGOFFIRE;
|
||||
case SWING -> RoomUnitStatus.SWING;
|
||||
|
@ -271,7 +271,8 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
|
||||
case ACTION_TURN_RIGHT_45 -> RoomUserRotation.clockwise(currentRotation);
|
||||
case ACTION_TURN_RIGHT_90 -> RoomUserRotation.clockwise(RoomUserRotation.clockwise(currentRotation));
|
||||
case ACTION_TURN_RANDOM -> RoomUserRotation.fromValue(Emulator.getRandom().nextInt(8));
|
||||
case ACTION_WAIT, default -> currentRotation;
|
||||
case ACTION_WAIT -> currentRotation;
|
||||
default -> currentRotation;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.eu.habbo.habbohotel.modtool;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.database.DatabaseConstants;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@ -28,7 +29,7 @@ public class ModToolBan implements Runnable {
|
||||
private final boolean needsInsert;
|
||||
|
||||
public ModToolBan(ResultSet set) throws SQLException {
|
||||
this.userId = set.getInt("user_id");
|
||||
this.userId = set.getInt(DatabaseConstants.USER_ID);
|
||||
this.ip = set.getString("ip");
|
||||
this.machineId = set.getString("machine_id");
|
||||
this.staffId = set.getInt("user_staff_id");
|
||||
|
@ -167,7 +167,7 @@ public class MonsterplantPet extends Pet implements IPetLook {
|
||||
if (difference >= growTime) {
|
||||
this.growthStage = 7;
|
||||
boolean clear = false;
|
||||
for (RoomUnitStatus s : this.roomUnit.getStatusMap().keySet()) {
|
||||
for (RoomUnitStatus s : this.roomUnit.getStatus().keySet()) {
|
||||
if (s.equals(RoomUnitStatus.GROW)) {
|
||||
clear = true;
|
||||
break;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.eu.habbo.habbohotel.pets;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.database.DatabaseConstants;
|
||||
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
||||
import com.eu.habbo.habbohotel.rooms.*;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
@ -138,7 +139,7 @@ public class Pet implements ISerialize, Runnable {
|
||||
public Pet(ResultSet set) throws SQLException {
|
||||
super();
|
||||
this.id = set.getInt("id");
|
||||
this.userId = set.getInt("user_id");
|
||||
this.userId = set.getInt(DatabaseConstants.USER_ID);
|
||||
this.room = null;
|
||||
this.name = set.getString("name");
|
||||
this.petData = Emulator.getGameEnvironment().getPetManager().getPetData(set.getInt("type"));
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,7 @@
|
||||
package com.eu.habbo.habbohotel.rooms;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.database.DatabaseConstants;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -22,7 +23,7 @@ public class RoomBan {
|
||||
|
||||
public RoomBan(ResultSet set) throws SQLException {
|
||||
this.roomId = set.getInt("room_id");
|
||||
this.userId = set.getInt("user_id");
|
||||
this.userId = set.getInt(DatabaseConstants.USER_ID);
|
||||
this.username = set.getString("username");
|
||||
this.endTimestamp = set.getInt("ends");
|
||||
}
|
||||
|
@ -68,6 +68,7 @@ public class RoomManager {
|
||||
public static int MAXIMUM_ROOMS_HC = 35;
|
||||
public static int HOME_ROOM_ID = 0;
|
||||
public static boolean SHOW_PUBLIC_IN_POPULAR_TAB = false;
|
||||
@Getter
|
||||
private final THashMap<Integer, RoomCategory> roomCategories;
|
||||
private final List<String> mapNames;
|
||||
private final ConcurrentHashMap<Integer, Room> activeRooms;
|
||||
@ -151,9 +152,8 @@ public class RoomManager {
|
||||
|
||||
public THashMap<Integer, List<Room>> findRooms(NavigatorFilterField filterField, String value, int category, boolean showInvisible) {
|
||||
THashMap<Integer, List<Room>> rooms = new THashMap<>();
|
||||
String query = filterField.getDatabaseQuery() + " AND rooms.state NOT LIKE " + (showInvisible ? "''" : "'invisible'") + (category >= 0 ? "AND rooms.category = '" + category + "'" : "") + " ORDER BY rooms.users, rooms.id DESC LIMIT " + (/* TODO: This is always 0?*/page * NavigatorManager.MAXIMUM_RESULTS_PER_PAGE) + "" + ((page * NavigatorManager.MAXIMUM_RESULTS_PER_PAGE) + NavigatorManager.MAXIMUM_RESULTS_PER_PAGE);
|
||||
String query = filterField.getDatabaseQuery() + " AND rooms.state NOT LIKE " + (showInvisible ? "''" : "'invisible'") + (category >= 0 ? "AND rooms.category = '" + category + "'" : "") + " ORDER BY rooms.users, rooms.id DESC LIMIT " + NavigatorManager.MAXIMUM_RESULTS_PER_PAGE;
|
||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement(query)) {
|
||||
statement.setString(1, (filterField.getComparator() == NavigatorFilterComparator.EQUALS ? value : "%" + value + "%"));
|
||||
try (ResultSet set = statement.executeQuery()) {
|
||||
while (set.next()) {
|
||||
Room room = this.activeRooms.get(set.getInt("id"));
|
||||
@ -178,32 +178,15 @@ public class RoomManager {
|
||||
}
|
||||
|
||||
public RoomCategory getCategory(int id) {
|
||||
for (RoomCategory category : this.roomCategories.values()) {
|
||||
if (category.getId() == id)
|
||||
return category;
|
||||
}
|
||||
|
||||
return null;
|
||||
return roomCategories.values().stream().filter(c -> c.getId() == id).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
public RoomCategory getCategory(String name) {
|
||||
for (RoomCategory category : this.roomCategories.values()) {
|
||||
if (category.getCaption().equalsIgnoreCase(name)) {
|
||||
return category;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return roomCategories.values().stream().filter(c -> c.getCaption().equalsIgnoreCase(name)).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
public RoomCategory getCategoryBySafeCaption(String safeCaption) {
|
||||
for (RoomCategory category : this.roomCategories.values()) {
|
||||
if (category.getCaptionSave().equalsIgnoreCase(safeCaption)) {
|
||||
return category;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return roomCategories.values().stream().filter(c -> c.getCaptionSave().equalsIgnoreCase(safeCaption)).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
public List<RoomCategory> roomCategoriesForHabbo(Habbo habbo) {
|
||||
@ -219,19 +202,7 @@ public class RoomManager {
|
||||
}
|
||||
|
||||
public boolean hasCategory(int categoryId, Habbo habbo) {
|
||||
for (RoomCategory category : this.roomCategories.values()) {
|
||||
if (category.getId() == categoryId) {
|
||||
if (category.getMinRank() <= habbo.getHabboInfo().getRank().getId()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public THashMap<Integer, RoomCategory> getRoomCategories() {
|
||||
return this.roomCategories;
|
||||
return roomCategories.values().stream().anyMatch(c -> c.getId() == categoryId && c.getMinRank() <= habbo.getHabboInfo().getRank().getId());
|
||||
}
|
||||
|
||||
public List<Room> getRoomsByScore() {
|
||||
@ -294,10 +265,8 @@ public class RoomManager {
|
||||
if (this.activeRooms.containsKey(id)) {
|
||||
room = this.activeRooms.get(id);
|
||||
|
||||
if (loadData) {
|
||||
if (room.isPreLoaded() && !room.isLoaded()) {
|
||||
room.loadData();
|
||||
}
|
||||
if (loadData && (room.isPreLoaded() && !room.isLoaded())) {
|
||||
room.loadData();
|
||||
}
|
||||
|
||||
return room;
|
||||
@ -602,7 +571,8 @@ public class RoomManager {
|
||||
habbo.getRoomUnit().clearStatus();
|
||||
if (habbo.getRoomUnit().getCurrentLocation() == null) {
|
||||
habbo.getRoomUnit().setLocation(doorLocation != null ? doorLocation : room.getLayout().getDoorTile());
|
||||
if (habbo.getRoomUnit().getCurrentLocation() != null) habbo.getRoomUnit().setZ(habbo.getRoomUnit().getCurrentLocation().getStackHeight());
|
||||
if (habbo.getRoomUnit().getCurrentLocation() != null)
|
||||
habbo.getRoomUnit().setZ(habbo.getRoomUnit().getCurrentLocation().getStackHeight());
|
||||
|
||||
if (doorLocation == null) {
|
||||
habbo.getRoomUnit().setBodyRotation(RoomUserRotation.values()[room.getLayout().getDoorDirection()]);
|
||||
@ -899,10 +869,10 @@ public class RoomManager {
|
||||
}
|
||||
|
||||
if (room.hasActiveWordQuiz()) {
|
||||
habbo.getClient().sendResponse(new QuestionComposer((Emulator.getIntUnixTimestamp() - room.wordQuizEnd) * 1000, room.wordQuiz));
|
||||
habbo.getClient().sendResponse(new QuestionComposer((Emulator.getIntUnixTimestamp() - room.getWordQuizEnd()) * 1000, room.getWordQuiz()));
|
||||
|
||||
if (room.hasVotedInWordQuiz(habbo)) {
|
||||
habbo.getClient().sendResponse(new QuestionFinishedComposer(room.noVotes, room.yesVotes));
|
||||
habbo.getClient().sendResponse(new QuestionFinishedComposer(room.getNoVotes(), room.getYesVotes()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,9 @@ import com.eu.habbo.util.pathfinding.Rotation;
|
||||
import gnu.trove.map.TMap;
|
||||
import gnu.trove.map.hash.THashMap;
|
||||
import gnu.trove.set.hash.THashSet;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.*;
|
||||
@ -35,6 +38,7 @@ public class RoomUnit {
|
||||
public boolean isWiredTeleporting = false;
|
||||
public boolean isLeavingTeleporter = false;
|
||||
public boolean isSwimming = false;
|
||||
@Getter
|
||||
private final ConcurrentHashMap<RoomUnitStatus, String> status;
|
||||
private final THashMap<String, Object> cacheable;
|
||||
public boolean canRotate = true;
|
||||
@ -48,22 +52,42 @@ public class RoomUnit {
|
||||
public boolean isKicked;
|
||||
public int kickCount = 0;
|
||||
private int id;
|
||||
@Getter
|
||||
private RoomTile startLocation;
|
||||
@Getter
|
||||
private RoomTile previousLocation;
|
||||
@Getter
|
||||
@Setter @Accessors(chain = true)
|
||||
private double previousLocationZ;
|
||||
private RoomTile currentLocation;
|
||||
@Getter
|
||||
private RoomTile goalLocation;
|
||||
@Getter
|
||||
private double z;
|
||||
private int tilesWalked;
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean inRoom;
|
||||
@Setter
|
||||
@Accessors(chain = true)
|
||||
private boolean canWalk;
|
||||
@Setter
|
||||
@Getter
|
||||
private boolean fastWalk = false;
|
||||
private boolean statusUpdate = false;
|
||||
private boolean invisible = false;
|
||||
private boolean canLeaveRoomByDoor = true;
|
||||
@Setter
|
||||
private RoomUserRotation bodyRotation = RoomUserRotation.NORTH;
|
||||
@Getter
|
||||
@Setter
|
||||
private RoomUserRotation headRotation = RoomUserRotation.NORTH;
|
||||
@Getter
|
||||
@Setter
|
||||
private DanceType danceType;
|
||||
@Getter
|
||||
@Setter
|
||||
@Accessors(chain = true)
|
||||
private RoomUnitType roomUnitType;
|
||||
private Deque<RoomTile> path = new LinkedList<>();
|
||||
private int handItem;
|
||||
@ -129,7 +153,7 @@ public class RoomUnit {
|
||||
|
||||
if (rider != null) {
|
||||
// copy things from rider
|
||||
if (this.status.containsKey(RoomUnitStatus.MOVE) && !rider.getRoomUnit().getStatusMap().containsKey(RoomUnitStatus.MOVE)) {
|
||||
if (this.status.containsKey(RoomUnitStatus.MOVE) && !rider.getRoomUnit().getStatus().containsKey(RoomUnitStatus.MOVE)) {
|
||||
this.status.remove(RoomUnitStatus.MOVE);
|
||||
}
|
||||
|
||||
@ -341,7 +365,7 @@ public class RoomUnit {
|
||||
this.setZ(zHeight - 1.0);
|
||||
ridingUnit.setRotation(RoomUserRotation.values()[Rotation.Calculate(this.getX(), this.getY(), next.getX(), next.getY())]);
|
||||
ridingUnit.setPreviousLocation(this.getCurrentLocation());
|
||||
ridingUnit.setGoalLocation(this.getGoal());
|
||||
ridingUnit.setGoalLocation(this.getGoalLocation());
|
||||
ridingUnit.setStatus(RoomUnitStatus.MOVE, next.getX() + "," + next.getY() + "," + (zHeight - 1.0));
|
||||
room.sendComposer(new UserUpdateComposer(ridingUnit).compose());
|
||||
//ridingUnit.setZ(zHeight - 1.0);
|
||||
@ -404,10 +428,6 @@ public class RoomUnit {
|
||||
return this.currentLocation.getY();
|
||||
}
|
||||
|
||||
public double getZ() {
|
||||
return this.z;
|
||||
}
|
||||
|
||||
public void setZ(double z) {
|
||||
this.z = z;
|
||||
|
||||
@ -419,22 +439,6 @@ public class RoomUnit {
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized boolean isInRoom() {
|
||||
return this.inRoom;
|
||||
}
|
||||
|
||||
public synchronized void setInRoom(boolean inRoom) {
|
||||
this.inRoom = inRoom;
|
||||
}
|
||||
|
||||
public synchronized RoomUnitType getRoomUnitType() {
|
||||
return this.roomUnitType;
|
||||
}
|
||||
|
||||
public synchronized void setRoomUnitType(RoomUnitType roomUnitType) {
|
||||
this.roomUnitType = roomUnitType;
|
||||
}
|
||||
|
||||
public void setRotation(RoomUserRotation rotation) {
|
||||
this.bodyRotation = rotation;
|
||||
this.headRotation = rotation;
|
||||
@ -444,60 +448,19 @@ public class RoomUnit {
|
||||
return this.bodyRotation;
|
||||
}
|
||||
|
||||
public void setBodyRotation(RoomUserRotation bodyRotation) {
|
||||
this.bodyRotation = bodyRotation;
|
||||
}
|
||||
|
||||
public RoomUserRotation getHeadRotation() {
|
||||
return this.headRotation;
|
||||
}
|
||||
|
||||
public void setHeadRotation(RoomUserRotation headRotation) {
|
||||
this.headRotation = headRotation;
|
||||
}
|
||||
|
||||
public synchronized DanceType getDanceType() {
|
||||
return this.danceType;
|
||||
}
|
||||
|
||||
public synchronized void setDanceType(DanceType danceType) {
|
||||
this.danceType = danceType;
|
||||
}
|
||||
|
||||
public void setCanWalk(boolean value) {
|
||||
this.canWalk = value;
|
||||
}
|
||||
|
||||
public boolean canWalk() {
|
||||
return this.canWalk;
|
||||
}
|
||||
|
||||
public boolean isFastWalk() {
|
||||
return this.fastWalk;
|
||||
}
|
||||
|
||||
public void setFastWalk(boolean fastWalk) {
|
||||
this.fastWalk = fastWalk;
|
||||
}
|
||||
|
||||
public RoomTile getStartLocation() {
|
||||
return this.startLocation;
|
||||
}
|
||||
|
||||
public int tilesWalked() {
|
||||
return this.tilesWalked;
|
||||
}
|
||||
|
||||
public RoomTile getGoal() {
|
||||
return this.goalLocation;
|
||||
}
|
||||
|
||||
public void setGoalLocation(RoomTile goalLocation) {
|
||||
public RoomUnit setGoalLocation(RoomTile goalLocation) {
|
||||
if (goalLocation != null) {
|
||||
// if (goalLocation.state != RoomTileState.INVALID) {
|
||||
this.setGoalLocation(goalLocation, false);
|
||||
}
|
||||
//}
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setGoalLocation(RoomTile goalLocation, boolean noReset) {
|
||||
@ -525,17 +488,14 @@ public class RoomUnit {
|
||||
}
|
||||
}
|
||||
|
||||
public void setLocation(RoomTile location) {
|
||||
public RoomUnit setLocation(RoomTile location) {
|
||||
if (location != null) {
|
||||
this.startLocation = location;
|
||||
setPreviousLocation(location);
|
||||
setCurrentLocation(location);
|
||||
this.goalLocation = location;
|
||||
}
|
||||
}
|
||||
|
||||
public RoomTile getPreviousLocation() {
|
||||
return this.previousLocation;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setPreviousLocation(RoomTile previousLocation) {
|
||||
@ -543,16 +503,9 @@ public class RoomUnit {
|
||||
this.previousLocationZ = this.z;
|
||||
}
|
||||
|
||||
public double getPreviousLocationZ() {
|
||||
return this.previousLocationZ;
|
||||
}
|
||||
|
||||
public void setPreviousLocationZ(double z) {
|
||||
this.previousLocationZ = z;
|
||||
}
|
||||
|
||||
public void setPathFinderRoom(Room room) {
|
||||
public RoomUnit setPathFinderRoom(Room room) {
|
||||
this.room = room;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void findPath() {
|
||||
@ -574,10 +527,6 @@ public class RoomUnit {
|
||||
return this.status.get(key);
|
||||
}
|
||||
|
||||
public ConcurrentHashMap<RoomUnitStatus, String> getStatusMap() {
|
||||
return this.status;
|
||||
}
|
||||
|
||||
public void removeStatus(RoomUnitStatus key) {
|
||||
this.status.remove(key);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.eu.habbo.habbohotel.users;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.database.DatabaseConstants;
|
||||
import com.eu.habbo.habbohotel.catalog.CatalogItem;
|
||||
import com.eu.habbo.habbohotel.games.Game;
|
||||
import com.eu.habbo.habbohotel.games.GamePlayer;
|
||||
@ -211,7 +212,7 @@ public class HabboInfo implements Runnable {
|
||||
statement.setInt(1, this.id);
|
||||
try (ResultSet set = statement.executeQuery()) {
|
||||
while (set.next()) {
|
||||
this.messengerCategories.add(new MessengerCategory(set.getString("name"), set.getInt("user_id"), set.getInt("id")));
|
||||
this.messengerCategories.add(new MessengerCategory(set.getString("name"), set.getInt(DatabaseConstants.USER_ID), set.getInt("id")));
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.eu.habbo.habbohotel.users;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.database.DatabaseConstants;
|
||||
import com.eu.habbo.habbohotel.achievements.Achievement;
|
||||
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
||||
import com.eu.habbo.habbohotel.bots.Bot;
|
||||
@ -21,6 +22,7 @@ import com.eu.habbo.messages.outgoing.users.FigureUpdateComposer;
|
||||
import gnu.trove.set.hash.THashSet;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.math3.util.Pair;
|
||||
@ -70,6 +72,7 @@ public abstract class HabboItem implements Runnable, IEventTriggers {
|
||||
private int rotation;
|
||||
@Setter
|
||||
@Getter
|
||||
@Accessors(chain = true)
|
||||
private String extradata;
|
||||
@Getter
|
||||
private int limitedStack;
|
||||
@ -81,7 +84,7 @@ public abstract class HabboItem implements Runnable, IEventTriggers {
|
||||
|
||||
public HabboItem(ResultSet set, Item baseItem) throws SQLException {
|
||||
this.id = set.getInt("id");
|
||||
this.userId = set.getInt("user_id");
|
||||
this.userId = set.getInt(DatabaseConstants.USER_ID);
|
||||
this.roomId = set.getInt("room_id");
|
||||
this.baseItem = baseItem;
|
||||
this.wallPosition = set.getString("wall_pos");
|
||||
@ -260,7 +263,7 @@ public abstract class HabboItem implements Runnable, IEventTriggers {
|
||||
room.sendComposer(new DanceMessageComposer(roomUnit).compose());
|
||||
}
|
||||
|
||||
if (!this.getBaseItem().getClothingOnWalk().isEmpty() && roomUnit.getPreviousLocation() != roomUnit.getGoal() && roomUnit.getGoal() == room.getLayout().getTile(this.x, this.y)) {
|
||||
if (!this.getBaseItem().getClothingOnWalk().isEmpty() && roomUnit.getPreviousLocation() != roomUnit.getGoalLocation() && roomUnit.getGoalLocation() == room.getLayout().getTile(this.x, this.y)) {
|
||||
Habbo habbo = room.getHabbo(roomUnit);
|
||||
|
||||
if (habbo != null && habbo.getClient() != null) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.eu.habbo.habbohotel.users;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.database.DatabaseConstants;
|
||||
import com.eu.habbo.habbohotel.navigation.DisplayMode;
|
||||
import com.eu.habbo.habbohotel.navigation.ListMode;
|
||||
import gnu.trove.map.hash.THashMap;
|
||||
@ -32,7 +33,7 @@ public class HabboNavigatorWindowSettings {
|
||||
}
|
||||
|
||||
public HabboNavigatorWindowSettings(ResultSet set) throws SQLException {
|
||||
this.userId = set.getInt("user_id");
|
||||
this.userId = set.getInt(DatabaseConstants.USER_ID);
|
||||
this.x = set.getInt("x");
|
||||
this.y = set.getInt("y");
|
||||
this.width = set.getInt("width");
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.eu.habbo.habbohotel.users.cache;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.database.DatabaseConstants;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -24,7 +25,7 @@ public class HabboOfferPurchase {
|
||||
private boolean needsUpdate = false;
|
||||
|
||||
public HabboOfferPurchase(ResultSet set) throws SQLException {
|
||||
this.userId = set.getInt("user_id");
|
||||
this.userId = set.getInt(DatabaseConstants.USER_ID);
|
||||
this.offerId = set.getInt("offer_id");
|
||||
this.state = set.getInt("state");
|
||||
this.amount = set.getInt("amount");
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.eu.habbo.habbohotel.users.inventory;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.database.DatabaseConstants;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.messages.outgoing.inventory.AvatarEffectActivatedMessageComposer;
|
||||
import com.eu.habbo.messages.outgoing.inventory.AvatarEffectAddedMessageComposer;
|
||||
@ -165,7 +166,7 @@ public class EffectsComponent {
|
||||
|
||||
public HabboEffect(ResultSet set) throws SQLException {
|
||||
this.effect = set.getInt("effect");
|
||||
this.userId = set.getInt("user_id");
|
||||
this.userId = set.getInt(DatabaseConstants.USER_ID);
|
||||
this.duration = set.getInt("duration");
|
||||
this.activationTimestamp = set.getInt("activation_timestamp");
|
||||
this.total = set.getInt("total");
|
||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.users.subscriptions;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.database.Database;
|
||||
import com.eu.habbo.database.DatabaseConstants;
|
||||
import com.eu.habbo.habbohotel.achievements.Achievement;
|
||||
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
||||
import com.eu.habbo.habbohotel.messenger.Messenger;
|
||||
@ -265,7 +266,7 @@ public class SubscriptionHabboClub extends Subscription {
|
||||
try (ResultSet set = statement.executeQuery()) {
|
||||
while (set.next()) {
|
||||
try {
|
||||
int userId = set.getInt("user_id");
|
||||
int userId = set.getInt(DatabaseConstants.USER_ID);
|
||||
HabboInfo habboInfo = Emulator.getGameEnvironment().getHabboManager().getHabboInfo(userId);
|
||||
HabboStats stats = habboInfo.getHabboStats();
|
||||
ScrSendKickbackInfoMessageComposer calculated = calculatePayday(habboInfo);
|
||||
@ -278,7 +279,7 @@ public class SubscriptionHabboClub extends Subscription {
|
||||
stats.setLastHCPayday(timestampNow);
|
||||
Emulator.getThreading().run(stats);
|
||||
} catch (Exception e) {
|
||||
log.error("Exception processing HC payday for user #" + set.getInt("user_id"), e);
|
||||
log.error("Exception processing HC payday for user #" + set.getInt(DatabaseConstants.USER_ID), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -328,7 +329,7 @@ public class SubscriptionHabboClub extends Subscription {
|
||||
while (set.next()) {
|
||||
try {
|
||||
int logId = set.getInt("id");
|
||||
int userId = set.getInt("user_id");
|
||||
int userId = set.getInt(DatabaseConstants.USER_ID);
|
||||
int totalPayout = set.getInt("total_payout");
|
||||
String currency = set.getString("currency");
|
||||
|
||||
@ -339,7 +340,7 @@ public class SubscriptionHabboClub extends Subscription {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("Exception processing HC payday for user #" + set.getInt("user_id"), e);
|
||||
log.error("Exception processing HC payday for user #" + set.getInt(DatabaseConstants.USER_ID), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.eu.habbo.habbohotel.users.subscriptions;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.database.DatabaseConstants;
|
||||
import gnu.trove.map.hash.THashMap;
|
||||
import gnu.trove.set.hash.THashSet;
|
||||
import lombok.Getter;
|
||||
@ -67,7 +68,7 @@ public class SubscriptionManager {
|
||||
Class<? extends Subscription> subClazz = Emulator.getGameEnvironment().getSubscriptionManager().getSubscriptionClass(set.getString("subscription_type"));
|
||||
Constructor<? extends Subscription> c = subClazz.getConstructor(Integer.class, Integer.class, String.class, Integer.class, Integer.class, Boolean.class);
|
||||
c.setAccessible(true);
|
||||
Subscription subscription = c.newInstance(set.getInt("id"), set.getInt("user_id"), set.getString("subscription_type"), set.getInt("timestamp_start"), set.getInt("duration"), set.getInt("active") == 1);
|
||||
Subscription subscription = c.newInstance(set.getInt("id"), set.getInt(DatabaseConstants.USER_ID), set.getString("subscription_type"), set.getInt("timestamp_start"), set.getInt("duration"), set.getInt("active") == 1);
|
||||
subscriptions.add(subscription);
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
|
@ -109,7 +109,7 @@ public class UseFurnitureEvent extends MessageHandler {
|
||||
room.sendComposer(new RemoveFloorItemComposer(item, true).compose());
|
||||
room.removeHabboItem(item);
|
||||
room.updateTile(room.getLayout().getTile(item.getX(), item.getY()));
|
||||
room.placePet(pet, item.getX(), item.getY(), item.getZ(), item.getRotation());
|
||||
room.placePet(pet, item.getX(), item.getY(), item.getZ());
|
||||
pet.cycle();
|
||||
room.sendComposer(new UserUpdateComposer(pet.getRoomUnit()).compose());
|
||||
return;
|
||||
|
@ -52,7 +52,7 @@ public class OpenPetPackageEvent extends MessageHandler {
|
||||
}
|
||||
|
||||
if (pet != null) {
|
||||
room.placePet(pet, item.getX(), item.getY(), item.getZ(), item.getRotation());
|
||||
room.placePet(pet, item.getX(), item.getY(), item.getZ());
|
||||
pet.setUserId(this.client.getHabbo().getHabboInfo().getId());
|
||||
pet.needsUpdate = true;
|
||||
pet.getRoomUnit().setLocation(room.getLayout().getTile(item.getX(), item.getY()));
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.eu.habbo.messages.outgoing.modtool;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.database.DatabaseConstants;
|
||||
import com.eu.habbo.habbohotel.modtool.ModToolSanctionItem;
|
||||
import com.eu.habbo.habbohotel.modtool.ModToolSanctionLevelItem;
|
||||
import com.eu.habbo.habbohotel.modtool.ModToolSanctions;
|
||||
@ -31,7 +32,7 @@ public class ModeratorUserInfoComposer extends MessageComposer {
|
||||
|
||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection();
|
||||
PreparedStatement statement = connection.prepareStatement("SELECT COUNT(*) AS amount FROM bans WHERE user_id = ?")) {
|
||||
statement.setInt(1, this.set.getInt("user_id"));
|
||||
statement.setInt(1, this.set.getInt(DatabaseConstants.USER_ID));
|
||||
try (ResultSet set = statement.executeQuery()) {
|
||||
if (set.next()) {
|
||||
totalBans = set.getInt("amount");
|
||||
@ -43,7 +44,7 @@ public class ModeratorUserInfoComposer extends MessageComposer {
|
||||
log.error("Caught SQL exception", e);
|
||||
}
|
||||
|
||||
this.response.appendInt(this.set.getInt("user_id"));
|
||||
this.response.appendInt(this.set.getInt(DatabaseConstants.USER_ID));
|
||||
this.response.appendString(this.set.getString("username"));
|
||||
this.response.appendString(this.set.getString("look"));
|
||||
this.response.appendInt((Emulator.getIntUnixTimestamp() - this.set.getInt("account_created")) / 60);
|
||||
@ -56,7 +57,7 @@ public class ModeratorUserInfoComposer extends MessageComposer {
|
||||
this.response.appendInt(this.set.getInt("tradelock_amount"));
|
||||
this.response.appendString(""); //Trading lock expiry timestamp
|
||||
this.response.appendString(""); //Last Purchase Timestamp
|
||||
this.response.appendInt(this.set.getInt("user_id")); //Personal Identification #
|
||||
this.response.appendInt(this.set.getInt(DatabaseConstants.USER_ID)); //Personal Identification #
|
||||
this.response.appendInt(0); // Number of account bans
|
||||
this.response.appendString(this.set.getBoolean("hide_mail") ? "" : this.set.getString("mail"));
|
||||
this.response.appendString("Rank (" + this.set.getInt("rank_id") + "): " + this.set.getString("rank_name")); //user_class_txt
|
||||
@ -64,8 +65,8 @@ public class ModeratorUserInfoComposer extends MessageComposer {
|
||||
ModToolSanctions modToolSanctions = Emulator.getGameEnvironment().getModToolSanctions();
|
||||
|
||||
if (Emulator.getConfig().getBoolean("hotel.sanctions.enabled")) {
|
||||
THashMap<Integer, ArrayList<ModToolSanctionItem>> modToolSanctionItemsHashMap = Emulator.getGameEnvironment().getModToolSanctions().getSanctions(this.set.getInt("user_id"));
|
||||
ArrayList<ModToolSanctionItem> modToolSanctionItems = modToolSanctionItemsHashMap.get(this.set.getInt("user_id"));
|
||||
THashMap<Integer, ArrayList<ModToolSanctionItem>> modToolSanctionItemsHashMap = Emulator.getGameEnvironment().getModToolSanctions().getSanctions(this.set.getInt(DatabaseConstants.USER_ID));
|
||||
ArrayList<ModToolSanctionItem> modToolSanctionItems = modToolSanctionItemsHashMap.get(this.set.getInt(DatabaseConstants.USER_ID));
|
||||
|
||||
if (modToolSanctionItems != null && modToolSanctionItems.size() > 0) //has sanction
|
||||
{
|
||||
|
@ -8,9 +8,9 @@ import com.eu.habbo.messages.outgoing.Outgoing;
|
||||
import gnu.trove.iterator.TIntObjectIterator;
|
||||
import gnu.trove.map.TIntObjectMap;
|
||||
import gnu.trove.map.hash.THashMap;
|
||||
import gnu.trove.set.hash.THashSet;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
@ -42,7 +42,7 @@ public class ItemsComposer extends MessageComposer {
|
||||
this.response.appendString(set.getValue());
|
||||
}
|
||||
|
||||
THashSet<HabboItem> items = this.room.getWallItems();
|
||||
List<HabboItem> items = this.room.getWallItems();
|
||||
|
||||
this.response.appendInt(items.size());
|
||||
for (HabboItem item : items) {
|
||||
|
@ -50,7 +50,7 @@ public class UserUpdateComposer extends MessageComposer {
|
||||
this.response.appendInt(roomUnit.getBodyRotation().getValue());
|
||||
|
||||
StringBuilder status = new StringBuilder("/");
|
||||
for (Map.Entry<RoomUnitStatus, String> entry : roomUnit.getStatusMap().entrySet()) {
|
||||
for (Map.Entry<RoomUnitStatus, String> entry : roomUnit.getStatus().entrySet()) {
|
||||
status.append(entry.getKey()).append(" ").append(entry.getValue()).append("/");
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ public class UserUpdateComposer extends MessageComposer {
|
||||
|
||||
StringBuilder status = new StringBuilder("/");
|
||||
|
||||
for (Map.Entry<RoomUnitStatus, String> entry : habbo.getRoomUnit().getStatusMap().entrySet()) {
|
||||
for (Map.Entry<RoomUnitStatus, String> entry : habbo.getRoomUnit().getStatus().entrySet()) {
|
||||
status.append(entry.getKey()).append(" ").append(entry.getValue()).append("/");
|
||||
}
|
||||
this.response.appendString(status.toString());
|
||||
|
@ -18,7 +18,7 @@ public class RoomUnitRidePet implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (this.habbo.getRoomUnit() == null || this.pet.getRoomUnit() == null || this.pet.getRoom() != this.habbo.getHabboInfo().getCurrentRoom() || this.goalTile == null || this.habbo.getRoomUnit().getGoal() != this.goalTile)
|
||||
if (this.habbo.getRoomUnit() == null || this.pet.getRoomUnit() == null || this.pet.getRoom() != this.habbo.getHabboInfo().getCurrentRoom() || this.goalTile == null || this.habbo.getRoomUnit().getGoalLocation() != this.goalTile)
|
||||
return;
|
||||
|
||||
if (habbo.getRoomUnit().getCurrentLocation().distance(pet.getRoomUnit().getCurrentLocation()) <= 1) {
|
||||
|
@ -24,7 +24,7 @@ public class RoomUnitTeleportWalkToAction implements Runnable {
|
||||
RoomTile tile = HabboItem.getSquareInFront(this.room.getLayout(), this.habboItem);
|
||||
|
||||
if (tile != null) {
|
||||
if (this.habbo.getRoomUnit().getGoal().equals(tile)) {
|
||||
if (this.habbo.getRoomUnit().getGoalLocation().equals(tile)) {
|
||||
if (this.habbo.getRoomUnit().getCurrentLocation().equals(tile)) {
|
||||
try {
|
||||
this.habboItem.onClick(this.habbo.getClient(), this.room, new Object[]{0});
|
||||
|
@ -22,7 +22,7 @@ public class RoomUnitVendingMachineAction implements Runnable {
|
||||
if (this.habboItem.getRoomId() == this.room.getId()) {
|
||||
RoomTile tile = HabboItem.getSquareInFront(this.room.getLayout(), this.habboItem);
|
||||
if (tile != null) {
|
||||
if (this.habbo.getRoomUnit().getGoal().equals(tile)) {
|
||||
if (this.habbo.getRoomUnit().getGoalLocation().equals(tile)) {
|
||||
if (this.habbo.getRoomUnit().getCurrentLocation().equals(tile)) {
|
||||
try {
|
||||
this.habboItem.onClick(this.habbo.getClient(), this.room, new Object[]{0});
|
||||
|
@ -43,7 +43,7 @@ public class RoomUnitWalkToLocation implements Runnable {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.walker.getGoal().equals(this.goalTile) || (this.walker.getPath().size() == 0 && !this.walker.hasStatus(RoomUnitStatus.MOVE))) {
|
||||
if (!this.walker.getGoalLocation().equals(this.goalTile) || (this.walker.getPath().size() == 0 && !this.walker.hasStatus(RoomUnitStatus.MOVE))) {
|
||||
onFail();
|
||||
return;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public class RoomUnitWalkToRoomUnit implements Runnable {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.walker.getGoal().equals(this.goalTile)) { // check that the action hasn't been cancelled by changing the goal
|
||||
if (this.walker.getGoalLocation().equals(this.goalTile)) { // check that the action hasn't been cancelled by changing the goal
|
||||
if (this.walker.getCurrentLocation().distance(this.goalTile) <= this.minDistance) {
|
||||
for (Runnable r : this.targetReached) {
|
||||
Emulator.getThreading().run(r);
|
||||
|
Loading…
Reference in New Issue
Block a user