ProfilsManagerCore is a Bukkit/Spigot/Paper minecraft plugin allowing players to have multiple game profiles on the same server, goodbye second account and welcome to Profiles! Only this plugin is useless it's an API so it requires addons to be useful.
The recent refactoring of the project has led to the incompatibility of the addons with version 2.0. I plan to update them soon, it will be done when this message is removed from the README.
https://github.com/Sorax5/ProfilsPlayerStatistics
https://github.com/Sorax5/ProfilsVaultIntegration
Work in progress
<dependency>
<groupId>fr.soraxdubbing</groupId>
<artifactId>profilsmanagercore</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
The addons allow you to save information according to the profiles, you have two functions that allow you to save and load the information of the addon if needed.
public class PlayerStats extends AddonData {
// Attribute you want to seperate by Profiles
private int level;
private int life;
private Gamemode gamemode;
// Constructor of the Class
public PlayerStats(Player player) {
super("PlayerStat"); // Addon name
this.level = player.getLevel();
this.life = player.getMaxLife();
this.gamemode = player.getGamemode();
}
// use in /profils command to give informations about your addon
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("§a§lPlayerStat:§r").append("\n");
sb.append("§2level:§r ").append(this.level).append("\n");
sb.append("§2life:§r ").append(this.life).append("\n");
sb.append("§2gamemode:§r ").append(this.gamemode).append("\n");
return sb.toString();
}
// call when The actual profil is save or juste update
@Override
public void updateAddonData(Player player, JavaPlugin javaPlugin) {
this.level = player.getLevel();
this.life = player.getMaxLife();
this.gamemode = player.getGamemode();
}
// call when the profils is loaded by the player
@Override
public void loadAddonData(Player player, JavaPlugin javaPlugin) {
player.setMaxLife(this.life);
player.setLevel(this.level);
player.setGamemode(this.gamemode);
}
}
You must specify to the API the class that implements the abstract class AddonData, otherwise the information of your addon will not be saved because the API does not recognize your addon.
@Override
public void onLoad(){
// PlayerStats.class is your AddonData
UsersManager.getInstance().registerClass(PlayerStats.class);
}
This class allows you to transform items into String for serialization, the methods are static and I used them originally to save the inventories of the players, so I let you these methods at your disposal.(work with modded item)
public static String ItemStackToStringByte(ItemStack itemStack)
public static ItemStack StringByteToItemStack(String encodedObject)
public static List<String> ItemStackToStringList(ItemStack[] itemStack)
public static ItemStack[] StringListToItemStack(List<String> encodedObject)
Work in progress
the logo was made by game-icons.net under the CC BY 3.0 license.