Merge remote-tracking branch 'upstream/master'

This commit is contained in:
mung3r 2012-09-07 21:14:06 -07:00
commit 3b528dcd20
8 changed files with 324 additions and 7 deletions

Binary file not shown.

BIN
lib/GoldIsMoney2.jar Normal file

Binary file not shown.

View File

@ -51,10 +51,17 @@
<dependency>
<groupId>com.flobi.GoldIsMoney</groupId>
<artifactId>GoldIsMoney</artifactId>
<version>1.0.0</version>
<version>1.2.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/GoldIsMoney.jar</systemPath>
</dependency>
<dependency>
<groupId>com.flobi.GoldIsMoney2</groupId>
<artifactId>GoldIsMoney</artifactId>
<version>2.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/GoldIsMoney2.jar</systemPath>
</dependency>
<dependency>
<groupId>cosine.boseconomy.BOSEconomy</groupId>
<artifactId>BOSEconomy</artifactId>

View File

@ -45,6 +45,7 @@ import net.milkbowl.vault.economy.plugins.Economy_CurrencyCore;
import net.milkbowl.vault.economy.plugins.Economy_EconXP;
import net.milkbowl.vault.economy.plugins.Economy_Essentials;
import net.milkbowl.vault.economy.plugins.Economy_GoldIsMoney;
import net.milkbowl.vault.economy.plugins.Economy_GoldIsMoney2;
import net.milkbowl.vault.economy.plugins.Economy_Gringotts;
import net.milkbowl.vault.economy.plugins.Economy_McMoney;
import net.milkbowl.vault.economy.plugins.Economy_MineConomy;
@ -243,6 +244,9 @@ public class Vault extends JavaPlugin {
// Try to load GoldIsMoney
hookEconomy("GoldIsMoney", Economy_GoldIsMoney.class, ServicePriority.Normal, "com.flobi.GoldIsMoney.GoldIsMoney");
// Try to load GoldIsMoney2
hookEconomy("GoldIsMoney2", Economy_GoldIsMoney2.class, ServicePriority.Normal, "com.flobi.GoldIsMoney2.GoldIsMoney");
}

View File

