diff --git a/src/main/java/dev/agatharose/asbestos/scheduler/MesotheliomaSched.java b/src/main/java/dev/agatharose/asbestos/scheduler/MesotheliomaSched.java index 11f255b..6471e59 100644 --- a/src/main/java/dev/agatharose/asbestos/scheduler/MesotheliomaSched.java +++ b/src/main/java/dev/agatharose/asbestos/scheduler/MesotheliomaSched.java @@ -20,6 +20,16 @@ public class MesotheliomaSched { if (server.getTicks() % (period * 20) == 0) { server.getWorlds().forEach(world -> { world.getPlayers().forEach(player -> { + // get the player's asbestos exposure level + int exposure = Asbestos.MESOTHELIOMA.get(player).getMesothelioma(); + + // let the player know that they may be entitled to financial compensation... + // before it's too late + if (exposure >= (threshold / 2)) { + // give the player infinite mesothelioma effect + player.addStatusEffect(new StatusEffectInstance(Asbestos.MESOTHELIOMA_EFFECT, 32767)); + } + // iterate over every block in the cuboid findasbestos: for (int i = -offset; i < offset; i++) { for (int j = -offset; j < offset; j++) { @@ -31,15 +41,8 @@ public class MesotheliomaSched { Block block = world.getBlockState(pos).getBlock(); if (block.equals(Asbestos.ASBESTOS_BLOCK)) { - int exposure = Asbestos.MESOTHELIOMA.get(player).getMesothelioma(); Asbestos.MESOTHELIOMA.get(player).setMesothelioma(exposure + 1); - if (exposure >= (threshold / 2)) { - // give the player infinite mesothelioma effect - player.addStatusEffect( - new StatusEffectInstance(Asbestos.MESOTHELIOMA_EFFECT, 32767)); - } - break findasbestos; } }