Download YardWatch — Minecraft Mods — MetaMods

YardWatch

Active

Downloads

0

Last update

1 year ago

Versions

1.16 — 1.21.4
Server
Game mechanics
Libraries
Utils

YardWatch - Universal Protection Monitoring for Minecraft Servers

YardWatch is a multifunctional plugin for server owners that implements API for working with popular protection systems. If any of the supported plugins already has its own implementation of YardWatchAPI, this plugin automatically stops providing its implementation, allowing the original plugin to take control.

System Requirements

  • Java 17 or newer
  • Minecraft version 1.16 and above

Supported Protection Plugins

Integration is implemented with the following popular protection systems:

  • GriefPrevention (version 16 and above)
  • WorldGuard (version 7.0.0 and above)
  • LWCX
  • FactionsUUID
  • SuperiorSkyBlock
  • Towny
  • PlotSquared (version 6.0.0 and above)

For Developers

YardWatchAPI offers a unified interface for working with protection systems on Minecraft Bukkit servers, allowing to perform queries to various protection plugins without the need to import dozens of individual APIs and create unique implementations for each of them.

Installing Dependencies

To use the API, you need to connect the dependency, replacing "VERSION" with the actual build version. If you're using the API only for queries without implementation, set the scope as "provided".

Maven

<repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io&lt;/url&gt;
</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'
}

Usage Example

Checking Block Break Permission

Example code for checking player's permission to break a block:

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 disallows breaking the block, return false
        }
    // If all protection plugins allowed breaking the block, return true
    return true;
}

For Protection Plugin Developers

Adding Dependency

You can include a soft dependency on YardWatch for implementing additional integration.

depend:
  - "YardWatch"

Implementing Interface

Create a class implementing the Protection interface:

public class YourPluginProtection implements Protection {}

Service Registration

@Override
public void onEnable() {
    getServer().getServicesManager().register(
        Protection.class,
        new YourPluginProtection(),
        this,
        ServicePriority.Normal
    );
}
Project members
YouHaveTrouble

YouHaveTrouble

Developer

Created: 18 Apr 2024

ID: 17019