Skip to content

Commit

Permalink
Fixed null player issue
Browse files Browse the repository at this point in the history
  • Loading branch information
WaterArchery committed Aug 28, 2024
1 parent c2a295a commit 2291de1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/java/me/waterarchery/litsellchest/models/SellTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public void run() {
}

public void handleSelling(SellChest sellChest) {
boolean isSellWithLore = LitSellChest.getInstance().getConfig().getBoolean("SellOnlyItemsWithLore");
boolean notifyOnUnsellable = ConfigHandler.getInstance().getConfig().getYml().getBoolean("NotSellingNotification", true);

new BukkitRunnable() {
@Override
public void run() {
Expand Down Expand Up @@ -137,8 +137,12 @@ public void run() {
}
}
if(hasInvalids && notifyOnUnsellable) {
String msg = configHandler.getMessageLang("InvalidPriceOrFree");
messageHandler.sendMessage(player,msg);
Player player = Bukkit.getPlayer(sellChest.getOwner());

if (player != null) {
String msg = configHandler.getMessageLang("InvalidPriceOrFree");
messageHandler.sendMessage(player, msg);
}
}
}
else {
Expand Down

0 comments on commit 2291de1

Please sign in to comment.