This repository was archived by the owner on Feb 5, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
For Developers
IceCruelStuff edited this page Jul 10, 2021
·
1 revision
This plugin comes with a script loader API. You can use this to access game functions, like when a player joins, quits, wins, etc. You do not need to enable it, as it loads itself.
Example Code 📖
<?php
use HungerGames\API\Scripts\HungerGamesAPI;
class ExampleScript extends HungerGamesAPI {
public function __construct() {
parent::__construct("Script name", "Versions here", "Author");
}
public function onLoad() {
$this->sendConsoleMessage("Test script loaded!");
}
}Functions
/**
* Creates script config
*
* @param string $name
* @param array $values
* @return Config
*/
public function createConfig(string $name, array $values);
/**
* Gets script config
*
* @return Config
*/
public function getConfig();
/**
* Gets the name of the script
*
* @return string
*/
public function getName();
/**
* Gets the name of the script
*
* @return string
*/
public function getVersion();
/**
* Gets the author of the script
*
* @return string
*/
public function getAuthor();
/**
* Disables script
*/
public function setDisabled();
/**
* Enables script
*/
public function setEnabled();
/**
* Returns whether script is enabled or not
*
* @return bool
*/
public function isEnabled();
/**
* Sends console message
*
* @param string $message
*/
public function sendConsoleMessage(string $message);
/**
* Called when script is loaded
*/
public function onLoad() : void {
// code
}
/**
* Called when player joins game
*
* @param Player $player
* @param HungerGames $game
*/
public function onPlayerJoinGame(Player $player, HungerGames $game) {
// code
}
/**
* Called when player quits game
*
* @param Player $player
* @param HungerGames $game
*/
public function onPlayerQuitGame(Player $player, HungerGames $game) {
// code
}
/**
* Called when players wins a game
*
* @param Player $player
* @param HungerGames $game
*/
public function onPlayerWinGame(Player $player, HungerGames $game) {
// code
}
/**
* Called when players lose a game
*
* @param Player $player
* @param HungerGames $game
*/
public function onPlayerLoseGame(Player $player, HungerGames $game) {
// code
}
/**
* Called when player fails to join full game
*
* @param Player $player
* @param HungerGames $game
*/
public function gameIsFull(Player $player, HungerGames $game) {
// code
}
/**
* Called when player is waiting for players
*
* @param array $players
* @param HungerGames $game
*/
public function whileWaitingForPlayers(array $players, HungerGames $game) {
// code
}
/**
* Called when player is waiting for players
*
* @param array $players
* @param HungerGames $game
*/
public function whileWaitingToStart(array $players, HungerGames $game) {
// code
}
/**
* Called when game starts
*
* @param array $players
* @param HungerGames $game
*/
public function onGameStart(array $players, HungerGames $game) {
// code
}
/**
* Called when death match starts
*
* @param array $players
* @param HungerGames $game
*/
public function onDeathMatchStart(array $players, HungerGames $game) {
// code
}