saicone / OneTimePack

Bungeecord and Velocity plugin that reduces duplicated resource pack requests
MIT License
17 stars 2 forks source link

Does not work for 1.20.4 client #5

Closed nhanledev closed 8 months ago

nhanledev commented 8 months ago

Hello,

I am testing the OneTimePack version 1.4.2 using default config on 1.20.1 and 1.20.4 vanilla clients on 1.20.4 paper servers. The only feature I turn on is Send-Invalid: true

On 1.20.1 client, when player switch server the resource pack does not reload, which is expected. On 1.20.4 client, when player switch server the resource pack get reloaded everytime.

I am trying to see what is happening and notice that player.isUniquePack() always returns false in my case.

The log on 1.20.1 client

[18:54:35 INFO]: [HibaraMamoru|/10.0.0.80:55017] <-> ServerConnector [s0] has connected
[18:54:35 INFO]: [/10.0.0.80:55017|HibaraMamoru] <-> DownstreamBridge <-> [hub0] has disconnected
[18:54:35 INFO] [OneTimePack]: [PLAY] Packet#read() = ClientboundResourcePackPush{url='http://mc.local:10200/generated.zip#2b2a13b04dd2ed9d6ef7a09215e4997d466f4216', hash='null', forced=true, hasPromptMessage=true, promptMessage=REDACTED}
[18:54:35 INFO] [OneTimePack]: Received ResourcePackSend: ClientboundResourcePackPush{url='http://mc.local:10200/generated.zip#2b2a13b04dd2ed9d6ef7a09215e4997d466f4216', hash='null', forced=true, hasPromptMessage=true, promptMessage=REDACTED}
[18:54:35 INFO] [OneTimePack]: The packet doesn't contains HASH, but invalid packs are allowed
[18:54:35 INFO] [OneTimePack]: Same resource pack received for player: c9bd2771-a736-35c8-a2a8-2fc1d51fbba9
[18:54:35 INFO] [OneTimePack]: Sent cached result ServerboundResourcePack{result=0} from player c9bd2771-a736-35c8-a2a8-2fc1d51fbba9

The log on 1.20.4 client

[18:52:00 INFO]: [HibaraMamoru|/10.0.0.80:55004] <-> ServerConnector [s0] has connected
[18:52:00 INFO]: [/10.0.0.80:55004|HibaraMamoru] <-> DownstreamBridge <-> [hub0] has disconnected
[18:52:01 INFO] [OneTimePack]: [PLAY] Packet#read() = ClientboundResourcePackPop{hasUniqueId=true, uniqueId=3c5d3fbe-29f2-3896-90af-a0a722e09a6a}
[18:52:01 INFO] [OneTimePack]: Remove cached packet using: ClientboundResourcePackPop{hasUniqueId=true, uniqueId=3c5d3fbe-29f2-3896-90af-a0a722e09a6a} from player c9bd2771-a736-35c8-a2a8-2fc1d51fbba9
[18:52:01 INFO] [OneTimePack]: [PLAY] Packet#read() = ClientboundResourcePackPush{uniqueId='3c5d3fbe-29f2-3896-90af-a0a722e09a6a', url='http://mc.local:10200/generated.zip#2b2a13b04dd2ed9d6ef7a09215e4997d466f4216', hash='null', forced=true, hasPromptMessage=true, promptMessage=REDACTED}
[18:52:01 INFO] [OneTimePack]: Received ResourcePackSend: ClientboundResourcePackPush{uniqueId='3c5d3fbe-29f2-3896-90af-a0a722e09a6a', url='http://mc.local:10200/generated.zip#2b2a13b04dd2ed9d6ef7a09215e4997d466f4216', hash='null', forced=true, hasPromptMessage=true, promptMessage=REDACTED}
[18:52:01 INFO] [OneTimePack]: The packet doesn't contains HASH, but invalid packs are allowed
[18:52:01 INFO] [OneTimePack]: Player Unique pack false
[18:52:01 INFO] [OneTimePack]: Player pack empty true
[18:52:01 INFO] [OneTimePack]: Save packet on PLAY protocol for player c9bd2771-a736-35c8-a2a8-2fc1d51fbba9
[18:52:01 INFO] [OneTimePack]: [PLAY] Packet#read() = ServerboundResourcePack{uniqueId='3c5d3fbe-29f2-3896-90af-a0a722e09a6a', result=3}
[18:52:01 INFO] [OneTimePack]: Saved cached result: ServerboundResourcePack{uniqueId='3c5d3fbe-29f2-3896-90af-a0a722e09a6a', result=3} from player c9bd2771-a736-35c8-a2a8-2fc1d51fbba9
[18:52:01 INFO] [OneTimePack]: [PLAY] Packet#read() = ServerboundResourcePack{uniqueId='3c5d3fbe-29f2-3896-90af-a0a722e09a6a', result=4}
[18:52:01 INFO] [OneTimePack]: Saved cached result: ServerboundResourcePack{uniqueId='3c5d3fbe-29f2-3896-90af-a0a722e09a6a', result=4} from player c9bd2771-a736-35c8-a2a8-2fc1d51fbba9
[18:52:02 INFO] [OneTimePack]: [PLAY] Packet#read() = ServerboundResourcePack{uniqueId='3c5d3fbe-29f2-3896-90af-a0a722e09a6a', result=0}
[18:52:02 INFO] [OneTimePack]: Saved cached result: ServerboundResourcePack{uniqueId='3c5d3fbe-29f2-3896-90af-a0a722e09a6a', result=0} from player c9bd2771-a736-35c8-a2a8-2fc1d51fbba9

