mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2025-01-31 12:22:36 +01:00
Fix NullPointerExceptions
This commit is contained in:
parent
31711bd2f9
commit
8870145948
@ -16,6 +16,7 @@ import com.eu.habbo.messages.ServerMessage;
|
|||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class InteractionGameTimer extends HabboItem implements Runnable {
|
public class InteractionGameTimer extends HabboItem implements Runnable {
|
||||||
private int[] TIMER_INTERVAL_STEPS = new int[] { 30, 60, 120, 180, 300, 600 };
|
private int[] TIMER_INTERVAL_STEPS = new int[] { 30, 60, 120, 180, 300, 600 };
|
||||||
@ -77,16 +78,17 @@ public class InteractionGameTimer extends HabboItem implements Runnable {
|
|||||||
parseCustomParams(item);
|
parseCustomParams(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void parseCustomParams(Item baseItem) {
|
private void parseCustomParams(Item baseItem) {
|
||||||
try {
|
try {
|
||||||
String[] intervalSteps = baseItem.getCustomParams().split(",");
|
TIMER_INTERVAL_STEPS = Arrays.stream(baseItem.getCustomParams().split(","))
|
||||||
int[] finalSteps = new int[intervalSteps.length];
|
.mapToInt(s -> {
|
||||||
for (int i = 0; i < intervalSteps.length; i++) {
|
try {
|
||||||
finalSteps[i] = Integer.parseInt(intervalSteps[i]);
|
return Integer.parseInt(s);
|
||||||
}
|
} catch (NumberFormatException e) {
|
||||||
TIMER_INTERVAL_STEPS = finalSteps;
|
return 0;
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
}).toArray();
|
||||||
|
} catch (Exception e) {
|
||||||
Emulator.getLogging().logErrorLine(e);
|
Emulator.getLogging().logErrorLine(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ public class RoomUserWalkEvent extends MessageHandler {
|
|||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
if (!event.idle) {
|
if (!event.idle) {
|
||||||
roomUnit.getRoom().unIdle(habbo);
|
if (roomUnit.getRoom() != null) roomUnit.getRoom().unIdle(habbo);
|
||||||
roomUnit.resetIdleTimer();
|
roomUnit.resetIdleTimer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,11 +19,12 @@ public class UserEffectsListComposer extends MessageComposer {
|
|||||||
public ServerMessage compose() {
|
public ServerMessage compose() {
|
||||||
this.response.init(Outgoing.UserEffectsListComposer);
|
this.response.init(Outgoing.UserEffectsListComposer);
|
||||||
|
|
||||||
synchronized (this.habbo.getInventory().getEffectsComponent().effects) {
|
if (this.habbo == null || this.habbo.getInventory() == null || this.habbo.getInventory().getEffectsComponent() == null || this.habbo.getInventory().getEffectsComponent().effects == null) {
|
||||||
this.response.appendInt(this.habbo.getInventory().getEffectsComponent().effects.size());
|
this.response.appendInt(0);
|
||||||
this.habbo.getInventory().getEffectsComponent().effects.forEachValue(new TObjectProcedure<EffectsComponent.HabboEffect>() {
|
} else {
|
||||||
@Override
|
synchronized (this.habbo.getInventory().getEffectsComponent().effects) {
|
||||||
public boolean execute(EffectsComponent.HabboEffect effect) {
|
this.response.appendInt(this.habbo.getInventory().getEffectsComponent().effects.size());
|
||||||
|
this.habbo.getInventory().getEffectsComponent().effects.forEachValue(effect -> {
|
||||||
UserEffectsListComposer.this.response.appendInt(effect.effect);
|
UserEffectsListComposer.this.response.appendInt(effect.effect);
|
||||||
UserEffectsListComposer.this.response.appendInt(0);
|
UserEffectsListComposer.this.response.appendInt(0);
|
||||||
UserEffectsListComposer.this.response.appendInt(effect.duration);
|
UserEffectsListComposer.this.response.appendInt(effect.duration);
|
||||||
@ -31,9 +32,10 @@ public class UserEffectsListComposer extends MessageComposer {
|
|||||||
UserEffectsListComposer.this.response.appendInt(effect.activationTimestamp >= 0 ? Emulator.getIntUnixTimestamp() - effect.activationTimestamp : -1);
|
UserEffectsListComposer.this.response.appendInt(effect.activationTimestamp >= 0 ? Emulator.getIntUnixTimestamp() - effect.activationTimestamp : -1);
|
||||||
UserEffectsListComposer.this.response.appendBoolean(effect.isActivated());
|
UserEffectsListComposer.this.response.appendBoolean(effect.isActivated());
|
||||||
return true;
|
return true;
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.response;
|
return this.response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user