Skip to content

Commit

Permalink
:wip: chore: Clean up even more sonarcloud code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
ProfElements committed Dec 10, 2023
1 parent 419c236 commit 2132d77
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,16 @@ public ElectricalStimulatorListener(@Nonnull DynaTech plugin, @Nonnull Electrica

@EventHandler
public void onHungerLoss(FoodLevelChangeEvent e) {
if (e.getEntity() instanceof Player p) {
if (p.getFoodLevel() < 20 && feedPlayer(p)) {
e.setFoodLevel(20);
}
if (e.getEntity() instanceof Player p && p.getFoodLevel() < 20 && feedPlayer(p)) {
e.setFoodLevel(20);
}
}

@EventHandler
public void onHungerDamage(EntityDamageEvent e) {
if (e.getEntity() instanceof Player p && e.getCause() == EntityDamageEvent.DamageCause.STARVATION) {
if(feedPlayer(p)) {
p.setFoodLevel(20);
p.setSaturation(20f);
}
if (e.getEntity() instanceof Player p && e.getCause() == EntityDamageEvent.DamageCause.STARVATION && feedPlayer(p)) {
p.setFoodLevel(20);
p.setSaturation(20f);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.bukkit.inventory.ItemStack;

import java.util.EnumMap;
import java.util.HashMap;
import java.util.Map;

import javax.annotation.Nonnull;
Expand Down

0 comments on commit 2132d77

Please sign in to comment.