Paper: Players not getting Voluntary Exile advancement after killing a raid captain

Created on 30 Jun 2020  路  17Comments  路  Source: PaperMC/Paper

What behaviour is expected:

The player getting the Voluntary Exile advancement after killing a raid captain

What behaviour is observed:

Nothing happens after the player kills the raid captain. I have to manually give them the advancement through the usage of the /advancement command

Steps/models to reproduce:

Have a player without the Voluntary Exile advancement kill a raid captain. Observe if they get the advancement or not.

Plugin list:

ActionHealth, ArmorStandTools, Autorank, BBeeChecker, BetterRTP, BuycraftX, Citizens, ClearLag, ColoredAnvils, CommandHook, CommandSpy, CoreProtect, DiscordSRV, EditableSign, Essentials, EssentialsAntiBuild, EssentialsChat, EssentialsGeoIP, EssentialsSpawn, GriefPrevention, Harbor, HolographicDisplays, ImageOnMap, LuckPerms, Marriage, Multiverse-Core, PayRespecc, PluginLibrary, RankSync*, SilkSpawners, SkQuery, Skript, Statz, SuperbVote, TAB, Vault, Votifier, VoxelSniper, WorldEdit, WorldGuard

Paper build number:

Paper version git-Paper-24 (MC:1.16.1)

1.16

Most helpful comment

root issue is that CriterionConditionItem is checking count, and now the counts been deduced before the advancement progress is checked.

can just make it ignore 0 counts and treat as 1

All 17 comments

Confirmed on my server. All the other 74 advancements work but not this one.

Unable to reproduce. Just tried on a brand new new build 43 server, and was able to get the advancement after killing a captain.

Sounds like possibly another #2810 of simply not fully understanding the mechanic

How did you manage to get the advancement?

  • Paper-43, new world, I teleported to the nearest pillager outpost and killed a captain with a banner: I got bad omen but no advancement.
  • Vanilla-1.16.1, same thing, new world, teleport to the nearest pillager output, killed a captain: I got bad omen AND the advancement.

12 players on my server managed to get _Hero of the Village_ and none of them have _Voluntary Exile_, I don't even know how this would be possible without a bug.

Yeah, I tp'd to the nearest outpost, waited around for one to spawn, killing off the non-banner mobs. I was in creative and had strength 255, but that shouldn't matter. when I killed one with the banner, I got the Voluntary Exile advancement.

Here's two videos where I can't manage to get the advancement:

https://files.abovetheflood.fr/voluntary-exile.mp4
https://files.abovetheflood.fr/voluntary-exile-creative.mp4

On the first video I tried using a sword in survival mode, on the second one I tried in creative mode with strength 255, just in case it changed anything.

Here's a video where I manage to get the advancement on the same world, same player, at the same location, using Spigot:

https://files.abovetheflood.fr/voluntary-exile-spigot.mp4

Here's two videos where I can't manage to get the advancement:

https://files.abovetheflood.fr/voluntary-exile.mp4
https://files.abovetheflood.fr/voluntary-exile-creative.mp4

On the first video I tried using a sword in survival mode, on the second one I tried in creative mode with strength 255, just in case it changed anything.

Here's a video where I manage to get the advancement on the same world, same player, at the same location, using Spigot:

https://files.abovetheflood.fr/voluntary-exile-spigot.mp4

Would you mind sharing your plugin list?

I did these tests without any plugin.

Oh wow, I see. Thanks for letting me know!

I tried many Paper 1.16.1 builds and the bug is present on all of them, all the way back to paperclip-1.jar.
I will check the 1.15.2 builds later but I'm pretty sure they are all fine.

I also checked the wiki and saw this:

Though bearing similar names, Voluntary Exile advancement does not use voluntary_exile criterion trigger, unlike most other advancements.

(source: https://minecraft.gamepedia.com/Advancement)

I wonder if this could be related to this bug.

Back when my server was on 1.15.2, we had no issues with this advancement.

Hope this information helps!

Update: I managed to find the problematic patch!

I checked Paper 1.15.2: build 215 works fine but build 216 has the problem.
Here is the commit: https://github.com/PaperMC/Paper/commit/a6ac47e502d4cadef0c2c289956971739076c49c

I tried to build the latest version of paper 1.16.1 after removing the patch 0469-Fix-numerous-item-duplication-issues-and-teleport-is.patch: the advancement works!

Another update.

The problem is caused by the following line:

if (stack instanceof CraftItemStack) stack.setAmount(0); // Paper - destroy this item - if this ever leaks due to game bugs, ensure it doesn't dupe, but don't nuke bukkit stacks of manually added items

https://github.com/PaperMC/Paper/blob/master/Spigot-Server-Patches/0469-Fix-numerous-item-duplication-issues-and-teleport-is.patch#L100

Removing this line is enough to fix the bug.

This points towards there being some data on the original item which was not cloned to the new one; a proper patch would be to ensure all data on the new item.

I'm not familiar enough with the code to write a proper patch, but for the time being I fixed it the following way:

if (stack instanceof CraftItemStack && stack.getType() != Material.WHITE_BANNER) stack.setAmount(0);

It works since the Ominous Banner worn by the pillagers is a WHITE_BANNER.

root issue is that CriterionConditionItem is checking count, and now the counts been deduced before the advancement progress is checked.

can just make it ignore 0 counts and treat as 1

It looks like the commit 243d2313b93448d8e525ef3c2c2a9a098ce69e09 also breaks this advancement.
Removing the patch "Fix-numerous-item-duplication-issues" is no longer enough to fix this issue.

I don't know why, especially since it works perfectly fine on Spigot.

Meanwhile, here is how I fixed it, hopefully permanently this time:

Advancement voluntaryExile = Bukkit.getAdvancement(NamespacedKey.minecraft("adventure/voluntary_exile"));

@EventHandler
public void onEntityDeathEvent(EntityDeathEvent event)  {
    if (event.getEntity().getType() == EntityType.PILLAGER) {
        for (ItemStack drop : event.getDrops()) {
            if (drop.getType() == Material.WHITE_BANNER) {
                Player killer = event.getEntity().getKiller();
                if (killer != null) {
                    AdvancementProgress progress = killer.getAdvancementProgress(voluntaryExile);
                    for (String criteria : progress.getRemainingCriteria()) {
                        progress.awardCriteria(criteria);
                    }
                }
            }
        }
    }
}
Was this page helpful?
0 / 5 - 0 ratings