mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-18 13:26:12 +00:00
5c0f77c7c5
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!!
42 lines
1.5 KiB
Java
42 lines
1.5 KiB
Java
package me.totalfreedom.totalfreedommod.command;
|
|
|
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
|
import org.bukkit.command.Command;
|
|
import org.bukkit.command.CommandSender;
|
|
import org.bukkit.entity.Entity;
|
|
import org.bukkit.entity.EntityType;
|
|
import org.bukkit.entity.Player;
|
|
|
|
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
|
@CommandParameters(description = "Release parrots from your shoulders.", usage = "/<command>", aliases = "removeparrots")
|
|
public class Command_releaseparrots extends FreedomCommand
|
|
{
|
|
|
|
@SuppressWarnings("deprecation")
|
|
@Override
|
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
|
{
|
|
Entity leftShoulderEntity = playerSender.getShoulderEntityLeft();
|
|
Entity rightShoulderEntity = playerSender.getShoulderEntityRight();
|
|
|
|
if (rightShoulderEntity == null && leftShoulderEntity == null)
|
|
{
|
|
msg("No parrots were detected on either of your shoulders.");
|
|
return true;
|
|
}
|
|
|
|
if (leftShoulderEntity != null && leftShoulderEntity.getType().equals(EntityType.PARROT))
|
|
{
|
|
playerSender.setShoulderEntityLeft(null);
|
|
msg("Removed the parrot on your left shoulder.");
|
|
}
|
|
|
|
if (rightShoulderEntity != null && rightShoulderEntity.getType().equals(EntityType.PARROT))
|
|
{
|
|
playerSender.setShoulderEntityRight(null);
|
|
msg("Removed the parrot on your right shoulder.");
|
|
}
|
|
return true;
|
|
}
|
|
}
|