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

Defer World modification to when the worlds are not being ticked on Paper #2802

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Commits on Apr 11, 2023

  1. Add method MVWorldManager#addOrRemoveWorldSafely

    Addresses Multiverse#2560
    
    Commands that load or unload worlds trigger an IllegalStateException if they are run via a command block while the worlds are being ticked.
    
    Using a BukkitRunnable, the operation can be delayed until the next tick at a time when the worlds are not being ticked.
    
    MVWorldManager#addOrRemoveWorldSafely performs this logic, either running the operation now or delaying it.
    
    8 commands were modified to use MVWorldManager#addOrRemoveWorldSafely, which I think are all the relevant commands.
    
    Unfortunately I haven't found a way to tell when the worlds are being ticked on a Spigot server. There probably won't be any way to do this until [SPIGOT-7089](https://hub.spigotmc.org/jira/browse/SPIGOT-7089) resolves
    willkroboth committed Apr 11, 2023
    Configuration menu
    Copy the full SHA
    9ea2037 View commit details
    Browse the repository at this point in the history
  2. Use reflection to test for Paper and check if it is safe to load or u…

    …nload worlds
    
    Note: this code was designed under the assumption that PaperMC/Paper#8316 will be accepted, so it won't work unless the commit from that PR is included in the Paper build.
    willkroboth committed Apr 11, 2023
    Configuration menu
    Copy the full SHA
    200a461 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b92c2fa View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    bc4127e View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    cc4fbbd View commit details
    Browse the repository at this point in the history
  6. Use original safeToAddOrRemoveWorld method

    (PaperMC/Paper#8316 was accepted, so this works now)
    Also some more logging messages
    willkroboth committed Apr 11, 2023
    Configuration menu
    Copy the full SHA
    11c9a06 View commit details
    Browse the repository at this point in the history