2023-08-24 09:43:16 +00:00
|
|
|
package dev.plex.extras.command;
|
2022-07-09 14:26:57 +00:00
|
|
|
|
2023-08-24 09:43:16 +00:00
|
|
|
import dev.plex.command.PlexCommand;
|
2022-07-09 14:26:57 +00:00
|
|
|
import dev.plex.command.annotation.CommandParameters;
|
|
|
|
import dev.plex.command.annotation.CommandPermissions;
|
|
|
|
import dev.plex.command.source.RequiredCommandSource;
|
|
|
|
import dev.plex.rank.enums.Rank;
|
|
|
|
import net.kyori.adventure.text.Component;
|
|
|
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
|
|
|
|
@CommandParameters(name = "eject", description = "Removes all passengers from a player")
|
|
|
|
@CommandPermissions(level = Rank.OP, permission = "plex.tfmextras.eject", source = RequiredCommandSource.IN_GAME)
|
2023-03-08 19:30:51 +00:00
|
|
|
public class EjectCommand extends PlexCommand
|
|
|
|
{
|
2022-07-09 14:26:57 +00:00
|
|
|
@Override
|
2023-03-08 19:30:51 +00:00
|
|
|
protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args)
|
|
|
|
{
|
2022-07-09 14:26:57 +00:00
|
|
|
final int passengers = player.getPassengers().size();
|
|
|
|
player.eject();
|
|
|
|
return MiniMessage.miniMessage().deserialize("<gray>Ejected " + passengers + " passengers.");
|
|
|
|
}
|
|
|
|
}
|