Skip to content
George V edited this page Feb 6, 2023 · 3 revisions

API

The class to use SkinOverlay user methods is UserData and Utilities

Disclaimer:

These methods can be changed at any time without notice. You can view the UserData file for any changes or return to this page

Usage:

Initialize UserData

//example
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
    //Initialize the UserData with PlayerObject
	PlayerObject playerObject = new PlayerObjectBukkit(event.getPlayer());
    UserData data = UserData.getUser(playerObject);
	
	//Initialize the UserData with UUID
	UserData userData = UserData.getUser(event.getPlayer().getUniqueID);
}

Set

//example
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
    //Initialize the UserData with PlayerObject
	PlayerObject playerObject = new PlayerObjectBukkit(event.getPlayer());
    UserData data = UserData.getUser(playerObject);
	
	//Initialize the UserData with UUID
	UserData userData = UserData.getUser(event.getPlayer().getUniqueID);
	
	//Set the default skin property
	//This is the skin cache in order to not send requests for the default skin to the mojang servers.
	userData.setDefaultSkinProperty(Property);
	
	//Set the skin property
	//The new skin property for the player
	userData.setProperty(Property);
	
	//Set the skin name
	//Set the name of the current skin (eg default or alley)
	userData.setSkinName(String);
    
}

Get

//example
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
    //Initialize the UserData with PlayerObject
	PlayerObject playerObject = new PlayerObjectBukkit(event.getPlayer());
    UserData data = UserData.getUser(playerObject);
	
	//Initialize the UserData with UUID
	UserData userData = UserData.getUser(event.getPlayer().getUniqueID);
	
    //Get the default skin property
	Property property = userData.getDefaultSkinProperty();
	
	//Set skin property
	//The new skin property for the player
	Property property = userData.getProperty();
	
	//Set skin name
	//Set the name of the current skin (eg default or alley)
	String skinName = userData.getSkinName();
}

Player database

//example
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
    //Initialize the UserData with PlayerObject
	PlayerObject playerObject = new PlayerObjectBukkit(event.getPlayer());
    UserData data = UserData.getUser(playerObject);
	
	//Initialize the UserData with UUID
	UserData userData = UserData.getUser(event.getPlayer().getUniqueID);
    
    //Setup user. this method is called by default everytime the user joins
    data.setupUser();
    
    //Reset user
    data.reset();
    
    //Check if player exists (return boolean)
    if(data.playerExist()) {
    }
}

Update player skin.

import com.georgev22.skinoverlay.utilities.Utilities;

//example
public void updateSkin(PlayerObject playerObject) {
    Utilities.updateSkin(playerObject, true /* if you want other to see the change */, false /* true if it is a skin reset */)
}
Clone this wiki locally