1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Thread Status:
Not open for further replies.
  1. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    175
    Medals:
    Donut submitted a new resource:

    SkUniversal - Skript addon that provides support for a variety of plugins.

    Read more about this resource...
     
  2. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    Mind on publishing the source code at GitHub?
     
    • Agree Agree x 1
  3. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    175
    Medals:
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
  5. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    175
    Medals:
  6. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    Thanks a lot.
     
  7. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    175
    Medals:
  8. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    175
    Medals:
  9. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    175
    Medals:
  10. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    175
    Medals:
    Donut updated SkUniversal with a new update entry:

    Version 1.2.5

    Read the rest of this update entry...
     
  11. byHelper

    byHelper Member

    Joined:
    Jul 5, 2017
    Messages:
    1
    Likes Received:
    0
    Hey! Can u add support for MultiSkyWars Events?
     
  12. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    175
    Medals:
  13. lucasmooon

    lucasmooon Member

    Joined:
    Feb 4, 2017
    Messages:
    16
    Likes Received:
    0
    That's awesome : )))
     
  14. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    175
    Medals:
  15. Wynnevir

    Wynnevir Well-Known Member

    Joined:
    Jul 9, 2017
    Messages:
    974
    Likes Received:
    57
  16. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    175
    Medals:
    • Like Like x 1
    • Friendly Friendly x 1
  17. Snow-Pyon

    Moderator Resource Staff

    Joined:
    Jan 25, 2017
    Messages:
    1,234
    Likes Received:
    172
    Medals:
  18. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    175
    Medals:
    because i couldnt get it to work and figured its not worth it since most people wouldnt need the perms of an offlineplayer and if they did they could store them. if you would like to convert either of his 2 methods to a working getUser() id be more than happy to include it

    his methods:
    Code (Java):
    1. public void getUserAndApply(UUID playerUuid, Consumer<User> action) {
    2.    User user = api.getUser(playerUuid);
    3.    if (user != null) {
    4.        // user is already loaded, just apply the action
    5.        action.accept(user);
    6.        return;
    7.    }
    8.  
    9.    // ok, user isn't online, so we need to load them.
    10.    // once the user is loaded, this callback will be executed on the main thread.
    11.    api.getStorage().loadUser(playerUuid)
    12.            .thenAcceptAsync(wasSuccessful -> {
    13.  
    14.                // for whatever reason, the user could not be loaded.
    15.                // this might be because the database is not accessible, or because
    16.                // there was some other unexpected error.
    17.                if (!wasSuccessful) {
    18.                    return;
    19.                }
    20.  
    21.                // ok, so the user *should* be loaded now!
    22.                User loadedUser = api.getUser(playerUuid);
    23.                if (loadedUser == null) {
    24.                    // nope, still not loaded.
    25.                    return;
    26.                }
    27.  
    28.                // apply the action now they're loaded.
    29.                action.accept(loadedUser);
    30.  
    31.                // tell LuckPerms that you're finished with the user, and that
    32.                // it can unload them.
    33.  
    34.                api.cleanupUser(loadedUser);
    35.            }, api.getStorage().getSyncExecutor());
    36. }
    Code (Java):
    1. public void doSomethingToUser(UUID playerUuid) {
    2.    User user = api.getUser(playerUuid);
    3.    if (user == null) {
    4.        // user not loaded, we need to load them from the storage.
    5.        // this is a blocking call.
    6.        api.getStorage().loadUser(playerUuid).join();
    7.  
    8.        // then grab a new instance
    9.        user = api.getUser(playerUuid);
    10.    }
    11.  
    12.    // still null, despite our efforts to load them.
    13.    if (user == null) {
    14.        throw new RuntimeException("Unable to load user for " + playerUuid);
    15.    }
    16.  
    17.    // now we have a user, and can apply whatever action we want.
    18.    user.doSomething(...);
    19.  
    20.    // remember that once you're finished with a user, you need to tell
    21.    // LuckPerms to cleanup that instance.
    22.    api.cleanupUser(loadedUser);
    23. }

    what i tried (something like this i forget what exactly i had):
    Code (Java):
    1. User getUser(UUID playerUUID) {
    2.    User user = api.getUser(playerUuid);
    3.    if (user != null)  {
    4.         return user;
    5.    } else {
    6.        api.getStorage().loadUser(playerUuid).join();
    7.        return api.getUser(playerUuid);
    8.    }
    9. }
     
  19. Wynnevir

    Wynnevir Well-Known Member

    Joined:
    Jul 9, 2017
    Messages:
    974
    Likes Received:
    57
    @Donut Awesome! :emoji_grinning: super helpful.
     
  20. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    175
    Medals:
    • Friendly Friendly x 1
Thread Status:
Not open for further replies.
Loading...