Fixed a IllegalArgumentException in WiredEffectBotWalkToFurni

This commit is contained in:
Beny 2019-05-18 14:14:58 +01:00
parent 8161e28411
commit 75985a3696

View File

@ -119,25 +119,22 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect
this.items.remove(item); this.items.remove(item);
} }
for(Bot bot : bots) if(this.items.size() > 0) {
{ for (Bot bot : bots) {
int i = Emulator.getRandom().nextInt(this.items.size()) + 1; int i = Emulator.getRandom().nextInt(this.items.size()) + 1;
int j = 1; int j = 1;
for (HabboItem item : this.items) for (HabboItem item : this.items) {
{ if (item.getRoomId() != 0 && item.getRoomId() == bot.getRoom().getId()) {
if(item.getRoomId() != 0 && item.getRoomId() == bot.getRoom().getId()) if (i == j) {
{
if (i == j)
{
bot.getRoomUnit().setGoalLocation(room.getLayout().getTile(item.getX(), item.getY())); bot.getRoomUnit().setGoalLocation(room.getLayout().getTile(item.getX(), item.getY()));
break; break;
} else } else {
{
j++; j++;
} }
} }
} }
} }
}
return true; return true;
} }