BedrockEconomy icon indicating copy to clipboard operation
BedrockEconomy copied to clipboard

Please remove getPlayerBalance API

Open SOF3 opened this issue 2 years ago • 3 comments

Is your feature request related to a problem? Please describe. getPlayerBalance is constantly abused for incorrect code where they check for whether the player has enough balance through getPlayerBalance and call subtractFromPlayerBalance without actually checking whether the latter is successful.

Describe the solution you'd like Remove the method. It is good for nothing other than abuse.

People who want to display the balance should use an API dedicated for displaying, such as InfoAPI. getPlayerBalance is good for nothing.

SOF3 avatar Apr 30 '22 16:04 SOF3

Here is a quick grep of released plugins where getPlayerBalance is used. https://poggit.pmmp.io/grepPlugins/2022-04-30-37b8173cc7ca2e50.html

  • @DaDevGuy /EconomyRename: incorrect use as described in OP
  • ZiteDesigns/EnchantShop: just a var_dump
  • BeeAZ-pm-pl/SeasonShop: they don't know how to do async
  • FlxiBoy1313/Perks: they don't know how to do async
  • @Shock95x /AuctionHouse: incorrect use as described in OP, but still handles purchase error as unknown error
  • muqsit/ChestShop: for display use only
  • NovaStark1234/SellStick: they don't know how to do async
  • udachin26/BedrockEconomy-udachin26: used for display only
  • @MulqiGaming64 /EconomyEnchant: incorrect use as described in OP
  • RevandDev/BuyHealFeed: just a var_dump
  • AlexPads/ShopUI-FormAPI-Working: FINALLY someone who uses it correctly! Used for display only

SOF3 avatar Apr 30 '22 16:04 SOF3

hm

DaDevGuy avatar May 01 '22 01:05 DaDevGuy

Currently it is used for the balance and the global cache in v4.0.0. I've marked it as internal with comments that describe its usage.

cooldogedev avatar Oct 07 '23 15:10 cooldogedev