From 1e9efecefeefa7e385c3dd75ab0b5a25e83539f9 Mon Sep 17 00:00:00 2001 From: Kiran Hart Date: Thu, 22 Sep 2022 21:39:10 -0400 Subject: [PATCH] stat command Took 56 minutes --- .../auctionhouse/commands/CommandStats.java | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/main/java/ca/tweetzy/auctionhouse/commands/CommandStats.java diff --git a/src/main/java/ca/tweetzy/auctionhouse/commands/CommandStats.java b/src/main/java/ca/tweetzy/auctionhouse/commands/CommandStats.java new file mode 100644 index 0000000..8e93360 --- /dev/null +++ b/src/main/java/ca/tweetzy/auctionhouse/commands/CommandStats.java @@ -0,0 +1,60 @@ +package ca.tweetzy.auctionhouse.commands; + +import ca.tweetzy.auctionhouse.AuctionHouse; +import ca.tweetzy.auctionhouse.auction.AuctionPlayer; +import ca.tweetzy.auctionhouse.guis.statistics.GUIStatisticViewSelect; +import ca.tweetzy.core.commands.AbstractCommand; +import ca.tweetzy.core.utils.TextUtils; +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.List; + +/** + * The current file has been created by Kiran Hart + * Date Created: March 15 2021 + * Time Created: 4:32 p.m. + * Usage of any code found within this class is prohibited unless given explicit permission otherwise + */ +public class CommandStats extends AbstractCommand { + + public CommandStats() { + super(CommandType.PLAYER_ONLY, "stats"); + } + + @Override + protected ReturnType runCommand(CommandSender sender, String... args) { + Player player = (Player) sender; + + if (CommandMiddleware.handle(player) == ReturnType.FAILURE) return ReturnType.FAILURE; + + if (AuctionHouse.getInstance().getAuctionPlayerManager().getPlayer(player.getUniqueId()) == null) { + AuctionHouse.getInstance().getLocale().newMessage(TextUtils.formatText("&cCould not find auction player instance for&f: &e" + player.getName() + "&c creating one now.")).sendPrefixedMessage(Bukkit.getConsoleSender()); + AuctionHouse.getInstance().getAuctionPlayerManager().addPlayer(new AuctionPlayer(player)); + } + + AuctionHouse.getInstance().getGuiManager().showGUI(player, new GUIStatisticViewSelect(AuctionHouse.getInstance().getAuctionPlayerManager().getPlayer(player.getUniqueId()))); + return ReturnType.SUCCESS; + } + + @Override + public String getPermissionNode() { + return "auctionhouse.cmd.stats"; + } + + @Override + public String getSyntax() { + return AuctionHouse.getInstance().getLocale().getMessage("commands.syntax.stats").getMessage(); + } + + @Override + public String getDescription() { + return AuctionHouse.getInstance().getLocale().getMessage("commands.description.stats").getMessage(); + } + + @Override + protected List onTab(CommandSender sender, String... args) { + return null; + } +}