MultiDH 是什么?
MultiDH 是插件 DecentHolograms 的一个附加组件。
它允许你创建现有全息图的副本,每当通过 /dh reload 更新原始全息图时,这些副本也会同步更新(你也可以使用 /multidh reload 强制从 MultiDH 端进行重载)。
这让你能够轻松地更新显示相同信息的多个全息图,而无需逐个编辑 n 个独立的全息图。
它是如何工作的?
要使用 MultiDH,首先打开位于 plugins/MultiDH/ 目录下的 config.yml 文件。在该文件中,你会找到两个设置项:holograms 和 initDelay。
对于我们的目的而言,只有 holograms(全息图)相关。要添加现有全息图的副本,请添加一个类似如下的新条目:
holograms:
- name: 'myhologram'
locations:
- 'world:0.500:100.0:0.500'
name 是 DecentHolograms 中使用的原始全息图的名称,而 locations 是一个位置列表,其格式与 DecentHolograms 所使用的格式一致(<world>:<x>:<y>:<z>)。
设置好全息图及其副本的位置后,保存文件并运行 /multidh reload。
此时,指定位置应会出现与原始内容相同的全息图。对原始全息图所做的任何更改,在运行 /dh reload 后将立即反映到副本上。
注意:
- 全息图副本是非持久化的,这意味着它们不会生成文件,且在服务器重启后若无插件支持也不会重新出现。
- 全息图副本的名称格式为
<name>_multidh_<index>(例如 example_multidh_0)。虽然不太可能发生,但请确保服务器上其他全息图不与该名称模式冲突。
已知问题与限制
本插件存在一些已知问题和限制,需要通过特定方式规避。
重载时全息图副本消失并重新出现
由于 DecentHolograms 中存在一个导致全息图被复制而非更新的 Bug/故障,MultiDH 会删除其创建的所有先前全息图,并重新创建它们以更新数据。
插件报告启动时无法加载全息图
注意:
仅当您使用 DecentHolograms 2.9.5 或更早版本,和/或 MultiDH 0.1.0 时才会出现此问题。
这两个插件的较新版本均提供并支持全息图(加载/卸载)事件,从而无需使用下文提到的变通方法。
由于缺乏与全息图相关的事件,MultiDH 无法获知 DecentHolograms 何时加载了全息图。
此外,DecentHolograms 会在服务器完成启动后才加载其全息图。这会导致竞态条件:MultiDH 尝试加载全息图时,DecentHolograms 甚至尚未开始加载它们。
为避免此问题,MultiDH 有意在服务器加载完成后延迟几秒再启动。默认延迟为 3 秒,且无法设置得更低。具体需要根据 DecentHolograms 中全息图的总数以及服务器的整体性能,来调整 initDelay 设置以适当增加该延迟时间。
What is MultiDH?
MultiDH is an addon for the plugin DecentHolograms.
It allows you to create copies of a pre-existing hologram that get updated whenever you update the original hologram via /dh reload (You may also do /multidh reload to force a reload on MultiDH's end).
This should allow you an easy way to update multiple holograms displaying the same info, without having to edit n individual ones.
How does it work?
To use MultiDH, you first open the config.yml located within plugins/MultiDH/. In this file should you find two settings: holograms and initDelay.
For our purpose is only holograms relevant. To add copies of an existing hologram, add a new entry that looks similar to the following:
holograms:
- name: 'myhologram'
locations:
- 'world:0.500:100.0:0.500'
name is the name of the original Hologram used in DecentHolograms and locations would be a list of locations matching the format DecentHolograms uses (<world>:<x>:<y>:<z>).
After you've set the hologram(s) and the locations of their copies, save the file and run /multidh reload.
You should now have holograms appear at the specified locations displaying the same content as the original. Any changes made to the original will be reflected on the copies as soon as /dh reload is executed.
Notes:
- The Hologram copies are non-persistent, meaning they do not create a file and won't reappear after a server restart without the plugin.
- The Hologram copies use the name format
<name>_multidh_<index> (i.e. example_multidh_0). While unlikely, make sure no other holograms on the server share this name pattern.
Known issues and limitations
There are a few known issues and limitations that the plugin has to work its way around.
Hologram Copies disappear and reappear on reload
Due to a bug/glitch in DecentHolograms that causes holograms to be duplicated rather than updated does MultiDH delete all previous holograms it made and re-creates them to update their data.
Plugin reports it can't load holograms at startup
NOTE:
This is only an issue if you're using DecentHolograms 2.9.5 or older, and/or MultiDH 0.1.0.
Newer versions of both provide and support Events for Hologram (un)loading, removing the need of the below mentioned workaround.
Due to a lack of a Hologram-related event can MultiDH not know when a Hologram is loaded by DecentHolograms.
In addition is DecentHolograms loading its holograms after the server completed its startup. This causes a race condition where MultiDH tries to load holograms before DecentHologram has even started loading them.
To avoid this issue does MultiDH intentionally delay its loading for a few seconds after the server is done loading. The default delay is 3 seconds and cannot be set lower. Depending on the number of Holograms in DecentHolograms and the server's overall performance will you need to increase the delay in the initDelay setting.
评论 0
登录后参与评分
还没有评论,来抢沙发吧