The config file

# Plugin related configuration
Plugin:
  # Log level to see messages in console:
  # 0 = disabled
  # 1 = errors
  # 2 = 1 + warnings
  # 3 = 2 + information
  # 4 = 3 + debug messages
  LogLevel: 4

# Resource pack configuration
Pack:
  # Pack comparator:
  # UUID   = Compare by unique ID (Only available for MC +1.20.3)
  # URL    = Compare by download URL
  # HASH   = Compare by 40 char hash ID
  # PROMPT = Compare using the prompt message (Only available for MC +1.17)
  # ALL    = Check is the two resource packs are equals
  # ANY    = Don't compare, just cancel any other pack sending to player
  # Use multiple comparisons with 'AND', or optional with 'OR'
  # Add '!' to compare object only if it's not null
  Comparator: !UUID OR !HASH OR URL
  # Default pack status to send if player don't have any status saved:
  # SUCCESS_DOWNLOAD = The pack was successfully downloaded, and it's active by the client
  # DECLINED         = The pack was declined by the player
  # FAILED_DOWNLOAD  = The client cannot download the pack correctly
  # ACCEPTED         = The pack is currently downloading by the client
  # DOWNLOADED       = The pack is already downloaded by the client (this status only appear if the client is on configuration screen)
  # INVALID_URL      = The pack URL cannot be used to download the resource pack
  # FAILED_RELOAD    = The pack was downloaded by the client, but cannot be reapplied
  # DISCARDED        = The pack is already downloaded, but was ignored
  # Set to 'none' to disable
  Default-Status: none
  # Pack behavior (Only for +1.20.3 clients):
  # STACK    = Stack new resource pack into loaded packs
  # OVERRIDE = Clear all loaded packs on detect new resource pack
  Behavior:
    # Pack behavior on PLAY protocol
    Play: OVERRIDE
    # Pack behavior on CONFIGURATION protocol
    Configuration: STACK
  # Allow or not resource pack re-sending
  Send:
    # Allow re-sending via PLAY protocol
    Play: false
    # Allow re-sending via CONFIGURATION protocol
    Configuration: false
  # Allow or not all resource packs can be cleared for +1.20.3 clients
  Clear:
    # Allow clear via PLAY protocol
    # This option may generate problems with < 1.20.3 servers using ViaVersion
    Play: false
    # Allow clear via CONFIGURATION protocol
    Configuration: true

# Experimental configuration
Experimental:
  # Send or not cached resource pack to 1.20.2 clients when configuration protocol starts
  # This option solve resource pack clear on server change, but will make 1.20.2 players to re-download resource pack every time they switch servers
  Send-Cached-1-20-2: false
  # Send or not invalid resource packs to clients
  Send-Invalid: true

image

Rubenicos commented 8 months ago

This is a normal behaviour, literally your paper server is removing the resource pack before send it to 1.20.4 players, this causes the resource pack get reloaded everytime.

[18:52:01 INFO] [OneTimePack]: [PLAY] Packet#read() = ClientboundResourcePackPop{hasUniqueId=true, uniqueId=3c5d3fbe-29f2-3896-90af-a0a722e09a6a}
[18:52:01 INFO] [OneTimePack]: Remove cached packet using: ClientboundResourcePackPop{hasUniqueId=true, uniqueId=3c5d3fbe-29f2-3896-90af-a0a722e09a6a} from player c9bd2771-a736-35c8-a2a8-2fc1d51fbba9

Change the way how texture pack is sent from your Paper server if you want to fix that. OneTimePack only saves information about duplicate packs, it doesn't cancel when a server wants to remove a resource pack directly from player.

Rubenicos commented 8 months ago

Also use the latest release (It fixes directly this pack sending behaviour).

nhanledev commented 8 months ago

This behavior is really weird for me because everything runs fine on paper 1.20.2 and I am just trying to update paper servers to 1.20.4. Rolled the servers back to 1.20.2 fixes this issue. I will try to test the new release again on the 1.20.4 backend and will tell you about the result here.

nhanledev commented 8 months ago

OneTimePack 1.5 fixes my issue. Thank you so much.