skh6075 / libMiniGame

[Plugin][lib] This plugin is an API that makes it easy to implement MiniGame.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MiniGameAPI

Tools that make it easy for developers to create MiniGames.

PHP Version: 8.0.9

Usage

Write the code below in the onEnable method of the minigame plugin you are creating.

public function onEnable() : void{
    if(!MiniGameHandler::isRegistered()){
        MiniGameHandler::register($this);
    }
}


Team overrides are as follows:

final class ColorMatchRoom extends MiniGameRoom{
	
	public function __construct(
		string $name,
		int $minPlayerCount, 
		int $maxPlayerCount, 
		Plugin $plugin, 
		int $gamemode = self::GAMEMODE_DEFAULT, 
		array $players = [], 
		?MiniGameTeamManager $teamManager = null){
		parent::__construct($name, $minPlayerCount, $maxPlayerCount, $plugin, $gamemode, $players, $teamManager);
	}
}


This plugin supports team features. If you create a game room without using the team feature.

final class RedTeam extends MiniGameTeam{}
final class BlueTeam extends MiniGameteam{}

$teamManager = new MiniGameTeamManager(
    new RedTeam("RED", []),
    new BlueTeam("BLUE", [])
);


This library manages the player's inventory.

$invManager = PlayerInventoryManager::getInstance();

You can save or load the player's inventory.

public function onPlayerJoinEvent(PlayerJoinEvent $event) : void{
    $invManager = PlayerInventoryManager::getInstance();
    $invManager->send($event->getPlayer());
}
public function onPlayerQuitEvent(PlayerQuitEvent $event) : void{
    $invManager = PlayerInventoryManager::getInstance();
    $invManager->save($event->getPlayer());
}

About

[Plugin][lib] This plugin is an API that makes it easy to implement MiniGame.

License:MIT License


Languages

Language:PHP 100.0%