Fixed Econ Format, Added Multiple Placeholders, Updated Pom.
This commit is contained in:
@@ -13,6 +13,7 @@ import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.economy.EconomyResponse;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
@@ -80,12 +81,12 @@ public class Econ {
|
||||
modifyBalance(Conf.econUniverseAccount, delta);
|
||||
}
|
||||
|
||||
public static void sendBalanceInfo(FPlayer to, EconomyParticipator about) {
|
||||
public static void sendBalanceInfo(CommandSender to, Faction about) {
|
||||
if (!shouldBeUsed()) {
|
||||
P.p.log(Level.WARNING, "Vault does not appear to be hooked into an economy plugin.");
|
||||
return;
|
||||
}
|
||||
to.msg("<a>%s's<i> balance is <h>%s<i>.", about.describeTo(to, true), Econ.moneyString(econ.getBalance(about.getAccountId())));
|
||||
to.sendMessage(String.format("%s's balance is %s.", about.getTag(), Econ.moneyString(econ.getBalance(about.getAccountId()))));
|
||||
}
|
||||
|
||||
public static boolean canIControllYou(EconomyParticipator i, EconomyParticipator you) {
|
||||
@@ -135,6 +136,7 @@ public class Econ {
|
||||
|
||||
public static boolean transferMoney(EconomyParticipator invoker, EconomyParticipator from, EconomyParticipator to, double amount, boolean notify) {
|
||||
if (!shouldBeUsed()) {
|
||||
invoker.msg(TL.ECON_OFF);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -183,6 +185,12 @@ public class Econ {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the new balance is over Essential's money cap.
|
||||
if (Essentials.isOverBalCap(to, econ.getBalance(toAcc) + amount)) {
|
||||
invoker.msg(TL.ECON_OVER_BAL_CAP, amount);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Transfer money
|
||||
EconomyResponse erw = econ.withdrawPlayer(fromAcc, amount);
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.earth2me.essentials.Teleport;
|
||||
import com.earth2me.essentials.Trade;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.iface.EconomyParticipator;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@@ -25,6 +26,13 @@ public class Essentials {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isOverBalCap(EconomyParticipator participator, double amount) {
|
||||
if (essentials == null) {
|
||||
return false;
|
||||
}
|
||||
return amount > essentials.getSettings().getMaxMoney().doubleValue();
|
||||
}
|
||||
|
||||
// return false if feature is disabled or Essentials isn't available
|
||||
public static boolean handleTeleport(Player player, Location loc) {
|
||||
if (!Conf.homesTeleportCommandEssentialsIntegration || essentials == null) {
|
||||
|
||||
Reference in New Issue
Block a user