Skip to content
This repository was archived by the owner on May 30, 2021. It is now read-only.

Documantation

supercrafter333 edited this page Dec 24, 2020 · 7 revisions

API Documantation

Uses:

use supercrafter333\BlockAPI\API\BlockAPI

API:

Managers:

  • BlockManager: BlockAPI::getBlockManager($player) With the BlockManager you can use functions to Block a Player!
  • UnblockManager: BlockAPI::getUnblockManager($playernameasstring) With the UnblockManager you can use functions to Unblock a Player! The playername must be a string!
  • ConfigurationManager: (unimportant) BlockAPI::getUnblockManager($playernameasstring) With the Configuration manager you can change anything in the Configuration! This Manager is unimportant!

BlockManager:

Please set BlockAPI::getBlockManager($player) in front of all code lines here!

  • Block a player:

setBlocker($blockernameasstring) Set the name of the Blocker! The name of the Blocker must be a string!

setBlockReason($reasonasstring) Set the Block/Ban reason! The blockreason must be a string!

setBlockTime($amountasstring, $dateformatasstring) Set the Block/Ban reason! The blockreason must be a string!

getBlockTime() Get the Time to Unblock!

getBlocker() Get the name of the Blocker!

getReason() Get the reasonm of the Block!

checkBlockStatus($player) Check if the player is blocked or not blocked! Not Blocked: true Blocked: false

Block Example:

$amount = $args[];
$reason = $args[];
BlockAPI::getBlockManager($player)->setBlockTime($amount, "minutes");
BlockAPI::getBlockManager($player)->setBlockReason($reason);
BlockAPI::getBlockManager($player)->setBlocker($player);
$blockmgr = BlockAPI::getBlockManager($player);
$player->close("", "You was blocker\nBlocker:" . $blockmgr->getBlocker() . "\nReason:" . $blockmgr->getReason() . "\nBlocket to:" . $blockmgr->getBlockTime());

CheckBlockStatus Example:

if(BlockAPI::getBlockManager($player)->checkBlockStatus($player) == true) {
    BlockAPI::getUnblockManager($playernameasstring)->unBlock();
}

UnblockManager:

Please set BlockAPI::getUnblockManager($playernameasstring) in front of all code lines here!

checkBlockStatus($playernameasstring) Check if the player is blocked or not blocked! Not Blocked: true Blocked: false

unBlock($playernameasstring) Unblock a player! Was unblocked: true Was not blocked: false

Unblock Example:

if(BlockAPI::getUnblockManager($playernameasstring)->checkBlockStatus($playernameasstring) == true) {
    BlockAPI::getUnblockManager($playernameasstring)->unBlock();
}

Do you have Questions? Contact me on Discord: supercrafter333#4062

Clone this wiki locally