mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-23 15:20:52 +01:00
Merge branch 'patch-wired-reset-null-exception' into 'dev'
fixed null pointer exception in timer reset wired See merge request morningstar/Arcturus-Community!78
This commit is contained in:
commit
a460b1e1a6
@ -1,9 +1,11 @@
|
|||||||
package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
|
package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
|
||||||
|
|
||||||
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.items.ICycleable;
|
import com.eu.habbo.habbohotel.items.ICycleable;
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||||
|
import com.eu.habbo.habbohotel.items.interactions.wired.WiredTriggerReset;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||||
@ -17,7 +19,7 @@ import java.sql.SQLException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class WiredTriggerRepeater extends InteractionWiredTrigger implements ICycleable {
|
public class WiredTriggerRepeater extends InteractionWiredTrigger implements ICycleable, WiredTriggerReset {
|
||||||
public static final WiredTriggerType type = WiredTriggerType.PERIODICALLY;
|
public static final WiredTriggerType type = WiredTriggerType.PERIODICALLY;
|
||||||
public static final int DEFAULT_DELAY = 20 * 500;
|
public static final int DEFAULT_DELAY = 20 * 500;
|
||||||
|
|
||||||
@ -123,4 +125,15 @@ public class WiredTriggerRepeater extends InteractionWiredTrigger implements ICy
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resetTimer() {
|
||||||
|
this.counter = 0;
|
||||||
|
if (this.getRoomId() != 0) {
|
||||||
|
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());
|
||||||
|
if (room != null && room.isLoaded()) {
|
||||||
|
WiredHandler.handle(this, null, room, new Object[]{this});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
|
package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
|
||||||
|
|
||||||
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.items.ICycleable;
|
import com.eu.habbo.habbohotel.items.ICycleable;
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||||
|
import com.eu.habbo.habbohotel.items.interactions.wired.WiredTriggerReset;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||||
@ -17,7 +19,7 @@ import java.sql.SQLException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class WiredTriggerRepeaterLong extends InteractionWiredTrigger implements ICycleable {
|
public class WiredTriggerRepeaterLong extends InteractionWiredTrigger implements ICycleable, WiredTriggerReset {
|
||||||
public static final int DEFAULT_DELAY = 20 * 5000;
|
public static final int DEFAULT_DELAY = 20 * 5000;
|
||||||
private static final WiredTriggerType type = WiredTriggerType.PERIODICALLY_LONG;
|
private static final WiredTriggerType type = WiredTriggerType.PERIODICALLY_LONG;
|
||||||
private int repeatTime = DEFAULT_DELAY;
|
private int repeatTime = DEFAULT_DELAY;
|
||||||
@ -117,4 +119,15 @@ public class WiredTriggerRepeaterLong extends InteractionWiredTrigger implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resetTimer() {
|
||||||
|
this.counter = 0;
|
||||||
|
if (this.getRoomId() != 0) {
|
||||||
|
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());
|
||||||
|
if (room != null && room.isLoaded()) {
|
||||||
|
WiredHandler.handle(this, null, room, new Object[]{this});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -418,14 +418,11 @@ public class WiredHandler {
|
|||||||
if (!room.isLoaded())
|
if (!room.isLoaded())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
THashSet<InteractionWiredTrigger> triggers = room.getRoomSpecialTypes().getTriggers(WiredTriggerType.AT_GIVEN_TIME);
|
room.getRoomSpecialTypes().getTriggers().forEach(t-> {
|
||||||
triggers.addAll(room.getRoomSpecialTypes().getTriggers(WiredTriggerType.PERIODICALLY));
|
if(t.getType() == WiredTriggerType.AT_GIVEN_TIME || t.getType() == WiredTriggerType.PERIODICALLY || t.getType() == WiredTriggerType.PERIODICALLY_LONG) {
|
||||||
triggers.addAll(room.getRoomSpecialTypes().getTriggers(WiredTriggerType.PERIODICALLY_LONG));
|
((WiredTriggerReset) t).resetTimer();
|
||||||
if (triggers != null) {
|
|
||||||
for (InteractionWiredTrigger trigger : triggers) {
|
|
||||||
((WiredTriggerReset) trigger).resetTimer();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
room.setLastTimerReset(Emulator.getIntUnixTimestamp());
|
room.setLastTimerReset(Emulator.getIntUnixTimestamp());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user