Add some early returns
This commit is contained in:
parent
cd850eeee3
commit
41e169df08
|
|
@ -280,6 +280,8 @@ public class PlayerShop {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setItemStack(ItemStack itemStack) {
|
public void setItemStack(ItemStack itemStack) {
|
||||||
|
if (this.itemStack.equals(itemStack))
|
||||||
|
return; // no changes have been made.
|
||||||
ShopItemChangeEvent shopItemChangeEvent = new ShopItemChangeEvent(this, itemStack);
|
ShopItemChangeEvent shopItemChangeEvent = new ShopItemChangeEvent(this, itemStack);
|
||||||
if (Util.callCancellableEvent(shopItemChangeEvent))
|
if (Util.callCancellableEvent(shopItemChangeEvent))
|
||||||
return; // cancelled by another plugin, does this need logging?
|
return; // cancelled by another plugin, does this need logging?
|
||||||
|
|
@ -290,6 +292,8 @@ public class PlayerShop {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPrice(double price) {
|
public void setPrice(double price) {
|
||||||
|
if (this.price == price)
|
||||||
|
return; // no changes have been made.
|
||||||
ShopPriceChangeEvent shopPriceChangeEvent = new ShopPriceChangeEvent(this, price);
|
ShopPriceChangeEvent shopPriceChangeEvent = new ShopPriceChangeEvent(this, price);
|
||||||
if (Util.callCancellableEvent(shopPriceChangeEvent))
|
if (Util.callCancellableEvent(shopPriceChangeEvent))
|
||||||
return; // cancelled by another plugin, does this need logging?
|
return; // cancelled by another plugin, does this need logging?
|
||||||
|
|
@ -300,6 +304,8 @@ public class PlayerShop {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAmount(int amount) {
|
public void setAmount(int amount) {
|
||||||
|
if (this.amount == amount)
|
||||||
|
return; // no changes have been made.
|
||||||
ShopItemAmountChangeEvent ShopItemAmountChangeEvent = new ShopItemAmountChangeEvent(this, amount);
|
ShopItemAmountChangeEvent ShopItemAmountChangeEvent = new ShopItemAmountChangeEvent(this, amount);
|
||||||
if (Util.callCancellableEvent(ShopItemAmountChangeEvent))
|
if (Util.callCancellableEvent(ShopItemAmountChangeEvent))
|
||||||
return; // cancelled by another plugin, does this need logging?
|
return; // cancelled by another plugin, does this need logging?
|
||||||
|
|
@ -310,6 +316,8 @@ public class PlayerShop {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setShopType(ShopType shopType) {
|
public void setShopType(ShopType shopType) {
|
||||||
|
if (this.type == shopType)
|
||||||
|
return; // no changes have been made.
|
||||||
ShopTypeChangeEvent shopTypeChangeEvent = new ShopTypeChangeEvent(this, shopType);
|
ShopTypeChangeEvent shopTypeChangeEvent = new ShopTypeChangeEvent(this, shopType);
|
||||||
if (Util.callCancellableEvent(shopTypeChangeEvent))
|
if (Util.callCancellableEvent(shopTypeChangeEvent))
|
||||||
return; // cancelled by another plugin, does this need logging?
|
return; // cancelled by another plugin, does this need logging?
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user