Paper icon indicating copy to clipboard operation
Paper copied to clipboard

Players not getting Voluntary Exile advancement after killing a raid captain

Open erasurvival opened this issue 6 years ago • 33 comments

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)

erasurvival avatar Jun 30 '20 19:06 erasurvival

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

paul-maxime avatar Jul 02 '20 15:07 paul-maxime

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

Machine-Maker avatar Jul 02 '20 23:07 Machine-Maker

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

BillyGalbreath avatar Jul 02 '20 23:07 BillyGalbreath

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.

paul-maxime avatar Jul 03 '20 00:07 paul-maxime

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.

Machine-Maker avatar Jul 03 '20 00:07 Machine-Maker

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

paul-maxime avatar Jul 03 '20 00:07 paul-maxime

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?

erasurvival avatar Jul 07 '20 17:07 erasurvival

I did these tests without any plugin.

paul-maxime avatar Jul 07 '20 17:07 paul-maxime

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

erasurvival avatar Jul 07 '20 17:07 erasurvival

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.

paul-maxime avatar Jul 10 '20 20:07 paul-maxime

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

Hope this information helps!

erasurvival avatar Jul 11 '20 02:07 erasurvival

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!

paul-maxime avatar Jul 11 '20 16:07 paul-maxime

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.

paul-maxime avatar Jul 11 '20 16:07 paul-maxime

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.

Proximyst avatar Jul 11 '20 17:07 Proximyst

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.

paul-maxime avatar Jul 11 '20 17:07 paul-maxime

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

aikar avatar Jul 11 '20 19:07 aikar

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);
                    }
                }
            }
        }
    }
}

paul-maxime avatar Nov 22 '20 18:11 paul-maxime

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jan 21 '21 19:01 stale[bot]

This bug is still relevant.

paul-maxime avatar Jan 21 '21 19:01 paul-maxime

Can we get an update on a fix soon?

Techno3600 avatar Feb 01 '21 00:02 Techno3600