AddstarMC / QuickShop

A bukkit plugin for shops.
http://addstarmc.com.au
1 stars 1 forks source link

Offline player issue from name change #4

Open addstar opened 5 years ago

addstar commented 5 years ago

We seem to have a problem with QuickShop when a player buys from an offline player after they have changed their name. I think this is most likely a Craftconomy3 issue, but I'm posting here because we're seeing the issue with QuickShops.

2019-02-08 15:30:56 [Server thread/WARN]: Task #2783187 for QuickShop v4.8.2-SNAPSHOT-46 generated an exception
java.lang.NullPointerException: null
        at net.milkbowl.vault.economy.plugins.Economy_Craftconomy3.depositPlayer(Economy_Craftconomy3.java:310) ~[?:?]
        at net.milkbowl.vault.economy.plugins.Economy_Craftconomy3.depositPlayer(Economy_Craftconomy3.java:130) ~[?:?]
        at net.milkbowl.vault.economy.AbstractEconomy.depositPlayer(AbstractEconomy.java:50) ~[?:?]
        at org.maxgamer.QuickShop.Economy.Economy_Vault.deposit(Economy_Vault.java:35) ~[?:?]
        at org.maxgamer.QuickShop.Economy.Economy.deposit(Economy.java:31) ~[?:?]
        at org.maxgamer.QuickShop.Shop.ShopManager.lambda$handleChat$2(ShopManager.java:501) ~[?:?]
        at org.bukkit.craftbukkit.v1_13_R2.scheduler.CraftTask.run(CraftTask.java:82) ~[patched_1.13.2.jar:git-Paper-518]
        at org.bukkit.craftbukkit.v1_13_R2.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:449) ~[patched_1.13.2.jar:git-Paper-518]
        at net.minecraft.server.v1_13_R2.MinecraftServer.b(MinecraftServer.java:1003) ~[patched_1.13.2.jar:git-Paper-518]
        at net.minecraft.server.v1_13_R2.DedicatedServer.b(DedicatedServer.java:439) ~[patched_1.13.2.jar:git-Paper-518]
        at net.minecraft.server.v1_13_R2.MinecraftServer.a(MinecraftServer.java:938) ~[patched_1.13.2.jar:git-Paper-518]
        at net.minecraft.server.v1_13_R2.MinecraftServer.run(MinecraftServer.java:836) ~[patched_1.13.2.jar:git-Paper-518]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_191]

I think this is the scenario:

  1. Player sets up QuickShop
  2. Player changes name offline
  3. Player's name is updated in cc3 database
  4. Another player buys from the shop, it takes their money and fails to deposit into the shop owner's account, NPE happens and purchaser doesn't get their items.

Deposit action is happening here, passing the OfflinePlayer object (which is correct): https://github.com/AddstarMC/QuickShop/blob/master/src/main/java/org/maxgamer/QuickShop/Economy/Economy_Vault.java#L35

Looks like Vault/CC3 isn't handling it properly and trying to purchase by player name (not UUID)

addstar commented 5 years ago

I think the issue is caused by:

  1. Player changing name
  2. Player joins another server using the same cc3 database (in our case creative)
  3. Player doesn't return to survival, so their OfflinePlayer profile still has their old name