Merge pull request #2 from MilkBowl/master

update
This commit is contained in:
Rodney Ramos 2012-09-27 08:45:57 -07:00
commit bafe9613ca
8 changed files with 192 additions and 9 deletions

Binary file not shown.

BIN
lib/Dosh.jar Normal file

Binary file not shown.

BIN
lib/craftconomy3.jar Normal file

Binary file not shown.

View File

@ -228,7 +228,7 @@
<artifactId>craftconomy3</artifactId>
<version>3.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/Craftconomy3-b189.jar</systemPath>
<systemPath>${project.basedir}/lib/craftconomy3.jar</systemPath>
</dependency>
<dependency>
<groupId>net.crystalyx.bukkit.simplyperms</groupId>
@ -244,6 +244,13 @@
<scope>system</scope>
<systemPath>${project.basedir}/lib/Gringotts.jar</systemPath>
</dependency>
<dependency>
<groupId>com.gravypod.Dosh</groupId>
<artifactId>Dosh</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/Dosh.jar</systemPath>
</dependency>
</dependencies>
<build>
<resources>

View File

@ -42,6 +42,7 @@ import net.milkbowl.vault.economy.plugins.Economy_BOSE7;
import net.milkbowl.vault.economy.plugins.Economy_Craftconomy;
import net.milkbowl.vault.economy.plugins.Economy_Craftconomy3;
import net.milkbowl.vault.economy.plugins.Economy_CurrencyCore;
import net.milkbowl.vault.economy.plugins.Economy_Dosh;
import net.milkbowl.vault.economy.plugins.Economy_EconXP;
import net.milkbowl.vault.economy.plugins.Economy_Essentials;
import net.milkbowl.vault.economy.plugins.Economy_GoldIsMoney;
@ -207,7 +208,7 @@ public class Vault extends JavaPlugin {
hookEconomy("CraftConomy", Economy_Craftconomy.class, ServicePriority.Normal, "me.greatman.Craftconomy.Craftconomy");
// Try to load Craftconomy3
hookEconomy("CraftConomy3", Economy_Craftconomy3.class, ServicePriority.Normal, "com.greatmancode.craftconomy3.CC3BukkitLoader");
hookEconomy("CraftConomy3", Economy_Craftconomy3.class, ServicePriority.Normal, "com.greatmancode.craftconomy3.BukkitLoader");
// Try to load eWallet
hookEconomy("eWallet", Economy_eWallet.class, ServicePriority.Normal, "me.ethan.eWallet.ECO");
@ -248,6 +249,8 @@ public class Vault extends JavaPlugin {
// Try to load GoldIsMoney2
hookEconomy("GoldIsMoney2", Economy_GoldIsMoney2.class, ServicePriority.Normal, "com.flobi.GoldIsMoney2.GoldIsMoney");
// Try to load Dosh
hookEconomy("Dosh", Economy_Dosh.class, ServicePriority.Normal, "com.gravypod.Dosh.Dosh");
}

View File

@ -32,7 +32,7 @@ import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.plugin.Plugin;
import com.greatmancode.craftconomy3.CC3BukkitLoader;
import com.greatmancode.craftconomy3.BukkitLoader;
import com.greatmancode.craftconomy3.Common;
import com.greatmancode.craftconomy3.account.Account;
import com.greatmancode.craftconomy3.currency.CurrencyManager;
@ -43,7 +43,7 @@ public class Economy_Craftconomy3 implements Economy {
private final String name = "Craftconomy3";
private Plugin plugin = null;
protected CC3BukkitLoader economy = null;
protected BukkitLoader economy = null;
public Economy_Craftconomy3(Plugin plugin) {
this.plugin = plugin;
@ -52,8 +52,8 @@ public class Economy_Craftconomy3 implements Economy {
// Load Plugin in case it was loaded before
if (economy == null) {
Plugin ec = plugin.getServer().getPluginManager().getPlugin("Craftconomy3");
if (ec != null && ec.isEnabled() && ec.getClass().getName().equals("com.greatmancode.craftconomy3.CC3BukkitLoader")) {
economy = (CC3BukkitLoader) ec;
if (ec != null && ec.isEnabled() && ec.getClass().getName().equals("com.greatmancode.craftconomy3.BukkitLoader")) {
economy = (BukkitLoader) ec;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), name));
}
}
@ -71,8 +71,8 @@ public class Economy_Craftconomy3 implements Economy {
if (economy.economy == null) {
Plugin ec = plugin.getServer().getPluginManager().getPlugin("Craftconomy3");
if (ec != null && ec.isEnabled() && ec.getClass().getName().equals("com.greatmancode.craftconomy3.CC3BukkitLoader")) {
economy.economy = (CC3BukkitLoader) ec;
if (ec != null && ec.isEnabled() && ec.getClass().getName().equals("com.greatmancode.craftconomy3.BukkitLoader")) {
economy.economy = (BukkitLoader) ec;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
}
}

View File

@ -0,0 +1,170 @@
/* This file is part of Vault.
Vault is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Vault is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with Vault. If not, see <http://www.gnu.org/licenses/>.
*/
package net.milkbowl.vault.economy.plugins;
import java.util.List;
import org.bukkit.plugin.Plugin;
import com.gravypod.Dosh.Dosh;
import com.gravypod.Dosh.MoneyUtils;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
public class Economy_Dosh implements Economy {
Plugin plugin;
Dosh doshPlugin;
boolean isEnabled = false;
DoshAPIHandler apiHandle;
public Economy_Dosh(Plugin _plugin) {
plugin = _plugin;
if (plugin.getServer().getPluginManager().isPluginEnabled("Dosh")) {
doshPlugin = (Dosh) plugin.getServer().getPluginManager().getPlugin("Dosh");
apiHandle = new DoshAPIHandler();
isEnabled = true;
} else {
return;
}
}
@Override
public boolean isEnabled() {
return isEnabled;
}
@Override
public String getName() {
return "Dosh";
}
@Override
public boolean hasBankSupport() {
return false;
}
@Override
public int fractionalDigits() {
return 0;
}
@Override
public String format(double amount) {
return null;
}
@Override
public String currencyNamePlural() {
return Dosh.getSettings().moneyName + "s";
}
@Override
public String currencyNameSingular() {
return Dosh.getSettings().moneyName;
}
@Override
public boolean hasAccount(String playerName) {
return true;
}
@Override
public double getBalance(String playerName) {
return DoshAPIHandler.getUserBal(playerName);
}
@Override
public boolean has(String playerName, double amount) {
return (getBalance(playerName) - amount) > 0;
}
@Override
public EconomyResponse withdrawPlayer(String playerName, double amount) {
if (DoshAPIHandler.subtractMoney(playerName, amount)) {
return new EconomyResponse(amount, getBalance(playerName), EconomyResponse.ResponseType.SUCCESS, "Worked!");
}
return new EconomyResponse(amount, getBalance(playerName), EconomyResponse.ResponseType.FAILURE, "Didnt work!");
}
@Override
public EconomyResponse depositPlayer(String playerName, double amount) {
DoshAPIHandler.addUserBal(playerName, amount);
return new EconomyResponse(amount, getBalance(playerName), EconomyResponse.ResponseType.SUCCESS, "It worked!");
}
@Override
public EconomyResponse createBank(String name, String player) {
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
}
@Override
public EconomyResponse deleteBank(String name) {
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
}
@Override
public EconomyResponse bankBalance(String name) {
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
}
@Override
public EconomyResponse bankHas(String name, double amount) {
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
}
@Override
public EconomyResponse bankWithdraw(String name, double amount) {
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
}
@Override
public EconomyResponse bankDeposit(String name, double amount) {
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
}
@Override
public EconomyResponse isBankOwner(String name, String playerName) {
return null;
}
@Override
public EconomyResponse isBankMember(String name, String playerName) {
return null;
}
@Override
public List<String> getBanks() {
return null;
}
@Override
public boolean createPlayerAccount(String playerName) {
return false;
}
public class DoshAPIHandler extends MoneyUtils {}
}

View File

@ -29,6 +29,7 @@ public class Items {
private static final List<ItemInfo> items = new CopyOnWriteArrayList<ItemInfo>();
static {
items.add(new ItemInfo("Air", new String[][]{{"air"}}, Material.AIR));
items.add(new ItemInfo("Stone", new String[][]{{"ston"}, {"smoo", "sto"}}, Material.STONE));
items.add(new ItemInfo("Grass", new String[][]{{"gras"}}, Material.GRASS));
items.add(new ItemInfo("Dirt", new String[][]{{"dirt"}}, Material.DIRT));
@ -416,7 +417,9 @@ public class Items {
items.add(new ItemInfo("strad Disc", new String[][] {{"strad", "disc"}, {"strad", "reco"}, {"9", "disc"}, {"9", "reco"}}, Material.RECORD_9));
items.add(new ItemInfo("ward Disc", new String[][] {{"ward", "disc"}, {"ward", "reco"}, {"10", "disc"}, {"10", "reco"}}, Material.RECORD_10));
items.add(new ItemInfo("11 Disc", new String[][] {{"11", "disc"}, {"11", "reco"}}, Material.RECORD_11));
items.add(new ItemInfo("Redstone Lamp", new String[][] {{"lamp"}, {"lamp", "red", "sto"}}, Material.REDSTONE_LAMP_OFF));
items.add(new ItemInfo("Redstone Lamp", new String[][] {{"lamp"}, {"lamp", "red", "sto", "off"}}, Material.REDSTONE_LAMP_OFF));
items.add(new ItemInfo("Redstone Lamp On", new String[][] {{"on", "lamp"}, {"on", "red", "lamp"}}, Material.REDSTONE_LAMP_ON));
items.add(new ItemInfo("Redstone Torch Off", new String[][] {{"off", "red", "sto", "tor"}}, Material.REDSTONE_TORCH_OFF));
//1.3 Blocks
items.add(new ItemInfo("Emerald Ore", new String[][]{{"emer", "ore"}}, Material.EMERALD_ORE));
items.add(new ItemInfo("Emerald", new String[][]{{"emer"}}, Material.EMERALD));