Placeholders
extends Instanceable
in package
Manages registering and retrieving PAPI placeholders.
Tags
Table of Contents
Properties
- $_all_placeholders : array<string|int, mixed>
- $_db : DB
- $_instances : array<class-string, static>
- Stores instances of classes with their class name as key.
Methods
- __construct() : mixed
- getAllPlaceholders() : array<string|int, mixed>
- Get all registered placeholders.
- getInstance() : static
- Get or make an instance of the class this was called on.
- getLeaderboardData() : array<string|int, mixed>
- Get leaderboard data for a specific leaderboard.
- getLeaderboardPlaceholders() : array<string|int, mixed>
- Get all placeholders which are set to have leaderboards.
- getPlaceholder() : object|null
- Get placeholder data by server id and name of placeholder.
- loadUserPlaceholders() : array<string|int, mixed>
- Load placeholders for a specific user.
- registerPlaceholder() : void
- Create a new row in nl2_placeholders_settings if a row with the "server_id" of $server_id and "name" of $name does not exist (this lets the same placeholder name be used across multiple NamelessMC plugin servers).
Properties
$_all_placeholders
private
array<string|int, mixed>
$_all_placeholders
$_db
private
DB
$_db
$_instances
Stores instances of classes with their class name as key.
private
static array<class-string, static>
$_instances
= []
Methods
__construct()
public
__construct() : mixed
getAllPlaceholders()
Get all registered placeholders.
public
getAllPlaceholders() : array<string|int, mixed>
Return values
array<string|int, mixed> —All placeholders.
getInstance()
Get or make an instance of the class this was called on.
public
final static getInstance() : static
Return values
static —Instance of the class this was called on.
getLeaderboardData()
Get leaderboard data for a specific leaderboard.
public
getLeaderboardData(int $server_id, string $placeholder_name) : array<string|int, mixed>
Parameters
- $server_id : int
-
Server ID to get this placeholder from.
- $placeholder_name : string
-
Unique name of placeholder to get data for.
Return values
array<string|int, mixed> —Array of leaderboard data.
getLeaderboardPlaceholders()
Get all placeholders which are set to have leaderboards.
public
getLeaderboardPlaceholders() : array<string|int, mixed>
Return values
array<string|int, mixed> —Array of placeholders which have leaderboard enabled.
getPlaceholder()
Get placeholder data by server id and name of placeholder.
public
getPlaceholder(int $server_id, string $placeholder_name) : object|null
Parameters
- $server_id : int
-
Server ID to get this placeholder from, if it exists across multiple.
- $placeholder_name : string
-
Name of placeholder - must be hashed with sha1.
Return values
object|null —This placeholder's data, null if not exist.
loadUserPlaceholders()
Load placeholders for a specific user.
public
loadUserPlaceholders(string $uuid) : array<string|int, mixed>
Parameters
- $uuid : string
-
Their valid Minecraft uuid to use for lookup.
Return values
array<string|int, mixed> —Their placeholders.
registerPlaceholder()
Create a new row in nl2_placeholders_settings if a row with the "server_id" of $server_id and "name" of $name does not exist (this lets the same placeholder name be used across multiple NamelessMC plugin servers).
public
registerPlaceholder(int $server_id, string $name) : void
Parameters
- $server_id : int
-
ID of the server this placeholder resides on
- $name : string
-
Name of placeholder