From fc3e580550167d11521d97573c08d3f9201157c0 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 25 Mar 2021 14:13:16 -0700 Subject: [PATCH] Fix NPE with Scoreboards when updating --- Changelog.txt | 1 + .../util/scoreboards/ScoreboardWrapper.java | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index cec01067c..dc5998fdd 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,4 +1,5 @@ Version 2.1.182 + Fixed a NPE with Scoreboards enabled when trying to update scoreboards Players now receive XP from harvesting Sweet Berry bushes (double XP for harvesting fully grown berries) Sweet Berry Bush will no longer ready tools for Super Abilities You can now use '.all' (for example: mcmmo.perks.xp.customboost.all) to give an XP perk to all skills diff --git a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java index 2ba8715f5..e35bb958b 100644 --- a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java +++ b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java @@ -428,14 +428,16 @@ public class ScoreboardWrapper { * Load new values into the sidebar. */ private void updateSidebar() { - try { - updateTask.cancel(); - } - catch (Exception e) { - e.printStackTrace(); + if(updateTask != null) { + try { + updateTask.cancel(); + } catch (Exception e) { + e.printStackTrace(); + } + + updateTask = null; } - updateTask = null; if (sidebarType == SidebarType.NONE) { return;