當前位置: 首頁>>代碼示例>>Java>>正文


Java Economy.bankWithdraw方法代碼示例

本文整理匯總了Java中net.milkbowl.vault.economy.Economy.bankWithdraw方法的典型用法代碼示例。如果您正苦於以下問題:Java Economy.bankWithdraw方法的具體用法?Java Economy.bankWithdraw怎麽用?Java Economy.bankWithdraw使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.milkbowl.vault.economy.Economy的用法示例。


在下文中一共展示了Economy.bankWithdraw方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: zeroPlayer

import net.milkbowl.vault.economy.Economy; //導入方法依賴的package包/類
/**
 * Set a player's stats to defaults, and optionally clear their inventory.
 *
 * @param plugin {@link PerWorldInventory} for econ.
 * @param player The player to zero.
 * @param clearInventory Clear the player's inventory.
 */
public static void zeroPlayer(PerWorldInventory plugin, Player player, boolean clearInventory) {
    if (clearInventory) {
        player.getInventory().clear();
        player.getEnderChest().clear();
    }

    player.setExp(0f);
    player.setFoodLevel(20);

    if (checkServerVersion(Bukkit.getVersion(), 1, 9, 0)) {
        player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
    } else {
        player.setHealth(player.getMaxHealth());
    }

    player.setLevel(0);
    for (PotionEffect effect : player.getActivePotionEffects()) {
        player.removePotionEffect(effect.getType());
    }
    player.setSaturation(5f);
    player.setFallDistance(0f);
    player.setFireTicks(0);

    if (plugin.isEconEnabled()) {
        Economy econ = plugin.getEconomy();
        econ.bankWithdraw(player.getName(), econ.bankBalance(player.getName()).amount);
        econ.withdrawPlayer(player, econ.getBalance(player));
    }
}
 
開發者ID:Gnat008,項目名稱:PerWorldInventory,代碼行數:37,代碼來源:Utils.java

示例2: setEconomy

import net.milkbowl.vault.economy.Economy; //導入方法依賴的package包/類
public static void setEconomy(Economy econ, JSONObject data, Player player) {
    try {
        if (data.has("bank-balance")) {
            econ.bankWithdraw(player.getName(), econ.bankBalance(player.getName()).balance);
            econ.bankDeposit(player.getName(), data.getDouble("bank-balance"));
        }

        econ.withdrawPlayer(String.valueOf(player), econ.getBalance(String.valueOf(player)));
        econ.depositPlayer(String.valueOf(player), data.getDouble("balance"));
    } catch (JSONException ex) {
        ex.printStackTrace();
    }
}
 
開發者ID:ThisIzEthan,項目名稱:NexusInventory,代碼行數:14,代碼來源:EconomySerialization.java


注:本文中的net.milkbowl.vault.economy.Economy.bankWithdraw方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。