TotalFreedomMod/src/main/java/me/totalfreedom/totalfreedommod/command/Command_releaseparrots.java

41 lines
1.5 KiB
Java
Raw Normal View History

2018-07-22 00:45:56 +00:00
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")
2018-07-22 00:45:56 +00:00
public class Command_releaseparrots extends FreedomCommand
{
@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;
}
2018-07-22 00:45:56 +00:00
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;
}
}