2.6.3, placeholder addition and attempted bug fix for issue with auction players not being added.

This commit is contained in:
Kiran Hart 2021-05-04 12:49:12 -04:00
parent 288cc4498e
commit c374af17e6
8 changed files with 31 additions and 2 deletions

View File

@ -6,7 +6,7 @@
<groupId>ca.tweetzy</groupId>
<artifactId>auctionhouse</artifactId>
<version>2.6.2</version>
<version>2.6.3</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

View File

@ -1,9 +1,12 @@
package ca.tweetzy.auctionhouse.commands;
import ca.tweetzy.auctionhouse.AuctionHouse;
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
import ca.tweetzy.auctionhouse.guis.GUIActiveAuctions;
import ca.tweetzy.auctionhouse.guis.GUIAuctionHouse;
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;
@ -24,6 +27,11 @@ public class CommandActive extends AbstractCommand {
@Override
protected ReturnType runCommand(CommandSender sender, String... args) {
Player player = (Player) sender;
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 GUIActiveAuctions(AuctionHouse.getInstance().getAuctionPlayerManager().getPlayer(player.getUniqueId())));
return ReturnType.SUCCESS;
}

View File

@ -1,8 +1,11 @@
package ca.tweetzy.auctionhouse.commands;
import ca.tweetzy.auctionhouse.AuctionHouse;
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
import ca.tweetzy.auctionhouse.guis.GUIAuctionHouse;
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;
@ -25,6 +28,11 @@ public class CommandAuctionHouse extends AbstractCommand {
protected ReturnType runCommand(CommandSender sender, String... args) {
if (sender instanceof Player) {
Player player = (Player) sender;
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 GUIAuctionHouse(AuctionHouse.getInstance().getAuctionPlayerManager().getPlayer(player.getUniqueId())));
}
return ReturnType.SUCCESS;

View File

@ -1,9 +1,12 @@
package ca.tweetzy.auctionhouse.commands;
import ca.tweetzy.auctionhouse.AuctionHouse;
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
import ca.tweetzy.auctionhouse.guis.GUIActiveAuctions;
import ca.tweetzy.auctionhouse.guis.GUIExpiredItems;
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;
@ -24,6 +27,11 @@ public class CommandExpired extends AbstractCommand {
@Override
protected ReturnType runCommand(CommandSender sender, String... args) {
Player player = (Player) sender;
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 GUIExpiredItems(AuctionHouse.getInstance().getAuctionPlayerManager().getPlayer(player.getUniqueId())));
return ReturnType.SUCCESS;
}

View File

@ -148,6 +148,7 @@ public class GUIConfirmPurchase extends Gui {
AuctionHouse.getInstance().getLocale().getMessage("auction.itemsold")
.processPlaceholder("item", WordUtils.capitalizeFully(AuctionAPI.getInstance().deserializeItem(located.getRawItem()).getType().name().replace("_", " ")))
.processPlaceholder("price", String.format("%,.2f", overwritePrice ? price : located.getBasePrice()))
.processPlaceholder("buyer_name", e.player.getName())
.sendPrefixedMessage(Bukkit.getOfflinePlayer(located.getOwner()).getPlayer());
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("price", String.format("%,.2f", overwritePrice ? price : located.getBasePrice())).sendPrefixedMessage(Bukkit.getOfflinePlayer(located.getOwner()).getPlayer());
}

View File

@ -24,6 +24,7 @@ public class PlayerListeners implements Listener {
Player player = e.getPlayer();
Bukkit.getServer().getScheduler().runTaskLaterAsynchronously(AuctionHouse.getInstance(), () -> {
AuctionHouse.getInstance().getAuctionPlayerManager().addPlayer(new AuctionPlayer(player));
AuctionHouse.getInstance().getLogger().info("Adding player: " + player.getName() + " to Auction Player list.");
if (AuctionHouse.getInstance().getStatus() == UpdateChecker.UpdateStatus.UNRELEASED_VERSION && player.isOp()) {
AuctionHouse.getInstance().getLocale().getMessage(TextUtils.formatText(String.format("&dYou're running an unreleased version of Auction House &f(&c%s&f)", AuctionHouse.getInstance().getDescription().getVersion()))).sendPrefixedMessage(player);
}
@ -35,5 +36,6 @@ public class PlayerListeners implements Listener {
Player player = e.getPlayer();
AuctionHouse.getInstance().getAuctionPlayerManager().removePlayer(player.getUniqueId());
AuctionHouse.getInstance().getAuctionPlayerManager().getCooldowns().remove(player.getUniqueId());
AuctionHouse.getInstance().getLogger().info("Removing Auction Player and Cooldown instances for user: " + player.getName());
}
}

View File

@ -82,6 +82,7 @@ public class TickAuctionsTask extends BukkitRunnable {
AuctionHouse.getInstance().getLocale().getMessage("auction.itemsold")
.processPlaceholder("item", WordUtils.capitalizeFully(AuctionAPI.getInstance().deserializeItem(item.getRawItem()).getType().name().replace("_", " ")))
.processPlaceholder("price", String.format("%,.2f", item.getCurrentPrice()))
.processPlaceholder("buyer_name", Bukkit.getOfflinePlayer(item.getHighestBidder()).getPlayer().getName())
.sendPrefixedMessage(Bukkit.getOfflinePlayer(item.getOwner()).getPlayer());
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("price", String.format("%,.2f", item.getCurrentPrice())).sendPrefixedMessage(Bukkit.getOfflinePlayer(item.getOwner()).getPlayer());
}
@ -108,6 +109,7 @@ public class TickAuctionsTask extends BukkitRunnable {
AuctionHouse.getInstance().getLocale().getMessage("auction.itemsold")
.processPlaceholder("item", WordUtils.capitalizeFully(AuctionAPI.getInstance().deserializeItem(item.getRawItem()).getType().name().replace("_", " ")))
.processPlaceholder("price", String.format("%,.2f", item.getCurrentPrice()))
.processPlaceholder("buyer_name", Bukkit.getOfflinePlayer(item.getHighestBidder()).getPlayer().getName())
.sendPrefixedMessage(Bukkit.getOfflinePlayer(item.getOwner()).getPlayer());
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("price", String.format("%,.2f", item.getCurrentPrice())).sendPrefixedMessage(Bukkit.getOfflinePlayer(item.getOwner()).getPlayer());
}

View File

@ -51,5 +51,5 @@ auction:
withbid: "&e%player% listed &fx%amount% &6%item% &e&lBuy Now&f: &a%base_price% &e&lStarting&f: &a%start_price% &e&lIncrement&f: &a%increment_price%"
nobid: "&e%player% listed &fx%amount% &6%item% &efor &a%base_price%"
bidwon: "&eYou won the bid for&fx%amount% &6%item% &efor &a%price%"
itemsold: "&eYou sold &6%item% &efor &a%price%"
itemsold: "&eYou sold &6%item% &eto &6%buyer_name% &efor &a%price%"
itemnotavailable: "&cThat item is no longer available :("