@ -112,7 +112,7 @@ public class Economy_GoldIsMoney implements Economy {
if (economy.economy == null) {
Plugin ec = plugin.getServer().getPluginManager().getPlugin("GoldIsMoney");
if (ec != null && ec.isEnabled() && ec.getClass().getName().equals("com.GoldIsMoney.GoldIsMoney")) {
if (ec != null && ec.isEnabled() && ec.getClass().getName().equals("com.flobi.GoldIsMoney.GoldIsMoney")) {
economy.economy = (GoldIsMoney) ec;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
}

View File

@ -0,0 +1,286 @@
/* 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 java.util.logging.Logger;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
import net.milkbowl.vault.economy.EconomyResponse.ResponseType;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.plugin.Plugin;
import com.flobi.GoldIsMoney2.GoldIsMoney;
public class Economy_GoldIsMoney2 implements Economy {
private static final Logger log = Logger.getLogger("Minecraft");
private final String name = "GoldIsMoney";
private Plugin plugin = null;
protected GoldIsMoney economy = null;
public Economy_GoldIsMoney2(Plugin plugin) {
this.plugin = plugin;
Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin);
// Load Plugin in case it was loaded before
if (economy == null) {
Plugin ec = plugin.getServer().getPluginManager().getPlugin("GoldIsMoney");
if (ec != null && ec.isEnabled() && ec.getClass().getName().equals("com.flobi.GoldIsMoney2.GoldIsMoney")) {
economy = (GoldIsMoney) ec;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), name));
}
}
}
@Override
public boolean isEnabled() {
if (economy == null) {
return false;
} else {
return economy.isEnabled();
}
}
@Override
public String getName() {
return name;
}
@Override
public boolean hasBankSupport() {
return GoldIsMoney.hasBankSupport();
}
@Override
public int fractionalDigits() {
return GoldIsMoney.fractionalDigits();
}
@Override
public String format(double amount) {
return GoldIsMoney.format(amount);
}
@Override
public String currencyNamePlural() {
return GoldIsMoney.currencyNamePlural();
}
@Override
public String currencyNameSingular() {
return GoldIsMoney.currencyNameSingular();
}
@Override
public boolean hasAccount(String playerName) {
return GoldIsMoney.hasAccount(playerName);
}
@Override
public double getBalance(String playerName) {
return GoldIsMoney.getBalance(playerName);
}
@Override
public boolean has(String playerName, double amount) {
return GoldIsMoney.has(playerName, amount);
}
@Override
public EconomyResponse withdrawPlayer(String playerName, double amount) {
if (amount < 0) {
return new EconomyResponse(0, 0, ResponseType.FAILURE, "Cannot withdraw negative funds!");
}
if (!GoldIsMoney.hasAccount(playerName)) {
return new EconomyResponse(0, 0, ResponseType.FAILURE, "That player does not have an account!");
}
if (!GoldIsMoney.has(playerName, amount)) {
return new EconomyResponse(0, GoldIsMoney.getBalance(playerName), ResponseType.FAILURE, "Insufficient funds");
}
if (!GoldIsMoney.withdrawPlayer(playerName, amount)) {
return new EconomyResponse(0, GoldIsMoney.getBalance(playerName), ResponseType.FAILURE, "Unable to withdraw funds!");
}
return new EconomyResponse(amount, GoldIsMoney.getBalance(playerName), ResponseType.SUCCESS, null);
}
@Override
public EconomyResponse depositPlayer(String playerName, double amount) {
if (amount < 0) {
return new EconomyResponse(0, 0, ResponseType.FAILURE, "Cannot desposit negative funds!");
}
if (!GoldIsMoney.hasAccount(playerName)) {
return new EconomyResponse(0, 0, ResponseType.FAILURE, "That player does not have an account!");
}
if (!GoldIsMoney.depositPlayer(playerName, amount)) {
return new EconomyResponse(0, GoldIsMoney.getBalance(playerName), ResponseType.FAILURE, "Unable to deposit funds!");
}
return new EconomyResponse(amount, GoldIsMoney.getBalance(playerName), ResponseType.SUCCESS, null);
}
@Override
public EconomyResponse createBank(String name, String player) {
if (!GoldIsMoney.hasBankSupport()) {
return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "GoldIsMoney bank support is disabled!");
}
if (!GoldIsMoney.createBank(name, player)) {
return new EconomyResponse(0, 0, ResponseType.FAILURE, "Unable to create bank account.");
}
return new EconomyResponse(0, GoldIsMoney.bankBalance(name), ResponseType.SUCCESS, "");
}
@Override
public EconomyResponse deleteBank(String name) {
if (!GoldIsMoney.hasBankSupport()) {
return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "GoldIsMoney bank support is disabled!");
}
if (!GoldIsMoney.deleteBank(name)) {
return new EconomyResponse(0, 0, ResponseType.FAILURE, "Unable to remove bank account.");
}
return new EconomyResponse(0, 0, ResponseType.SUCCESS, "");
}
@Override
public EconomyResponse bankBalance(String name) {
if (!GoldIsMoney.hasBankSupport()) {
return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "GoldIsMoney bank support is disabled!");
}
if (!GoldIsMoney.bankExists(name)) {
return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!");
}
return new EconomyResponse(0, GoldIsMoney.bankBalance(name), ResponseType.SUCCESS, "");
}
@Override
public EconomyResponse bankHas(String name, double amount) {
if (!GoldIsMoney.hasBankSupport()) {
return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "GoldIsMoney bank support is disabled!");
}
if (!GoldIsMoney.bankExists(name)) {
return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!");
}
if (GoldIsMoney.bankHas(name, amount)) {
return new EconomyResponse(0, GoldIsMoney.bankBalance(name), ResponseType.FAILURE, "The bank does not have enough money!");
}
return new EconomyResponse(0, GoldIsMoney.bankBalance(name), ResponseType.SUCCESS, "");
}
@Override
public EconomyResponse bankWithdraw(String name, double amount) {
if (!GoldIsMoney.hasBankSupport()) {
return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "GoldIsMoney bank support is disabled!");
}
if (!GoldIsMoney.bankExists(name)) {
return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!");
}
if (!GoldIsMoney.bankHas(name, amount)) {
return new EconomyResponse(0, GoldIsMoney.bankBalance(name), ResponseType.FAILURE, "The bank does not have enough money!");
}
if (!GoldIsMoney.bankWithdraw(name, amount)) {
return new EconomyResponse(0, GoldIsMoney.bankBalance(name), ResponseType.FAILURE, "Unable to withdraw from that bank account!");
}
return new EconomyResponse(amount, GoldIsMoney.bankBalance(name), ResponseType.SUCCESS, "");
}
@Override
public EconomyResponse bankDeposit(String name, double amount) {
if (!GoldIsMoney.hasBankSupport()) {
return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "GoldIsMoney bank support is disabled!");
}
if (!GoldIsMoney.bankExists(name)) {
return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!");
}
if (!GoldIsMoney.bankDeposit(name, amount)) {
return new EconomyResponse(0, GoldIsMoney.bankBalance(name), ResponseType.FAILURE, "Unable to deposit to that bank account!");
}
return new EconomyResponse(amount, GoldIsMoney.bankBalance(name), ResponseType.SUCCESS, "");
}
@Override
public EconomyResponse isBankOwner(String name, String playerName) {
if (!GoldIsMoney.hasBankSupport()) {
return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "GoldIsMoney bank support is disabled!");
}
if (!GoldIsMoney.bankExists(name)) {
return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!");
}
if (!GoldIsMoney.isBankOwner(name, playerName)) {
return new EconomyResponse(0, 0, ResponseType.FAILURE, "That player does not own that bank!");
}
return new EconomyResponse(0, GoldIsMoney.bankBalance(name), ResponseType.SUCCESS, "");
}
@Override
public EconomyResponse isBankMember(String name, String playerName) {
if (!GoldIsMoney.hasBankSupport()) {
return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "GoldIsMoney bank support is disabled!");
}
if (!GoldIsMoney.bankExists(name)) {
return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!");
}
if (!GoldIsMoney.isBankMember(name, playerName)) {
return new EconomyResponse(0, 0, ResponseType.FAILURE, "That player is not a member of that bank!");
}
return new EconomyResponse(0, GoldIsMoney.bankBalance(name), ResponseType.SUCCESS, "");
}
@Override
public List<String> getBanks() {
return GoldIsMoney.getBanks();
}
@Override
public boolean createPlayerAccount(String playerName) {
return GoldIsMoney.createPlayerAccount(playerName);
}
public class EconomyServerListener implements Listener {
Economy_GoldIsMoney2 economy = null;
public EconomyServerListener(Economy_GoldIsMoney2 economy_GoldIsMoney2) {
this.economy = economy_GoldIsMoney2;
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (economy.economy == null) {
Plugin ec = plugin.getServer().getPluginManager().getPlugin("GoldIsMoney");
if (ec != null && ec.isEnabled() && ec.getClass().getName().equals("com.flobi.GoldIsMoney2.GoldIsMoney")) {
economy.economy = (GoldIsMoney) ec;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
}
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(PluginDisableEvent event) {
if (economy.economy != null) {
if (event.getPlugin().getDescription().getName().equals("GoldIsMoney")) {
economy.economy = null;
log.info(String.format("[%s][Economy] %s unhooked.", plugin.getDescription().getName(), economy.name));
}
}
}
}
}

View File

@ -311,7 +311,7 @@ public class Items {
items.add(new ItemInfo("End Stone", new String[][] {{"end", "ston"}}, Material.ENDER_STONE));
items.add(new ItemInfo("Dragon Egg", new String[][] {{"drag", "egg"}}, Material.DRAGON_EGG));
items.add(new ItemInfo("Blaze Rod", new String[][] {{"rod", "blaz"}}, Material.BLAZE_ROD));
items.add(new ItemInfo("Ghost Tear", new String[][] {{"ghas", "tear"}}, Material.GHAST_TEAR));
items.add(new ItemInfo("Ghast Tear", new String[][] {{"ghas", "tear"}}, Material.GHAST_TEAR));
items.add(new ItemInfo("Gold Nugget", new String[][] {{"nugg", "gold"}}, Material.GOLD_NUGGET));
items.add(new ItemInfo("Glass Bottle", new String[][] {{"bottl"}, {"glas", "bott"}, {"empt", "bott"}}, Material.GLASS_BOTTLE));
items.add(new ItemInfo("Potion", new String[][] {{"potio"}}, Material.POTION));

View File

@ -26,6 +26,7 @@ import org.anjocaido.groupmanager.data.Group;
import org.anjocaido.groupmanager.data.User;
import org.anjocaido.groupmanager.dataholder.OverloadedWorldHolder;
import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler;
import org.anjocaido.groupmanager.permissions.BukkitPermissions;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Player;
@ -134,6 +135,10 @@ public class Permission_GroupManager extends Permission {
}
user.addPermission(permission);
Player p = Bukkit.getPlayer(playerName);
if (p != null) {
GroupManager.BukkitPermissions.updatePermissions(p);
}
return true;
}
@ -155,6 +160,10 @@ public class Permission_GroupManager extends Permission {
}
user.removePermission(permission);
Player p = Bukkit.getPlayer(playerName);
if (p != null) {
GroupManager.BukkitPermissions.updatePermissions(p);
}
return true;
}
@ -260,6 +269,10 @@ public class Permission_GroupManager extends Permission {
} else {
user.addSubGroup(group);
}
Player p = Bukkit.getPlayer(playerName);
if (p != null) {
GroupManager.BukkitPermissions.updatePermissions(p);
}
return true;
}
@ -278,16 +291,23 @@ public class Permission_GroupManager extends Permission {
if (user == null) {
return false;
}
boolean success = false;
if (user.getGroup().getName().equalsIgnoreCase(groupName)) {
user.setGroup(owh.getDefaultGroup());
return true;
success = true;
} else {
Group group = owh.getGroup(groupName);
if (group == null) {
return false;
if (group != null) {
success = user.removeSubGroup(group);
}
return user.removeSubGroup(group);
}
if (success) {
Player p = Bukkit.getPlayer(playerName);
if (p != null) {
GroupManager.BukkitPermissions.updatePermissions(p);
}
}
return success;
}
@Override