Laith98Dev / FFA

My FFA plugin
GNU General Public License v3.0
10 stars 6 forks source link

Free For All

(FFA, or Free for All) is a survival and fighting game where the game begins and you have to fight to survive.

Dependencies

How to create an arena

the configure

Commands

Command Description Permission
/ffa join <ArenaName:optional> To join a specific or random arena No permission
/ffa quit To leave the arena No permission
/ffa help To see the command list ffa.command.admin
/ffa create To create a new arena ffa.command.admin
/ffa remove To delete a specific arena ffa.command.admin
/ffa setlobby To set the lobby position in the arena ffa.command.admin
/ffa setrespawn To set the respawn position in the arena ffa.command.admin
/ffa reload re-loaded the kits and arenas ffa.command.admin
/ffa list To see the arenas list ffa.command.admin

API

As of v2.0.0, all the API functions have moved to API.

use Laith98Dev\FFA\API;
use Laith98Dev\FFA\utils\ClosureResult;

// add kills to the player
API::addKill($PlayerOrPlayerName, $amount, function (ClosureResult $result){
    if($result->getStatus() == ClosureResult::STATE_SUCCESS){
        echo "Added `$amount` kills to the player successfully." . PHP_EOL;
    } else {
        echo "Failed to add kills to the player; reason: " . $result->getValue() . PHP_EOL;
    }
});

// add deaths to player
API::addDeath($PlayerOrPlayerName, $amount, function (ClosureResult $result){
    if($result->getStatus() == ClosureResult::STATE_SUCCESS){
        echo "Added `$amount` deaths to the player successfully." . PHP_EOL;
    } else {
        echo "Failed to add deaths to the player; reason: " . $result->getValue() . PHP_EOL;
    }
});

// get player kills
API::getKills($PlayerOrPlayerName, function (ClosureResult $result){
    if($result->getStatus() == ClosureResult::STATE_SUCCESS){
        echo "Player kills is " . $result->getValue() . PHP_EOL;
    } else {
        echo "Failed to get player kills; reason: " . $result->getValue() . PHP_EOL;
    }
});

// get player deaths
API::getDeaths($PlayerOrPlayerName, function (ClosureResult $result){
    if($result->getStatus() == ClosureResult::STATE_SUCCESS){
        echo "Player deaths is " . $result->getValue() . PHP_EOL;
    } else {
        echo "Failed to get player deaths; reason: " . $result->getValue() . PHP_EOL;
    }
});

// Check if an arena exists
API::isValidArena($arena_name, function (ClosureResult $result){
    if($result->getValue()){
        echo "Arena exists" . PHP_EOL;
    } else {
        echo "Arena doesn't exist." . PHP_EOL;
    }
});

Other