Crazy-Crew / CrazyAuctions

A simple auctions plugin where you can sell your items and bid on other items!
https://modrinth.com/plugin/crazyauctions
MIT License
106 stars 65 forks source link

[Bug Report]: Bid auction problem with offline player. #173

Closed EncryptSL closed 4 months ago

EncryptSL commented 7 months ago

Spark link

No response

Server Version

1.20.4

Server Platform

Purpur

Describe the bug

CrazyAuctions try call winner of auction but when he is unlogged from server, items from seller is expired and not added to winner.

Crate Type

None

Steps to reproduce

  1. Added item to bid auction from first account.
  2. Bid to item from second account / winner leave server.
  3. Wait to time left.
  4. After when time is left is not added to winner.

Additional context

CrazyAuction have in if statement, getBalance but with static function getPlayer() excepted online player on server, Plugin with Economy return 0.0 balance because player is null, when player leave server.

if (data.getBoolean("Items." + i + ".Biddable") && !data.getString("Items." + i + ".TopBidder").equalsIgnoreCase("None") && plugin.getSupport().getMoney(getPlayer(data.getString("Items." + i + ".TopBidder"))) >= data.getInt("Items." + i + ".Price")) {
    public static Player getPlayer(String name) {
        try {
            return Bukkit.getServer().getPlayer(name);
        } catch (Exception e) {
            return null;
        }
    }

Related to this issue: https://github.com/EncryptSL/LiteEco/issues/80

Agreements

ryderbelserion commented 4 months ago

Fixed in newer versions since we no longer use player names for data