serverselector menu - Historical

Applied By Andre_601: Sep 3, 2017 at 6:00 PM

serverselector menu
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
Next important thing is the command. If you want to use the command /server (like in my example), you need to add it in the section "disabled_commands:" in your BungeeCord-config, or else the command won't work.

Before I explain, what everything does, I will show you the menu first:
Code (YAML):
menu_title: '&1Server'
open_command
: server
size
: 9
update_interval
: 1
items
:
  'vanilla_server'
:
    material
: GRASS
    slot
: 2
    priotity
: 1
    view_requirement
:
      requirements
:
        vanila_online
:
          type
: string equals ignorecase
          input
: '%pinger_online_vanilla%'
          output
: '&aOnline'
    display_name
: '&7Vanilla'
    lore
:
    - '&7Online
: &a%pinger_players_vanilla%'
    - '&7Description
: &bOnly vanilla!'
    - ''
    - '&aclick to join!'
    left_click_commands
:
    - '[close]'
    - '[message] &7Connecting to server &aVanilla&7...'
    - '[connect] vanilla'
    update
: true
  'vanilla_offline'
:
    material
: BARRIER
    slot
: 2
    priority
: 2
    display_name
: '&7Vanilla &4[Offline]'
    lore
:
    - '&cThis server is currently offline'
    - '&cPlease contact a staff-member,'
    - '&cif this problem still exist after some'
    - '&ctime'
    - ''
    - '&aClick to refresh!'
    left_click_commands
:
    - '[refresh]'
    update
: true
  'games_server'
:
    material
: IRON_SWORD
    slot
: 6
    display_name
: '&9Games'
    lore
:
    - '&7Online
: %server_online%'
    - '&7Description
: &bThe best minigames EVER!'
    - ''
    - '&cYou are already on this server'
    left_click_commands
:
    - '[message] &cYou are already on this server!'
    update
: true
In my example, we have 2 different servers on one BungeeCord: vanilla and games.
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)