当前位置: 首页>>代码示例>>Java>>正文


Java ResponseType类代码示例

本文整理汇总了Java中net.milkbowl.vault.economy.EconomyResponse.ResponseType的典型用法代码示例。如果您正苦于以下问题:Java ResponseType类的具体用法?Java ResponseType怎么用?Java ResponseType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ResponseType类属于net.milkbowl.vault.economy.EconomyResponse包,在下文中一共展示了ResponseType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: withdrawPlayer

import net.milkbowl.vault.economy.EconomyResponse.ResponseType; //导入依赖的package包/类
@Override
public EconomyResponse withdrawPlayer(String playerName, double amount) {
	if (amount < 0) {
		return new EconomyResponse(0, 0, ResponseType.FAILURE, "Can't deposit negative amount");
	}
	switch (db.withdrawPlayer(playerName, amount)) {
	case ACCOUNT_NOT_FOUND:
		return new EconomyResponse(0, 0, ResponseType.FAILURE, "Account not found");
	case NOT_ENOUGH:
		return new EconomyResponse(0, 0, ResponseType.FAILURE, "Money is not enough");
	case SUCCESS:
		return new EconomyResponse(amount, db.getBalance(playerName), ResponseType.SUCCESS, "");
	default:
		return new EconomyResponse(0, 0, ResponseType.FAILURE, "Unknown error");
	}
}
 
开发者ID:HimaJyun,项目名称:Jecon,代码行数:17,代码来源:VaultEconomy.java

示例2: withdrawPlayer

import net.milkbowl.vault.economy.EconomyResponse.ResponseType; //导入依赖的package包/类
@Override
public EconomyResponse withdrawPlayer(OfflinePlayer player, double amount) {
	// grab any coins in inventory first
	double residual = new InventoryCoins(player.getPlayer()).collectCoinPayment(amount);
	// then grab remaining balance from account
	if (residual > 0) {
		String accountNumber = UniversalAccounts.getInstance().getPlayerAccount(player.getUniqueId().toString());
		if (UniversalAccounts.getInstance().debitAccount(accountNumber, (int) residual)) {
			return new EconomyResponse(amount, 0, ResponseType.SUCCESS, null);
		} else {
			// return coins taken since payment could not be completed
			new InventoryCoins(player.getPlayer()).returnChange(amount - residual);
			return new EconomyResponse(amount, 0, ResponseType.FAILURE, "Withdrawal failed");
		}
	}
	return new EconomyResponse(amount, 0, ResponseType.SUCCESS, null);
}
 
开发者ID:notabadminer,项目名称:UniversalCoinsVaultPlugin,代码行数:18,代码来源:UCEconomy.java

示例3: withdrawPlayer

import net.milkbowl.vault.economy.EconomyResponse.ResponseType; //导入依赖的package包/类
@Override
public EconomyResponse withdrawPlayer(OfflinePlayer player, double amount) {
	
	if (!(player instanceof OfflinePlayer)) {
		return new EconomyResponse(0, 0, ResponseType.FAILURE, String.format(plugin.getMessage("InvalidPlayer"), "Unknown"));
	}
	
	double balance = players.get(player.getUniqueId()).getBalance();
	if (amount < 0) {
		return new EconomyResponse(amount, balance, ResponseType.FAILURE, plugin.getMessage("NegativeAmountUsed"));
	}
	String displayAmount = format(amount);
	
	if (balance < amount) {
		return new EconomyResponse(amount, balance, ResponseType.FAILURE, String.format(plugin.getMessage("InsufficientFunds"), displayAmount));
	}
	balance = players.get(player.getUniqueId()).withdraw(amount);
	if (plugin.getLogTransactions()) {
		plugin.getLogger().info(String.format("Withdraw Player: %s %s%12.2f", player.getName(), plugin.getCurrencySymbol(), amount));
	}
	return new EconomyResponse(amount, balance, ResponseType.SUCCESS, String.format(plugin.getMessage("Withdraw"), displayAmount));
}
 
