mirror of
https://github.com/plexusorg/Module-TFMExtras.git
synced 2024-12-03 16:52:10 +00:00
Altered tab completion to include "stop" argument.
Included the isPlayerOrbited check inside the scheduler to fix premature checking
This commit is contained in:
parent
7d1698c1da
commit
6a85428724
@ -13,6 +13,7 @@ import org.bukkit.potion.PotionEffectType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
@ -61,7 +62,15 @@ public class OrbitCommand extends PlexCommand
|
||||
@Override
|
||||
public @NotNull List<String> smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
|
||||
{
|
||||
return args.length == 1 && silentCheckPermission(sender, this.getPermission()) ? PlexUtils.getPlayerNameList() : ImmutableList.of();
|
||||
if (args.length == 1 && silentCheckPermission(sender, this.getPermission()))
|
||||
{
|
||||
return PlexUtils.getPlayerNameList();
|
||||
}
|
||||
else if (args.length == 2 && silentCheckPermission(sender, this.getPermission()))
|
||||
{
|
||||
return Collections.singletonList("stop");
|
||||
}
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
private void startOrbiting(Player player, int strength)
|
||||
|
@ -20,12 +20,14 @@ public class OrbitEffectListener extends PlexListener
|
||||
{
|
||||
if ((event.getAction() == EntityPotionEffectEvent.Action.CLEARED || event.getAction() == EntityPotionEffectEvent.Action.REMOVED)
|
||||
&& event.getModifiedType() == PotionEffectType.LEVITATION)
|
||||
{
|
||||
Bukkit.getScheduler().runTaskLater(Plex.get(), () ->
|
||||
{
|
||||
if (OrbitCommand.isPlayerOrbited(player.getUniqueId()))
|
||||
{
|
||||
Bukkit.getScheduler().runTaskLater(Plex.get(), () ->
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION, Integer.MAX_VALUE, 100, false, false)), 2);
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION, Integer.MAX_VALUE, 100, false, false));
|
||||
}
|
||||
}, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user