插件手册:betonquest:通知提示

这是本文档旧的修订版!


通知与提示

A notification is any message that is sent to the player either by BetonQuest itself, one of its plugins, or through a custom notify event.

You can customize what is sent by editing messages.yml. This contains a list of languages and all the notifications used by BetonQuest.

If you want to customize how a notification is sent to the player then you can edit custom.yml to define a NotifyIO to use to for the specific notification. For example you can send a pop up achievement when the journal is updated and a bossbar notification when breaking blocks in a block objective.

A NotifyIO is some method of sending a notification out. BetonQuest provides some by default and third party plugins may register their own.

The following are provided by default:

  • suppress - Does not send anything. Good at turning off some notifications.
  • chat - (Default) Sends the notification as a chat message
  • advancement - Sends a notification via a popup advancement
  • actionbar- Sends a notification via the actionbar
  • bossbar - Sends a notification via a bossbar
  • title - Sends a notification via a title
  • subtitle - Sends a notification via a subtitle

If not set, the default NotifyIO is chat. You can change the default to actionbar by setting the following in config.yml:

  1. default_notify_IO: actionbar

When a notification is generated it will usually have one or more categories assigned to it. These categories are searched for, in order, in all custom.yml files under the section notifications. The first category found will be used to configured the notification. If none were found then a category of default will be search for.

A typical custom.yml file may have the following:

  1. notifications:
  2. # A new journal entry has been added
  3.   new_journal_entry:
  4.   io: advancement
  5.   frame: challenge
  6.   icon: map
  7.  
  8. # All infomation notifications
  9.   info:
  10.   io: chat
  11.   sound: BLOCK_CHEST_CLOSE

When a new journal entry is added, it will send a notification with the following categories:

  • new_journal_entry
  • info

In the above file, it will find new_journal_entry first so will ignore info. This defines the settings for the notification by using the advancement notifyIO with a challenge frame and a map for the icon.

When a new changelog occurs it will send a notification using the following categories:

  • changelog
  • info

In the above file, it will find info which defines that it should be sent via the chat with a specific sound played as well.

Categories are a way of defining settings for a notification. BetonQuest uses many categories itself but you can define your own custom categories and use them through the notify event.

In general a BetonQuest notification will use the same category name for a notification as it uses in messages.yml to define the language and text of the notification. It will also use more general categories to allow you to more broadly define settings and only provide specific settings for some notifications. Remember the categories are searched for in order so the first category will be used in preference to those later in the list.

A list of categories used by BetonQuest are as follows:

Notification Categories
Pullback pullback, error
Command Blocked command_blocked,error
No Permission no_permission,error
Busy busy,error
Changelog changelog,info
Inventory Full inventory_full,error
Language Changed language_changed,info
Mobs to Kill mobs_to_kill,info
Money Given money_given,info
Money Taken money_taken,info
Quest Cancelled quest_cancelled,quest_canceled,info
Items Given items_given,info
New Journal Entry new_journal_entry,info
Items Taken items_taken,info
Blocks to Break blocks_to_break,info
Blocks to Place blocks_to_place,info
Animals to Breed animals_to_breed,info
Mobs to click mobs_to_click,info
Fish to catch fish_to_catch,info
Players to kill players_to_kill,info
Potions to brew potions_to_brew,info
Sheep to shear sheep_to_shear,info

Each NotifyIO has its own set of configuration that can be used. None are required. The built in ones will be described in this section.

Does not output anything. Can be used to stop notifications.

Writes the notification to the players chat.

Option Description
sound Sound to play. If blank, no sound. Can be from here or the name of a sound including from a custom resource.

Shows the notification using an achievement popup.

Option Description
sound Sound to play. If blank, no sound. Can be from here or the name of a sound including from a custom resource.
frame What Achievement frame to use. Can be: challenge, goal, task
icon What icon to show. Must be the vanilla name of an item. Example: minecraft:map

Shows the notification using the actionbar.

Option Description
sound Sound to play. If blank, no sound. Can be from here or the name of a sound including from a custom resource.

Shows the notification using a bossbar.

Option Description
sound Sound to play. If blank, no sound. Can be from here or the name of a sound including from a custom resource.
barFlags
barColor What color to draw the bar. One of the following from here
progress What progress to show the bar. A floating point number between 0.0 (empty) and 1.0 (full)
style What style bar to use. One of the following from here
stay How many ticks to keep the bar on screen. Defaults to 70
countdown If set, will step the progress of the bar by countdown steps. For example, if set to 10, then 10 times during the time it is on the screen the progress will drop by 1/10