开发者ID:Drewpercraft,项目名称:BlockBank,代码行数:23,代码来源:VaultEconomy.java

示例4: withdrawPlayer

import net.milkbowl.vault.economy.EconomyResponse.ResponseType; //导入依赖的package包/类
@Override
public final EconomyResponse withdrawPlayer(final String playerName, final double amount) {
	double balance = getBalance(playerName);
	if(amount < 0) {
		return new EconomyResponse(amount, balance, ResponseType.FAILURE, "Cannot withdraw negative funds.");
	}
	if(!has(playerName, amount)) {
		return new EconomyResponse(amount, balance, ResponseType.FAILURE, "Insufficient funds.");
	}
	if(!hasAccount(playerName)) {
		return new EconomyResponse(amount, balance, ResponseType.FAILURE, "This player does not exist or does not have an account.");
	}
	final SkyowalletAccount account = getAccountByName(playerName);
	balance -= account.getWallet();
	account.setWallet(balance);
	return new EconomyResponse(amount, balance, ResponseType.SUCCESS, "Success.");
}
 
开发者ID:Skyost,项目名称:Skyowallet,代码行数:18,代码来源:VaultHook.java

示例5: createBank

import net.milkbowl.vault.economy.EconomyResponse.ResponseType; //导入依赖的package包/类
@Override
public final EconomyResponse createBank(final String bankName, final String playerName) {
	if(!Utils.isValidFileName(bankName)) {
		return new EconomyResponse(0d, 0d, ResponseType.FAILURE, "This is not a valid bank name.");
	}
	if(SkyowalletAPI.isBankExists(bankName)) {
		return new EconomyResponse(0d, 0d, ResponseType.FAILURE, "A bank with the same name already exists.");
	}
	if(!hasAccount(playerName)) {
		return new EconomyResponse(0d, 0d, ResponseType.FAILURE, "This player does not exist or does not have an account.");
	}
	final SkyowalletBank bank = SkyowalletAPI.createBank(bankName);
	final SkyowalletAccount account = getAccountByName(playerName);
	account.setBank(bank, false);
	account.setBankOwner(true);
	return new EconomyResponse(0d, 0d, ResponseType.SUCCESS, "Success.");
}
 
开发者ID:Skyost,项目名称:Skyowallet,代码行数:18,代码来源:VaultHook.java

示例6: withdrawPlayer

import net.milkbowl.vault.economy.EconomyResponse.ResponseType; //导入依赖的package包/类
@Override
public EconomyResponse withdrawPlayer(String playerName, double amount) {
    OfflinePlayer player = econ.getPlayer(playerName);

    if ( player == null ) {
        return new EconomyResponse(0, 0, ResponseType.FAILURE, "Player does not exist");
    }

    double balance = econ.getExp(player);
    amount = Math.ceil(amount);

    if (amount < 0) {
        return new EconomyResponse(0, balance, ResponseType.FAILURE, "Cannot withdraw negative funds");
    }

    if ( econ.hasExp(player, (int) amount) == false ) {
        return new EconomyResponse(0, balance, ResponseType.FAILURE, "Insufficient funds");
    }

    econ.removeExp(player, (int) amount);

    double finalBalance = econ.getExp(player);

    return new EconomyResponse(amount, finalBalance, ResponseType.SUCCESS, null);
}
 
开发者ID:Realmcraft,项目名称:Vault,代码行数:26,代码来源:Economy_EconXP.java

示例7: depositPlayer

import net.milkbowl.vault.economy.EconomyResponse.ResponseType; //导入依赖的package包/类
@Override
public EconomyResponse depositPlayer(String playerName, double amount) {
    OfflinePlayer player = econ.getPlayer(playerName);

    if ( player == null ) {
        return new EconomyResponse(0, 0, ResponseType.FAILURE, "Player does not exist");
    }

    double balance = econ.getExp(player);
    amount = Math.ceil(amount);

    if (amount < 0) {
        return new EconomyResponse(0, balance, ResponseType.FAILURE, "Cannot withdraw negative funds");
    }

    econ.addExp(player, (int) amount );
    balance = econ.getExp(player);

    return new EconomyResponse(amount, balance, ResponseType.SUCCESS, null);
}
 
