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


Java ResponseType.SUCCESS属性代码示例

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


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

示例1: withdrawPlayer

@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,代码行数:16,代码来源:VaultEconomy.java

示例2: withdrawPlayer

@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,代码行数:17,代码来源:UCEconomy.java

示例3: withdrawPlayer

@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,代码行数:22,代码来源:VaultEconomy.java

示例4: withdrawPlayer

@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,代码行数:17,代码来源:VaultHook.java

示例5: createBank

@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,代码行数:17,代码来源:VaultHook.java

示例6: bankDeposit

@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,代码行数:19,代码来源:Economy_XPBank.java

示例7: isBankOwner

@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,代码行数:20,代码来源:Economy_XPBank.java

示例8: depositPlayer

@Override
public EconomyResponse depositPlayer(String playerName, double amount) {
    double balance;
    try {
        balance = MCCom.getExternalBalance(playerName);
    } catch (NoAccountException e) {
        MCCom.create(playerName);
        balance = MCCom.getExternalBalance(playerName);
    }
    if(amount < 0.0D) {
        return new EconomyResponse(0.0D, 0.0, ResponseType.FAILURE, "Cannot deposit negative funds");
    }

    balance += amount;
    MCCom.setExternalBalance(playerName, balance);
    return new EconomyResponse(amount, balance, ResponseType.SUCCESS, null);

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

示例9: isBankMember

@Override
public EconomyResponse isBankMember (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.groupMembers.getMembers().containsKey(playerName)) {
        return new EconomyResponse(0, groupBank.getBalance(), ResponseType.SUCCESS, null);
    }

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

示例10: depositPlayer

@Override
public EconomyResponse depositPlayer(String playerName, double amount) {
	if (amount < 0) {
		return new EconomyResponse(0, 0, ResponseType.FAILURE, "Can't deposit negative amount");
	}
	switch (db.depositPlayer(playerName, amount)) {
	case ACCOUNT_NOT_FOUND:
		return new EconomyResponse(0, 0, ResponseType.FAILURE, "Account not found");
	case SUCCESS:
		return new EconomyResponse(amount, db.getBalance(playerName), ResponseType.SUCCESS, "");
	default:
		return new EconomyResponse(0, 0, ResponseType.FAILURE, "Unknown error");
	}
}
 
开发者ID:HimaJyun,项目名称:Jecon,代码行数:14,代码来源:VaultEconomy.java

示例11: depositPlayer

@Override
public EconomyResponse depositPlayer(OfflinePlayer arg0, double arg1) {
	String accountNumber = UniversalAccounts.getInstance().getOrCreatePlayerAccount(arg0.getUniqueId().toString());
	if (UniversalAccounts.getInstance().creditAccount(accountNumber, (int) arg1)) {
		return new EconomyResponse(arg1, 0, ResponseType.SUCCESS, null);
	}
	return new EconomyResponse(arg1, 0, ResponseType.FAILURE, "Deposit failed.");
}
 
开发者ID:notabadminer,项目名称:UniversalCoinsVaultPlugin,代码行数:8,代码来源:UCEconomy.java

示例12: withdrawPlayer

private EconomyResponse withdrawPlayer(Account account, double amount) {
    TransactionResult removed = account.remove(amount);

    switch (removed) {
        case SUCCESS:
            return new EconomyResponse(amount, account.balance(), ResponseType.SUCCESS, null);
        case INSUFFICIENT_FUNDS:
            return new EconomyResponse(0, account.balance(), ResponseType.FAILURE, LANG.plugin_vault_insufficientFunds);
        case ERROR:
        default:
            return new EconomyResponse(0, account.balance(), ResponseType.FAILURE, LANG.plugin_vault_error);
    }
}
 
开发者ID:sakunc,项目名称:Gringotts-,代码行数:13,代码来源:VaultConnector.java

示例13: depositPlayer

private EconomyResponse depositPlayer(Account account, double amount) {
    TransactionResult added = account.add(amount);

    switch (added) {
        case SUCCESS:
            return new EconomyResponse(amount, account.balance(), ResponseType.SUCCESS, null);
        case INSUFFICIENT_SPACE:
            return new EconomyResponse(0, account.balance(), ResponseType.FAILURE, LANG.plugin_vault_insufficientSpace);
        case ERROR:
        default:
            return new EconomyResponse(0, account.balance(), ResponseType.FAILURE, LANG.plugin_vault_error);
    }
}
 
开发者ID:sakunc,项目名称:Gringotts-,代码行数:13,代码来源:VaultConnector.java

示例14: depositPlayer

@Override
public EconomyResponse depositPlayer(String player, String world, double amount) {
    if(amount < 0) {
        return new EconomyResponse(0, 0, ResponseType.FAILURE, "Cannot deposit negative funds");
    }

    if(!this.hasAccount(player, world)) {
        return new EconomyResponse(0, 0, ResponseType.FAILURE, "Player does not have an account in this world.");
    }

    this.manager.getWorld(world).getPlayer(player).addBalance(amount);
    return new EconomyResponse(amount, this.getBalance(player, world), ResponseType.SUCCESS, null);
}
 
开发者ID:Steveice10,项目名称:Peacecraft,代码行数:13,代码来源:PeaceEconomyVault.java

示例15: withdrawPlayer

@Override
public EconomyResponse withdrawPlayer(String player, String world, double amount) {
    if(amount < 0) {
        return new EconomyResponse(0, 0, ResponseType.FAILURE, "Cannot withdraw negative funds");
    }

    if(!this.hasAccount(player, world)) {
        return new EconomyResponse(0, 0, ResponseType.FAILURE, "Player does not have an account in this world.");
    }

    this.manager.getWorld(world).getPlayer(player).removeBalance(amount);
    return new EconomyResponse(amount, this.getBalance(player, world), ResponseType.SUCCESS, null);
}
 
开发者ID:Steveice10,项目名称:Peacecraft,代码行数:13,代码来源:PeaceEconomyVault.java


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