Skip to content

Commit

Permalink
style: spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
Xzavier0722 committed Jan 16, 2024
1 parent 002d0eb commit da6f41e
Showing 1 changed file with 22 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@
import io.github.bakedlibs.dough.collections.Pair;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
import org.bukkit.Bukkit;
Expand All @@ -28,18 +39,6 @@
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitTask;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;

public class BlockDataController extends ADataController {

private final Map<LinkedKey, DelayedTask> delayedWriteTasks;
Expand Down Expand Up @@ -185,6 +184,10 @@ public void removeBlock(Location l) {
return;
}

if (!removed.isDataLoaded()) {
return;
}

var menu = removed.getBlockMenu();
if (menu != null) {
InventoryUtil.closeInventory(menu.toInventory());
Expand Down Expand Up @@ -278,7 +281,7 @@ public void setBlockDataLocation(SlimefunBlockData blockData, Location target) {

var hasTicker = false;

if (Slimefun.getRegistry().getTickerBlocks().contains(blockData.getSfId())) {
if (blockData.isDataLoaded() && Slimefun.getRegistry().getTickerBlocks().contains(blockData.getSfId())) {
Slimefun.getTickerTask().disableTicker(blockData.getLocation());
hasTicker = true;
}
Expand Down Expand Up @@ -547,11 +550,14 @@ public void removeAllDataInWorld(World world) {

// 2. remove ticker and delayed tasks
for (var blockData : loadedBlockData) {
if (Slimefun.getRegistry().getTickerBlocks().contains(blockData.getSfId())) {
Slimefun.getTickerTask().disableTicker(blockData.getLocation());
var l = blockData.getLocation();
if (blockData.isDataLoaded()
&& Slimefun.getRegistry().getTickerBlocks().contains(blockData.getSfId())) {
Slimefun.getTickerTask().disableTicker(l);
}
Slimefun.getNetworkManager().updateAllNetworks(l);

var scopeKey = new LocationKey(DataScope.NONE, blockData.getLocation());
var scopeKey = new LocationKey(DataScope.NONE, l);
removeDelayedBlockDataUpdates(scopeKey);
abortScopeTask(scopeKey);
}
Expand Down

0 comments on commit da6f41e

Please sign in to comment.