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

Asynchronous event handling with functional non-thread-blocking chunk loading [PROPOSAL] #129

Closed

Commits on Jul 10, 2023

  1. Implement EntityTeleportEvent properly

    Many things to express. This change implements the EntityTeleportEvent in a context thread safe way. The following are handled:
    - Passengers have the event called properly
    - Recursion is prevented by checking for the teleport status. Such status is revoked by overriding and chaining the teleport callback. It is manually removed when the event fails and henceforth the callback would call null, or when the entities are in the same chunk region, and hence don't call the callback.
    - Teleporting status is removed on callback
    - Modifying the teleport location of passenger entities is forbidden to prevent conflicts
    - Cancelling an entity riding will dismount it and NOT trigger any events for its passengers
    terminalsin committed Jul 10, 2023
    Configuration menu
    Copy the full SHA
    84a262a View commit details
    Browse the repository at this point in the history

Commits on Jul 11, 2023

  1. Configuration menu
    Copy the full SHA
    b58e3a9 View commit details
    Browse the repository at this point in the history
  2. Rework listeners to support proper linear execution and deprecate old…

    … bukkit event api
    
    - Reworked listeners. Now they execute synchronously after any edits including chunk loading. This allows for perfect asynchronous linear behaviour (tested!)
    - Reworked bukkit event api, introduced callEventAsync. If old method is call, the event is at risk of not having the proper data if paired up with any kind of chunk loading or non-direct modifier which is called asynchronously. This is the best we could possibly do without creating conflicting behaviour
    - Fixed teleportation whoopsie I made
    terminalsin committed Jul 11, 2023
    Configuration menu
    Copy the full SHA
    b3ee17a View commit details
    Browse the repository at this point in the history
  3. Improve asynchronous calling, make thread safe by returning to previo…

    …usly fetched thread context
    
    - If the current thread is not a region --> run consecutive code on current thread
    - If the origin of the event is unspecified --> heuristical approach at fetching current thread coords by taking a random coordinate in current map of thread. This can go wrong so easily, SpottedLeaf, this one's on you, I trust that you'll help me improve this
    - If the origin of the event is specified -> return to thread context at specified location (hurray)
    
    Additional improvements:
    - Made nms command /teleport depend on bukkit handling to support proper event handling
    - Added player teleportation to the handlers. All player teleports now have the same behaviour as chunk fetches (yipee)
    - Fixed a scenario of chunk loading I forgot about
    terminalsin committed Jul 11, 2023
    Configuration menu
    Copy the full SHA
    c5543de View commit details
    Browse the repository at this point in the history
  4. Additional events

    Implemented the following events:
    -  PlayerSpawnLocationEvent,
    -  EntityPortalEnterEvent,
    -  EntityPortalExitEvent,
    -  PlayerPortalEvent,
    -  EntityPortalReadyEvent
    terminalsin committed Jul 11, 2023
    Configuration menu
    Copy the full SHA
    c463a5d View commit details
    Browse the repository at this point in the history

Commits on Jul 12, 2023

  1. Fix multiple events and ensure they are fired properly + fix global t…

    …hread and offthread events
    
    - Fixed issue where global thread events wouldn't be properly accounted for
    - Fixed an issue where the EntityEnterPortalEvent would be fired every tick (god knows how long this has been there like this)
    terminalsin committed Jul 12, 2023
    Configuration menu
    Copy the full SHA
    b01fc90 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a8b7f25 View commit details
    Browse the repository at this point in the history
  3. Fixed compile issue

    terminalsin committed Jul 12, 2023
    Configuration menu
    Copy the full SHA
    8d617bd View commit details
    Browse the repository at this point in the history

Commits on Jul 17, 2023

  1. Fix non-region threads + Player/EntityPortalEvent

    - Fix non-region threads calling teleport and chunk functions failing 
    - Fixed wrong origin level in player and entity portal event
    terminalsin committed Jul 17, 2023
    Configuration menu
    Copy the full SHA
    71172e9 View commit details
    Browse the repository at this point in the history

Commits on Jul 18, 2023

  1. Configuration menu
    Copy the full SHA
    f4dfb03 View commit details
    Browse the repository at this point in the history