YardWatch(面向服务器管理员)
为常见保护类插件实现 YardWatchAPI。如果任何受支持的插件自行实现了该 API,本插件将停止提供其实现,以便让该插件接管。
如果你是一名正在寻找如何在你的插件中实现 YardWatchAPI 信息的开发者,请参阅 YardWatchAPI
要求
- Java 17
- Minecraft 1.16+
支持实现的插件:
- GriefPrevention (v16+)
- WorldGuard (7.0.0+)
- LWCX
- FactionsUUID
- SuperiorSkyBlock
- Towny
- PlotSquared (6.0.0+)
你使用的插件没有实现 YardWatchAPI?
请联系该插件的开发者并将他们引导至此处!
你也可以在此处请求在此插件中添加临时实现。
YardWatchAPI(面向开发者)
一个用于统一 Minecraft Bukkit 服务器保护类插件的 API,允许轻松进行保护查询,而无需导入 10 个具有不同实现的插件 API。
如果你正在寻找为常见保护类插件实现 YardWatchAPI 的插件,请查看 YardWatch plugin。
用法
使用依赖管理器导入 API
在任何使用场景下,你都需要导入 API。将 VERSION 替换为当前版本号标签。如果你不是要实现 API 而是仅进行查询,你还应将 <scope> 调整为 provided。
Maven
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<dependency>
<groupId>com.github.YouHaveTrouble</groupId>
<artifactId>YardWatchAPI</artifactId>
<version>VERSION</version>
<scope>compile</scope>
</dependency>
Gradle
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
dependencies {
compileOnly 'com.github.YouHaveTrouble:YardWatchAPI:VERSION'
}
对于想要检查某物是否受保护的插件
检查玩家是否可以破坏方块
处理方块破坏检查的示例。对此无需依赖任何插件。
public boolean canBreakBlock(Player player, Block block) {
ServicesManager servicesManager = getServer().getServicesManager();
Collection<RegisteredServiceProvider<Protection>> protections = servicesManager.getRegistrations(Protection.class);
for (RegisteredServiceProvider<Protection> protection : protections) {
if (protection.getProvider().canBreakBlock(player, block.getState(true))) continue;
return false; // 如果任何保护插件不允许破坏该方块,则返回 false
}
// 如果所有保护插件都允许破坏该方块,则返回 true
return true;
}
对于保护类插件
依赖 YardWatch 插件
你可以选择软依赖并检查是否存在 YardWatch 以添加可选集成。
depend:
- "YardWatch"
实现 Protection 接口
实现接口所需的所有方法
public class YourPluginProtection implements Protection {}
将你的实现注册为服务
@Override
public void onEnable() {
getServer().getServicesManager().register(
Protection.class,
new YourPluginProtection(),
this,
ServicePriority.Normal
);
}
YardWatch (for server owners)
Implementation of YardWatchAPI for common protection plugins. If any of supported plugins implements the API itself, then this plugin will stop providing its implementation to allow the plugin to take over.
If you're a developer looking for information how to implement YardWatchAPI in your plugin, see YardWatchAPI
Requirements
- Java 17
- Minecraft 1.16+
Implementations for:
- GriefPrevention (v16+)
- WorldGuard (7.0.0+)
- LWCX
- FactionsUUID
- SuperiorSkyBlock
- Towny
- PlotSquared (6.0.0+)
Plugin you're using is not implementing YardWatchAPI?
Contact the plugin developer and send them here!
You can also request a temporary implementation within this plugin here.
YardWatchAPI (for developers)
API to unify protection plugins for minecraft bukkit servers to allow easy protection queries without having to import 10 different plugin apis with separate implementations.
If you're looking for a plugin implementing YardWatchAPI for common protection plugins, see YardWatch plugin.
Usage
Import the api using dependency manager
In any case of usage you will need to import the API. Replace VERSION with current version tag. You should also adjust your <scope> to provided if you're not implementing the api and just querying it.
Maven
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<dependency>
<groupId>com.github.YouHaveTrouble</groupId>
<artifactId>YardWatchAPI</artifactId>
<version>VERSION</version>
<scope>compile</scope>
</dependency>
Gradle
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
dependencies {
compileOnly 'com.github.YouHaveTrouble:YardWatchAPI:VERSION'
}
For plugins wanting to see if something is protected
Check if player can break a block
Example handling of block breaking check. There's no need to depend on any plugins for this.
public boolean canBreakBlock(Player player, Block block) {
ServicesManager servicesManager = getServer().getServicesManager();
Collection<RegisteredServiceProvider<Protection>> protections = servicesManager.getRegistrations(Protection.class);
for (RegisteredServiceProvider<Protection> protection : protections) {
if (protection.getProvider().canBreakBlock(player, block.getState(true))) continue;
return false; // if any protection plugin disallowed breaking the block, return false
}
// If all protection plugins allowed breaking the block, return true
return true;
}
For protection plugins
Depend on YardWatch plugin
You can optionally softdepend and check if YardWatch is present to add an optional integration.
depend:
- "YardWatch"
Implement Protection interface
Implement all the methods required by the interface
public class YourPluginProtection implements Protection {}
Register your implementation as a service
@Override
public void onEnable() {
getServer().getServicesManager().register(
Protection.class,
new YourPluginProtection(),
this,
ServicePriority.Normal
);
}
下载 YardWatch
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 YardWatch
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 YardWatch
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 YardWatch
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 YardWatch
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 YardWatch
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
- 改进对 FUUID 的支持
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
插件
PacketEvents 是一款专为 Minecraft Java 版打造的协议库,旨在简化数据包的处理与传输。
插件
使床在所有维度中爆炸的模组
插件
ExyliaPlugins 的库。
插件
通过对话框或铁砧界面帮助你的 Anthme
插件
重新定义服务器上的生物运输方式。使用高度可定制的口袋道具,安全地捕获、存储和释放任何实体。
插件
为基于 Spigot/Paper/Folia 的服务器添加对 Vivecraft 的支持
评论 0
登录后参与评分
还没有评论,来抢沙发吧