Sueta

UUIDCache | Lag-Less | Easy configurable | With API

1.0.6

UIDCache offers an easy way to store minecraft player uuid’s into an redis database and automaticall

·Plugin

UUIDCache offers an easy way to store minecraft player uuid’s into an redis database and automatically cache them.

How to setup the plugin?

First install the redis-server:

sudo apt-get install redis-server or for CentOS, OpenSUSE or other distributions: yum install redis-server

Then put the plugin on your server and edit the config file:

Thanks to: https://api.minetools.eu/ and @McLive for distributing their service, It's working great and it's also used to get the uuids of this plugin.

[/B][/B][/B][/B][/B][/B]
[B][B][B][B][B][B]RedisHost: 127.0.0.1 //The redis host
RedisPort: 6379 //The redis port
AuthUsingPassword: false //If you have a password set for your redis server
RedisPassword: MyPassword //The password.
CacheEntryExpire: 7200 //The time in seconds after the uuid cache entry will expire and removed from redis.


FAQ:
What if a player changes his name?

Spoiler

The uuid get's cleared in the interval that you have set in the config.


I found a bug!!!!!! I want to report it?

Spoiler

Add me on Discord: FileInputStream | Alex#7395
or open a bug report on github.

» Does this plugin produce lags?

Spoiler

This plugin runs fully asynchronous in the background.


Screenshots:

upload_2018-5-1_15-30-26.png

As you can see, there is no lag. Even on uncached uuid's there is no lag.

upload_2018-5-1_15-31-20.png

And here are the little debug messages.

There are two events: UUIDCachedEvent and UUIDUncachedEvent

@EventHandler
public void onUUIDCached(UUIDCachedEvent event) {
    System.out.println("swsww");
    System.out.println("Event: " + event.getCachedUUID());
    System.out.println("Event: " + event.getCachedName());
}

@EventHandler
public void onUUIDUncached(UUIDUncachedEvent event) {
    System.out.println("Event: " + event.getUncachedUUID());
    System.out.println("Event: " + event.getUncachedName());
}
[/B]

There is an API for UUIDCache:

Get the uuid:

[/[/B][/B][/B][/B][/B]
[B][B][B][B][B]package de.fileinputstream.uuidcache.commands;
import de.fileinputstream.uuidcache.UUIDCacheBootstrap;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
/**
 * This class has been generated by Alexander on 30.04.18 17:35
 * You are not allowed to edit this resource or other components of it
 * © 2018 Alexander Fiedler
 */
public class CommandUUID implements CommandExecutor {
   @Override
   public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
       if(commandSender.isOp()) {
           if(strings.length == 1) {
               String player = strings[0];
                UUIDCacheBootstrap.getInstance().getUuidCache().getUUID(player, s1 -> commandSender.sendMessage(ChatColor.GREEN + "UUID of " + player + " is: " + s1));
                //Do something with the uuid.
           } else {
               commandSender.sendMessage(ChatColor.DARK_RED + "§bPlease use /uuid <Name>");
               return true;
           }
       }
       return false;
   }
}
[/B][/B][/B][/B][/B]
[B][B][B][B][B]Uncache an uuid:

package de.fileinputstream.uuidcache.commands;

import de.fileinputstream.uuidcache.UUIDCacheBootstrap;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;

/**
 * This class has been generated by Alexander on 30.04.18 18:06
 * You are not allowed to edit this resource or other components of it
 * © 2018 Alexander Fiedler
 */
public class CommandUncacheUUID implements CommandExecutor {
  @Override
   public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
       if(commandSender.isOp()) {
           if(strings.length == 1) {
               String name = strings[0];
               if((UUIDCacheBootstrap.getInstance().getRedisManager().getJedis().exists("uuidcache:" + name.toLowerCase() ))) {
                   UUIDCacheBootstrap.getInstance().getUuidCache().getUUID(name, s1 -> {
                       UUIDCacheBootstrap.getInstance().getUuidCache().uncacheUUID(name);
                       commandSender.sendMessage(ChatColor.GREEN + "This uuid has been uncached now!");

                   });

               } else {
                   commandSender.sendMessage(ChatColor.DARK_RED + "This uuid hasn't been cached yet.");
                   return true;
               }
           } else {
               commandSender.sendMessage(ChatColor.DARK_RED + "§bPlease use /uncacheuuid <Name>");
               return true;
           }

       }
       return false;
   }
}

Please take a look at the javadoc at : https://fileinputstream.github.io/UUIDCache/docs/

Similar projects

Plugin →