EssentialsX / Essentials

The modern Essentials suite for Spigot and Paper.
https://essentialsx.net
GNU General Public License v3.0
1.94k stars 979 forks source link

fly disabled when warping or otherwise teleporting between dimesions (excluding portals) #4325

Open Nibby49 opened 3 years ago

Nibby49 commented 3 years ago

Type of bug

Other unexpected behaviour

/ess version output

[17:33:19] [Server thread/INFO]: Server version: 1.17-R0.1-SNAPSHOT git-Paper-79 (MC: 1.17) [17:33:19] [Server thread/INFO]: Brand version: Paper [17:33:19] [Server thread/INFO]: EssentialsX version: 2.19.0-dev+196-33ca3b2 [17:33:19] [Server thread/INFO]: LuckPerms version: 5.3.47 [17:33:19] [Server thread/INFO]: Vault version: 1.7.3-b131 [17:33:19] [Server thread/INFO]: EssentialsXSpawn version: 2.19.0-dev+196-33ca3b2 [17:33:19] [Server thread/INFO]: EssentialsXChat version: 2.19.0-dev+196-33ca3b2 [17:33:19] [Server thread/INFO]: Economy Layer: None [17:33:19] [Server thread/INFO]: Fetching version information... [17:33:19] [Craft Scheduler Thread - 10/INFO]: You're running the latest EssentialsX dev build!

Server startup log

https://gist.github.com/Nibby49/c85f7829422fcf7b9cd2638ff664ba44

EssentialsX config files

https://gist.github.com/Nibby49/3184353698ea69d827621eaf1427899d

Error log (if applicable)

No response

Bug description

When teleporting (has tested /warp and /home) between dimensions (has tested Overworld and end), /fly gets toggled off in survival mode. This appears unrelated to the config option "world-change-fly-reset:" as using an end portal does not reproduce the issue. Player testing issue has both essentials.fly and essentials.fly.safelogin as permissions. Plugins being used are EssentialsX (including Base, Spawn, and Chat), Vault, and LuckPerms.

Steps to reproduce

  1. Ensure world-change-fly-reset is false in the config
  2. Have EssentialsX, EssentialsX Spawn, EssentialsX Chat, Vault (version 1.7.3-b131), and LuckPerms (version 5.3.47) installed.
  3. Set a home in the Overworld and a warp in the end.
  4. Have essentials.fly and essentials.fly.safelogin as permissions
  5. In the Overworld switch to Survival and toggle /fly on. Go to the warp in the End, double tap your jump key and attempt to fly. (Note: This happens when teleporting in either direction.)

Expected behaviour

Based on configuration settings and permissions, /fly should remain enabled when teleporting betweens dimensions.

Actual behaviour

/fly does not remain toggled on when teleporting between dimensions.

lucky819-dev commented 3 years ago

i have the exact same problem

triagonal commented 3 years ago

This isn't an Essentials issue. I was able to reproduce the issue using a test plugin that teleported the user between dimensions and observed the same behaviour as described here without any other plugins installed. This might be an issue with the Bukkit API itself, further investigation is required.

Nibby49 commented 3 years ago

I am not skilled enough with java to write tests for this issue. However, please let me know if you need any more information or if I can be of any assistance. Otherwise, good luck @triagonal and the rest of the essentialsx team!

ghost commented 3 years ago

Same issue for me,

Were using PaperMC Build 99 (Latest when issue started) Essentials 2.19.0-dev+221

Permissions are set up right and config is right no errors or so.

TNTUP commented 3 years ago

Can confirm.

EssentialsX 2.19.0-dev+221-1556b91 Paper Build#109

remyd95 commented 3 years ago

Can confirm, the config option does not work. Fly is always disabled, even for players with wildcard permissions.

JRoy commented 3 years ago

After further investigation, this occurs on vanilla single player as well (1.17.1). If this didn't occur on 1.16.5, this should probably be reported to Mojang but I didn't get a chance to test that yet.

Nibby49 commented 3 years ago

I can confirm that this did not happen prior to 1.17 (aka 1.16.5 and down). If you would be so kind, please provide me with evidence to back up any possible bug report I am to make to Mojang. Thanks in advance!

remyd95 commented 3 years ago

With essentials 2.18 this problem does not occur on 1.17.1. The problem started when we upgraded to 2.19 dev builds.

MacTh3Mac commented 3 years ago

have recreated this issue on a server with no essentials on it. Not an essentials issue.

Nibby49 commented 3 years ago

I have very limited knowledge of java, and I apologize if what I am about to suggest seems naive or uninformed, but could this issue be caused by using a specific type of code to simulate flying? I'm not sure how to further elaborate on that, but perhaps essentials updated the flying code in the development builds of 1.19.0? Apologizes again if that doesn't make sense, I'm just suggesting a theory. Regardless of the above, I would imagine it may be an issue with paper or upstream spigot seeing as other plugins are effected too.

I wish you all luck in finding a solution to this, and please let me know if you have any questions or if I can be of any assistance.

