# 自定义事件(Custom events)

默认 `custom-events.yml` 文件如下:

```yaml
custom-events:
   dated-events:
      october-event-example:
         enabled: false
         name: "&6十月鬼魅"
         display-event: true
         times:
            event-start:
               date: 1/10
            event-stop:
               date: 1/11
         commands:
            start:
               - "&a十月鬼魅降临，怪物们变得更加强壮..."
               - "/difficulty hard"
            stop:
               - "/difficulty normal"
   weekly-events:
     safe-sunday-example:
         enabled: false
         name: "&a安全日"
         display-event: true
         day: Sunday
         commands:
            start:
               - "&6现在是 &7安全日 %day%/%month%/%year%. &6是时候休息一下了，死亡并不会有任何损失."
               - "/gamerule keepInventory true"
            stop:
               - "/gamerule keepInventory false"
   daily-events:
      daily-message-example:
         enabled: false
         commands:
            - "&3午夜已过, &f%weekday%, %month_asname% %day%, %year%&3 已开始!"
            - "&3当前季节: &f%season%"
```

在该配置文件中，你可以创建各种自定义事件.

你可以定义事件在特定的日期触发，当事件开始/结束时，你可以自定义向玩家发送消息或执行命令（需要在命令前面加上/）

当然，事件也拥有可用的变量，你可以将其应用至命令或消息中.

%day%（天）、%month%（月）、%month\_asname%（月份名称）、%year%（年）、%weekday%（星期几）、%season%（季节）、%world%（世界）\
同时也支持 [PaPi](https://molasheyu.gitbook.io/realisticseasons-wiki-chinese/cha-jian-jiao-hu/ke-xuan-qian-zhi-softdependencies/placeholderapi) 提供的所有变量

当美国日期格式启用时，事件日期可以使用 ***dd/mm/yyyy*** 或 ***mm/dd/yyyy*** 的格式\
配置中不包含年份将使该事件每年都运行一次（详见 `october-event-example`）\
当在事件配置中只输入一个日期（例如：`date: 5`）时，而没有指定月份或年份时，该事件将在每个月的该日触发

玩家可以通过使用 `/season` 或变量 `%rs_active_events%` 查看活动事件\
创建自定义事件时，你可以选择是否将该事件在玩家 /season 命令中显示\
设置 `"display-event"` 属性为 true，该事件将在玩家使用 /season 命令或使用变量显示.同时你还可以为事件自定义名称，可以添加颜色代码使其更加醒目.
