Add a workaround for mesothelioma being temporary

This commit is contained in:
Agatha Lovelace 2020-12-24 00:56:10 +02:00
parent d1860097ce
commit ec95a21963
No known key found for this signature in database
GPG Key ID: 2DB18BA2E0A80BC3
1 changed files with 10 additions and 7 deletions

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