Skip to content

Optimization#6

Merged
NguyenDevs merged 13 commits into
mainfrom
Optimization
Apr 17, 2026
Merged

Optimization#6
NguyenDevs merged 13 commits into
mainfrom
Optimization

Conversation

@NguyenDevs
Copy link
Copy Markdown
Owner

No description provided.

- Backend: soft depend Citizens, log hook success/failure on enable
- Backend: CitizensHook + CitizensSkinChannelHandler (freesia:citizens_setskin in, freesia:citizens_uuid_resp out)
- Backend: TrackerProcessor tracks Citizens NPC entities (NPC metadata check, no Citizens API needed)
- Proxy (Waterfall + Velocity): merge /listysmplayers + /dworkerc into unified /freesia command
- Proxy: add /freesia setskin <npc_id> <model_id> subcommand
- Proxy: VirtualPlayerManager handles citizens_uuid_resp -> build YSM NBT -> setVirtualPlayerEntityState
…skin

- Add freesia.setskin.* lang keys to all 6 lang files (en_US, vi_VN, zh_CN x Velocity+Waterfall)
- CitizensSkinChannelHandler: include NPC entity ID in outbound response packet
- VirtualPlayerManager (Waterfall+Velocity): read entityId from citizens_uuid_resp,
  call addVirtualPlayer() before setVirtualPlayerEntityState() to ensure NPC is registered
…mat, fix fetchTrackerList for NPC UUIDs, add debug logging
- addVirtualPlayer: fallback to clean state (setPlayerEntityId) instead
  of completeExceptionally when stored NBT fails to deserialize (prevents
  entityId staying at -1 which silently blocks notifyFullTrackerUpdates)
- addVirtualPlayer: when NPC proxy already exists (re-setskin), update
  its entityId and return true instead of false
…constructing wrong format

- Stop constructing binary manually (writeUtf only was incomplete/wrong format)
- Add npcModelBinaryCache to YsmMapperPayloadManager (Waterfall + Velocity)
- RealPlayerYsmPacketProxyImpl: after capturing 2.6 binary, probe first
  readUtf() as model path and cache the full binary for NPC reuse
- VirtualPlayerManager: handleCitizensUuidResponse now looks up the cache;
  if no cached binary for the model, logs a warning and skips sending
  (prevents DecoderException crash caused by malformed binary payload)
- Client will no longer disconnect when /freesia setskin is called
…cModelBinary

YSM 2.6 stores model paths as 'ModelName.ysm' (e.g. 'Kipfel.ysm') but
users type 'Kipfel' in the setskin command. Now tries both with and
without .ysm suffix when looking up cached binary.
…arts

- Backend: add npcId to citizens_uuid_resp packet so proxy can map
  Citizens NPC ID (int) to modelId without needing UUID
- Add NpcPersistenceManager (Velocity + Waterfall): persists
  npc_assignments.dat (npcId->modelId) and npc_model_cache.dat (modelPath->bytes)
  to PLUGIN_DIR using DataOutputStream binary format
- YsmMapperPayloadManager: load model binary cache from disk on startup;
  save to disk whenever a new model is cached from a real player
- VirtualPlayerManager: load NPC assignments on init; auto-reapply all
  NPC models when the first player joins (re-triggers setskin to backend
  which returns fresh UUID+entityId); save assignment on every setskin cmd
- Result: after first-time setup, NPC models persist across proxy/server
  restarts without needing a real player with that model to be online
- Rewrite NpcPersistenceManager (Velocity + Waterfall) to use NpcEntry (npcId, UUID, modelId).
- Proxy pre-loads persistent NPC models at startup via YsmMapperPayloadManager#preloadNpcModels with entityId = -1.
- Send real NPC entityId via Backend TrackerProcessor's virtual tracker_sync plugin message when a player discovers the NPC.
- Proxy uses YsmMapperPayloadManager#updateVirtualPlayerEntityId to lazily apply network updates in real-time when tracking occurs.
- Removes the requirement for a player connection on Proxy restart to restore NPC models.
- Update TrackerProcessor to append stable Citizens npcId alongside UUID mappings in track sync packets.
- Implemented UUID realignment across backend server reboots (replaces cached stale UUID tied to npcId).
- Resolve transient YSM handshake dropping packet bugs by enforcing queueTrackerUpdate synchronization block for proxies
…ckerProcessor

- Resolves a bug where Citizens Player NPCs were incorrectly categorized as Real Players because they inherit from org.bukkit.entity.Player, causing their tracking packets (and proxy model alignment) to be dropped.
… support

- Added Freesia-NPC module for backend NPC tracking.
- Implemented NpcMessageReceiver in Waterfall and Velocity for NPC synchronization.
- Enhanced YsmMapperPayloadManager with NPC model binary caching and remapping.
- Improved VirtualPlayerManager and NpcPersistenceManager for better state handling.
- Integrated CyanidinRealPlayerTrackerUpdateEvent in Freesia-Backend.
@NguyenDevs NguyenDevs merged commit 3669a53 into main Apr 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant