Skip to content

Commit

Permalink
fixed radiation - not sure if this is the intended way
Browse files Browse the repository at this point in the history
  • Loading branch information
J3fftw1 committed Jul 5, 2023
1 parent a7fac04 commit b2c264d
Showing 1 changed file with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,32 +46,31 @@ protected void onPlayerTick(Player p,PlayerProfile profile) {
exposureTotal += item.getAmount() * radioactiveItem.getRadioactivity().getExposureModifier();
}
}
}
int exposureLevelBefore = RadiationUtils.getExposure(p);

int exposureLevelBefore = RadiationUtils.getExposure(p);
if (exposureTotal > 0) {
if (exposureLevelBefore == 0) {
Slimefun.getLocalization().sendMessage(p, "messages.radiation");
}

if (exposureTotal > 0) {
if (exposureLevelBefore == 0) {
Slimefun.getLocalization().sendMessage(p, "messages.radiation");
RadiationUtils.addExposure(p, exposureTotal);
} else if (exposureLevelBefore > 0) {
RadiationUtils.removeExposure(p, 1);
}

RadiationUtils.addExposure(p, exposureTotal);
} else if (exposureLevelBefore > 0) {
RadiationUtils.removeExposure(p, 1);
}

int exposureLevelAfter = RadiationUtils.getExposure(p);
int exposureLevelAfter = RadiationUtils.getExposure(p);

for (RadiationSymptom symptom : symptoms) {
if (symptom.shouldApply(exposureLevelAfter)) {
symptom.apply(p);
for (RadiationSymptom symptom : symptoms) {
if (symptom.shouldApply(exposureLevelAfter)) {
symptom.apply(p);
}
}
}

if (exposureLevelAfter > 0 || exposureLevelBefore > 0) {
String msg = Slimefun.getLocalization().getMessage(p, "actionbar.radiation").replace("%level%", "" + exposureLevelAfter);
BaseComponent[] components = new ComponentBuilder().append(ChatColors.color(msg)).create();
p.spigot().sendMessage(ChatMessageType.ACTION_BAR, components);
if (exposureLevelAfter > 0 || exposureLevelBefore > 0) {
String msg = Slimefun.getLocalization().getMessage(p, "actionbar.radiation").replace("%level%", "" + exposureLevelAfter);
BaseComponent[] components = new ComponentBuilder().append(ChatColors.color(msg)).create();
p.spigot().sendMessage(ChatMessageType.ACTION_BAR, components);
}
}
}
}

0 comments on commit b2c264d

Please sign in to comment.