Skip to content

Commit

Permalink
fix: NPE without action bars
Browse files Browse the repository at this point in the history
  • Loading branch information
Thatsmusic99 committed May 14, 2023
1 parent 26273e1 commit 1fe6d1f
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.jetbrains.annotations.Nullable;

import java.io.IOException;
import java.util.*;
Expand Down Expand Up @@ -368,9 +369,9 @@ public static void sendMessage(CommandSender sender, String path, String... plac
if (sender instanceof Player) {
Player player = (Player) sender;

ConfigSection titles = config.getConfigSection(path + "_title");
ConfigSection subtitles = config.getConfigSection(path + "_subtitle");
ConfigSection actionBars = config.getConfigSection(path + "_actionbar");
@Nullable ConfigSection titles = config.getConfigSection(path + "_title");
@Nullable ConfigSection subtitles = config.getConfigSection(path + "_subtitle");
@Nullable ConfigSection actionBars = config.getConfigSection(path + "_actionbar");
if (titles != null || subtitles != null || actionBars != null) {

// Debug
Expand Down Expand Up @@ -419,9 +420,11 @@ public void run() {
titleManager.put(player, titleRunnable);
titleRunnable.runTaskTimer(CoreClass.getInstance(), 1, 1);

// If action bars are null, stop there
if (actionBars == null) return;
BukkitRunnable actionBarRunnable = new BukkitRunnable() {

private Queue<String> times = new ArrayDeque<>(actionBars.getKeys(false));
private final Queue<String> times = new ArrayDeque<>(actionBars.getKeys(false));
private int current = 0;

@Override
Expand Down

0 comments on commit 1fe6d1f

Please sign in to comment.