Sueta

UUIDAPI - Offline UUID

Build 2

API for Developers to get UUID from an offline player name.

·Plugin

UUIDAPI

When I make some private projects, I think that it would be great to add some features like offline payment or, offline whatever. So it came in my mind to make some UUID API to help me and developers to get UUID from a name and vice versa.

public   boolean  checkUUIDAPI  (   )   {  
         boolean  enabled  =  Bukkit.  getServer   (   )  .  getPluginManager   (   )  .  isPluginEnabled   (   "UUIDAPI"   )   ;  
         if   (   !  enabled  )   {  
             // Warn  
             this  .  setEnabled   (   false   )   ;  
        
         }  
         return  enabled  ;  
 }
#  
 # Add softdepend: [UUIDAPI] to it.  
 #  
 # If you want to add multiple dependencies, incase you haven't  
 # understand yet, use  

 # softdepend: [UUIDAPI, Whatplugin, Plugin2] etc   
softdepend   :   [  UUIDAPI  ]
public   class  ExampleUsage  {  
     public   void  setOfflineSomeThing  (    String   name  )   {  
        UUID uuid  =  UUIDAPI.  getUUID   (  name  )   ;   // Get UUID  
         if   (  uuid  ==   null   )   {   // Player never existed  
                 return   ;  
         }  
         /*Get file of player*/    File   file  =   new    File    (   this  .  getDataFolder   (   )  ,  "data"   +    File   .  separator   +  uuid.  toString   (   )   +   ".yml"   )   ;  
        YamlConfiguration yml  =  YamlConfiguration.  loadConfiguration   (  file  )   ;  
         /* 
         * TODO 
         * Do something 
         */  
   }  
 }

UUIDAPI#getName
UUIDAPI#getUUID

Icon by Smashicons

Similar projects

Plugin →