SamB440 / ForcePack

Spigot/Velocity plugin to aid resource pack deployment and enforcement, among other utilities.
https://fortitude.islandearth.net/category/forcepack
GNU General Public License v3.0
51 stars 17 forks source link

Remove instead of putting null. #31

Closed portlek closed 11 months ago

portlek commented 1 year ago

Causes a movement prevent issue.

SUCCESSFULLY_LOADED status will be send before PlayerJoinEvent so it won't be able to remove it in here

putting null in to a map is still putting a key with null value so, ExemptionListener will still prevent our movements.

Debug:

[17:50:51 INFO]: [ForcePack] portlek's exemptions: geyser, false. permission, false.
[17:50:51 INFO]: [ForcePack] portlek sent status: SUCCESSFULLY_LOADED
[17:50:51 INFO]: [ForcePack] portlek's exemptions: geyser, false. permission, false.
[17:50:51 INFO]: [ForcePack] Velocity mode is enabled
[17:50:54 INFO]: [ForcePack] Cancelled movement for player 'portlek' due to resource pack not applied.
[17:50:54 INFO]: [ForcePack] Cancelled movement for player 'portlek' due to resource pack not applied.
[17:50:55 INFO]: [ForcePack] Cancelled movement for player 'portlek' due to resource pack not applied.
[17:50:55 INFO]: [ForcePack] Cancelled movement for player 'portlek' due to resource pack not applied.

Update: Tested and it's working now.

SamB440 commented 1 year ago

In what cases does the status get sent before PlayerJoinEvent? My understanding was that if velocity mode is enabled, the player joins, we add to map whilst waiting for confirmation from the proxy, then remove when the status is received from proxy.

portlek commented 1 year ago

It happens when you swtich servers. the resource pack status event runs first before the player join event, that causes the issue. actually it's not but you know putting null is still putting a KEY into the map, so if you have somehow a KEY that equls your unique id the movement will be prevented that's the core issue.

SamB440 commented 1 year ago

I'll test this shortly as I'm not 100% sure the logic is correct here

portlek commented 1 year ago

Well the issue is fixed and i've been using it since i made the changes and nothing wrong with it.

SamB440 commented 1 year ago

Is this related to #15? But that was only for DECLINED statuses in my testing. I still don't understand how a SUCCESSFULLY_LOADED can be sent before the player joins their new server, I can't reproduce this.

My understanding of the process is this: The player joins a server on the proxy -> the player is added to the waiting list -> any movement is prevented -> the resource pack for that server is sent -> the player sends ACCEPTED -> the player sends SUCCESSFULLY_LOADED -> player is removed from the waiting list

portlek commented 1 year ago

join server-1 wait for the resource pack load then switch to server-2. that's how it sends before the player join event for server-2.

SamB440 commented 11 months ago

I got round to testing this whilst rewriting a lot of the plugin.

The player is meant to be put into the map to allow prevent-movement and prevent-damage to work. Without this a client can bypass a resource pack by never sending a status.

I think the real fix to this is more complicated and will need to be addressed in a different PR/commit.