TotalFreedomMod/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_clownfish.java

43 lines
1.6 KiB
Java

package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.api.ShopItem;
import me.totalfreedom.totalfreedommod.command.handling.*;
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandDependencies({"TF-Shoppe"})
@CommandPermissions(permission = "clownfish", source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Obtain a clown fish", usage = "/<command>")
public class Command_clownfish extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (plugin.sh == null)
{
msgNew("<red>Shop is currently disabled.");
return true;
}
if (plugin.pl.getData(playerSender).hasItem(ShopItem.CLOWN_FISH))
{
playerSender.getInventory().addItem(plugin.sh.getClownFish());
msgNew("<green>You have been given a <name>.", Placeholder.unparsed("name", ShopItem.CLOWN_FISH.getName()));
}
else if (plugin.pl.getPlayer(playerSender).isClownfishDisabled())
{
msgNew("<red>An admin has disabled your ability to use the <name>. Guess you were the clown after all.",
Placeholder.unparsed("name", ShopItem.CLOWN_FISH.getName()));
}
else
{
msgNew("<red>You don't own a <name>! Purchase one from the shop.", Placeholder.unparsed("name", ShopItem.CLOWN_FISH.getName()));
}
return true;
}
}