Add a workaround for mesothelioma being temporary
This commit is contained in:
parent
d1860097ce
commit
ec95a21963
|
@ -20,6 +20,16 @@ public class MesotheliomaSched {
|
||||||
if (server.getTicks() % (period * 20) == 0) {
|
if (server.getTicks() % (period * 20) == 0) {
|
||||||
server.getWorlds().forEach(world -> {
|
server.getWorlds().forEach(world -> {
|
||||||
world.getPlayers().forEach(player -> {
|
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
|
// iterate over every block in the cuboid
|
||||||
findasbestos: for (int i = -offset; i < offset; i++) {
|
findasbestos: for (int i = -offset; i < offset; i++) {
|
||||||
for (int j = -offset; j < offset; j++) {
|
for (int j = -offset; j < offset; j++) {
|
||||||
|
@ -31,15 +41,8 @@ public class MesotheliomaSched {
|
||||||
Block block = world.getBlockState(pos).getBlock();
|
Block block = world.getBlockState(pos).getBlock();
|
||||||
|
|
||||||
if (block.equals(Asbestos.ASBESTOS_BLOCK)) {
|
if (block.equals(Asbestos.ASBESTOS_BLOCK)) {
|
||||||
int exposure = Asbestos.MESOTHELIOMA.get(player).getMesothelioma();
|
|
||||||
Asbestos.MESOTHELIOMA.get(player).setMesothelioma(exposure + 1);
|
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;
|
break findasbestos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue