WiIIiam278 / HuskSync

A modern, cross-server player data synchronisation system
https://william278.net/project/husksync
Apache License 2.0
160 stars 128 forks source link

Syncing max health doesn't work properly in certain circumstances #219

Closed ch4ika closed 5 months ago

ch4ika commented 8 months ago

If you pick up the item, lives will be removed from you. Nothing is added and nothing happens when you switch. See video.

https://www.youtube.com/watch?v=WjQw2GOlrkI

synchronization:
  # The data synchronization mode to use (LOCKSTEP or DELAY). LOCKSTEP is recommended for most networks. Docs: https://william278.net/docs/husksync/sync-modes
  mode: LOCKSTEP
  # The number of data snapshot backups that should be kept at once per user
  max_user_data_snapshots: 16
  # Number of hours between new snapshots being saved as backups (Use "0" to backup all snapshots)
  snapshot_backup_frequency: 4
  # List of save cause IDs for which a snapshot will be automatically pinned (so it won't be rotated). Docs: https://william278.net/docs/husksync/data-rotation#save-causes
  auto_pinned_save_causes:
  - INVENTORY_COMMAND
  - ENDERCHEST_COMMAND
  - BACKUP_RESTORE
  - LEGACY_MIGRATION
  - MPDB_MIGRATION
  # Whether to create a snapshot for users on a world when the server saves that world
  save_on_world_save: true
  save_on_death:
    # Whether to create a snapshot for users when they die (containing their death drops)
    enabled: true
    # What items to save in death snapshots? (DROPS or ITEMS_TO_KEEP).  Note that ITEMS_TO_KEEP (suggested for keepInventory servers) requires a Paper 1.19.4+ server.
    items_to_save: DROPS
    # Should a death snapshot still be created even if the items to save on the player's death are empty?
    save_empty_items: true
    # Whether dead players who log out and log in to a different server should have their items saved.
    sync_dead_players_changing_server: true
  # Whether to use the snappy data compression algorithm. Keep on unless you know what you're doing
  compress_data: true
  # Where to display sync notifications (ACTION_BAR, CHAT, TOAST or NONE)
  notification_display_slot: NONE
  # (Experimental) Persist Cartography Table locked maps to let them be viewed on any server
  persist_locked_maps: true
  # Whether to synchronize player max health (requires health syncing to be enabled)
  synchronize_max_health: true
  # If using the DELAY sync method, how long should this server listen for Redis key data updates before pulling data from the database instead (i.e., if the user did not change servers).
  network_latency_milliseconds: 500
  # Which data types to synchronize (Docs: https://william278.net/docs/husksync/sync-features)
  features:
    advancements: true
    experience: true
    ender_chest: true
    potion_effects: true
    location: false
    statistics: true
    health: true
    hunger: true
    persistent_data: true
    inventory: true
    game_mode: true
  # Commands which should be blocked before a player has finished syncing (Use * to block all commands)
  blacklisted_commands_while_locked:
  - '*'
  # Event priorities for listeners (HIGHEST, NORMAL, LOWEST). Change if you encounter plugin conflicts
  event_priorities:
    join_listener: LOWEST
    death_listener: NORMAL
    quit_listener: LOWEST
WiIIiam278 commented 8 months ago

The video shows it working perfectly, though?

HuskSync's job here is to sync your health (and the item), and it does so. The fact your item is taking health from your player suggests something's up with the item attributes, not HuskSync.

ch4ika commented 8 months ago

But this means item attributes are no longer supported, so set synchronized_max_health to false?

WiIIiam278 commented 8 months ago

Item attributes are supported. You can see in the video that the behaviour of the item is the same on either server

ch4ika commented 8 months ago

I should have gotten 10 extra hearts with this sword. Maybe I'm just misunderstanding this, but actually I should have more life with this item.

WiIIiam278 commented 8 months ago

It's not giving that before/after you sync

ch4ika commented 8 months ago

Oke in 1.20.4 it is simply displayed incorrectly in the client - my mistake.

Everything works except that lives have to regenerate again and again on server switches. The life you had will not be synced.

WiIIiam278 commented 5 months ago

Requires attribute syncing to do properly, so blocked by #253

rudde0 commented 3 months ago

Oke in 1.20.4 it is simply displayed incorrectly in the client - my mistake.

This visual bug happens only when HuskSync is loaded and its still exist in HuskSync 3.5.2.

Max health syncing on server side correctly, but, it still displays 10 hearts in client side even if its higher. There is no any visual bug when HuskSync isn't loaded.