Make minigames easilier !
Find a file
2016-08-05 12:30:57 +03:00
games Events ! 2016-08-02 10:25:31 +03:00
resources WIP 2016-08-03 18:44:52 +03:00
src/Ad5001/GameManager Starting winning over bugs :D 2016-08-03 20:02:12 +03:00
.gitattributes 💥🐫 Added .gitattributes & .gitignore files 2016-07-28 09:36:48 +03:00
.gitignore Working on games... 2016-07-31 13:25:48 +03:00
config.yml Starting winning over bugs :D 2016-08-03 20:02:12 +03:00
LICENSE Create LICENSE 2016-07-28 11:10:12 +02:00
plugin.yml Starting 2016-07-28 09:39:24 +03:00
README.md Update README.md 2016-08-05 12:30:57 +03:00

GameManager

Make minigames easilier ! Gamemanager is a plugin that allow minigame writing a lot easilier with his easy api, disigned for per world minigame !
I made this for me at start but feel free to use it to write your own minigame !

How to make a game:

To make a game base, create a new file called "<YOUR_GAME_NAME>.php". Inside it, add a

``

extends Game { public function onGameStart() { // When the game start (enought players) // $this->getServer()->broadcastMessage("Game started on {$this->getLevel()->getName()}"); } public function onGameStop() { // When you stop the game. // $this->getServer()->broadcastMessage("Game stoped on {$this->getLevel()->getName()}"); } public function getMaxPlayers() : int { // Return the max of the players return ; } } `` This is the basic class. Methods that you can add to the class (optionals): | Function name | Arguments | When it is called ? | What does it do by default? | |-----------------------------------|---------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | onJoin | Player $player | When a player join the game. | It check if there are enought players that joined the game to start or kick the player from the game if there are too much players that have joined and game isn't started | | onQuit | Player $player | When a player quit the game | Nothing | | onCommand | \pocketmine\command\CommandSender $sender, \pocketmine\command\Command $cmd, $label, array $args | When a command (registered by the game (see registerCommand in methods)) is used by the console or a player. | Nothing | | onInteract | PlayerInteractEvent $event | When a player touch a block and is in the current game | Nothing | | onChat onPlayerChat | PlayerChatEvent $event | When a player chat and is in the current game | Nothing | | onPlayerCommand | PlayerCommandPreprocessEvent $event | When a player use a command, is in the current game, and the commmand haven't been processed yet | Nothing | | onDeath onPlayerDeath | PlayerDeathEvent $event | When a player die and is in the current game | Nothing | | onDrop onPlayerDropItem | PlayerDropItemEvent $event | When a player drop an item and is in the current game | Nothing | | onPlayerMove onMove | PlayerMoveEvent $event | When a player move in the current game | Nothing | | onPlayerItemConsume onItemConsume | PlayerItemConsumeEvent $event | When a player use an item in the current game | Nothing | | onPlayerItemHeld onItemHeld | PlayerItemHeldEvent $event | When a player switch item in the current game | Nothing | | onDataPacketReceive | DataPacketReceiveEvent $event | When the server receive a packet from a player in the current game | Nothing | | onDataPacketSend | DataPacketSendEvent $event | When the server send a packet to a player in the current game | Nothing | | onServerCommand | ServerCommandEvent $event | When the console or RCon send a command | Nothing | | onBlockBreak onBreak | BlockBreakEvent $event | When a player break a block in the current game. | Nothing | | onBlockPlace onPlace | BlockPlaceEvent $event | When a player place a block in the current game | Nothing | | onEntityDamage | EntityDamageEvent | When an entity get damage in the current game | Nothing | Methods that you can use in the class: | Function name | Arguments | What does it return ? | |-------------------|----------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------:| | getPlugin | None | Instance of the main class (Ad5001\GameManager\Main) | | getLevel | None | Intance of the current game level (pocketmine\level\Level) | | isStarted | None | Boolean if the game is already started (boolean) | | stop | None | Boolean true. Stop the game. | | start | None | Boolean true. Start the game. | | getLogger | None | Instance of the plugin logger (pocketmine\plugin\PluginLogger) | | saveDefaultConfig | None | Save a config that you will be able to use using the next function | | getConfig | None | Instance of the config (be sure of having used saveDefaultConfig)(pocketmine\utils\Config) | | getDataFolder | None | The path of the game data folder (string) | | registerCommand | string $cmd, string $desc, string $usage, array $aliases, string $perm = "gamemanager.command.use" | Null. Register command $cmd with the description $desc, usage $usage, aliases $aliases and permission $perm. |