开发者ID:Realmcraft,项目名称:Vault,代码行数:21,代码来源:Economy_EconXP.java

示例8: bankDeposit

import net.milkbowl.vault.economy.EconomyResponse.ResponseType; //导入依赖的package包/类
@Override
public EconomyResponse bankDeposit (String name, double amount) {
    GroupBank groupBank = api.getGroupBank(name);

    if (groupBank == null) {
        return new EconomyResponse(0, 0, ResponseType.FAILURE, api.getMsg("GroupBankNotExists"));
    }

    int value = (int) amount;
    int balance = groupBank.getBalance();

    if (value < 1) {
        return new EconomyResponse(0, balance, ResponseType.FAILURE, api.getMsg("LessThanZero"));
    }

    groupBank.modifyBalance(value);

    return new EconomyResponse(value, balance + value, ResponseType.SUCCESS, null);
}
 
开发者ID:Realmcraft,项目名称:Vault,代码行数:20,代码来源:Economy_XPBank.java

示例9: bankWithdraw

import net.milkbowl.vault.economy.EconomyResponse.ResponseType; //导入依赖的package包/类
@Override
public EconomyResponse bankWithdraw (String name, double amount) {
    GroupBank groupBank = api.getGroupBank(name);

    if (groupBank == null) {
        return new EconomyResponse(0, 0, ResponseType.FAILURE, api.getMsg("GroupBankNotExists"));
    }

    int value = (int) amount;
    int balance = groupBank.getBalance();

    if (value < 1) {
        return new EconomyResponse(0, balance, ResponseType.FAILURE, api.getMsg("LessThanZero"));
    }

    if (value > balance) {
        return new EconomyResponse(0, balance, ResponseType.FAILURE, String.format(api.getMsg("InsufficientXP"), api.currencyName(value)));
    }

    groupBank.modifyBalance(-value);

    return new EconomyResponse(value, balance - value, ResponseType.SUCCESS, null);
}
 
开发者ID:Realmcraft,项目名称:Vault,代码行数:24,代码来源:Economy_XPBank.java

示例10: withdrawPlayer

import net.milkbowl.vault.economy.EconomyResponse.ResponseType; //导入依赖的package包/类
@Override
public EconomyResponse withdrawPlayer(String playerName, double amount) {
    if (amount < 0) {
        return new EconomyResponse(0, economy.getPlayerMoneyDouble(playerName), ResponseType.FAILURE, "Cannot withdraw negative funds");
    }

    if (!has(playerName, amount)) {
        return new EconomyResponse(0, economy.getPlayerMoneyDouble(playerName), ResponseType.FAILURE, "Insufficient funds");
    }
    
    double balance = economy.getPlayerMoneyDouble(playerName);
    if (economy.setPlayerMoney(playerName, balance - amount, false)) {
        balance = economy.getPlayerMoneyDouble(playerName);
        return new EconomyResponse(amount, balance, ResponseType.SUCCESS, "");
    } else {
          return new EconomyResponse(0, balance, ResponseType.FAILURE, "Error withdrawing funds");
    }
}
 
开发者ID:Realmcraft,项目名称:Vault,代码行数:19,代码来源:Economy_BOSE7.java

示例11: withdrawPlayer

import net.milkbowl.vault.economy.EconomyResponse.ResponseType; //导入依赖的package包/类
@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);
}
 
开发者ID:Realmcraft,项目名称:Vault,代码行数:17,代码来源:Economy_GoldIsMoney2.java

示例12: isBankMember

