From 528f25afa30582e5a61fcba04ebb7dfcddccc8bd Mon Sep 17 00:00:00 2001 From: Fido2603 Date: Mon, 16 Sep 2019 21:45:45 +0200 Subject: [PATCH] V0.0.9 - Tried a new method of invoking Vault, which closes #9. Tested with 1.14 and Vault 1.7.2-b107 --- pom.xml | 4 +++- src/dk/fido2603/mydog/MyDog.java | 13 +++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 1ca8108..aa92de6 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 dk.fido2603 mydog - 0.0.8 + 0.0.9 MyDog Tamed wolves but at least 10x better! https://github.com/DoggyCraftDK/MyDog @@ -19,7 +19,9 @@ 1.8 UTF-8 http://localhost:9000/ + ${dependency.check.report.dir}/dependency-check-report.xml + ${dependency.check.report.dir}/dependency-check-report.html diff --git a/src/dk/fido2603/mydog/MyDog.java b/src/dk/fido2603/mydog/MyDog.java index a94bdd9..d80b825 100644 --- a/src/dk/fido2603/mydog/MyDog.java +++ b/src/dk/fido2603/mydog/MyDog.java @@ -4,6 +4,7 @@ import dk.fido2603.mydog.listeners.DamageListener; import dk.fido2603.mydog.listeners.WolfMainListener; import dk.fido2603.mydog.utils.ParticleUtils; +import net.milkbowl.vault.chat.Chat; import net.milkbowl.vault.economy.Economy; import java.util.Arrays; @@ -11,6 +12,7 @@ import java.util.List; import java.util.Map; +import net.milkbowl.vault.permission.Permission; import org.bukkit.Server; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -147,18 +149,17 @@ public void onEnable() // Check for Vault if (pm.getPlugin("Vault") != null && pm.getPlugin("Vault").isEnabled()) { - this.vaultEnabled = true; - log("Vault detected."); - RegisteredServiceProvider economyProvider = plugin.getServer().getServicesManager().getRegistration(Economy.class); - if (economyProvider != null) + RegisteredServiceProvider permissionProvider = plugin.getServer().getServicesManager().getRegistration(Permission.class); + RegisteredServiceProvider chatProvider = plugin.getServer().getServicesManager().getRegistration(Chat.class); + if (permissionProvider == null || chatProvider == null) { - economy = economyProvider.getProvider(); + plugin.log("A permission provider or a chat provider was not found! Will not enable the vault integration!"); } else { - plugin.log("Vault not found."); + this.vaultEnabled = true; } } else