本文整理匯總了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));
}
}
示例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();
}
}