8000 GitHub - Sorax5/ProfilesManager at v2.1.1
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Sorax5/ProfilesManager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


ProfilsManagerCore

License CodeFactor

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.

BStats

Official Addon

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.

ProfilsPlayerStatistics (WORK WITH V2.0)

https://github.com/Sorax5/ProfilsPlayerStatistics

ProfilsVaultIntegration (DO NOT WORK YET)

https://github.com/Sorax5/ProfilsVaultIntegration

API

Work in progress

Maven Artifact Package

<dependency>
  <groupId>fr.soraxdubbing</groupId>
  <artifactId>profilsmanagercore</artifactId>
  <version>1.0-SNAPSHOT</version>
</dependency>

Exemple

Create an Addon

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);
    }
}

Register your Addon

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);
}

ItemManager

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)

JavaDocs

Work in progress

Used By

Authors

Artwork

the logo was made by game-icons.net under the CC BY 3.0 license.

0