Add some early returns

This commit is contained in:
Len 2022-08-22 16:56:49 +02:00
parent cd850eeee3
commit 41e169df08

View File

@ -280,6 +280,8 @@ public class PlayerShop {
}
public void setItemStack(ItemStack itemStack) {
if (this.itemStack.equals(itemStack))
return; // no changes have been made.
ShopItemChangeEvent shopItemChangeEvent = new ShopItemChangeEvent(this, itemStack);
if (Util.callCancellableEvent(shopItemChangeEvent))
return; // cancelled by another plugin, does this need logging?
@ -290,6 +292,8 @@ public class PlayerShop {
}
public void setPrice(double price) {
if (this.price == price)
return; // no changes have been made.
ShopPriceChangeEvent shopPriceChangeEvent = new ShopPriceChangeEvent(this, price);
if (Util.callCancellableEvent(shopPriceChangeEvent))
return; // cancelled by another plugin, does this need logging?
@ -300,6 +304,8 @@ public class PlayerShop {
}
public void setAmount(int amount) {
if (this.amount == amount)
return; // no changes have been made.
ShopItemAmountChangeEvent ShopItemAmountChangeEvent = new ShopItemAmountChangeEvent(this, amount);
if (Util.callCancellableEvent(ShopItemAmountChangeEvent))
return; // cancelled by another plugin, does this need logging?
@ -310,6 +316,8 @@ public class PlayerShop {
}
public void setShopType(ShopType shopType) {
if (this.type == shopType)
return; // no changes have been made.
ShopTypeChangeEvent shopTypeChangeEvent = new ShopTypeChangeEvent(this, shopType);
if (Util.callCancellableEvent(shopTypeChangeEvent))
return; // cancelled by another plugin, does this need logging?