mirror of
https://github.com/YouHaveTrouble/YardWatch.git
synced 2026-05-12 14:36:58 +00:00
Add support for GriefPrevention Protection
Refactored the YardWatch.java file to check if the GriefPrevention plugin is enabled. If enabled, GriefPrevention Protection is registered. Additionally, a new class GriefPreventionProtection.java was added which checks if a location is protected, if a player can break/place a block, interact with a block or entity, or damage an entity based on GriefPrevention's claims. Moreover, added a new dependency for GriefPrevention in pom.xml.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package me.youhavetrouble.yardwatch;
|
||||
|
||||
import me.youhavetrouble.yardwatch.hooks.GriefPreventionProtection;
|
||||
import me.youhavetrouble.yardwatch.hooks.WorldGuardProtection;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.ServicePriority;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
@@ -8,13 +10,19 @@ public final class YardWatch extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
PluginManager pluginManager = getServer().getPluginManager();
|
||||
|
||||
if (getServer().getPluginManager().isPluginEnabled("WorldGuard")) {
|
||||
getServer().getServicesManager().register(
|
||||
Protection.class, new WorldGuardProtection(this), this, ServicePriority.Normal
|
||||
);
|
||||
}
|
||||
if (pluginManager.isPluginEnabled("WorldGuard")) {
|
||||
getServer().getServicesManager().register(
|
||||
Protection.class, new WorldGuardProtection(this), this, ServicePriority.Normal
|
||||
);
|
||||
}
|
||||
|
||||
if (pluginManager.isPluginEnabled("GriefPrevention")) {
|
||||
getServer().getServicesManager().register(
|
||||
Protection.class, new GriefPreventionProtection(this), this, ServicePriority.Normal
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user