Formatting changes

This commit is contained in:
Sczptor 2024-02-04 00:13:51 +00:00
parent 441e9b5679
commit 7d1698c1da
2 changed files with 8 additions and 5 deletions

View file

@ -21,7 +21,6 @@ import java.util.UUID;
@CommandPermissions(permission = "plex.tfmextras.orbit") @CommandPermissions(permission = "plex.tfmextras.orbit")
public class OrbitCommand extends PlexCommand public class OrbitCommand extends PlexCommand
{ {
private static final List<UUID> isOrbited = new ArrayList<>(); private static final List<UUID> isOrbited = new ArrayList<>();
@Override @Override
@ -65,18 +64,21 @@ public class OrbitCommand extends PlexCommand
return args.length == 1 && silentCheckPermission(sender, this.getPermission()) ? PlexUtils.getPlayerNameList() : ImmutableList.of(); return args.length == 1 && silentCheckPermission(sender, this.getPermission()) ? PlexUtils.getPlayerNameList() : ImmutableList.of();
} }
private void startOrbiting(Player player, int strength) { private void startOrbiting(Player player, int strength)
{
player.setGameMode(org.bukkit.GameMode.SURVIVAL); player.setGameMode(org.bukkit.GameMode.SURVIVAL);
player.addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION, Integer.MAX_VALUE, strength, false, false)); player.addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION, Integer.MAX_VALUE, strength, false, false));
isOrbited.add(player.getUniqueId()); isOrbited.add(player.getUniqueId());
} }
private void stopOrbiting(Player player) { private void stopOrbiting(Player player)
{
player.removePotionEffect(PotionEffectType.LEVITATION); player.removePotionEffect(PotionEffectType.LEVITATION);
isOrbited.remove(player.getUniqueId()); isOrbited.remove(player.getUniqueId());
} }
public static boolean isPlayerOrbited(UUID playerId) { public static boolean isPlayerOrbited(UUID playerId)
{
return isOrbited.contains(playerId); return isOrbited.contains(playerId);
} }
} }

View file

@ -19,7 +19,8 @@ public class OrbitEffectListener extends PlexListener
if (event.getEntity() instanceof Player player) if (event.getEntity() instanceof Player player)
{ {
if ((event.getAction() == EntityPotionEffectEvent.Action.CLEARED || event.getAction() == EntityPotionEffectEvent.Action.REMOVED) if ((event.getAction() == EntityPotionEffectEvent.Action.CLEARED || event.getAction() == EntityPotionEffectEvent.Action.REMOVED)
&& event.getModifiedType() == PotionEffectType.LEVITATION) { && event.getModifiedType() == PotionEffectType.LEVITATION)
{
if (OrbitCommand.isPlayerOrbited(player.getUniqueId())) if (OrbitCommand.isPlayerOrbited(player.getUniqueId()))
{ {
Bukkit.getScheduler().runTaskLater(Plex.get(), () -> Bukkit.getScheduler().runTaskLater(Plex.get(), () ->