diff --git a/core/src/main/java/tc/oc/pgm/variables/types/LivesVariable.java b/core/src/main/java/tc/oc/pgm/variables/types/LivesVariable.java index 462feb5a57..5d5a11a8d5 100644 --- a/core/src/main/java/tc/oc/pgm/variables/types/LivesVariable.java +++ b/core/src/main/java/tc/oc/pgm/variables/types/LivesVariable.java @@ -12,11 +12,15 @@ public LivesVariable() { @Override protected double getValueImpl(MatchPlayer player) { - return player.moduleRequire(BlitzMatchModule.class).getNumOfLives(player.getId()); + return player + .moduleOptional(BlitzMatchModule.class) + .map(bmm -> bmm.getNumOfLives(player.getId())) + .orElse(-1); } @Override protected void setValueImpl(MatchPlayer player, double value) { - player.moduleRequire(BlitzMatchModule.class).setLives(player, Math.max((int) value, 0)); + int amt = Math.max((int) value, 0); + player.moduleOptional(BlitzMatchModule.class).ifPresent(bmm -> bmm.setLives(player, amt)); } }