11package io .github .thebusybiscuit .slimefun4 .implementation .tasks .armor ;
22
3- import java .util .HashMap ;
4- import java .util .Map ;
5- import java .util .UUID ;
6-
7- import javax .annotation .Nonnull ;
8- import javax .annotation .ParametersAreNonnullByDefault ;
9-
10- import org .bukkit .GameMode ;
11- import org .bukkit .entity .Player ;
12- import org .bukkit .inventory .ItemStack ;
13-
143import io .github .bakedlibs .dough .common .ChatColors ;
154import io .github .thebusybiscuit .slimefun4 .api .items .SlimefunItem ;
165import io .github .thebusybiscuit .slimefun4 .api .player .PlayerProfile ;
176import io .github .thebusybiscuit .slimefun4 .core .attributes .ProtectionType ;
187import io .github .thebusybiscuit .slimefun4 .core .attributes .RadiationSymptom ;
198import io .github .thebusybiscuit .slimefun4 .core .attributes .Radioactive ;
20- import io .github .thebusybiscuit .slimefun4 .implementation .listeners .RadioactivityListener ;
219import io .github .thebusybiscuit .slimefun4 .implementation .Slimefun ;
22- import io .github .thebusybiscuit .slimefun4 .implementation .items . RadioactiveItem ;
10+ import io .github .thebusybiscuit .slimefun4 .implementation .listeners . RadioactivityListener ;
2311import io .github .thebusybiscuit .slimefun4 .utils .RadiationUtils ;
24-
2512import net .md_5 .bungee .api .ChatMessageType ;
2613import net .md_5 .bungee .api .chat .BaseComponent ;
2714import net .md_5 .bungee .api .chat .ComponentBuilder ;
15+ import org .bukkit .GameMode ;
16+ import org .bukkit .entity .Player ;
17+ import org .bukkit .inventory .ItemStack ;
18+
19+ import javax .annotation .Nonnull ;
20+ import javax .annotation .ParametersAreNonnullByDefault ;
21+ import java .util .HashMap ;
22+ import java .util .Map ;
23+ import java .util .UUID ;
2824
2925/**
3026 * The {@link RadiationTask} handles radioactivity for
@@ -48,13 +44,15 @@ protected void onPlayerTick(Player p, PlayerProfile profile) {
4844 }
4945
5046 int exposureTotal = 0 ;
51- if (!profile .hasFullProtectionAgainst (ProtectionType .RADIATION ) && p .getGameMode () != GameMode .CREATIVE && p .getGameMode () != GameMode .SPECTATOR ) {
47+ if (!profile .hasFullProtectionAgainst (ProtectionType .RADIATION )
48+ && p .getGameMode () != GameMode .CREATIVE
49+ && p .getGameMode () != GameMode .SPECTATOR ) {
5250 for (ItemStack item : p .getInventory ()) {
5351 if (item == null || item .getType ().isAir ()) {
5452 continue ;
5553 }
5654 SlimefunItem sfItem = SlimefunItem .getByItem (item );
57- if (sfItem instanceof RadioactiveItem radioactiveItem ) {
55+ if (sfItem instanceof Radioactive radioactiveItem ) {
5856 exposureTotal += item .getAmount () * radioactiveItem .getRadioactivity ().getExposureModifier ();
5957 }
6058 }
@@ -72,7 +70,7 @@ protected void onPlayerTick(Player p, PlayerProfile profile) {
7270
7371 int exposureLevelAfter = RadiationUtils .getExposure (p );
7472
75- Slimefun .runSync (() -> {
73+ Slimefun .runSync (() -> {
7674 for (RadiationSymptom symptom : symptoms ) {
7775 if (symptom .shouldApply (exposureLevelAfter )) {
7876 symptom .apply (p );
@@ -81,8 +79,11 @@ protected void onPlayerTick(Player p, PlayerProfile profile) {
8179 });
8280
8381 if (exposureLevelAfter > 0 || exposureLevelBefore > 0 ) {
84- String msg = Slimefun .getLocalization ().getMessage (p , "actionbar.radiation" ).replace ("%level%" , "" + exposureLevelAfter );
85- BaseComponent [] components = new ComponentBuilder ().append (ChatColors .color (msg )).create ();
82+ String msg = Slimefun .getLocalization ()
83+ .getMessage (p , "actionbar.radiation" )
84+ .replace ("%level%" , "" + exposureLevelAfter );
85+ BaseComponent [] components =
86+ new ComponentBuilder ().append (ChatColors .color (msg )).create ();
8687 p .spigot ().sendMessage (ChatMessageType .ACTION_BAR , components );
8788 }
8889 } else {
0 commit comments