Skip to content

Ads ​

Module info
Configurationads.yml
ManagerAdManager
Support1.8+
Free versionâś”
Proxy-configurable❌

Ads are clickable text messages displayed in the player's chat. This module prints them in configurable time intervals. They can be used to show useful information and reminders or, more generally, advertisements:

Example ad

Default configuration (ads.yml in 1.8+)
yaml
ads:
  settings:
    enabled: true
    random-order: true
    prefix:
      enabled: false
      format: '&8[&5&lAds&8] &r'
    sound:
      enabled: true
      id: UI_BUTTON_CLICK
      volume: 1.0
      pitch: 1.0
    sending-timeout: 5m
    placeholder-types: []
  discord:
    texts:
      english: |-
        &e&lJoin our Discord server:
        &b&nstay updated about the new features!

        &7&oClick this message to receive the invitation.
      italian: |-
        &e&lEntra nel nostro Discord:
        &b&nrimanete aggiornati sulle novitĂ !

        &7&oClicca questo messaggio per ricevere l'invito.
    hovers:
      english: '&9[Click here to open the link]'
      italian: '&9[Clicca qui per aprire il link]'
    click:
      action: OPEN_URL
      values:
        english: https://discord.gg/eSnAPhvMTG
        italian: https://discord.gg/eSnAPhvMTG
  store:
    texts:
      english: |-
        &e&lVisit our Store:
        &b&nbuy perks and cosmetics and support the server!

        &7&oClick this message to get the link.
      italian: |-
        &e&lVisita il nostro Store:
        &b&ncompra benefici e cosmetici e supporta il server!

        &7&oClicca questo messaggio per ricevere il link.
    hovers:
      english: '&9[Click here to open the link]'
      italian: '&9[Clicca qui per aprire il link]'
    click:
      action: OPEN_URL
      values:
        english: https://megaproserver.com/store
        italian: https://megaproserver.com/store
    disabled-ranks:
    - staff
    - vip

Setup ​

The following snippet of code represents and explains the ads' configuration.

yaml
ads: 
  settings:
    enabled: true # whether to enable or disable this module
    random-order: true # whether to use a random order when sending the ads
    prefix:
      enabled: false # whether to add a prefix at the beginning of every ad's line
      format: '&8[&5&lAds&8] &r' # the prefix to add, if enabled
    sound:
      enabled: true # whether to play a sound when sending the ads
      id: UI_BUTTON_CLICK # the sound that ads will produce
      volume: 1.0 # the sound's volume [0 - 1]
      pitch: 1.0 # the sound's pitch [0 - 2]
    sending-timeout: 5m # timeout between sendings
    placeholder-types: [] # read below
  # ...default ads...

Refer to the Getting started/Syntax/Recognized IDs page to find out the sound IDs specifiable at sound.id.

Refer to the Getting started/Syntax/Timestamps page to find out the timestamp specifiable at sending-timeout.

Just like for the other modules, you have to specify which placeholder types you wish to use. Refer to the Modules/Placeholders page for more info.

Adding ads ​

To add a new ad, you just need to specify its ID and its texts. Note that they support multi line strings. The ID has to respect the following pattern: ^[a-zA-Z0-9-_]{2,36}$.

yaml
  # ...ads' settings...
  # ...default ads...
  new-ad: # ID - required
    texts: # required
      english: |- # main language's translation - required
        &e&lVisit our website:
        &b&nstay updated about the new features!
        
        &7&oClick this message to get the link.
      italian: |- # other language's translation - optional
        &e&lVisita il nostro sito web:
        &b&nrimanete aggiornati sulle novitĂ !
        
        &7&oClicca questo messaggio per ricevere il link.
    hovers: # optional
      english: '&9[Click here to open the link]'
      italian: '&9[Clicca qui per aprire il link]'
    click: # optional
      action: OPEN_URL # read below
      values:
        english: https://megaproserver.com
        italian: https://megaproserver.com
    disabled-ranks: # ranks that will not receive this ad - optional
    - staff

So, in summary, there are 4 configurable sections:

1. texts ​

This section represents the displayed text in chat; it is required and has to contain at least the translation for the main language.

2. hovers ​

This section represents the text displayed when hovering the ad; it is optional and nothing will be displayed if it is not specified.

3. click ​

This section controls what happens when a player click the ad; it is optional and nothing will happen if it is not specified.

The plugin supports 4 click actions specifiable at click.action:

  • COPY_TEXT - copies text to the player's clipboard; only available on 1.15.2+ servers
  • OPEN_URL - opens the URL in the player's browser
  • SEND_MESSAGE - makes the player send a message
  • SUGGEST_TEXT - suggests text in the player's chat

You can then specify a different value of the click action for every language at click.values

4. disabled-ranks ​

This is just a list that contains IDs of ranks that should not receive the ad when automatically sent by this module. Useful, for example, not to show ads to VIPs.

Remember to perform /chatplugin reload after applying changes to configuration files.

/ad command ​

You can easily test the ad you have just configured by typing /ad send <your username> new-ad.

Refer to the Getting started/Commands/Misc page for more info.

ChatPlugin - A complete yet lightweight plugin which handles just too many features!
© 2024  Remigio07
This wiki is currently updated to version 1.9.4.
Please report any errors, mistakes and misspellings as described at Home/Reporting issues.

Remigio07.me - built w/ VitePress