null check in tempblock revert_queue, rare occasion when server stops before any tempblocks are made

This commit is contained in:
PhanaticD 2019-01-12 22:12:17 -05:00
parent 3094c691a9
commit abfbff19fa

View file

@ -1,10 +1,7 @@
package com.projectkorra.projectkorra.util; package com.projectkorra.projectkorra.util;
import java.util.Comparator; import com.projectkorra.projectkorra.GeneralMethods;
import java.util.Map; import com.projectkorra.projectkorra.ProjectKorra;
import java.util.PriorityQueue;
import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -14,8 +11,10 @@ import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Levelled; import org.bukkit.block.data.Levelled;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import com.projectkorra.projectkorra.GeneralMethods; import java.util.Comparator;
import com.projectkorra.projectkorra.ProjectKorra; import java.util.Map;
import java.util.PriorityQueue;
import java.util.concurrent.ConcurrentHashMap;
public class TempBlock { public class TempBlock {
@ -88,10 +87,12 @@ public class TempBlock {
for (final Block block : instances.keySet()) { for (final Block block : instances.keySet()) {
revertBlock(block, Material.AIR); revertBlock(block, Material.AIR);
} }
if (REVERT_QUEUE != null) {
for (final TempBlock tempblock : REVERT_QUEUE) { for (final TempBlock tempblock : REVERT_QUEUE) {
tempblock.revertBlock(); tempblock.revertBlock();
} }
} }
}
public static void removeBlock(final Block block) { public static void removeBlock(final Block block) {
instances.remove(block); instances.remove(block);