2018-07-22 00:45:56 +00:00
|
|
|
package me.totalfreedom.totalfreedommod.command;
|
|
|
|
|
2018-07-31 07:01:29 +00:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
2018-07-22 00:45:56 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
2019-07-31 16:19:23 +00:00
|
|
|
import org.apache.commons.lang.StringUtils;
|
2018-07-22 00:45:56 +00:00
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.entity.Entity;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
2018-07-26 07:40:28 +00:00
|
|
|
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
2018-07-22 00:45:56 +00:00
|
|
|
@CommandParameters(description = "Eject everything off of you.", usage = "/<command>")
|
|
|
|
public class Command_eject extends FreedomCommand
|
|
|
|
{
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
|
|
|
{
|
|
|
|
|
|
|
|
List<String> names = new ArrayList();
|
|
|
|
|
|
|
|
for (Entity entity : playerSender.getPassengers())
|
|
|
|
{
|
|
|
|
names.add(entity.getName());
|
|
|
|
}
|
|
|
|
|
2018-07-25 05:54:00 +00:00
|
|
|
if (names.isEmpty())
|
|
|
|
{
|
|
|
|
msg("Nothing was ejected.", ChatColor.GREEN);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-07-22 00:45:56 +00:00
|
|
|
msg("Ejecting " + StringUtils.join(names, ", ") + ".", ChatColor.GREEN);
|
|
|
|
playerSender.eject();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|