Fix trap interaction (Kitt Mustang)

This commit is contained in:
ArpyAge 2021-09-03 16:25:27 +02:00
parent 9386ad4663
commit 1b82658bd3

View File

@ -22,13 +22,12 @@ public class InteractionTrap extends InteractionDefault {
@Override
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
if (!this.getExtradata().equals("0")) {
Habbo habbo = room.getHabbo(roomUnit);
int effect = habbo.getClient().getHabbo().getRoomUnit().getEffectId();
roomUnit.stopWalking();
super.onWalkOn(roomUnit, room, objects);
if (!this.getExtradata().equals("1"))
return;
int delay = Emulator.getConfig().getInt("hotel.item.trap." + this.getBaseItem().getName());
if (delay == 0) {
Emulator.getConfig().register("hotel.item.trap." + this.getBaseItem().getName(), "3000");
delay = 3000;
@ -37,7 +36,6 @@ public class InteractionTrap extends InteractionDefault {
if (roomUnit != null) {
if (this.getBaseItem().getEffectF() > 0 || this.getBaseItem().getEffectM() > 0) {
if (roomUnit.getRoomUnitType().equals(RoomUnitType.USER)) {
Habbo habbo = room.getHabbo(roomUnit);
if (habbo != null) {
if (habbo.getHabboInfo().getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0 && habbo.getRoomUnit().getEffectId() != this.getBaseItem().getEffectM()) {
@ -55,12 +53,14 @@ public class InteractionTrap extends InteractionDefault {
Emulator.getThreading().run(() -> {
room.giveEffect(roomUnit, 0, -1);
roomUnit.setCanWalk(true);
room.giveEffect(roomUnit, effect, -1);
}, delay);
}
}
}
}
}
}
@Override
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {