Browse Source

Add a workaround for mesothelioma being temporary

mistress
Agatha 4 months ago
parent
commit
ec95a21963
Signed by: sorceress <agatharose@wantscuddl.es> GPG Key ID: 2DB18BA2E0A80BC3
1 changed files with 10 additions and 7 deletions
  1. +10
    -7
      src/main/java/dev/agatharose/asbestos/scheduler/MesotheliomaSched.java

+ 10
- 7
src/main/java/dev/agatharose/asbestos/scheduler/MesotheliomaSched.java View File

@@ -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;
}
}


Loading…
Cancel
Save