Some cleanup of code and deprecated stuff

Also deprecate amount and account setters on the CurrencyCheckEvent,
these values will be final in a future version. Changing them here does
not make sense in the internal structure.
This commit is contained in:
Phoenix616 2020-05-03 02:37:06 +01:00
parent 9ae6725c5d
commit 0d08880ed2
2 changed files with 10 additions and 4 deletions

View File

@ -16,7 +16,7 @@ import java.util.UUID;
public class CurrencyCheckEvent extends Event {
private static final HandlerList handlers = new HandlerList();
boolean outcome = false;
private boolean outcome = false;
private BigDecimal amount;
private UUID account;
@ -59,6 +59,7 @@ public class CurrencyCheckEvent extends Event {
* @return Amount of currency, as a double
* @deprecated Use {@link #getAmount()} if possible
*/
@Deprecated
public double getDoubleAmount() {
return amount.doubleValue();
}
@ -67,7 +68,9 @@ public class CurrencyCheckEvent extends Event {
* Sets the amount of currency transferred
*
* @param amount Amount to transfer
* @deprecated The amount should not be changed!
*/
@Deprecated
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
@ -76,8 +79,9 @@ public class CurrencyCheckEvent extends Event {
* Sets the amount of currency transferred
*
* @param amount Amount to transfer
* @deprecated Use {@link #setAmount(java.math.BigDecimal)} if possible
* @deprecated The amount should not be changed! Use {@link #setAmount(java.math.BigDecimal)} if possible
*/
@Deprecated
public void setAmount(double amount) {
this.amount = BigDecimal.valueOf(amount);
}
@ -100,7 +104,9 @@ public class CurrencyCheckEvent extends Event {
* Sets the account name
*
* @param account Account name
* @deprecated The account should not be changed!
*/
@Deprecated
public void setAccount(UUID account) {
this.account = account;
}

View File

@ -137,7 +137,7 @@ public class VaultListener extends EconomyAdapter {
try {
event.hasEnough(lastSeen != null && provider.has(lastSeen, world.getName(), event.getAmount().doubleValue()));
} catch (Exception e) {
ChestShop.getBukkitLogger().log(Level.WARNING, "Could not check if account of " + lastSeen.getUniqueId() + "/" + lastSeen.getName() + " has " + event.getDoubleAmount() + "." +
ChestShop.getBukkitLogger().log(Level.WARNING, "Could not check if account of " + lastSeen.getUniqueId() + "/" + lastSeen.getName() + " has " + event.getAmount() + "." +
"This is probably due to https://github.com/MilkBowl/Vault/issues/746 and has to be fixed in either Vault directly or your economy plugin." +
"If you are sure it's not this issue then please report the following error.", e);
}
@ -168,7 +168,7 @@ public class VaultListener extends EconomyAdapter {
return;
}
String formatted = provider.format(event.getDoubleAmount());
String formatted = provider.format(event.getAmount().doubleValue());
event.setFormattedAmount(formatted);
}