Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Player Location Persistence System #498

Open
1 task done
MarkPLacer opened this issue Jan 25, 2025 · 1 comment
Open
1 task done

Player Location Persistence System #498

MarkPLacer opened this issue Jan 25, 2025 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@MarkPLacer
Copy link

I've searched existing issues and couldn't find a duplicate.

  • I confirm this is not a duplicate.

Is your feature request related to a problem? Please describe.

Problem

Currently, when players disconnect and reconnect to the server, they always spawn at the default world spawn point. This creates a poor user experience as players lose their position and have to travel back to where they were, which can be frustrating and time-consuming, especially in large worlds or after unplanned disconnections.

Describe the solution you'd like

Proposed Solution

Implement a reliable player location persistence system that saves player positions when they disconnect and restores them upon reconnection.

Core Features

  1. Location Storage

    • Save player coordinates (X, Y, Z)
    • Save player rotation (yaw, pitch)
    • Save dimension information
    • Store in JSON format for easy debugging and manual editing
  2. Save Triggers

    • On clean player disconnect
    • On server shutdown
    • Periodic saves (every 5 minutes)
    • During world save operations
  3. Location Loading

    • Load after player initialization
    • Wait for chunks to be loaded
    • Verify location safety before teleporting
    • Fall back to spawn point if the location is invalid

Safety Considerations

  • Handle corrupted save files gracefully
  • Validate coordinates before teleporting
  • Consider dimension boundaries
  • Ensure chunks are loaded before teleport
  • Prevent teleporting into solid blocks
  • Add configuration options to disable the feature

Technical Implementation

  • Use JSON for data storage
  • Implement atomic writes to prevent corruption
  • Add proper error handling and logging
  • Support multiple dimensions
  • Consider adding location history

Future Enhancements

  • Custom spawn points per player
  • Last death location storage
  • Location history/rollback system
  • Admin commands to manage saved locations
  • Migration tools for format changes

Benefits

  1. Improved player experience
  2. Reduced frustration from disconnects
  3. Time saved from not having to travel back
  4. Better server administration tools

Examples

Similar features exist in:

  • Spigot/Paper servers (Essentials plugin)
  • Vanilla Minecraft (spawn point system)
  • Other popular multiplayer games
@MarkPLacer MarkPLacer added the enhancement New feature or request label Jan 25, 2025
@Snowiiii
Copy link
Member

Currently working at Entity NBT reading and writing just like Vanilla does. Should be possible when #420 is fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants