GeyserMC / Geyser

A bridge/proxy allowing you to connect to Minecraft: Java Edition servers with Minecraft: Bedrock Edition.
https://geysermc.org
MIT License
4.7k stars 673 forks source link

Using plugins to make players glide without elytras doesn't work #3255

Closed Xemorr closed 3 months ago

Xemorr commented 2 years ago

Describe the bug

A common way of allowing players to use an elytra without wearing them is to set their gliding to true and then listen to the EntityToggleGlideEvent and only allow them to be set back to Gliding = false if they hit the ground etc. This doesn't work on a bedrock player unless they wear an elytra and then the code is executed on them. However, they can see other java players gliding without the elytra on, so it seems like it might not be a limitation, but a bug with the Geyser project.

To Reproduce

setGliding to true on the player Cancel the event in EntityToggleGlideEvent Notice how it works on Java players but not on Bedrock players

Expected behaviour

The Bedrock player will glide without needing to wear an elytra!

Screenshots / Videos

https://gyazo.com/be5067af897afd2b98a4b47870aaf0e5 https://gyazo.com/302623d301acb8719a2e348c111c4a64

Server Version and Plugins

image

[21:54:41 INFO]: Plugins (87): ActivityRewarder, AncientGates, Animatronics, ArcherPraise, ArmorStandTools, AxCommandHider, BetterRTP, BossShopPro, BuycraftX, ChangeSlots, ChatChat, ChestShop, ChestShop-towny, Chunky, Citizens, CombatLogX, CoreProtect, CrateReloaded, CrateReloadedReward, EnchantedBosses, EnchantedCombat, EnchantedCommands, EnchantedFollowers, EnchantedWarbands, EpicRename, es-balancing, ESChallenges, ESCrateAddon, esdonorbroadcast-satellite, ESEmoji, ESHolographicCitizens, ESMusicRegions, ESParticles, Essentials, EssentialsSpawn, ESTrading, ESWelcome, EternalTags, FastAsyncWorldEdit (WorldEdit), floodgate, Graves, GSit, HarderEnderDragon, HeadDatabase, HolographicDisplays, LootArrows, LuckPerms, LWC, Multiverse-Core, Multiverse-NetherPortals, MVdWPlaceholderAPI, NoClaimCamping, NoteBlockAPI, Notes, OpenInv, ParticlesLibrary, PlaceholderAPI, PlayerPoints, PlayerShopOverhaul, PlayerVaults, PronounsPP, ProtocolLib, PVPToggle, QuestsBossesAddon, ReportBook, ShowItem, SirBlobmanCore (SirBlobmanAPI, XSeries), SkillsLibrary2, SkillsLibraryParticles, SkyblockNPCs, spark, Superheroes, SuperheroesPlusUltra, SuperheroesWorldGuard, TAB, Towny, TownySkillsLibraryAddon, UserInterface, Vault, ViaBackwards, ViaVersion, VoidWarp, VoidWorld, VotingPlugin, WorldGuard, WorldGuard-Towny*, WorldGuardEvents

Geyser Dump

https://dump.geysermc.org/Xe90cTGnGTy8cnjDCGXlXzifk6dAwxHg

Geyser Version

Geyser version 2.0.7-SNAPSHOT (git-master-8dde4b4) (Java: 1.19.1 - 1.19.2, Bedrock: 1.19.0/1.19.2 - 1.19.21)

Minecraft: Bedrock Edition Device/Version

Minecraft Windows 10 Edition

Additional Context

This has existed since 1.17, I made an issue back then but it got closed when refactoring happened. This is a real issue and has existed for a while

Konicai commented 2 years ago

Original issue: https://github.com/GeyserMC/Geyser/issues/2339

Camotoy commented 2 years ago

Can you attach example code? I have this and Java players don't persist in gliding without an elytra:

Bukkit.getCommandMap().register(this.getName(), new Command("iwanttobreakfree") {
            @Override
            public boolean execute(@NotNull CommandSender sender, @NotNull String commandLabel, @NotNull String[] args) {
                if (sender instanceof Player player) {
                    player.setGliding(true);
                }
                return false;
            }
});
Camotoy commented 2 years ago

OK I realized I didn't work with the toggle glide event but I still can't figure out how to get this working on Java so some sample code would be appreciated.

Xemorr commented 2 years ago
@EventHandler
    public void onGlideStop(EntityToggleGlideEvent e) {
        if (e.getEntity() instanceof Player) {
            Player player = (Player) e.getEntity();
            ItemStack helmet = player.getInventory().getHelmet();
            if (helmet == null) return;
            if (!isEqual(helmet, getGlider())) return;
            if (!e.isGliding()) {
                e.setCancelled(true);
            }
        }
    }

This was some code where if you were wearing a certain helmet it would allow you to glide, you can obviously remove those lines the main bit that's important is if (!e.isGliding()) then cancel it as that prevents you from un gliding. then you just set that player to gliding true. Normally I would include a check that if you're on ground it allows it to be cancelled so players can get out of the elytra but for testing that should be fine.

Camotoy commented 2 years ago

OK, so I can confirm Bedrock's behavior differs here but I'm not sure if we can address it. It seems like Bedrock refuses to glide without a glider, and will always try to de-glide on the ground without us doing anything.

Xemorr commented 2 years ago

So you can't glide without an elytra on at all?

Camotoy commented 2 years ago

I suspect there's more stringent code on the client that determines if it should be gliding or not.

onebeastchris commented 3 months ago

Closing this issue in favor of it being documented on our current limitations page: https://wiki.geysermc.org/geyser/current-limitations/