WeatherNews
关于天气,你所需要知道的一切。
WeatherNews 是一个小巧简单的模组,用于在聊天栏中显示天气信息。
每当天气发生变化时,它会播报变化后的天气状况、持续时间以及可能的后续天气情况。
安装
安装方法很简单,只需将 jar 文件放入你的 Bukkit 安装目录中的 plugins 文件夹即可。
配置
是的,我已经完成了配置。
目前有两个系统,但只需使用其中一个。
首先以下是默认配置。该配置理解换行符或断行,只要你通过 YAML 正确提供它们即可。
worldwhitelist: false
worlds:
- world_sample
- world_other
showonlogin: true
stepping:
- 1:
minute: 1
- 60:
minute: 10
- 240:
minute: 30
- 360:
minute: 0
hour: 1
- 11520:
minute: 0
hour: 0
day: 2
unprecise: true
minimumpercentage: 0.1
maximumpercentage: 1.0
exponentialmod: 2.0
modulator: 79
maximumtime: 180000
variables:
DAY: "day"
DAY_PLURAL: "days"
HOUR: "hour"
HOUR_PLURAL: "hours"
MINUTE: "minute"
MINUTE_PLURAL: "minutes"
AND: "and"
SUN: "sun"
RAIN: "rain"
THUNDERSTORM: "thunderstorm"
CLEAR: "${header}${today}${mainclear}${nextclear}"
UNCLEAR: "${header}${today}${mainunclear}${nextunclear}"
UNAVAILABLE: "${header}${RED}Weatherunavailable."
BLACKLISTED: "${header}${RED}SorryIcan'tdothis."
header: "${GOLD}[WeatherNews]"
today: |
Today the day ${TIMEDAY}.
nextunclear: |
After that we have something different.
I will notice you then.
nextclear: "Afterthatwehave${NEXT}(${ACCURACY}%)."
mainclear: |
We have ${NOW} for the next ${NEXTNICE}.
mainunclear: |
We have at least ${NOW} for the next ${NEXTNICE} (${ACCURACY}%).
基础设置
如上所示,有许多全大写的单词。这些大写变量由内部系统使用,具有特殊的符号意义。该系统允许你在字符串中使用变量。其构建格式为 "${variablename}"。所有这些变量都位于 "variables" 部分下。其余内容均为普通字符串和 YAML 语法。
预设值
这是一个表格,列出了所有预设变量名称及其在 "variables" 部分中的用法。
| 变量名称 | 用法 |
| DAY | 设置单数“天”的显示名称 |
| DAY_PLURAL | 设置复数“天”的显示名称 |
| HOUR | 设置单数“小时”的显示名称 |
| HOUR_PLURAL | 设置复数“小时”的显示名称 |
| MINUTE | 设置单数“分钟”的显示名称 |
| MINUTE_PLURAL | 设置复数“分钟”的显示名称 |
| AND | 设置“和”的显示名称 |
| SUN | 设置“晴天”的显示名称 |
| RAIN | 设置“雨天”的显示名称 |
| THUNDERSTORM | 设置“雷暴”的显示名称 |
| CLEAR | 当系统知道当前天气(变化)之后的天气时显示 |
| UNCLEAR | 当系统不知道当前天气(变化)之后的天气时显示 |
| BLACKLISTED | 当此世界被列入黑名单或未列入白名单时显示 |
| UNAVAILABLE | 当此世界不提供天气信息时显示 |
| ACCURACY | 替换为 0-100 之间的假精度百分比数值(不含 % 符号) |
| BLACK | 将其后的所有内容设置为黑色 |
| DARK_BLUE | 将其后的所有内容设置为深蓝色 |
| DARK_GREEN | 将其后的所有内容设置为深绿色 |
| DARK_AQUA | 将其后的所有内容设置为深青色(aqua) |
| DARK_RED | 将其后的所有内容设置为深红色 |
| DARK_PURPLE | 将其后的所有内容设置为深紫色 |
| GOLD | 将其后的所有内容设置为金色 |
| GRAY | 将其后的所有内容设置为灰色 |
| DARK_GRAY | 将其后的内容设置为深灰色 |
| BLUE | 将其后的内容设置为蓝色 |
| GREEN | 将其后的内容设置为绿色 |
| AQUA | 将其后的内容设置为青色 |
| RED | 将其后的内容设置为红色 |
| LIGHT_PURPLE | 将其后的内容设置为淡紫色 |
| YELLOW | 将其后的内容设置为黄色 |
| WHITE | 将其后的内容设置为白色 |
禁用登录消息(应请求添加)
使用 showonlogin 并传入 true 或 false,以控制是否显示登录消息。
支持白名单和黑名单
worldwhitelist 可用于切换白名单和黑名单模式。
worlds 包含已列入黑名单或白名单的世界列表。
时间步进
Stepping 允许以步进方式显示时间。如果你希望向玩家隐藏某些信息,这将非常有用。系统将使用小于当前时间的最大条目,直到下一次 Minecraft 游戏内刻的天气变化。例如,24000 代表 1 天。每个条目最多由分钟、小时和天三个部分组成。请注意,如果并非所有三个部分都存在,可能会出现奇怪的情况。在默认配置中不会出现这种情况。对于分钟、小时和天的条目,0 表示不显示;大于 1 的数值表示除以该数 x 再乘以 x(取整数,即自然数)。
虚假精度
首先,以下是用于计算精度的公式以及各变量的含义。
t %天气变化剩余时间。
accuracy=((maximumpercentage-minimumpercentage) * exp(-2*pi*(t/maximumtime)^exponentialmod) + minimumpercentage) * 100
| 变量名称 | 用途 |
| maximumpercentage | t=0 时的绝对最大精度 |
| minimumpercentage | t=maximumtime 时的绝对最小精度 |
| maximumtime | 该值应设置在 180000 左右,因为这是天气变化的绝对最长时间周期 |
| exponentialmod | 控制函数曲线的斜率,应设为 2 且大于 1 |
| modulator | 设置可能的随机化程度。应为质数,且不应过大,尤其不能大于 maximumtime |
| unprecise | 启用虚假信息 |
大多数情况下,只需调整 maximumpercentage 和 minimumpercentage 即可。这一切都是试错的过程,为了你的便利,你可以在 Craftbukkit 运行时更改配置文件。
命令
只有一个命令 "/wnews",可在你希望的时候显示新闻。在控制台运行此命令会将天气新闻广播给所有玩家,即使当前没有可用的天气信息。
WeatherNews
All you want to know about weather.
WeatherNews is a small simple mod that shows weather information in chat.
Every time the weather changes it will pronounce to what and how long and what next if possible.
Install
To install just put the jar in the plugins folder in your bukkit installation.
Configuration
Yes I've done it.
There are two systems for now but only one of them should be used.
First of all here is the default configuration. And the system understands newline or line breaks if you provide them correctly through Yaml.
worldwhitelist: false
worlds:
- world_sample
- world_other
showonlogin: true
stepping:
- 1:
minute: 1
- 60:
minute: 10
- 240:
minute: 30
- 360:
minute: 0
hour: 1
- 11520:
minute: 0
hour: 0
day: 2
unprecise: true
minimumpercentage: 0.1
maximumpercentage: 1.0
exponentialmod: 2.0
modulator: 79
maximumtime: 180000
variables:
DAY: "day"
DAY_PLURAL: "days"
HOUR: "hour"
HOUR_PLURAL: "hours"
MINUTE: "minute"
MINUTE_PLURAL: "minutes"
AND: "and"
SUN: "sun"
RAIN: "rain"
THUNDERSTORM: "thunderstorm"
CLEAR: "${header}${today}${mainclear}${nextclear}"
UNCLEAR: "${header}${today}${mainunclear}${nextunclear}"
UNAVAILABLE: "${header}${RED}Weatherunavailable."
BLACKLISTED: "${header}${RED}SorryIcan'tdothis."
header: "${GOLD}[WeatherNews]"
today: |
Today the day ${TIMEDAY}.
nextunclear: |
After that we have something different.
I will notice you then.
nextclear: "Afterthatwehave${NEXT}(${ACCURACY}%)."
mainclear: |
We have ${NOW} for the next ${NEXTNICE}.
mainunclear: |
We have at least ${NOW} for the next ${NEXTNICE} (${ACCURACY}%).
Basic
As one can see there are a number of uppercase words. Uppercase signs that these variables are used by the internal system and have a special symbolic. The system allows you to use variables in strings. It's build up like this "${variablename}". All these variables lies under the "variables" section. Anything else is just Strings and YAML.
Presets
This is a small table over all preset variable names and their usage in the "variables" section.
| Variable Name | Usage |
| DAY | Set display name of singular day |
| DAY_PLURAL | Set display name of plural days |
| HOUR | Set display name of singular hour |
| HOUR_PLURAL | Set display name of plural hours |
| MINUTE | Set display name of singular minute |
| MINUTE_PLURAL | Set display name of plural minutes |
| AND | Set display name of and |
| SUN | Set display name of sun |
| RAIN | Set display name of rain |
| THUNDERSTORM | Set display name of thunderstorm |
| CLEAR | Will be displayed if the system know which weather will be after the current (change) |
| UNCLEAR | Will be displayed if the system doesn't know which weather will be after the current (change) |
| BLACKLISTED | Will be displayed if this world is blacklisted or not whitelisted |
| UNAVAILABLE | Will be displayed if this world doesn't provide weather information |
| ACCURACY | Get replaced by fake accuracy as percentage from 0-100 without a % |
| BLACK | Sets anything after it black |
| DARK_BLUE | Sets anything after it dark blue |
| DARK_GREEN | Sets anything after it dark green |
| DARK_AQUA | Sets anything after it dark blue (aqua) |
| DARK_RED | Sets anything after it dark red |
| DARK_PURPLE | Sets anything after it dark purple |
| GOLD | Sets anything after it gold |
| GRAY | Sets anything after it gray |
| DARK_GRAY | Sets anything after it dark gray |
| BLUE | Sets anything after it blue |
| GREEN | Sets anything after it green |
| AQUA | Sets anything after it aqua |
| RED | Sets anything after it red |
| LIGHT_PURPLE | Sets anything after it light purple |
| YELLOW | Sets anything after it yellow |
| WHITE | Sets anything after it white |
Disable login message (as requested)
Use showonlogin with true and false to change if a login message should be shown.
Whitelist and blacklist support
worldwhitelist can be used to switch between whitelisting and blacklisting.
worlds contains a list of blacklisted or whitelisted worlds.
Time stepping
Stepping allows time to be displayed in steps. This is useful if you wish to hide information from your players. The system will use the entry which is the least less than the current time to the next weather change in ingame Minecraft ticks. 24000 for example is 1 day. An entry consist of up to 3 entrys of minute, hour and day. Please note that there could be strange things happening if not all three are present. This isn't true if anything is made as in the default configuration. For the minute, hour and day entrys a zero means will not show and anything over 1 means divide thou x and multiply with x in integer (natural numbers).
Fake accuracy
First of all here is the formula used to calculate the accuracy and the meaning of the variables.
t %time left for weather change.
accuracy=((maximumpercentage-minimumpercentage) * exp(-2*pi*(t/maximumtime)^exponentialmod) + minimumpercentage) * 100
| Variable Name | Usage |
| maximumpercentage | The absolute maximum of accuracy at t=0 |
| minimumpercentage | The absolute minimum of accuracy at t=maximumtime |
| maximumtime | This should be somewhere at 180000 because this is the absolute maximum time period for a weather change |
| exponentialmod | This controls the flank of the function should be 2 and bigger than 1 |
| modulator | This sets the amount of possible randomization. Should always be a prime and not no big specially not bigger than maximumtime |
| unprecise | Enables fake news |
Most of the time changing maximumpercentage and minimumpercentage is sufficient. All of this is try and error and for your comfort changing the config will work while running Craftbukkit.
Command
There is only one command "/wnews" to show the news any time you want it. Running this command at the console will broadcast weather news to all players even if there isn't weather available.
评论 0
登录后参与评分
还没有评论,来抢沙发吧