diff --git a/README.md b/README.md index 7266635..4e9893f 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,7 @@ # MinecraftServerAPI ## Overview -MinecraftServerAPI is a powerful and flexible plugin for Minecraft servers, -providing RESTful APIs to interact with the server programmatically. -This project allows server administrators to automate tasks, gather -information, and manage the server more efficiently. +**MinecraftServerAPI** is a powerful and flexible plugin for Minecraft servers, providing RESTful APIs to interact with the server programmatically. This project allows server administrators to automate tasks, gather information, manage the server more efficiently, and even trigger WebHooks for various server events. ## Prerequisites - **Java:** JDK 21 @@ -40,7 +37,7 @@ java -Xmx1024M -Xms1024M -jar paper-1.21.jar nogui ### Accessing the API 6. The API is accessible at `http://localhost:7000/`. You can test it by sending a GET request to the following endpoint: `GET http://localhost:7000/api/v1/ping`. -## Usage +## API Usage ### Example API Requests - **Get all Players:** ```bash @@ -49,8 +46,40 @@ curl -X 'GET' \ -H 'accept: application/json' \ -H 'Authorization: ' ``` -### Configuration + +## WebHook Usage +### Configuring WebHooks +MinecraftServerAPI supports WebHooks, allowing you to trigger HTTP requests to specified URLs when certain events occur on your server (e.g., server start, server stop, plugin enable/disable). + +### Setting up WebHooks +1. **Define WebHooks URLs:** In your `config.yml` located in the `plugins/MinecraftServerAPI`, specify the URLs you want to trigger for different events. +2. **Enable/Disable WebHooks:** You can enable or disable WebHooks for specific events by setting the `enabled` flag to `true` or `false` in the `config.yml` file. Or you can enable/disable the WebHooks with the following commands: +- **Enable a WebHook:** +``` +/webhook enable +``` +- **Disable a WebHook:** +``` +/webhook disable +``` +- **List all WebHooks:** +``` +/webhook list +``` + +### Sending a custom WebHook +MinecraftServerAPI allows you to send custom WebHook events to the URLs specified in your config.yml file. This feature enables you to trigger specific WebHook notifications manually. + +To send a custom WebHook event, use the following command in-game or via the server console: +``` +/webhook send +``` + +### More Information +For a detailed list of all available WebHooks and their default settings, please refer to the [WebHooks Documentation](webhooks.md). + +## Configuration The plugin is configured via a `config.yml` file in the `plugins/MinecraftServerAPI directory. Here, you can set the authentication key and other settings. ## Contributing -Contributions are welcome! Please read the [contributing guidelines](CONTRIBUTING.md) to get started. \ No newline at end of file +Contributions are welcome! Please read the [contributing guidelines](CONTRIBUTING.md) to get started. diff --git a/webhooks.md b/webhooks.md new file mode 100644 index 0000000..7dfaa59 --- /dev/null +++ b/webhooks.md @@ -0,0 +1,55 @@ +# MinecraftServerAPI WebHooks + +## Overview +MinecraftServerAPI allows you to configure various WebHooks that are triggered by specific events on your Minecraft server. These WebHooks can be used to send notifications or execute specific actions when events occur in the game. + +Below is a list of all possible WebHooks supported by MinecraftServerAPI, along with their default activation status. + +## WebHooks List + +| WebHook | Description | Default Status | +|------------------------|----------------------------------------------------------------------------------|----------------| +| `server_start` | Triggered when the server starts. | Enabled | +| `server_stop` | Triggered when the server stops. | Enabled | +| `plugin_disable` | Triggered when a plugin is disabled. | Enabled | +| `plugin_enable` | Triggered when a plugin is enabled. | Enabled | +| `block_break` | Triggered when a block is broken. | Enabled | +| `block_place` | Triggered when a block is placed. | Enabled | +| `block_burn` | Triggered when a block burns. | Enabled | +| `block_redstone` | Triggered when a redstone event occurs. | Enabled | +| `note_play` | Triggered when a note block is played. | Enabled | +| `sign_change` | Triggered when a sign is changed. | Enabled | +| `enchant_item` | Triggered when an item is enchanted. | Enabled | +| `creeper_power` | Triggered when a creeper is struck by lightning and becomes charged. | Enabled | +| `creature_spawn` | Triggered when a creature spawns. | Disabled | +| `entity_death` | Triggered when an entity dies. | Disabled | +| `entity_explode` | Triggered when an entity explodes. | Enabled | +| `entity_shoot_bow` | Triggered when an entity shoots a bow. | Enabled | +| `entity_tame` | Triggered when an entity is tamed. | Enabled | +| `explosion_prime` | Triggered when an explosion is primed. | Enabled | +| `player_death` | Triggered when a player dies. | Enabled | +| `brew` | Triggered when a brewing event occurs. | Enabled | +| `craft_item` | Triggered when an item is crafted. | Disabled | +| `furnace_burn` | Triggered when a furnace starts burning. | Enabled | +| `furnace_smelt` | Triggered when a furnace smelts an item. | Enabled | +| `player_chat` | Triggered when a player sends a chat message. | Disabled | +| `player_login` | Triggered when a player logs in. | Enabled | +| `player_command` | Triggered when a player issues a command. | Disabled | +| `player_gamemode_change` | Triggered when a player's game mode changes. | Enabled | +| `player_item_break` | Triggered when a player breaks an item. | Enabled | +| `player_join` | Triggered when a player joins the server. | Enabled | +| `player_kick` | Triggered when a player is kicked from the server. | Enabled | +| `player_quit` | Triggered when a player quits the server. | Enabled | +| `player_respawn` | Triggered when a player respawns. | Enabled | +| `lightning_strike` | Triggered when a lightning strike occurs. | Enabled | +| `weather_change` | Triggered when the weather changes. | Enabled | +| `thunder_change` | Triggered when thunder starts or stops. | Enabled | +| `world_load` | Triggered when a world is loaded. | Enabled | +| `world_save` | Triggered when a world is saved. | Enabled | +| `world_unload` | Triggered when a world is unloaded. | Enabled | + +## Configuration +You can enable or disable these WebHooks by modifying the `config.yml` file located in the `plugins/MinecraftServerAPI` directory. Each WebHook can be toggled individually, allowing you to control which events trigger notifications. + +For more details on configuring WebHooks, please refer to the [main README](README.md). +