From 12033af8aa824881b35e8e4693c7174cb46c27e1 Mon Sep 17 00:00:00 2001 From: shansen Date: Sun, 1 Apr 2012 03:21:14 +0200 Subject: [PATCH] Bugfix for Vault initialization. --- pom.xml | 6 +++--- .../java/me/shansen/EggCatcher/EggCatcher.java | 15 +++++++++++---- src/main/resources/plugin.yml | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 0c62024..762ada4 100644 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,7 @@ bukkit-repo - http://repo.bukkit.org/content/repositories/snapshots/ + http://repo.bukkit.org/content/repositories/releases/ @@ -25,12 +25,12 @@ org.bukkit bukkit - 1.2.2-R0.1-SNAPSHOT + 1.2.4-R1.0 net.milkbowl.vault Vault - 1.2.8 + 1.2.13 provided diff --git a/src/main/java/me/shansen/EggCatcher/EggCatcher.java b/src/main/java/me/shansen/EggCatcher/EggCatcher.java index 995184e..787fbd7 100644 --- a/src/main/java/me/shansen/EggCatcher/EggCatcher.java +++ b/src/main/java/me/shansen/EggCatcher/EggCatcher.java @@ -28,6 +28,7 @@ import net.milkbowl.vault.economy.Economy; import org.bukkit.entity.*; import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.RegisteredServiceProvider; import org.bukkit.plugin.java.JavaPlugin; public class EggCatcher extends JavaPlugin { @@ -55,17 +56,23 @@ public class EggCatcher extends JavaPlugin { pm.registerEvents(entityListener, this); if (getServer().getPluginManager().getPlugin("Vault") != null) { - economy = getServer().getServicesManager() - .getRegistration(Economy.class).getProvider(); + RegisteredServiceProvider economyProvider = getServer().getServicesManager() + .getRegistration(Economy.class); + if(economyProvider!=null){ + economy = economyProvider.getProvider(); + } } } public void CheckConfigurationFile() { double configVersion = this.getConfig().getDouble("ConfigVersion", 0.0); - - if (configVersion == 1.16) { + if (configVersion == 1.17) { // this.saveConfig(); + } + if (configVersion == 1.16) { + this.getConfig().set("ConfigVersion", 1.17); + this.saveConfig(); } else { this.saveResource("config.yml", true); this.reloadConfig(); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index ee8d1e7..8c8d19e 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EggCatcher -version: 1.16 +version: 1.17 description: This plugin allows you to catch mobs in eggs. author: shansen