Reformatted Code
This commit is contained in:
@@ -34,24 +34,24 @@ public class Econ {
|
||||
String integrationFail = "Economy integration is " + (Conf.econEnabled ? "enabled, but" : "disabled, and") + " the plugin \"Vault\" ";
|
||||
|
||||
if (Bukkit.getServer().getPluginManager().getPlugin("Vault") == null) {
|
||||
SavageFactions.plugin.log(integrationFail + "is not installed.");
|
||||
SavageFactions.plugin.log(integrationFail + "is not installed.");
|
||||
return;
|
||||
}
|
||||
|
||||
RegisteredServiceProvider<Economy> rsp = Bukkit.getServer().getServicesManager().getRegistration(Economy.class);
|
||||
if (rsp == null) {
|
||||
SavageFactions.plugin.log(integrationFail + "is not hooked into an economy plugin.");
|
||||
SavageFactions.plugin.log(integrationFail + "is not hooked into an economy plugin.");
|
||||
return;
|
||||
}
|
||||
econ = rsp.getProvider();
|
||||
|
||||
SavageFactions.plugin.log("Economy integration through Vault plugin successful.");
|
||||
SavageFactions.plugin.log("Economy integration through Vault plugin successful.");
|
||||
|
||||
if (!Conf.econEnabled) {
|
||||
SavageFactions.plugin.log("NOTE: Economy is disabled. You can enable it with the command: f config econEnabled true");
|
||||
if (! Conf.econEnabled) {
|
||||
SavageFactions.plugin.log("NOTE: Economy is disabled. You can enable it with the command: f config econEnabled true");
|
||||
}
|
||||
|
||||
SavageFactions.plugin.cmdBase.cmdHelp.updateHelp();
|
||||
SavageFactions.plugin.cmdBase.cmdHelp.updateHelp();
|
||||
}
|
||||
|
||||
public static boolean shouldBeUsed() {
|
||||
@@ -63,7 +63,7 @@ public class Econ {
|
||||
}
|
||||
|
||||
public static void modifyUniverseMoney(double delta) {
|
||||
if (!shouldBeUsed()) {
|
||||
if (! shouldBeUsed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class Econ {
|
||||
if (Conf.econUniverseAccount.length() == 0) {
|
||||
return;
|
||||
}
|
||||
if (!econ.hasAccount(Conf.econUniverseAccount)) {
|
||||
if (! econ.hasAccount(Conf.econUniverseAccount)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -81,8 +81,8 @@ public class Econ {
|
||||
}
|
||||
|
||||
public static void sendBalanceInfo(FPlayer to, EconomyParticipator about) {
|
||||
if (!shouldBeUsed()) {
|
||||
SavageFactions.plugin.log(Level.WARNING, "Vault does not appear to be hooked into an economy plugin.");
|
||||
if (! shouldBeUsed()) {
|
||||
SavageFactions.plugin.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())));
|
||||
@@ -134,21 +134,21 @@ public class Econ {
|
||||
}
|
||||
|
||||
public static boolean transferMoney(EconomyParticipator invoker, EconomyParticipator from, EconomyParticipator to, double amount, boolean notify) {
|
||||
if (!shouldBeUsed()) {
|
||||
if (! shouldBeUsed()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// The amount must be positive.
|
||||
// If the amount is negative we must flip and multiply amount with -1.
|
||||
if (amount < 0) {
|
||||
amount *= -1;
|
||||
amount *= - 1;
|
||||
EconomyParticipator temp = from;
|
||||
from = to;
|
||||
to = temp;
|
||||
}
|
||||
|
||||
// Check the rights
|
||||
if (!canIControllYou(invoker, from)) {
|
||||
if (! canIControllYou(invoker, from)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ public class Econ {
|
||||
}
|
||||
|
||||
// Is there enough money for the transaction to happen?
|
||||
if (!econ.has(fromAcc, amount)) {
|
||||
if (! econ.has(fromAcc, amount)) {
|
||||
// There was not enough money to pay
|
||||
if (invoker != null && notify) {
|
||||
invoker.msg("<h>%s<b> can't afford to transfer <h>%s<b> to %s<b>.", from.describeTo(invoker, true), moneyString(amount), to.describeTo(invoker));
|
||||
@@ -247,7 +247,7 @@ public class Econ {
|
||||
}
|
||||
|
||||
public static boolean hasAtLeast(EconomyParticipator ep, double delta, String toDoThis) {
|
||||
if (!shouldBeUsed()) {
|
||||
if (! shouldBeUsed()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -270,8 +270,8 @@ public class Econ {
|
||||
affordable = true;
|
||||
}
|
||||
|
||||
if (!affordable) {
|
||||
if (toDoThis != null && !toDoThis.isEmpty()) {
|
||||
if (! affordable) {
|
||||
if (toDoThis != null && ! toDoThis.isEmpty()) {
|
||||
ep.msg("<h>%s<i> can't afford <h>%s<i> %s.", ep.describeTo(ep, true), moneyString(delta), toDoThis);
|
||||
}
|
||||
return false;
|
||||
@@ -280,7 +280,7 @@ public class Econ {
|
||||
}
|
||||
|
||||
public static boolean modifyMoney(EconomyParticipator ep, double delta, String toDoThis, String forDoingThis) {
|
||||
if (!shouldBeUsed()) {
|
||||
if (! shouldBeUsed()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -308,14 +308,14 @@ public class Econ {
|
||||
// The account might not have enough space
|
||||
EconomyResponse er = econ.depositPlayer(acc, delta);
|
||||
if (er.transactionSuccess()) {
|
||||
modifyUniverseMoney(-delta);
|
||||
if (forDoingThis != null && !forDoingThis.isEmpty()) {
|
||||
modifyUniverseMoney(- delta);
|
||||
if (forDoingThis != null && ! forDoingThis.isEmpty()) {
|
||||
ep.msg("<h>%s<i> gained <h>%s<i> %s.", You, moneyString(delta), forDoingThis);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
// transfer to account failed
|
||||
if (forDoingThis != null && !forDoingThis.isEmpty()) {
|
||||
if (forDoingThis != null && ! forDoingThis.isEmpty()) {
|
||||
ep.msg("<h>%s<i> would have gained <h>%s<i> %s, but the deposit failed.", You, moneyString(delta), forDoingThis);
|
||||
}
|
||||
return false;
|
||||
@@ -324,17 +324,17 @@ public class Econ {
|
||||
// The player should loose money
|
||||
// The player might not have enough.
|
||||
|
||||
if (econ.has(acc, -delta) && econ.withdrawPlayer(acc, -delta).transactionSuccess()) {
|
||||
if (econ.has(acc, - delta) && econ.withdrawPlayer(acc, - delta).transactionSuccess()) {
|
||||
// There is enough money to pay
|
||||
modifyUniverseMoney(-delta);
|
||||
if (forDoingThis != null && !forDoingThis.isEmpty()) {
|
||||
ep.msg("<h>%s<i> lost <h>%s<i> %s.", You, moneyString(-delta), forDoingThis);
|
||||
modifyUniverseMoney(- delta);
|
||||
if (forDoingThis != null && ! forDoingThis.isEmpty()) {
|
||||
ep.msg("<h>%s<i> lost <h>%s<i> %s.", You, moneyString(- delta), forDoingThis);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
// There was not enough money to pay
|
||||
if (toDoThis != null && !toDoThis.isEmpty()) {
|
||||
ep.msg("<h>%s<i> can't afford <h>%s<i> %s.", You, moneyString(-delta), toDoThis);
|
||||
if (toDoThis != null && ! toDoThis.isEmpty()) {
|
||||
ep.msg("<h>%s<i> can't afford <h>%s<i> %s.", You, moneyString(- delta), toDoThis);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -347,7 +347,7 @@ public class Econ {
|
||||
|
||||
// calculate the cost for claiming land
|
||||
public static double calculateClaimCost(int ownedLand, boolean takingFromAnotherFaction) {
|
||||
if (!shouldBeUsed()) {
|
||||
if (! shouldBeUsed()) {
|
||||
return 0d;
|
||||
}
|
||||
|
||||
@@ -410,7 +410,7 @@ public class Econ {
|
||||
|
||||
public static boolean modifyBalance(String account, double amount) {
|
||||
if (amount < 0) {
|
||||
return econ.withdrawPlayer(account, -amount).transactionSuccess();
|
||||
return econ.withdrawPlayer(account, - amount).transactionSuccess();
|
||||
} else {
|
||||
return econ.depositPlayer(account, amount).transactionSuccess();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user