BentoBoxWorld / Boxed

A game mode where you are boxed into a tiny space that only expands by completing advancements
Eclipse Public License 2.0
15 stars 4 forks source link

XP for achievements is still added to the player even if the achievements itself is revoked (BOXED) #38

Closed RebelDs closed 1 year ago

RebelDs commented 2 years ago

Expected behavior

When a player attempts to complete an achievement OUTSIDE his box (meaning, in another player's box), the achievement should be revoked AND the XP gain should be cancelled in order to prevent infinite XP farms.

Observed/Actual behavior

Although Achievements are prevented from being completed outside a player's box, they still gain XP from the attempt (Vanilla XP that comes with the achievement), and they can do so an infinite amount of times for easy XP.

Steps/models to reproduce

  1. Go to another player's box
  2. Attempt to complete an achievement
  3. Achievement is revoked, but you receive the XP
  4. Attempt to complete the achievement again
  5. You still receive the Vanilla XP
  6. Attempt to complete the achievement again
  7. Yep, still gaining XP.
  8. ?????
  9. Profit

BentoBox version

[13:14:50 INFO]: Running AIRPLANE 1.16.5. [13:14:50 INFO]: BentoBox version: 1.16.6 [13:14:50 INFO]: Database: JSON [13:14:50 INFO]: Loaded Game Worlds: [13:14:50 INFO]: boxedworld (Boxedworld): Overworld, Nether, The End* [13:14:50 INFO]: Loaded Addons: [13:14:50 INFO]: Bank 1.3.0 (ENABLED) [13:14:50 INFO]: Border 3.1.1 (ENABLED) [13:14:50 INFO]: Boxed 1.1.5 (ENABLED) [13:14:50 INFO]: Challenges 0.8.4 (ENABLED) [13:14:50 INFO]: Chat 1.1.4 (ENABLED) [13:14:50 INFO]: ControlPanel 1.13.0 (ENABLED) [13:14:50 INFO]: ExtraMobs 1.11.0.3 (ENABLED) [13:14:50 INFO]: Level 2.6.4 (ENABLED) [13:14:50 INFO]: MagicCobblestoneGenerator 2.3.0 (ENABLED) [13:14:50 INFO]: VoidPortals 1.5.0.0 (ENABLED) [13:14:50 INFO]: Warps 1.10.2 (ENABLED)

Plugin list

Plugins (55): BeautyQuests, BeautyQuestsAddon, BentoBox, Boss, BuycraftX, ChatColor, ChatGames, Chunky, Citizens, ClearLag, CMI, CMIEInjector, CMILib, CrateReloaded, CrazyAuctions, DeluxeCoinflip, DeluxeMenus, DeluxeTags, DisableJoinMessage, DropEdit2, eGlow, FastAsyncWorldEdit (WorldEdit), HeadDatabase, InteractiveBooks, IPWhitelist, JetsMinions, Jobs, KGenerators, LagAssist, LiteBans, LuckPerms, Multiverse-Core, NoUnicode, OriginalAntiAnvilDupe, OriginalDonatorsCore, OriginalStaffArrangement, OriginalTPSCommands, PlaceholderAPI, PlayerPoints, PlugMan, ProtocolLib, ShopGUIPlus, Shopkeepers, spark, SuggestionBlocker, TAB, TerraformGenerator, TradeMe, Vault, ViaVersion, VoteParty, WorldBorderAPI, WorldGeneratorApi, WorldGuard, WorldGuardExtraFlags

Other

https://youtu.be/rCrE26FdPdQ Here's a video of how this bug works. Please note that this bug is not in any way tied to the XP Bottles held by one of our staff members in the video. We've tested it with achievements that have nothing to do with XP directly, and the bug is still present.

BONNe commented 2 years ago

Minecraft Advancement File Format allows to specify a different "reward" things: https://minecraft.fandom.com/wiki/Advancement/JSON_format

So it means, if someone creates a data pack where a reward is an item, then viola... infinite item duplication.

tastybento commented 2 years ago

Unfortunately, I do not see any way to prevent this in the Bukkit API. The Advancement API does not allow advancements to be cancelled. There is only one event: PlayerAdvancementDoneEvent and it is non-cancellable. It just informs me that the advancement was done. The only thing I can do is revoke the advancement immediately. There is no information on the rewards of the advancement.

Here are some ways I can think of supporting this:

  1. Have an advancement exp rewards file that the addon can use to deduct exp from players. The data for this will need to be taken from the Minecraft jar file default advancements. Should be possible to do. Will be a bit of pain to maintain.
  2. Deduct a default amount of exp from players, e.g., just guess and ding them for it. Ouch.
  3. Use custom data packs for advancements that do not give out exp to anyone. The reward is the box expanding.

The last is no work for me, so that's the fastest workaround. 2 sounds unfair and would be a hack. 1 is a lot of work, but would be the most seamless to the user.

BONNe commented 2 years ago

I would say that there is one more thing that could be used. md_5 even responded to one if features requests for improving the advancement handling in bukkit:

Use an API which has more function.

And there are several of them. I would suggest to use Crazy advancement API as it is very advanced, however, much simpler advancement manager may work too

RebelDs commented 2 years ago

Until a fix is being found, can we have a config option that would allow players to receive XP regardless of the Box they complete the achievement in? At least the achievement would be completed and they wouldn't be able to farm the XP / items for infinite amounts. I'd rather have them easily complete achievements than taking advantage of this issue.

RebelDs commented 2 years ago

bump

tastybento commented 2 years ago

@RebelDs I added an option in config. I'm also going to look at the API that BONNe mentions.

tastybento commented 1 year ago

Out of date now.