On this page, I will show you, how to make your very own serverselector.
Important: This example will use the new syntax of the open, click and view_requirements. (DeluxeMenus 1.10.0+)
Older versions of DeluxeMenus won't work with that new setup!
First of all: If you want to show, how many players are on a server on your BungeeCord, you need to download the pinger-placeholder with PlaceholderAPI like this:
Code (Text):/papi ecloud download pinger
Before I explain, what everything does, I will show you the menu first:
Code (YAML):menu_title: '&1Server'
type: string equals ignorecase
- '&7Online: &a%pinger_players_vanilla%'
- '&7Description: &bOnly vanilla!'
- '&aclick to join!'
- '[message] &7Connecting to server &aVanilla&7...'
- '[connect] vanilla'
display_name: '&7Vanilla &4[Offline]'
- '&cThis server is currently offline'
- '&cPlease contact a staff-member,'
- '&cif this problem still exists after some'
- '&aClick to refresh!'
- '&7Online: %server_online%'
- '&7Description: &bThe best minigames EVER!'
- '&cYou are already on this server'
- '[message] &cYou are already on this server!'
We are on the server games in this example.
If we now want, that the player should be able to connect to the server vanilla, we need to setup the right functions in the section "left_click_commands:"
In my example, we will first close the menu with [close], send a message to the viewer of the menu with [message] and finally connect to the server with [connect].
You can use the name of the server, that you set in the config of your BungeeCord.
To show, how many players are on the server vanilla, we will use the placeholder %pinger_player_<server>%.
You can use the name you set in the config of the BungeeCord, or just use the IP with the port.
Please keep in mind, that the updateinterval of the pinger-placeholders are different from the other placeholder.
To change the updateinterval, go to the PlaceholderAPI-folder and change the interval (default is 30) in the config.
But what if the server is currently offline?
In this case, we can use a second item with a lower priority, that will be displayed, if the view_requirement of the first item aren't true.
So now we can show a different item, if the server is offline. But we have still one problem. DeluxeMenu doesn't update the item by itself, if the view_requirement have changed (from Offline to Online).
We can fix that, by let the player execute [refresh], if he clicks on the item.
The second item is easier. Because we are already connected, we just need to send a message.
And we can show the amount of players on the server with the %server_online% placeholder (Needs the server-expansion from PlaceholderAPI)