Scenes
将实体可见性限制在 WorldGuard 区域内的玩家。
大量的实体会降低客户端性能。
即使实体不可见(例如被墙壁遮挡),这种情况也会发生。
安装
本插件需要 Paper 26.3。
下载并将 Scenes.jar 文件放入你的 plugins 文件夹中。
控制可见性
Scenes 允许使用标签对实体进行分组。
没有任何标签的实体始终可见。
/scenes entity @e[type=armor_stand,sort=nearest,limit=1] tag add hello_world
然后,可以显示或隐藏标签。这将显示或隐藏分配给该标签的所有实体。
/scenes show hello_world
除了使用命令外,你还可以通过以下集成来控制标签可见性。
WorldGuard 区域
如果安装了 WorldGuard,可以使用 scenes 标志将标签添加到 WorldGuard 区域。
此标志包含一个以逗号分隔的标签列表。
玩家将看到他们所在区域的任何区域分配的任何标签对应的所有实体。
/rg flag my_region scenes hello_world,another_tag
TrainCarts 列车
如果安装了 TrainCarts,可以通过 TrainCarts 告示牌将标签添加到列车上。
列车的乘客将看到分配给列车所拥有的任何标签的实体。
[+train]
scene show
hello_world
another_tag
每行只能包含一个标签。
通过在下方放置另一个告示牌(就像 announce 告示牌一样),可以指定两个以上的场景名称。
| 告示牌 |
描述 |
scene show |
将指定的场景标签添加到列车。乘客将开始看到具有这些标签的实体。 |
scene hide |
从列车中移除指定的场景标签。 |
scene set |
用指定的标签替换列车的场景标签列表。 |
scene clear |
从列车中移除所有场景标签。 |
权限
| 权限 |
描述 |
scenes.assign.entity |
允许使用 /scenes entity ... tag ... 将实体分配到场景标签。 |
scenes.manual |
允许使用 /scenes show 和 /scenes hide 手动显示场景标签。 |
scenes.traincarts.build |
允许放置 Scenes TrainCarts 告示牌。 |
API
Scenes 提供了一个 API,允许其他插件将其对象注册到场景中。
Gradle
repositories {
maven("https://repo.bundlegroup.gg/repository/maven-public/")
}
dependencies {
compileOnly("gg.bundlegroup.scenes:scenes-api:1.1.0")
}
用法
控制器 (Controllers)
控制器允许向玩家显示场景标签。
例如,内置的 WorldGuard 集成使用控制器向特定区域的玩家显示场景。
Controller controller = Scenes.get().createController(plugin);
controller.showTag(player, "hello_world");
元素 (Elements)
元素是可以显示或隐藏的物体。
例如,所有实体都会自动注册为元素。
Element element = Scenes.get().createElement(plugin, viewable);
element.addTag("hello_world");
传入的 Viewable 对象需要实现以下方法:
@Override
public void addViewer(Player player) {
}
@Override
public void removeViewer(Player player) {
}
当元素不再存在时,调用 element.remove(); 以注销你的元素。
Scenes
Restricts entity visibility to players inside WorldGuard regions.
Large amounts of entities reduce client-side performance.
This happens even if the entities are not visible, for example, if they are behind walls.
Installation
This plugin requires Paper 26.3.
Download and place the Scenes.jar file in your plugins folder.
Controlling visibility
Scenes allows grouping entities using tags.
Entities without any tags are always visible.
/scenes entity @e[type=armor_stand,sort=nearest,limit=1] tag add hello_world
Then, tags can be shown or hidden. This shows or hides all entities assigned to the tag.
/scenes show hello_world
Instead of using a command, you can control tag visibility using the following integrations.
WorldGuard regions
If WorldGuard is installed, tags can be added to WorldGuard regions using the scenes flag.
This flag contains a comma-separated list of tags.
Players will see any entities assigned to any tag of any region they are standing in.
/rg flag my_region scenes hello_world,another_tag
TrainCarts trains
If TrainCarts is installed, tags can be added to trains using a TrainCarts sign.
Passengers of a train will see any entities assigned to any tag which the train also has.
[+train]
scene show
hello_world
another_tag
Each line can contain a single tag.
More than two scene names can be specified by placing another sign below (just like the announce sign).
| Sign |
Description |
scene show |
Adds the specified scene tags to the train. Passengers will start seeing entities with those tags. |
scene hide |
Removes the specified scene tags from the train. |
scene set |
Replaces the list of scene tags of the train with the specified tags. |
scene clear |
Removes all scene tags from the train. |
Permissions
| Permission |
Description |
scenes.assign.entity |
Allows assigning entities to scene tags using /scenes entity ... tag .... |
scenes.manual |
Allows using /scenes show and /scenes hide to manually show scene tags. |
scenes.traincarts.build |
Allows placing Scenes TrainCarts signs. |
API
Scenes offers an API which allows other plugins to register their objects into scenes.
Gradle
repositories {
maven("https://repo.bundlegroup.gg/repository/maven-public/")
}
dependencies {
compileOnly("gg.bundlegroup.scenes:scenes-api:1.1.0")
}
Usage
Controllers
Controllers allow showing scene tags to players.
For example, the built-in WorldGuard integration uses a controller to show scenes to players in certain regions.
Controller controller = Scenes.get().createController(plugin);
controller.showTag(player, "hello_world");
Elements
Elements are objects which can be shown or hidden.
For example, all entities are automatically registered as elements.
Element element = Scenes.get().createElement(plugin, viewable);
element.addTag("hello_world");
The passed Viewable object needs to implement these methods:
@Override
public void addViewer(Player player) {
}
@Override
public void removeViewer(Player player) {
}
Call element.remove(); to unregister your element when it no longer exists.
评论 0
登录后参与评分
还没有评论,来抢沙发吧