import net.milkbowl.vault.economy.EconomyResponse.ResponseType; //导入依赖的package包/类
@Override
public EconomyResponse isBankMember(String name, String playerName) {
    EconomyResponse er = isBankOwner(name,playerName);
    if (er.transactionSuccess()) {
        return er;
    } else {
        if (BankHandler.exists(name)) {
            Bank bank = BankHandler.getBank(name);
            Iterator<String> iterator = bank.getMembers().iterator();
            while(iterator.hasNext()) {
                if (iterator.next().equals(playerName))
                    return new EconomyResponse(0,bank.getDefaultBalance(), ResponseType.SUCCESS, "");
            }

        }
        return new EconomyResponse(0, 0, ResponseType.FAILURE, "This player is not a member of the bank!");
    }
}
 
开发者ID:Realmcraft,项目名称:Vault,代码行数:19,代码来源:Economy_Craftconomy.java

示例13: bankWithdraw

import net.milkbowl.vault.economy.EconomyResponse.ResponseType; //导入依赖的package包/类
@Override
public EconomyResponse bankWithdraw(String name, double amount) {
    if (amount < 0) {
        return new EconomyResponse(0, 0, ResponseType.FAILURE, "Cannot withdraw negative funds");
    }

    EconomyResponse er = bankHas(name, amount);
    if (!er.transactionSuccess()) {
        return er;
    } else {
        if (BankHandler.exists(name)) {
            Bank bank = BankHandler.getBank(name);
            double balance = bank.substractMoney(amount);
            return new EconomyResponse(0, balance, ResponseType.SUCCESS, "");
        }
        return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!");
    }

}
 
开发者ID:Realmcraft,项目名称:Vault,代码行数:20,代码来源:Economy_Craftconomy.java

示例14: depositPlayer

import net.milkbowl.vault.economy.EconomyResponse.ResponseType; //导入依赖的package包/类
@Override
public EconomyResponse depositPlayer(String playerName, double amount) {
    double balance;
    EconomyResponse.ResponseType type;
    String errorMessage = null;

    if (amount < 0) {
        errorMessage = "Cannot deposit negative funds";
        type = EconomyResponse.ResponseType.FAILURE;
        amount = 0;
        balance = (double) economy.getMoney(plugin.getServer().getPlayer(playerName));

        return new EconomyResponse(amount, balance, type, errorMessage);
    }
    amount = Math.ceil(amount);
    balance = (double) economy.getMoney(plugin.getServer().getPlayer(playerName));
    economy.setMoney(plugin.getServer().getPlayer(playerName), (int) (balance + amount));
    type = EconomyResponse.ResponseType.SUCCESS;
    balance = (double) economy.getMoney(plugin.getServer().getPlayer(playerName));

    return new EconomyResponse(amount, balance, type, errorMessage);
}
 
开发者ID:Realmcraft,项目名称:Vault,代码行数:23,代码来源:Economy_3co.java

示例15: isBankOwner

import net.milkbowl.vault.economy.EconomyResponse.ResponseType; //导入依赖的package包/类
@Override
public EconomyResponse isBankOwner (String name, String playerName) {
    GroupBank groupBank = api.getGroupBank(name);

    if (groupBank == null) {
        return new EconomyResponse(0, 0, ResponseType.FAILURE, api.getMsg("GroupBankNotExists"));
    }

    Account account = api.getAccount(name);

    if (account == null) {
        return new EconomyResponse(0, groupBank.getBalance(), ResponseType.FAILURE, api.getMsg("PlayerNotExist"));
    }

    if (groupBank.getOwner().equalsIgnoreCase(name)) {
        return new EconomyResponse(0, groupBank.getBalance(), ResponseType.SUCCESS, null);
    }

    return new EconomyResponse(0, groupBank.getBalance(), ResponseType.FAILURE, String.format(api.getMsg("PlayerNotOwner"), account.getName(), groupBank.getName()));
}
 
开发者ID:Realmcraft,项目名称:Vault,代码行数:21,代码来源:Economy_XPBank.java


注:本文中的net.milkbowl.vault.economy.EconomyResponse.ResponseType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。