Addon [Deleted] SkUniversal

  • 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!

Status
Not open for further replies.

Donut

Well-Known Member
Mar 27, 2017
1,336
177
0
U.S.
Donut submitted a new resource:

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

Xuvczfm.gif

Overview:
SkUniversal is a Skript addon that aims to universalize Skript by providing support for a wide range of plugins. You can download the latest version of Skript here.

Installation:

  1. Download the plugin jar.
  2. Place the jar in your plugins folder.
  3. Restart your server and enjoy!
Supported Plugins:
  • ...

Read more about this resource...
 
Donut updated SkUniversal with a new update entry:

Version 1.2.5

- Added LockettePro owner expression
- Added LWC protection amount expression
- Removed owner condition from Lockette, LockettePro, and LWC (You can still check if the owner is a player with 'if owner of %block% is %player%' which doesn't need a separate condition)

- On server startup, the plugins that SkUniversal hooked into will be displayed in console
- Added command: /skuniversal (displays SkUniversal version, hooked plugins, and useful links. Permission is skuniversal.info)

Read the rest of this update entry...
 
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:
Java:
public void getUserAndApply(UUID playerUuid, Consumer<User> action) {
   User user = api.getUser(playerUuid);
   if (user != null) {
       // user is already loaded, just apply the action
       action.accept(user);
       return;
   }

   // ok, user isn't online, so we need to load them.
   // once the user is loaded, this callback will be executed on the main thread.
   api.getStorage().loadUser(playerUuid)
           .thenAcceptAsync(wasSuccessful -> {

               // for whatever reason, the user could not be loaded.
               // this might be because the database is not accessible, or because
               // there was some other unexpected error.
               if (!wasSuccessful) {
                   return;
               }

               // ok, so the user *should* be loaded now!
               User loadedUser = api.getUser(playerUuid);
               if (loadedUser == null) {
                   // nope, still not loaded.
                   return;
               }

               // apply the action now they're loaded.
               action.accept(loadedUser);

               // tell LuckPerms that you're finished with the user, and that
               // it can unload them.

               api.cleanupUser(loadedUser);
           }, api.getStorage().getSyncExecutor());
}
Java:
public void doSomethingToUser(UUID playerUuid) {
   User user = api.getUser(playerUuid);
   if (user == null) {
       // user not loaded, we need to load them from the storage.
       // this is a blocking call.
       api.getStorage().loadUser(playerUuid).join();

       // then grab a new instance
       user = api.getUser(playerUuid);
   }

   // still null, despite our efforts to load them.
   if (user == null) {
       throw new RuntimeException("Unable to load user for " + playerUuid);
   }

   // now we have a user, and can apply whatever action we want.
   user.doSomething(...);

   // remember that once you're finished with a user, you need to tell
   // LuckPerms to cleanup that instance.
   api.cleanupUser(loadedUser);
}

what i tried (something like this i forget what exactly i had):
Java:
User getUser(UUID playerUUID) {
   User user = api.getUser(playerUuid);
   if (user != null)  {
        return user;
   } else {
       api.getStorage().loadUser(playerUuid).join();
       return api.getUser(playerUuid);
   }
}
 
Status
Not open for further replies.