mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-12-25 09:27:39 +01:00
Fix possible StackOverflowExceptions
This commit is contained in:
parent
d7473d68bd
commit
aa87b01b68
@ -10,6 +10,8 @@ import org.bukkit.event.Listener;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import static com.Acrobot.ChestShop.Configuration.Properties.SERVER_ECONOMY_ACCOUNT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Acrobot
|
* @author Acrobot
|
||||||
*/
|
*/
|
||||||
@ -19,15 +21,15 @@ public class ServerAccountCorrector implements Listener {
|
|||||||
public static void onCurrencyAdd(CurrencyAddEvent event) {
|
public static void onCurrencyAdd(CurrencyAddEvent event) {
|
||||||
String target = event.getTarget();
|
String target = event.getTarget();
|
||||||
|
|
||||||
if (!ChestShopSign.isAdminShop(target)) {
|
if (!ChestShopSign.isAdminShop(target) || event.getTarget().equals(SERVER_ECONOMY_ACCOUNT)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Properties.SERVER_ECONOMY_ACCOUNT.isEmpty()) {
|
if (SERVER_ECONOMY_ACCOUNT.isEmpty()) {
|
||||||
event.setAdded(true);
|
event.setAdded(true);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
target = Properties.SERVER_ECONOMY_ACCOUNT;
|
target = SERVER_ECONOMY_ACCOUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.setAdded(true);
|
event.setAdded(true);
|
||||||
@ -40,15 +42,15 @@ public class ServerAccountCorrector implements Listener {
|
|||||||
public static void onCurrencySubtract(CurrencySubtractEvent event) {
|
public static void onCurrencySubtract(CurrencySubtractEvent event) {
|
||||||
String target = event.getTarget();
|
String target = event.getTarget();
|
||||||
|
|
||||||
if (!ChestShopSign.isAdminShop(target)) {
|
if (!ChestShopSign.isAdminShop(target) || event.getTarget().equals(SERVER_ECONOMY_ACCOUNT)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Properties.SERVER_ECONOMY_ACCOUNT.isEmpty()) {
|
if (SERVER_ECONOMY_ACCOUNT.isEmpty()) {
|
||||||
event.setSubtracted(true);
|
event.setSubtracted(true);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
target = Properties.SERVER_ECONOMY_ACCOUNT;
|
target = SERVER_ECONOMY_ACCOUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.setSubtracted(true);
|
event.setSubtracted(true);
|
||||||
@ -61,15 +63,15 @@ public class ServerAccountCorrector implements Listener {
|
|||||||
public static void onCurrencyCheck(CurrencyCheckEvent event) {
|
public static void onCurrencyCheck(CurrencyCheckEvent event) {
|
||||||
String target = event.getAccount();
|
String target = event.getAccount();
|
||||||
|
|
||||||
if (!ChestShopSign.isAdminShop(target)) {
|
if (!ChestShopSign.isAdminShop(target) || event.getAccount().equals(SERVER_ECONOMY_ACCOUNT)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Properties.SERVER_ECONOMY_ACCOUNT.isEmpty()) {
|
if (SERVER_ECONOMY_ACCOUNT.isEmpty()) {
|
||||||
event.hasEnough(true);
|
event.hasEnough(true);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
target = Properties.SERVER_ECONOMY_ACCOUNT;
|
target = SERVER_ECONOMY_ACCOUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrencyCheckEvent currencyCheckEvent = new CurrencyCheckEvent(event.getAmount(), target, event.getWorld());
|
CurrencyCheckEvent currencyCheckEvent = new CurrencyCheckEvent(event.getAmount(), target, event.getWorld());
|
||||||
@ -82,7 +84,7 @@ public class ServerAccountCorrector implements Listener {
|
|||||||
public static void onCurrencyHoldCheck(CurrencyHoldEvent event) {
|
public static void onCurrencyHoldCheck(CurrencyHoldEvent event) {
|
||||||
String target = event.getAccount();
|
String target = event.getAccount();
|
||||||
|
|
||||||
if (!ChestShopSign.isAdminShop(target)) {
|
if (!ChestShopSign.isAdminShop(target) || event.getAccount().equals(SERVER_ECONOMY_ACCOUNT)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,15 +96,15 @@ public class ServerAccountCorrector implements Listener {
|
|||||||
public static void onBalanceCheck(CurrencyAmountEvent event) {
|
public static void onBalanceCheck(CurrencyAmountEvent event) {
|
||||||
String target = event.getAccount();
|
String target = event.getAccount();
|
||||||
|
|
||||||
if (!ChestShopSign.isAdminShop(target)) {
|
if (!ChestShopSign.isAdminShop(target) || event.getAccount().equals(SERVER_ECONOMY_ACCOUNT)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Properties.SERVER_ECONOMY_ACCOUNT.isEmpty()) {
|
if (SERVER_ECONOMY_ACCOUNT.isEmpty()) {
|
||||||
event.setAmount(BigDecimal.valueOf(Double.MAX_VALUE));
|
event.setAmount(BigDecimal.valueOf(Double.MAX_VALUE));
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
target = Properties.SERVER_ECONOMY_ACCOUNT;
|
target = SERVER_ECONOMY_ACCOUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrencyAmountEvent currencyAmountEvent = new CurrencyAmountEvent(target, event.getWorld());
|
CurrencyAmountEvent currencyAmountEvent = new CurrencyAmountEvent(target, event.getWorld());
|
||||||
|
Loading…
Reference in New Issue
Block a user