From 4ab4a1bec4815be5803c7eb05494bad38e817477 Mon Sep 17 00:00:00 2001 From: LunarAkai Date: Sun, 14 Apr 2024 20:59:46 +0200 Subject: [PATCH] dependencies & stuff --- .../minecleaner/MinecleanerArena.java | 63 +++++++++++++++++++ .../minecleaner/MinecleanerPlugin.java | 7 ++- src/main/resources/plugin.yml | 3 + 3 files changed, 72 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/lunarakai/minecleaner/MinecleanerArena.java b/src/main/java/de/lunarakai/minecleaner/MinecleanerArena.java index e836219..7beda46 100644 --- a/src/main/java/de/lunarakai/minecleaner/MinecleanerArena.java +++ b/src/main/java/de/lunarakai/minecleaner/MinecleanerArena.java @@ -10,6 +10,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; +import java.util.logging.Level; + import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TextComponent; import net.md_5.bungee.api.ChatColor; @@ -18,6 +20,7 @@ import net.md_5.bungee.api.chat.BaseComponent; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; +import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.data.BlockData; import org.bukkit.configuration.ConfigurationSection; @@ -270,6 +273,9 @@ public class MinecleanerArena { this.currentPlayer = null; this.currentMinecleanerGame = null; + // load chunk of block -1 and x+1 +// loadBlockChunk(); + for (int x = 0; x < sizeWidth; x++) { for (int y = 0; y < sizeHeight; y++) { setDiplayBlock(x, y, MinecleanerHeads.MINESWEEPER_TILE_UNKNOWN, true); @@ -279,6 +285,63 @@ public class MinecleanerArena { removeTextDisplay(); } +// private void loadBlockChunk() { +// +// BlockFace orientation = getOrientation(); +// Location loc1 = this.getLocation(); +// Location loc2 = this.getLocation(); +// double x; +// double z; +// +// switch (orientation) { +// case NORTH: +// // Block -1: +// // x: +1 +// x = loc1.x() + 3.0; +// loc1 = new Location(loc1.getWorld(), x, loc1.y(), loc1.z()); +// // Block width+1: +// // x: -1; +// x = loc2.x() - (double) getArenaWidth()/4 - 1; +// loc2 = new Location(loc2.getWorld(), x, loc2.y(), loc2.z()); +// break; +// case EAST: +// // Block -1: +// // z: +1 +// z = loc1.z() + 3.0; +// loc1 = new Location(loc2.getWorld(), loc2.x(), loc2.y(), z); +// // Block width+1: +// // z: -1; +// z = loc2.z() - (double) getArenaWidth()/4 - 1; +// loc2 = new Location(loc2.getWorld(), loc2.x(), loc2.y(), z); +// break; +// case SOUTH: +// // Block -1: +// // x: -1 +// x = loc1.x() - 3.0; +// loc1 = new Location(loc1.getWorld(), x, loc1.y(), loc1.z()); +// // Block width+1: +// // x: +1; +// x = loc2.x() + (double) getArenaWidth()/4 + 1; +// loc2 = new Location(loc2.getWorld(), x, loc2.y(), loc2.z()); +// break; +// case WEST: +// // Block -1: +// // z: -1 +// z = loc1.z() - 3.0 ; +// loc1 = new Location(loc2.getWorld(), loc2.x(), loc2.y(), z); +// // Block width+1: +// // z: +1; +// z = loc2.z() + (double) getArenaWidth()/4 - 1; +// loc2 = new Location(loc2.getWorld(), loc2.x(), loc2.y(), z); +// break; +// } +// +// plugin.getLogger().log(Level.WARNING, "Loc1: " + loc1); +// plugin.getLogger().log(Level.WARNING, "Loc2: " + loc2); +// loc1.getWorld().getChunkAt(loc1).load(); +// loc2.getWorld().getChunkAt(loc2).load(); +// } + public void showStartHeads() { int width = BoardSize.boardSizesWidth[widthIndex]; int height = BoardSize.boardSizesHeight[widthIndex]; diff --git a/src/main/java/de/lunarakai/minecleaner/MinecleanerPlugin.java b/src/main/java/de/lunarakai/minecleaner/MinecleanerPlugin.java index 69efe8f..8cd79de 100644 --- a/src/main/java/de/lunarakai/minecleaner/MinecleanerPlugin.java +++ b/src/main/java/de/lunarakai/minecleaner/MinecleanerPlugin.java @@ -30,7 +30,12 @@ public final class MinecleanerPlugin extends JavaPlugin { } public void onLateEnable() { - playerUUIDCache = (PlayerUUIDCache) getServer().getPluginManager().getPlugin("PlayerUUIDCache"); + if(getServer().getPluginManager().getPlugin("PlayerUUIDCache") != null) { + playerUUIDCache = (PlayerUUIDCache) getServer().getPluginManager().getPlugin("PlayerUUIDCache"); + } else { + this.getLogger().log(Level.WARNING, "PlayerUUIDCache not found."); + } + if(getServer().getPluginManager().getPlugin("CubesideStatistics") != null) { cubesideStatistics = getServer().getServicesManager().load(CubesideStatisticsAPI.class); } else { diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index c5d49ad..1ac16a2 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -4,6 +4,9 @@ author: LunarAkai website: https://github.com/LunarAkai/Minecleaner main: de.lunarakai.minecleaner.MinecleanerPlugin api-version: '1.20' +depend: + - CubesideUtils +softdepend: [CubesideSettings, PlayerUUIDCache] commands: minecleaner: description: main command