Skip to content

Commit

Permalink
fix more == PotionEffectType comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
TehBrian committed Nov 23, 2023
1 parent 904d976 commit 33158f6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
6 changes: 2 additions & 4 deletions src/main/java/city/thefloating/floatyplugin/nextbot/Nate.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.bukkit.event.player.PlayerChangedWorldEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import org.spigotmc.event.entity.EntityDismountEvent;
Expand Down Expand Up @@ -228,7 +227,7 @@ private void startTargetingTask(final Nextbot nextbot) {
}

private static void givePlayerRunningSpeed(final Player player, final int amplifier) {
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 30, amplifier, true, false, false));
player.addPotionEffect(PotEff.hidden(PotionEffectType.SPEED, 30, amplifier));
}
//</editor-fold>

Expand All @@ -248,8 +247,7 @@ private Location requestLaggedLocation(final Player player) {

//<editor-fold desc="jump">
private void jump(final Nextbot nextbot, final int amplifier) {
final PotionEffect jump = PotEff.hidden(PotionEffectType.JUMP, 5, amplifier);
nextbot.pf().addPotionEffect(jump);
nextbot.pf().addPotionEffect(PotEff.hidden(PotionEffectType.JUMP, 5, amplifier));
nextbot.pf().setJumping(true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public void onPotionEffect(final EntityPotionEffectEvent event) {
return;
}

if (event.getNewEffect().getType() != PotionEffectType.DAMAGE_RESISTANCE
&& event.getNewEffect().getType() != PotionEffectType.SATURATION) {
if (!(event.getNewEffect().getType().equals(PotionEffectType.DAMAGE_RESISTANCE))
&& !(event.getNewEffect().getType().equals(PotionEffectType.SATURATION))) {
event.setCancelled(true);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.bukkit.Server;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;

public final class TransportationTask {
Expand Down Expand Up @@ -58,13 +57,11 @@ public void start() {
// block-specific functionality.
switch (player.getLocation().add(0, -0.8, 0).getBlock().getType()) {
// ice blocks slow down player.
case ICE, PACKED_ICE, BLUE_ICE, FROSTED_ICE -> player.addPotionEffect(new PotionEffect(
PotionEffectType.SLOW, 40, 3, true, false, false
));
case ICE, PACKED_ICE, BLUE_ICE, FROSTED_ICE -> player.addPotionEffect(
PotEff.hidden(PotionEffectType.SLOW, 40, 3));
// soul blocks stop the player.
case SOUL_SAND, SOUL_SOIL -> player.addPotionEffect(new PotionEffect(
PotionEffectType.SLOW, 40, 120, true, false, false
));
case SOUL_SAND, SOUL_SOIL -> player.addPotionEffect(
PotEff.hidden(PotionEffectType.SLOW, 40, 120));
default -> {
}
}
Expand Down

0 comments on commit 33158f6

Please sign in to comment.