Skip to content

Commit

Permalink
V0.0.9 - Tried a new method of invoking Vault, which closes #9. Teste…
Browse files Browse the repository at this point in the history
…d with 1.14 and Vault 1.7.2-b107
  • Loading branch information
Fido2603 committed Sep 16, 2019
1 parent 7fb7c33 commit 528f25a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 3 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>dk.fido2603</groupId>
<artifactId>mydog</artifactId>
<version>0.0.8</version>
<version>0.0.9</version>
<name>MyDog</name>
<description>Tamed wolves but at least 10x better!</description>
<url>https://github.com/DoggyCraftDK/MyDog</url>
Expand All @@ -19,7 +19,9 @@
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.host.url>http://localhost:9000/</sonar.host.url>
<!--suppress UnresolvedMavenProperty -->
<sonar.dependencyCheck.reportPath>${dependency.check.report.dir}/dependency-check-report.xml</sonar.dependencyCheck.reportPath>
<!--suppress UnresolvedMavenProperty -->
<sonar.dependencyCheck.htmlReportPath>${dependency.check.report.dir}/dependency-check-report.html</sonar.dependencyCheck.htmlReportPath> </properties>
<repositories>
<!-- Spigot Repo for Spigot and Bukkit -->
Expand Down
13 changes: 7 additions & 6 deletions src/dk/fido2603/mydog/MyDog.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
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;
import java.util.HashMap;
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;
Expand Down Expand Up @@ -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<Economy> economyProvider = plugin.getServer().getServicesManager().getRegistration(Economy.class);
if (economyProvider != null)
RegisteredServiceProvider<Permission> permissionProvider = plugin.getServer().getServicesManager().getRegistration(Permission.class);
RegisteredServiceProvider<Chat> 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
Expand Down

0 comments on commit 528f25a

Please sign in to comment.