pop4959 commented 3 years ago

@Nibby49 Essentials uses the Bukkit API to set flight abilities on the player. So yes, this is something that if anything needs to be fixed upstream. JRoy already mentioned that he was able to get this issue to occur in Vanilla. If the code being used by Bukkit isn't correct for 1.17 it will need to be updated. Otherwise, it's probably just an oversight on Mojang's end. Either way, nothing that Essentials would be directly able to fix.

Chew commented 3 years ago

As stated this is a known, easily reproducible upstream issue, and still nothing we can fix here.

electronicboy commented 2 years ago
    @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
    public void onPlayerTeleport(final PlayerTeleportEvent event)
    {
        if (event.getFrom().getWorld() != event.getTo().getWorld()) {
            if (event.getPlayer().isFlying()) {
                worldTeleports.put(event.getPlayer().getUniqueId(), Bukkit.getCurrentTick());
            }
        }
    private final Map<UUID, Integer> worldTeleports = new HashMap<>();
    @EventHandler
    public void onPlayerChangeWorld(PlayerChangedWorldEvent e) {
        final Integer ifPresent = worldTeleports.remove(e.getPlayer().getUniqueId());
        if (ifPresent != null && Bukkit.getCurrentTick() == ifPresent) {
            e.getPlayer().setAllowFlight(true);
            e.getPlayer().setFlying(true);
        }

    }

Working off an old fork of the codebase here and not exactly fond of this, but, it works™ (Can easily be thrown into a standalone plugin)

This OFC is likely nuanced and not really sure it should belong in Ess but is the best "2 second" workaround I can come up with, the issue here is that mojang added a call to set the players gamemode inside of ServerPlayer#restoreFrom which sets the expected abilities for the players gamemode

edit: in testing locally this worked, in prod, it's apparently missing some stuff... trying to look at a delay to see if that helps, but, I don't see how this could fail unless there is a missing step somewhere... sigh

TNTUP commented 2 years ago

Persists on 1.18 and 1.18.1 sadly :(

> ver Essentials
[02:43:26 INFO]: Essentials version 2.19.1-dev+48-c45c741
[02:43:26 INFO]: Provides an essential, core set of commands for Bukkit.
[02:43:26 INFO]: Website: https://essentialsx.net/
[02:43:26 INFO]: Authors: Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, md_5, Iaccidentally, drtshock, vemacs, SupaHam, mdcfe, JRoy and pop4959
> ver
[02:43:27 INFO]: Checking version, please wait...
[02:43:27 INFO]: This server is running Paper version git-Paper-"13a445c" (MC: 1.18) (Implementing API version 1.18-R0.1-SNAPSHOT) (Git: 13a445c)
You are 4 version(s) behind
Download the new version at: https://papermc.io/downloads
Previous version: git-Paper-"b32a3b1" (MC: 1.17.1)
donvdp commented 2 years ago

this problem is still here. running the lastest version paper-1.18.1-214 in combination with latest EssentialsX dev version EssentialsX-2.19.3-dev+27-bc2da98

I have chatted in discord with electroniccat on the paper discord, and he tells me he tried to help essentials fix the problem with a github gist. He has update his code a bit. but its still the basic concept from his post above here.

https://gist.github.com/electronicboy/59a5d72024c1fc053217056499cea2c8

HexedHero commented 2 years ago

Any news on this?

Leahcimkrob commented 2 years ago

I have the same issue with Essentials 2.20.0-dev+6-ea5cdc0

bigsmileling commented 2 years ago

Any update?

Aoredon commented 2 years ago

Still having issues with this

JRoy commented 2 years ago

My comment here still applies. This is a vanilla issue and I'm not sure a workaround should be part of Essentials itself.

mdcfe commented 2 years ago

(apparently I never posted my thoughts on this issue in public, so here goes:)

Yes, this was a vanilla change. However, the change here breaks behaviour that is implied by EssentialsX's own config options. I would prefer we implemented a new option that lets people restore pre-1.17 behaviour if they choose (in turn restoring the functionality of our existing config option).

TNTUP commented 2 years ago

Someone developed a plugin that fixes EssentialsX's fly on world change so this issue does not affect me anymore, not sure if im allowed to say that here since it would be offtopic (Sorry!)

mdcfe commented 2 years ago

Someone developed a plugin that fixes EssentialsX's fly on world change so this issue does not affect me anymore, not sure if im allowed to say that here since it would be offtopic (Sorry!)

It's not off-topic, but we would like to implement a solution within EssentialsX itself rather than relying on a third party plugin (since right now, the fly on world change options are useless above 1.17).

Leahcimkrob commented 2 years ago

Top Idea.

ItzRobin commented 2 years ago

Someone developed a plugin that fixes EssentialsX's fly on world change so this issue does not affect me anymore, not sure if im allowed to say that here since it would be offtopic (Sorry!)

Interesting! Maybe you can share this plugin, I would be interested to add it because I guess there is no other good alternative :)