Shows the notification using a title.

Option Description
sound Sound to play. If blank, no sound. Can be from here or the name of a sound including from a custom resource.
fadeIn Ticks to fade the title in. Default 10
stay Ticks to keep title on screen. Default 70
fadeOut Ticks to fade the title out. Default 20
subTitle Optional subtitle to show. All _'s are replaced with spaces

Shows the notification using a subtitle.

Option Description
sound Sound to play. If blank, no sound. Can be from here or the name of a sound including from a custom resource.
fadeIn Ticks to fade the title in. Default 10
stay Ticks to keep title on screen. Default 70
fadeOut Ticks to fade the title out. Default 20

Using the notify event a custom notification can be sent. It can make use of any category defined or can override by directly defining the NotifyIO configuration options. Please refer to the Events-List chapter for more details on this event.

Assuming the following custom.yml file:

  1. notifications:
  2. # Test Categories
  3.   test_suppress:
  4.   io: suppress
  5.  
  6.   test_chat:
  7.   io: chat
  8.   sound: BLOCK_CHEST_CLOSE
  9.  
  10.   test_advancement:
  11.   io: advancement
  12.   sound: BLOCK_CHEST_CLOSE
  13.   frame: challenge # challenge|goal|task
  14.   icon: map
  15.  
  16.   test_actionbar:
  17.   io: actionbar
  18.   sound: BLOCK_CHEST_CLOSE
  19.  
  20.   test_bossbar:
  21.   io: bossbar
  22.   sound: BLOCK_CHEST_CLOSE
  23. #barFlags: create_fog,darken_sky,play_boss_music
  24.   barColor: purple # blue|green|pink|purple|red|white
  25.   progress: 0.0 # 0.0 - 1.0
  26.   style: solid # segmented_10|segmented_12|segmented_20|segmented_6|solid
  27.   stay: 70
  28.  
  29.   test_title:
  30.   io: title
  31.   sound: BLOCK_CHEST_CLOSE
  32.   fadeIn: 10
  33.   stay: 70
  34.   fadeOut: 20
  35. #subtitle:
  36.  
  37.   test_subtitle:
  38.   io: subtitle
  39.   sound: BLOCK_CHEST_CLOSE
  40.   fadeIn: 10
  41.   stay: 70
  42.   fadeOut: 20

And the following events run in order:

  1. # Test of Category
  2. notify_cat_suppress: notify Test Notify category:test_suppress
  3. notify_cat_chat: notify Test Notify category:test_chat
  4. notify_cat_advancement: notify Test Notify category:test_advancement
  5. notify_cat_actionbar: notify Test Notify category:test_actionbar
  6. notify_cat_bossbar: notify Test Notify category:test_bossbar
  7. notify_cat_title: notify Test Notify category:test_title
  8. notify_cat_subtitle: notify Test Notify category:test_subtitle
  9.  
  10. # Test of Category + some custom
  11. notify_catcus_title_sub: notify Test Notify category:test_title subtitle:"My SubTitle"
  12. notify_catcus_bossbar_red: notify Test Notify category:test_bossbar barColor:red sound:ENTITY_BAT_TAKEOFF style:segmented_10 progress:0.3
  13.  
  14. # Test of totally custom, needs an io
  15. notify_cus_bossbar_green: notify Test Notify io:bossbar barColor:green stay:120
  16. notify_cus_advancement: notify Test Notify io:advancement icon:hopper frame:goal

A video can be found here

Assuming the following events run in order:

  1. notify_cus_bossbar_countdown1: notify Countdown Test Bossbar io:bossbar stay:120 countdown:10 progress:1
  2. notify_cus_bossbar_countdown2: notify Countdown Test Bossbar io:bossbar stay:120 countdown:120 progress:1

A video can be found here

If you don't want to see the changelog notifications then you can use the suppress notifyio for the category changelog.

Example custom.yml

  1. notifications:
  2.   changelog:
  3.   io: suppress
  • 插件手册/betonquest/通知提示.1563641211.txt.gz
  • 最后更改: 2019/07/21 00:46
  • 小小k酱