Fix: improve flood detection
This commit is contained in:
parent
05af8c2160
commit
ef10b1de85
@ -585,7 +585,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
for (HabboItem item : items) {
|
for (HabboItem item : items) {
|
||||||
if (exclude != null && item == exclude) continue;
|
if (exclude != null && item == exclude) continue;
|
||||||
|
|
||||||
if(item.getBaseItem().allowLay()) {
|
if (item.getBaseItem().allowLay()) {
|
||||||
return RoomTileState.LAY;
|
return RoomTileState.LAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -594,7 +594,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
|
|
||||||
highestItem = item;*/
|
highestItem = item;*/
|
||||||
|
|
||||||
if(tallestItem != null && tallestItem.getZ() + Item.getCurrentHeight(tallestItem) > item.getZ() + Item.getCurrentHeight(item))
|
if (tallestItem != null && tallestItem.getZ() + Item.getCurrentHeight(tallestItem) > item.getZ() + Item.getCurrentHeight(item))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
result = this.checkStateForItem(item, tile);
|
result = this.checkStateForItem(item, tile);
|
||||||
@ -788,7 +788,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
habbo.getRoomUnit().setPreviousLocationZ(z);
|
habbo.getRoomUnit().setPreviousLocationZ(z);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(habbo.getRoomUnit().getCurrentLocation().is(x, y) && (oldZ != z || updated || oldRotation != habbo.getRoomUnit().getBodyRotation())) {
|
if (habbo.getRoomUnit().getCurrentLocation().is(x, y) && (oldZ != z || updated || oldRotation != habbo.getRoomUnit().getBodyRotation())) {
|
||||||
habbo.getRoomUnit().statusUpdate(true);
|
habbo.getRoomUnit().statusUpdate(true);
|
||||||
//roomUnits.add(habbo.getRoomUnit());
|
//roomUnits.add(habbo.getRoomUnit());
|
||||||
}
|
}
|
||||||
@ -1455,7 +1455,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
for (RoomUnit unit : unitsOnTile) {
|
for (RoomUnit unit : unitsOnTile) {
|
||||||
if (rolledUnitIds.contains(unit.getId())) continue;
|
if (rolledUnitIds.contains(unit.getId())) continue;
|
||||||
|
|
||||||
if(usersRolledThisTile.size() >= Room.ROLLERS_MAXIMUM_ROLL_AVATARS) break;
|
if (usersRolledThisTile.size() >= Room.ROLLERS_MAXIMUM_ROLL_AVATARS) break;
|
||||||
|
|
||||||
if (stackContainsRoller && !allowFurniture && !(topItem != null && topItem.isWalkable()))
|
if (stackContainsRoller && !allowFurniture && !(topItem != null && topItem.isWalkable()))
|
||||||
continue;
|
continue;
|
||||||
@ -1503,7 +1503,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
Emulator.getThreading().run(() -> {
|
Emulator.getThreading().run(() -> {
|
||||||
if (unit.getGoal() == rollerTile) {
|
if (unit.getGoal() == rollerTile) {
|
||||||
try {
|
try {
|
||||||
item.onWalkOn(unit, room, new Object[] { rollerTile, tileInFront });
|
item.onWalkOn(unit, room, new Object[]{rollerTile, tileInFront});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
@ -2212,7 +2212,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
|
|
||||||
public Game getGameOrCreate(Class<? extends Game> gameType) {
|
public Game getGameOrCreate(Class<? extends Game> gameType) {
|
||||||
Game game = this.getGame(gameType);
|
Game game = this.getGame(gameType);
|
||||||
if(game == null) {
|
if (game == null) {
|
||||||
try {
|
try {
|
||||||
game = gameType.getDeclaredConstructor(Room.class).newInstance(this);
|
game = gameType.getDeclaredConstructor(Room.class).newInstance(this);
|
||||||
this.addGame(game);
|
this.addGame(game);
|
||||||
@ -2969,8 +2969,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
list.add(bot.getRoomUnit());
|
list.add(bot.getRoomUnit());
|
||||||
}
|
}
|
||||||
|
|
||||||
for(Habbo habbo : this.getHabbosAt(tile))
|
for (Habbo habbo : this.getHabbosAt(tile)) {
|
||||||
{
|
|
||||||
list.add(habbo.getRoomUnit());
|
list.add(habbo.getRoomUnit());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3142,7 +3141,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
if (roomChatMessage == null || roomChatMessage.getMessage() == null || roomChatMessage.getMessage().equals(""))
|
if (roomChatMessage == null || roomChatMessage.getMessage() == null || roomChatMessage.getMessage().equals(""))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!habbo.hasPermission(Permission.ACC_NOMUTE) && (!MUTEAREA_CAN_WHISPER || chatType != RoomChatType.WHISPER)) {
|
if (!habbo.hasPermission(Permission.ACC_NOMUTE) && (!MUTEAREA_CAN_WHISPER || chatType != RoomChatType.WHISPER)) {
|
||||||
for (HabboItem area : this.getRoomSpecialTypes().getItemsOfType(InteractionMuteArea.class)) {
|
for (HabboItem area : this.getRoomSpecialTypes().getItemsOfType(InteractionMuteArea.class)) {
|
||||||
if (((InteractionMuteArea) area).inSquare(habbo.getRoomUnit().getCurrentLocation())) {
|
if (((InteractionMuteArea) area).inSquare(habbo.getRoomUnit().getCurrentLocation())) {
|
||||||
return;
|
return;
|
||||||
@ -3169,6 +3168,28 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!habbo.hasPermission(Permission.ACC_CHAT_NO_FLOOD)) {
|
||||||
|
final int chatCounter = habbo.getHabboStats().chatCounter.addAndGet(1);
|
||||||
|
|
||||||
|
if (chatCounter > 3) {
|
||||||
|
final boolean floodRights = Emulator.getConfig().getBoolean("flood.with.rights");
|
||||||
|
final boolean hasRights = this.hasRights(habbo);
|
||||||
|
|
||||||
|
if (floodRights || !hasRights) {
|
||||||
|
if (this.chatProtection == 0) {
|
||||||
|
this.floodMuteHabbo(habbo, muteTime);
|
||||||
|
return;
|
||||||
|
} /* else if (this.chatProtection == 1 && chatCounter > 4) {
|
||||||
|
this.floodMuteHabbo(habbo, muteTime);
|
||||||
|
return;
|
||||||
|
} else if (this.chatProtection == 2 && chatCounter > 5) {
|
||||||
|
this.floodMuteHabbo(habbo, muteTime);
|
||||||
|
return;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (chatType != RoomChatType.WHISPER) {
|
if (chatType != RoomChatType.WHISPER) {
|
||||||
if (CommandHandler.handleCommand(habbo.getClient(), roomChatMessage.getUnfilteredMessage())) {
|
if (CommandHandler.handleCommand(habbo.getClient(), roomChatMessage.getUnfilteredMessage())) {
|
||||||
WiredHandler.handle(WiredTriggerType.SAY_COMMAND, habbo.getRoomUnit(), habbo.getHabboInfo().getCurrentRoom(), new Object[]{roomChatMessage.getMessage()});
|
WiredHandler.handle(WiredTriggerType.SAY_COMMAND, habbo.getRoomUnit(), habbo.getHabboInfo().getCurrentRoom(), new Object[]{roomChatMessage.getMessage()});
|
||||||
@ -3184,28 +3205,6 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!habbo.hasPermission(Permission.ACC_CHAT_NO_FLOOD)) {
|
|
||||||
final int chatCounter = habbo.getHabboStats().chatCounter.addAndGet(1);
|
|
||||||
|
|
||||||
if (chatCounter > 3) {
|
|
||||||
final boolean floodRights = Emulator.getConfig().getBoolean("flood.with.rights");
|
|
||||||
final boolean hasRights = this.hasRights(habbo);
|
|
||||||
|
|
||||||
if (floodRights || !hasRights) {
|
|
||||||
if (this.chatProtection == 0) {
|
|
||||||
this.floodMuteHabbo(habbo, muteTime);
|
|
||||||
return;
|
|
||||||
} else if (this.chatProtection == 1 && chatCounter > 4) {
|
|
||||||
this.floodMuteHabbo(habbo, muteTime);
|
|
||||||
return;
|
|
||||||
} else if (this.chatProtection == 2 && chatCounter > 5) {
|
|
||||||
this.floodMuteHabbo(habbo, muteTime);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ServerMessage prefixMessage = null;
|
ServerMessage prefixMessage = null;
|
||||||
|
|
||||||
if (Emulator.getPluginManager().isRegistered(UsernameTalkEvent.class, true)) {
|
if (Emulator.getPluginManager().isRegistered(UsernameTalkEvent.class, true)) {
|
||||||
@ -3215,14 +3214,14 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(prefixMessage == null) {
|
if (prefixMessage == null) {
|
||||||
prefixMessage = roomChatMessage.getHabbo().getHabboInfo().getRank().hasPrefix() ? new RoomUserNameChangedComposer(habbo, true).compose() : null;
|
prefixMessage = roomChatMessage.getHabbo().getHabboInfo().getRank().hasPrefix() ? new RoomUserNameChangedComposer(habbo, true).compose() : null;
|
||||||
}
|
}
|
||||||
ServerMessage clearPrefixMessage = prefixMessage != null ? new RoomUserNameChangedComposer(habbo).compose() : null;
|
ServerMessage clearPrefixMessage = prefixMessage != null ? new RoomUserNameChangedComposer(habbo).compose() : null;
|
||||||
|
|
||||||
Rectangle tentRectangle = this.roomSpecialTypes.tentAt(habbo.getRoomUnit().getCurrentLocation());
|
Rectangle tentRectangle = this.roomSpecialTypes.tentAt(habbo.getRoomUnit().getCurrentLocation());
|
||||||
|
|
||||||
String trimmedMessage = roomChatMessage.getMessage().replaceAll("\\s+$","");
|
String trimmedMessage = roomChatMessage.getMessage().replaceAll("\\s+$", "");
|
||||||
|
|
||||||
if (trimmedMessage.isEmpty()) trimmedMessage = " ";
|
if (trimmedMessage.isEmpty()) trimmedMessage = " ";
|
||||||
|
|
||||||
@ -3357,9 +3356,10 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends the given message to the receiving Habbo if the Habbo has the ACC_SEE_TENTCHAT permission and is not within the tent
|
* Sends the given message to the receiving Habbo if the Habbo has the ACC_SEE_TENTCHAT permission and is not within the tent
|
||||||
* @param receivingHabbo The receiving Habbo
|
*
|
||||||
|
* @param receivingHabbo The receiving Habbo
|
||||||
* @param roomChatMessage The message to receive
|
* @param roomChatMessage The message to receive
|
||||||
* @param tentRectangle The whole tent area from where the sending Habbo is saying something
|
* @param tentRectangle The whole tent area from where the sending Habbo is saying something
|
||||||
*/
|
*/
|
||||||
private void showTentChatMessageOutsideTentIfPermitted(Habbo receivingHabbo, RoomChatMessage roomChatMessage, Rectangle tentRectangle) {
|
private void showTentChatMessageOutsideTentIfPermitted(Habbo receivingHabbo, RoomChatMessage roomChatMessage, Rectangle tentRectangle) {
|
||||||
if (receivingHabbo != null && receivingHabbo.hasPermission(Permission.ACC_SEE_TENTCHAT) && tentRectangle != null && !RoomLayout.tileInSquare(tentRectangle, receivingHabbo.getRoomUnit().getCurrentLocation())) {
|
if (receivingHabbo != null && receivingHabbo.hasPermission(Permission.ACC_SEE_TENTCHAT) && tentRectangle != null && !RoomLayout.tileInSquare(tentRectangle, receivingHabbo.getRoomUnit().getCurrentLocation())) {
|
||||||
@ -3447,7 +3447,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
|
|
||||||
if (this.loaded) {
|
if (this.loaded) {
|
||||||
THashSet<HabboItem> cachedItems = this.tileCache.get(tile);
|
THashSet<HabboItem> cachedItems = this.tileCache.get(tile);
|
||||||
if(cachedItems != null)
|
if (cachedItems != null)
|
||||||
return cachedItems;
|
return cachedItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3473,8 +3473,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
if (item.getRotation() != 2 && item.getRotation() != 6) {
|
if (item.getRotation() != 2 && item.getRotation() != 6) {
|
||||||
width = item.getBaseItem().getWidth() > 0 ? item.getBaseItem().getWidth() : 1;
|
width = item.getBaseItem().getWidth() > 0 ? item.getBaseItem().getWidth() : 1;
|
||||||
length = item.getBaseItem().getLength() > 0 ? item.getBaseItem().getLength() : 1;
|
length = item.getBaseItem().getLength() > 0 ? item.getBaseItem().getLength() : 1;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
width = item.getBaseItem().getLength() > 0 ? item.getBaseItem().getLength() : 1;
|
width = item.getBaseItem().getLength() > 0 ? item.getBaseItem().getLength() : 1;
|
||||||
length = item.getBaseItem().getWidth() > 0 ? item.getBaseItem().getWidth() : 1;
|
length = item.getBaseItem().getWidth() > 0 ? item.getBaseItem().getWidth() : 1;
|
||||||
}
|
}
|
||||||
@ -3484,7 +3483,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
|
|
||||||
items.add(item);
|
items.add(item);
|
||||||
|
|
||||||
if(returnOnFirst) {
|
if (returnOnFirst) {
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3523,7 +3522,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
public boolean hasItemsAt(int x, int y) {
|
public boolean hasItemsAt(int x, int y) {
|
||||||
RoomTile tile = this.getLayout().getTile((short) x, (short) y);
|
RoomTile tile = this.getLayout().getTile((short) x, (short) y);
|
||||||
|
|
||||||
if(tile == null)
|
if (tile == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return this.getItemsAt(tile, true).size() > 0;
|
return this.getItemsAt(tile, true).size() > 0;
|
||||||
@ -3536,13 +3535,13 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
public HabboItem getTopItemAt(int x, int y, HabboItem exclude) {
|
public HabboItem getTopItemAt(int x, int y, HabboItem exclude) {
|
||||||
RoomTile tile = this.getLayout().getTile((short) x, (short) y);
|
RoomTile tile = this.getLayout().getTile((short) x, (short) y);
|
||||||
|
|
||||||
if(tile == null)
|
if (tile == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
HabboItem highestItem = null;
|
HabboItem highestItem = null;
|
||||||
|
|
||||||
for (HabboItem item : this.getItemsAt(x, y)) {
|
for (HabboItem item : this.getItemsAt(x, y)) {
|
||||||
if(exclude != null && exclude == item)
|
if (exclude != null && exclude == item)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (highestItem != null && highestItem.getZ() + Item.getCurrentHeight(highestItem) > item.getZ() + Item.getCurrentHeight(item))
|
if (highestItem != null && highestItem.getZ() + Item.getCurrentHeight(highestItem) > item.getZ() + Item.getCurrentHeight(item))
|
||||||
@ -3556,7 +3555,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
|
|
||||||
public HabboItem getTopItemAt(THashSet<RoomTile> tiles, HabboItem exclude) {
|
public HabboItem getTopItemAt(THashSet<RoomTile> tiles, HabboItem exclude) {
|
||||||
HabboItem highestItem = null;
|
HabboItem highestItem = null;
|
||||||
for(RoomTile tile : tiles) {
|
for (RoomTile tile : tiles) {
|
||||||
|
|
||||||
if (tile == null)
|
if (tile == null)
|
||||||
continue;
|
continue;
|
||||||
@ -3604,10 +3603,10 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
if (items != null && !items.isEmpty()) {
|
if (items != null && !items.isEmpty()) {
|
||||||
for (HabboItem item : items) {
|
for (HabboItem item : items) {
|
||||||
|
|
||||||
if(!item.getBaseItem().allowSit())
|
if (!item.getBaseItem().allowSit())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(lowestChair != null && lowestChair.getZ() < item.getZ())
|
if (lowestChair != null && lowestChair.getZ() < item.getZ())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
lowestChair = item;
|
lowestChair = item;
|
||||||
@ -3624,10 +3623,10 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
if (items != null && !items.isEmpty()) {
|
if (items != null && !items.isEmpty()) {
|
||||||
for (HabboItem item : items) {
|
for (HabboItem item : items) {
|
||||||
|
|
||||||
if(!item.getBaseItem().allowSit())
|
if (!item.getBaseItem().allowSit())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(lowestChair != null && lowestChair.getZ() + Item.getCurrentHeight(lowestChair) > item.getZ() + Item.getCurrentHeight(item))
|
if (lowestChair != null && lowestChair.getZ() + Item.getCurrentHeight(lowestChair) > item.getZ() + Item.getCurrentHeight(item))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
lowestChair = item;
|
lowestChair = item;
|
||||||
@ -3644,7 +3643,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
|
|
||||||
if (Emulator.getPluginManager().isRegistered(FurnitureStackHeightEvent.class, true)) {
|
if (Emulator.getPluginManager().isRegistered(FurnitureStackHeightEvent.class, true)) {
|
||||||
FurnitureStackHeightEvent event = Emulator.getPluginManager().fireEvent(new FurnitureStackHeightEvent(x, y, this));
|
FurnitureStackHeightEvent event = Emulator.getPluginManager().fireEvent(new FurnitureStackHeightEvent(x, y, this));
|
||||||
if(event.hasPluginHelper()) {
|
if (event.hasPluginHelper()) {
|
||||||
return calculateHeightmap ? event.getHeight() * 256.0D : event.getHeight();
|
return calculateHeightmap ? event.getHeight() * 256.0D : event.getHeight();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3654,8 +3653,8 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
|
|
||||||
THashSet<HabboItem> stackHelpers = this.getItemsAt(InteractionStackHelper.class, x, y);
|
THashSet<HabboItem> stackHelpers = this.getItemsAt(InteractionStackHelper.class, x, y);
|
||||||
|
|
||||||
if(stackHelpers.size() > 0) {
|
if (stackHelpers.size() > 0) {
|
||||||
for(HabboItem item : stackHelpers) {
|
for (HabboItem item : stackHelpers) {
|
||||||
if (item == exclude) continue;
|
if (item == exclude) continue;
|
||||||
return calculateHeightmap ? item.getZ() * 256.0D : item.getZ();
|
return calculateHeightmap ? item.getZ() * 256.0D : item.getZ();
|
||||||
}
|
}
|
||||||
@ -3750,7 +3749,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
HabboItem tallestItem = null;
|
HabboItem tallestItem = null;
|
||||||
|
|
||||||
for (HabboItem item : items) {
|
for (HabboItem item : items) {
|
||||||
if(tallestItem != null && tallestItem.getZ() + Item.getCurrentHeight(tallestItem) > item.getZ() + Item.getCurrentHeight(item))
|
if (tallestItem != null && tallestItem.getZ() + Item.getCurrentHeight(tallestItem) > item.getZ() + Item.getCurrentHeight(item))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
tallestItem = item;
|
tallestItem = item;
|
||||||
@ -4173,8 +4172,8 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
|
|
||||||
this.updateTiles(this.getLayout().getTilesAt(this.layout.getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()));
|
this.updateTiles(this.getLayout().getTilesAt(this.layout.getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()));
|
||||||
|
|
||||||
if(item instanceof InteractionMultiHeight) {
|
if (item instanceof InteractionMultiHeight) {
|
||||||
((InteractionMultiHeight)item).updateUnitsOnItem(this);
|
((InteractionMultiHeight) item).updateUnitsOnItem(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4341,7 +4340,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void dance(RoomUnit unit, DanceType danceType) {
|
public void dance(RoomUnit unit, DanceType danceType) {
|
||||||
if(unit.getDanceType() != danceType) {
|
if (unit.getDanceType() != danceType) {
|
||||||
boolean isDancing = !unit.getDanceType().equals(DanceType.NONE);
|
boolean isDancing = !unit.getDanceType().equals(DanceType.NONE);
|
||||||
unit.setDanceType(danceType);
|
unit.setDanceType(danceType);
|
||||||
this.sendComposer(new RoomUserDanceComposer(unit).compose());
|
this.sendComposer(new RoomUserDanceComposer(unit).compose());
|
||||||
@ -4496,7 +4495,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
|
|
||||||
for (HabboItem area : this.getRoomSpecialTypes().getItemsOfType(InteractionBuildArea.class)) {
|
for (HabboItem area : this.getRoomSpecialTypes().getItemsOfType(InteractionBuildArea.class)) {
|
||||||
if (((InteractionBuildArea) area).inSquare(tile) && ((InteractionBuildArea) area).isBuilder(habbo.getHabboInfo().getUsername())) {
|
if (((InteractionBuildArea) area).inSquare(tile) && ((InteractionBuildArea) area).isBuilder(habbo.getHabboInfo().getUsername())) {
|
||||||
return FurnitureMovementError.NONE;
|
return FurnitureMovementError.NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4515,8 +4514,8 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
|
|
||||||
THashSet<RoomTile> occupiedTiles = this.layout.getTilesAt(tile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation);
|
THashSet<RoomTile> occupiedTiles = this.layout.getTilesAt(tile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation);
|
||||||
for (RoomTile t : occupiedTiles) {
|
for (RoomTile t : occupiedTiles) {
|
||||||
if(t.state == RoomTileState.INVALID) return FurnitureMovementError.INVALID_MOVE;
|
if (t.state == RoomTileState.INVALID) return FurnitureMovementError.INVALID_MOVE;
|
||||||
if(!Emulator.getConfig().getBoolean("wired.place.under", false) || (Emulator.getConfig().getBoolean("wired.place.under", false) && !item.isWalkable() && !item.getBaseItem().allowSit() && !item.getBaseItem().allowLay())) {
|
if (!Emulator.getConfig().getBoolean("wired.place.under", false) || (Emulator.getConfig().getBoolean("wired.place.under", false) && !item.isWalkable() && !item.getBaseItem().allowSit() && !item.getBaseItem().allowLay())) {
|
||||||
if (checkForUnits && this.hasHabbosAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_HABBOS;
|
if (checkForUnits && this.hasHabbosAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_HABBOS;
|
||||||
if (checkForUnits && this.hasBotsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_BOTS;
|
if (checkForUnits && this.hasBotsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_BOTS;
|
||||||
if (checkForUnits && this.hasPetsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_PETS;
|
if (checkForUnits && this.hasPetsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_PETS;
|
||||||
@ -4562,9 +4561,9 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
|
|
||||||
double height = tile.getStackHeight();
|
double height = tile.getStackHeight();
|
||||||
|
|
||||||
for(RoomTile tile2 : occupiedTiles) {
|
for (RoomTile tile2 : occupiedTiles) {
|
||||||
double sHeight = tile2.getStackHeight();
|
double sHeight = tile2.getStackHeight();
|
||||||
if(sHeight > height) {
|
if (sHeight > height) {
|
||||||
height = sHeight;
|
height = sHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4640,7 +4639,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
boolean pluginHelper = false;
|
boolean pluginHelper = false;
|
||||||
if (Emulator.getPluginManager().isRegistered(FurnitureMovedEvent.class, true)) {
|
if (Emulator.getPluginManager().isRegistered(FurnitureMovedEvent.class, true)) {
|
||||||
FurnitureMovedEvent event = Emulator.getPluginManager().fireEvent(new FurnitureMovedEvent(item, actor, oldLocation, tile));
|
FurnitureMovedEvent event = Emulator.getPluginManager().fireEvent(new FurnitureMovedEvent(item, actor, oldLocation, tile));
|
||||||
if(event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return FurnitureMovementError.CANCEL_PLUGIN_MOVE;
|
return FurnitureMovementError.CANCEL_PLUGIN_MOVE;
|
||||||
}
|
}
|
||||||
pluginHelper = event.hasPluginHelper();
|
pluginHelper = event.hasPluginHelper();
|
||||||
@ -4663,7 +4662,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
if (!magicTile && ((tileTopItem != null && tileTopItem != item ? (t.state.equals(RoomTileState.INVALID) || !t.getAllowStack() || !tileTopItem.getBaseItem().allowStack()) : this.calculateTileState(t, item).equals(RoomTileState.INVALID))))
|
if (!magicTile && ((tileTopItem != null && tileTopItem != item ? (t.state.equals(RoomTileState.INVALID) || !t.getAllowStack() || !tileTopItem.getBaseItem().allowStack()) : this.calculateTileState(t, item).equals(RoomTileState.INVALID))))
|
||||||
return FurnitureMovementError.CANT_STACK;
|
return FurnitureMovementError.CANT_STACK;
|
||||||
|
|
||||||
if(!Emulator.getConfig().getBoolean("wired.place.under", false) || (Emulator.getConfig().getBoolean("wired.place.under", false) && !item.isWalkable() && !item.getBaseItem().allowSit() && !item.getBaseItem().allowLay())) {
|
if (!Emulator.getConfig().getBoolean("wired.place.under", false) || (Emulator.getConfig().getBoolean("wired.place.under", false) && !item.isWalkable() && !item.getBaseItem().allowSit() && !item.getBaseItem().allowLay())) {
|
||||||
if (checkForUnits) {
|
if (checkForUnits) {
|
||||||
if (!magicTile && this.hasHabbosAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_HABBOS;
|
if (!magicTile && this.hasHabbosAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_HABBOS;
|
||||||
if (!magicTile && this.hasBotsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_BOTS;
|
if (!magicTile && this.hasBotsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_BOTS;
|
||||||
@ -4699,8 +4698,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if((!stackHelper.isPresent() && topItem != null && topItem != item && !topItem.getBaseItem().allowStack())|| (topItem != null && topItem != item && topItem.getZ() + Item.getCurrentHeight(topItem) + Item.getCurrentHeight(item) > MAXIMUM_FURNI_HEIGHT))
|
if ((!stackHelper.isPresent() && topItem != null && topItem != item && !topItem.getBaseItem().allowStack()) || (topItem != null && topItem != item && topItem.getZ() + Item.getCurrentHeight(topItem) + Item.getCurrentHeight(item) > MAXIMUM_FURNI_HEIGHT)) {
|
||||||
{
|
|
||||||
item.setRotation(oldRotation);
|
item.setRotation(oldRotation);
|
||||||
return FurnitureMovementError.CANT_STACK;
|
return FurnitureMovementError.CANT_STACK;
|
||||||
}
|
}
|
||||||
@ -4717,16 +4715,17 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
height = item.getZ();
|
height = item.getZ();
|
||||||
} else {
|
} else {
|
||||||
height = this.getStackHeight(tile.x, tile.y, false, item);
|
height = this.getStackHeight(tile.x, tile.y, false, item);
|
||||||
for(RoomTile til : occupiedTiles) {
|
for (RoomTile til : occupiedTiles) {
|
||||||
double sHeight = this.getStackHeight(til.x, til.y, false, item);
|
double sHeight = this.getStackHeight(til.x, til.y, false, item);
|
||||||
if(sHeight > height) {
|
if (sHeight > height) {
|
||||||
height = sHeight;
|
height = sHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(height > MAXIMUM_FURNI_HEIGHT) return FurnitureMovementError.CANT_STACK;
|
if (height > MAXIMUM_FURNI_HEIGHT) return FurnitureMovementError.CANT_STACK;
|
||||||
if(height < this.getLayout().getHeightAtSquare(tile.x, tile.y)) return FurnitureMovementError.CANT_STACK; //prevent furni going under the floor
|
if (height < this.getLayout().getHeightAtSquare(tile.x, tile.y))
|
||||||
|
return FurnitureMovementError.CANT_STACK; //prevent furni going under the floor
|
||||||
|
|
||||||
if (Emulator.getPluginManager().isRegistered(FurnitureBuildheightEvent.class, true)) {
|
if (Emulator.getPluginManager().isRegistered(FurnitureBuildheightEvent.class, true)) {
|
||||||
FurnitureBuildheightEvent event = Emulator.getPluginManager().fireEvent(new FurnitureBuildheightEvent(item, actor, 0.00, height));
|
FurnitureBuildheightEvent event = Emulator.getPluginManager().fireEvent(new FurnitureBuildheightEvent(item, actor, 0.00, height));
|
||||||
@ -4752,7 +4751,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
item.needsUpdate(true);
|
item.needsUpdate(true);
|
||||||
Emulator.getThreading().run(item);
|
Emulator.getThreading().run(item);
|
||||||
|
|
||||||
if(sendUpdates) {
|
if (sendUpdates) {
|
||||||
this.sendComposer(new FloorItemUpdateComposer(item).compose());
|
this.sendComposer(new FloorItemUpdateComposer(item).compose());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4773,13 +4772,12 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
);
|
);
|
||||||
this.updateBotsAt(t.x, t.y);
|
this.updateBotsAt(t.x, t.y);
|
||||||
}
|
}
|
||||||
if(Emulator.getConfig().getBoolean("wired.place.under", false)) {
|
if (Emulator.getConfig().getBoolean("wired.place.under", false)) {
|
||||||
for(RoomTile t : newOccupiedTiles) {
|
for (RoomTile t : newOccupiedTiles) {
|
||||||
for(Habbo h : this.getHabbosAt(t.x, t.y)) {
|
for (Habbo h : this.getHabbosAt(t.x, t.y)) {
|
||||||
try {
|
try {
|
||||||
item.onWalkOn(h.getRoomUnit(), this, null);
|
item.onWalkOn(h.getRoomUnit(), this, null);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch(Exception e) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user