TotalFreedomMod/src/main/java/me/totalfreedom/totalfreedommod/command/Command_eject.java
Paldiu 5c0f77c7c5 Removal of Lombok
Lombok implementation removal.

I have also gone through and replaced things with inline methods and variables, lambdas, and simplified loops down, removed unnecessary guard clauses, and overall cleaned up every single class. This took a long time, please do remember to follow proper naming conventions, don't include unnecessary guard clauses, follow exception rules and comment rules, and please PLEASE remember to use the DIAMOND OPERATOR rather than just inferring RAW TYPES!!!

Thank you!!
2020-12-25 14:46:43 -05:00

41 lines
1.2 KiB
Java

package me.totalfreedom.totalfreedommod.command;
import java.util.ArrayList;
import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Eject players that are riding 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());
}
if (names.isEmpty())
{
msg("Nothing was ejected.", ChatColor.GREEN);
return true;
}
msg("Ejecting " + StringUtils.join(names, ", ") + ".", ChatColor.GREEN);
playerSender.eject();
return true;
}
}