libRanks is a virion for easy support of multiple rank providers.
Take a look at the wiki to learn more about how virions work.
- PurePerms by #64FF00/poggit-orphanage
- RankSystem by IvanCraft623
libRanks::init()
libRanks::getProvider($providerInformation)
$providerInformation
is an array with the key provider
.
RankProvider::giveRank(Player|string $player, string $rank, ?callable $callback = null)
RankProvider::getRank(Player|string $player, ?callable $callback = null)
RankProvider::removeRank(Player|string $player, string $rank, ?callable $callback = null)
RankProvider::getRankData(string $rank, ?callable $callback = null)
RankProvider::getPlayerPermission(Player|string $player, ?callable $callback = null)
RankProvider::setPlayerPermission(Player|string $player, string $permission, ?callable $callback = null)
RankProvider::unsetPlayerPermission(Player|string $player, string $permission, ?callable $callback = null)
There are several exceptions that can be thrown that you may want to handle in your plugin:
- MissingProviderDependencyException
- UnknownProviderException
config.yml
rank:
provider: ranksystem
ExamplePlugin.php
class ExamplePlugin extends PluginBase{
public $rankProvider;
public function onEnable(): void{
$this->saveDefaultConfig();
libRanks::init();
$this->rankProvider = libRanks::getProvider($this->getConfig()->get("rank"));
}
}
If you usage poggit
to build your repo, you can add it to .poggit.yml
file
projects:
YourPlugin:
libs:
- src: ClickedTran/libRanks/libRanks
version: ^1.0.0
- If you find this lib similar to a certain lib, then you are right, I made this lib based on DaPigGuy's libPiggyEconomy
- Thank for you reading note