Fix NFE and some other possible issues (#502)

Fixes #499
This commit is contained in:
Krakenied 2022-02-17 16:34:25 +01:00 committed by GitHub
parent e40b5567b8
commit 2ebc2f285b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 10 additions and 10 deletions

View File

@ -31,7 +31,7 @@ public class SignCreate implements Listener {
Sign sign = (Sign) signBlock.getState();
if (ChestShopSign.isValid(sign) && !NameManager.canUseName(event.getPlayer(), OTHER_NAME_DESTROY, ChestShopSign.getOwner(sign))) {
if (ChestShopSign.isValid(event.getLines()) && !NameManager.canUseName(event.getPlayer(), OTHER_NAME_DESTROY, ChestShopSign.getOwner(event.getLines()))) {
event.setCancelled(true);
sign.update();
return;

View File

@ -114,7 +114,7 @@ public class PriceRestrictionModule implements Listener {
String itemType = material.getType().toString().toLowerCase(Locale.ROOT);
int amount;
try {
amount = ChestShopSign.getQuantity(event.getSign());
amount = ChestShopSign.getQuantity(event.getSignLines());
} catch (IllegalArgumentException e) {
return;
}

View File

@ -36,7 +36,7 @@ public class StockCounterModule implements Listener {
public static void onPreShopCreation(PreShopCreationEvent event) {
int quantity;
try {
quantity = ChestShopSign.getQuantity(event.getSign());
quantity = ChestShopSign.getQuantity(event.getSignLines());
} catch (IllegalArgumentException invalidQuantity) {
return;
}

View File

@ -21,8 +21,8 @@ public class ShopCreationLogger implements Listener {
String shopOwner = ChestShopSign.getOwner(event.getSignLines());
String typeOfShop = ChestShopSign.isAdminShop(shopOwner) ? "an Admin Shop" : "a shop" + (event.createdByOwner() ? "" : " for " + event.getOwnerAccount().getName());
String item = ChestShopSign.getQuantity(event.getSign()) + ' ' + ChestShopSign.getItem(event.getSign());
String prices = ChestShopSign.getPrice(event.getSign());
String item = ChestShopSign.getQuantity(event.getSignLines()) + ' ' + ChestShopSign.getItem(event.getSignLines());
String prices = ChestShopSign.getPrice(event.getSignLines());
String location = LocationUtil.locationToString(event.getSign().getLocation());
String message = String.format(CREATION_MESSAGE,

View File

@ -24,7 +24,7 @@ public class SignSticker implements Listener {
return;
}
if (ChestShopSign.isAdminShop(event.getSign())) {
if (ChestShopSign.isAdminShop(event.getSignLines())) {
return;
}

View File

@ -32,7 +32,7 @@ public class CreationFeeGetter implements Listener {
return;
}
if (ChestShopSign.isAdminShop(event.getSign())) {
if (ChestShopSign.isAdminShop(event.getSignLines())) {
return;
}

View File

@ -28,7 +28,7 @@ public class MoneyChecker implements Listener {
return;
}
if (ChestShopSign.isAdminShop(event.getSign())) {
if (ChestShopSign.isAdminShop(event.getSignLines())) {
return;
}

View File

@ -35,8 +35,8 @@ public class PermissionChecker implements Listener {
return;
}
String priceLine = ChestShopSign.getPrice(event.getSign());
String itemLine = ChestShopSign.getItem(event.getSign());
String priceLine = ChestShopSign.getPrice(event.getSignLines());
String itemLine = ChestShopSign.getItem(event.getSignLines());
ItemParseEvent parseEvent = new ItemParseEvent(itemLine);
Bukkit.getPluginManager().callEvent(parseEvent);