Initial Vault support for economy

I personally dislike forcing our users to use a separate plugin
just to abstract different economy plugins, but sadly we live in a
hell world where there are 20 competing economy plugins and
counting so I don't want to deal with that.
This commit is contained in:
cmastudios 2014-02-26 17:07:44 -06:00
parent 64ae4c617f
commit 43bbb24dd5
3 changed files with 27 additions and 3 deletions

View File

@ -35,6 +35,10 @@
<id>mcstats.releases</id>
<url>http://repo.mcstats.org/content/repositories/releases/</url>
</repository>
<repository>
<id>vault-repo</id>
<url>http://nexus.theyeticave.net/content/repositories/pub_releases</url>
</repository>
</repositories>
<issueManagement>
<system>Github issues</system>
@ -140,5 +144,10 @@
<version>R7</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.milkbowl.vault</groupId>
<artifactId>Vault</artifactId>
<version>1.2.32</version>
</dependency>
</dependencies>
</project>

View File

@ -8,6 +8,8 @@ import java.util.logging.FileHandler;
import java.util.logging.Formatter;
import java.util.logging.Level;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
@ -20,7 +22,10 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import com.tommytony.war.command.WarCommandHandler;
import com.tommytony.war.config.FlagReturn;
@ -57,8 +62,6 @@ import com.tommytony.war.utility.PlayerState;
import com.tommytony.war.utility.SizeCounter;
import com.tommytony.war.utility.WarLogFormatter;
import com.tommytony.war.volume.Volume;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
/**
* Main class of War
@ -99,6 +102,7 @@ public class War extends JavaPlugin {
private final InventoryBag defaultInventories = new InventoryBag();
private KillstreakReward killstreakReward;
private MySQLConfig mysqlConfig;
private Economy econ = null;
private final WarConfigBag warConfig = new WarConfigBag();
private final WarzoneConfigBag warzoneDefaultConfig = new WarzoneConfigBag();
@ -292,6 +296,13 @@ public class War extends JavaPlugin {
this.getServer().getPluginManager().disablePlugin(this);
}
}
if (this.getServer().getPluginManager().isPluginEnabled("Vault")) {
RegisteredServiceProvider<Economy> rsp = this.getServer().getServicesManager()
.getRegistration(Economy.class);
if (rsp != null) {
this.econ = rsp.getProvider();
}
}
War.reloadLanguage();
@ -1341,4 +1352,8 @@ public class War extends JavaPlugin {
return null;
}
}
public Economy getEconomy() {
return econ;
}
}

View File

@ -4,7 +4,7 @@ description: ${project.description}
author: tommytony
website: ${project.url}
main: com.tommytony.war.War
softdepend: [Spout, TagAPI, WorldEdit]
softdepend: [Spout, TagAPI, WorldEdit, Vault]
permissions:
war.*:
description: Full War permissions. Create and destroy warzones. Change War configuration.