BungeePteroPower
BungeePteroPower is a plugin that can automatically start/stop servers based on the number of players.
Install / Use
/learn @Kamesuta/BungeePteroPowerREADME
BungeePteroPower
BungeePteroPower is a plugin that can automatically start/stop servers based on the number of players.
It can start and stop servers on the Pterodactyl panel when players join or leave the Bungeecord proxy server.
This helps to save server resources and manage servers more efficiently.
https://github.com/Kamesuta/BungeePteroPower/assets/16362824/019fdfc5-f0fc-4532-89f3-3342b5812593
Key Features
- Automatically stops servers using Pterodactyl's API when there are no players on the server for a certain period of time.
- The time until shutdown can be configured for each server.
- Automatically starts servers using Pterodactyl's API when players join the server.
- Permissions settings allow for specifying players who can manually start servers and players for whom automatic startup is enabled upon joining.
- You can reset the server from a backup when it shuts down.
- This is useful when creating mini-game servers that reset once played.
Download
- You can download it from Spigot or GitHub Releases.
Requirements
- Java 11 or higher
- uses
java.net.http.HttpClientin Java 11 for REST API communication with Pterodactyl.
- uses
Getting Started
- Obtain an API key in the Pterodactyl panel.
- The client API key for Pterodactyl can be found in the "API Credentials" tab on the account page.
- Add the plugin to the BungeeCord server and start it.
- Configure the Required Settings in the generated
plugins/BungeePteroPower/config.ymlfile.# Pterodactyl configuration pterodactyl: # The URL of your pterodactyl panel # If you use Cloudflare Tunnel, you need to allow the ip in the bypass setting. url: "https://panel.example.com" # The client api key of your pterodactyl panel. It starts with "ptlc_". # You can find the client api key in the "API Credentials" tab of the "Account" page. apiKey: "ptlc_000000000000000000000000000000000000000000" # Per server configuration servers: pvp: # Pterodactyl server ID # You can find the Pterodactyl server ID in the URL of the server page. # For example, if the URL is https://panel.example.com/server/1234abcd, the server ID is 1234abcd. id: 1234abcd # The time in seconds to stop the server after the last player leaves. # If you don't want to stop the server automatically, set it to -1. # If you set it to 0, the server will be stopped immediately after the last player leaves. timeout: 30 - Reload the config with the
/ptero reloadcommand. - Configure the Permission Settings.
(You MUST configure permission to use this plugin, otherwise the player will not be able to do anything!)
You can use either of the following methods.- Use a permission plugin like LuckPerms.
- For LuckPerms, use the following commands to set permissions:
※# The player can start all servers /lp user <player_name> permission set ptero.autostart.* # The player can start specific server /lp user <player_name> permission set ptero.autostart.<server_name> # All players can start all servers /lp group default permission set ptero.autostart.*<player_name>refers to the player's name,<server_name>refers to the server name specified in BungeeCord'sconfig.yml.
- For LuckPerms, use the following commands to set permissions:
- Use built-in permission settings.
- Open
config.yml. - Add the following settings to the
config.ymlfile.
※permissions: default: # All players can start all server - ptero.autostart.* # All players can start specific server - ptero.autostart.<server_name><server_name>refers to the server name specified in BungeeCord'sconfig.yml. - Restart the BungeeCord server.
- Open
- Use a permission plugin like LuckPerms.
Usage
Automatic Startup
- Servers will automatically start when players attempt to join each server on BungeeCord.
- This feature is available only to players with the
ptero.autostart.<server_name>permission.
- This feature is available only to players with the
Manual Start/Stop
- Use the
/ptero start <server_name>command to manually start a server.- This command is available only to players with the
ptero.start.<server_name>permission.
- This command is available only to players with the
- Use the
/ptero stop <server_name>command to manually stop a server.- This command is available only to players with the
ptero.stop.<server_name>permission.
- This command is available only to players with the
※ <server_name> refers to the server name specified in BungeeCord's config.yml.
Reloading config.yml/Language files
- Use
/ptero reloadto reload the config.yml and language files.
Configuration
The config.yml file includes the following settings, but not all items need to be configured.
Required Settings
pterodactyl: Refer to Using Panels Other Than Pterodactyl > Panel Settings.servers: Configure settings for each server. Set the server ID and the time until automatic shutdown.id: Set the server ID on Pterodactyl.- Server IDs on Pterodactyl can be found in the URL of the server page.
- For example, if the URL is https://panel.example.com/server/1234abcd, the server ID is 1234abcd.
Optional Settings
version: Set the version of the plugin.- When updating the plugin, a warning will be displayed if this value does not match the plugin version.
- A
config.new.ymlfile will be generated, and manual migration of settings using a merge tool is required. - After migration, please change this value to the new version.
checkUpdate: Set whether to check for plugin updates. The default istrue.language: Set the language to be used. The default is English (en).- Refer to the comments in the config file for supported languages.
startTimeout: After starting a server with this plugin, it will stop the server if there are no players for a certain period. The unit is seconds.- After starting, the server will stop after the
startTimeoutplus the server's timeout duration. - Setting it to 1 keeps the server running until players join and leave.
- After starting, the server will stop after the
useSynchronousPing: This setting determines whether to perform synchronous pinging to the server during login. (Experimental feature)- When enabled, pinging the server during login will happen synchronously rather than asynchronously.
- This allows displaying BungeePteroPower messages (
join_autostart_loginin messages.yml) instead of the "Could not connect to a default or fallback server" message upon login. - The default value is
false. Enabling this can be useful if you want to set servers (such as lobby servers) to a suspended state in BungeePteroPower immediately after login.
serverStatusCheckMethod: Choose the method to check if a managed server is offline.- "bungeecord" method: Use BungeeCord ping to check the server status
- "panel" method: Use the panel API to check the server status
customHeaders: Custom HTTP headers- Can be used for purposes such as authentication headers or reverse proxies.
- Specify in the format
Key: Value.
startupJoin: After server startup, it is used to automatically join players to the server and check the server's status.timeout: Set the maximum waiting time for players to join after server startup.- Set this value to the maximum time it takes for the server to start.
- Setting it to 0 disables this feature, and players will not automatically join after startup.
joinDelay: Once the server is pingable, wait the specified amount of seconds before sending the player to the server- This is useful to wait for plugins like Luckperms to fully load
- If you set it to 0, the player will be connected as soon as the server is pingable
pingInterval: Set the interval for checking the server's status.
restoreOnStop: Configure settings for the feature to reset the server from a backup when it is stopped.timeout: Set the maximum waiting time after sending the stop signal for the server to stop. (The restore will be performed after the server stops)pingInterval: Set the interval for checking if the server is offline after sendi
