mirror of
https://github.com/plexusorg/Module-TFMExtras.git
synced 2024-12-28 02:24:33 +00:00
Made relevant changes (Blame drunk me)
This commit is contained in:
parent
7f9c8d217e
commit
441e9b5679
1 changed files with 5 additions and 6 deletions
|
@ -13,9 +13,8 @@ import org.bukkit.potion.PotionEffectType;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.ArrayList;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@CommandParameters(name = "orbit", description = "Accelerates the player at a super fast rate", usage = "/<command> <target> [<<power> | stop>]")
|
@CommandParameters(name = "orbit", description = "Accelerates the player at a super fast rate", usage = "/<command> <target> [<<power> | stop>]")
|
||||||
|
@ -23,7 +22,7 @@ import java.util.UUID;
|
||||||
public class OrbitCommand extends PlexCommand
|
public class OrbitCommand extends PlexCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final Map<UUID, Boolean> isOrbitedMap = new HashMap<>();
|
private static final List<UUID> isOrbited = new ArrayList<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
|
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
|
||||||
|
@ -69,15 +68,15 @@ public class OrbitCommand extends PlexCommand
|
||||||
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));
|
||||||
isOrbitedMap.put(player.getUniqueId(), true);
|
isOrbited.add(player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void stopOrbiting(Player player) {
|
private void stopOrbiting(Player player) {
|
||||||
player.removePotionEffect(PotionEffectType.LEVITATION);
|
player.removePotionEffect(PotionEffectType.LEVITATION);
|
||||||
isOrbitedMap.remove(player.getUniqueId());
|
isOrbited.remove(player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isPlayerOrbited(UUID playerId) {
|
public static boolean isPlayerOrbited(UUID playerId) {
|
||||||
return isOrbitedMap.getOrDefault(playerId, false);
|
return isOrbited.contains(playerId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue