Fixed NullPointer in Rollers

This commit is contained in:
KrewsOrg 2019-05-04 02:25:43 +01:00
parent b68842d172
commit 37010f7ab3

View File

@ -1617,7 +1617,14 @@ public class Room implements Comparable<Room>, ISerialize, Runnable
HabboItem newRoller = null;
THashSet<Habbo> habbosOnRoller = Room.this.getHabbosAt(roller.getX(), roller.getY());
THashSet<HabboItem> itemsOnRoller = new THashSet<>(getItemsAt(roller.getX(), roller.getY()));
THashSet<HabboItem> itemsOnRoller = new THashSet<>();
RoomTile rollerTile = Room.this.layout.getTile(roller.getX(), roller.getY());
for(HabboItem item : getItemsAt(rollerTile))
{
itemsOnRoller.add(item);
}
itemsOnRoller.remove(roller);
@ -1628,7 +1635,6 @@ public class Room implements Comparable<Room>, ISerialize, Runnable
}
RoomTile tileInFront = Room.this.layout.getTileInFront(Room.this.layout.getTile(roller.getX(), roller.getY()), roller.getRotation());
RoomTile rollerTile = Room.this.layout.getTile(roller.getX(), roller.getY());
if (tileInFront == null)
return true;
@ -1646,7 +1652,13 @@ public class Room implements Comparable<Room>, ISerialize, Runnable
if (Room.this.hasHabbosAt(tileInFront.x, tileInFront.y))
return true;
THashSet<HabboItem> itemsNewTile = new THashSet<>(getItemsAt(tileInFront.x, tileInFront.y));
THashSet<HabboItem> itemsNewTile = new THashSet<>();
for(HabboItem item : getItemsAt(tileInFront))
{
itemsNewTile.add(item);
}
itemsNewTile.removeAll(itemsOnRoller);
List<HabboItem> toRemove = new ArrayList<>();
for (HabboItem item : itemsOnRoller)