Sueta
SK

SkinAPI

1.2

A skin manipulation API

·Plugin

SkinAPI

The SkinAPI Plugin / Library is a small library I wrote to make it super easy to do things like changing a players skin, or using custom skins. It is still under development, but I have tested it under various conditions and it works like a charm.

If you want a plugin that enables your players to switch skins with commands, take a look at my "GSkin" plugin HERE

INFO : I hope this library will help some people. If you have any questions / suggestions just open a comment below.
Also please consider writing a short review if this library helped you.

HELP : You can also join the Discord server and talk about issues ( https://discord.gg/YFArBG7 )

Requirements:

  • A MySQL database (MariaDB is fine as well)
  • ProtocolLib (Tested with version 4.3.0: Download Link )
  • About 1 Minute to set everything up

Features:

  • Change a players skin to any other players skin
  • Change a players skin to a custom skin
  • Keep skin, even when disconnecting
  • Keep skin, even when switching servers (Servers need to have the API Plugin)
  • Get a Skull item with a any other players skin
  • Get a skull item with a custom skin
  • Skin caching in the database (Due to Mojang rate limits)
  • Skin caching in memory

Future Goals:

  • Make it more user friendly to use custom skins (Skin downloading from a URL)

Setup:

Setup
  • Download the plugin JAR and place it inside of all the Bukkit / Spigot servers on which you want to enable the SkinAPI.
  • Create a MySQL database (preferably named "skinapi").
  • Restart your server, and open the config.yml file.
  • Change the database configuration to fit your database name, username & password.
  • Visit the "API Setup" Section to see how to use the API in your own Plugin.
  • (You can also download my "GSkin" plugin. This is just a simple plugin, which enables users to change skins. Download Link )

Configuration:

Configuration
plugin  :  
  DEBUG   :  false  // Whether to display debug information.  
  chatPrefix   :   "§7» §6SkinAPI {success}§7*"   // The chat prefix for the plugin.  
  caching  :  
    memCacheMaxItems   :  20  // The max ammount of items to store in memory cache.  
  database  :  
    host   :  localhost  // The database host  (  IP  )  .  
    port   :  3306  // The database port.  
    database   :  skinapi  // The database name.  
    username   :  root  // The database username.  
    password   :  placeyourpasswordhere  // The database password.

API Setup:

API Setup
  1. Add the SkinAPI JAR to your projects dependencies.
  2. Use the following code to get an instance of the API.
  3. Use the API methods as described in the "API" section.
// SkinAPI Setup.  
SkinAPI api  =   new  SkinAPI  (   )   ;

API:

API
SkinAPI.getPlayerData(UUID/String) 

Returns the PlayerData object which can be used to get information about specific player data 
like the currently used skin. 


SkinAPI.getSkinData(UUID/String) 

Returns the SkinData object which can be used to get skin information. 


SkinAPI.saveNewSkinData(String) 

- String: The JSON GameProfile string 
Saves custom skin data (a gameprofile json string) into the database. 
The returned UUID can be used to access the skin data. This method is for advanced users only. There will be some other methods added, which wrap this one, to make it easy to add custom skins. 


SkinAPI.changePlayerSkin(Player, UUID/String) 

- Player: The player who's skin should be changed 
- UUID/String: The skins owner uuid or username 

This method changes a Players skin on all Servers with the SkinAPI Plugin installed & configured properly. 


SkinAPI.getSkinHeadItem(UUID/String) 

- UUID/String: The skins owner uuid or username 

This method returns a player head item with a specified player's skin. 
Due to the method using SkinData objects from the database

Similar projects

Plugin →