diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java index 2a2466f320..1f4b35d857 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java @@ -337,7 +337,7 @@ private Optional checkRecipe( return Optional.empty(); } - private Optional checkPedestals( + public static Optional checkPedestals( List items, AltarRecipe recipe) { for (int i = 0; i < 8; i++) { if (SlimefunUtils.isItemSimilar(items.get(i), recipe.getInput().get(0), true)) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AutoCrafterListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AutoCrafterListener.java index 985b904958..a31370155c 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AutoCrafterListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AutoCrafterListener.java @@ -89,7 +89,7 @@ public void onInteract(PlayerRightClickEvent e) { } } - private boolean hasUnlockedRecipe(Player p, ItemStack item) { + private static boolean hasUnlockedRecipe(Player p, ItemStack item) { for (Recipe recipe : Slimefun.getMinecraftRecipeService().getRecipesFor(item)) { if (recipe instanceof Keyed keyed && !p.hasDiscoveredRecipe(keyed.getKey())) { return false; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BackpackListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BackpackListener.java index f3c7290898..c4aa49447a 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BackpackListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BackpackListener.java @@ -144,7 +144,7 @@ public void onClick(InventoryClickEvent e) { } } - private boolean isAllowed(SlimefunBackpack backpack, @Nullable ItemStack item) { + public static boolean isAllowed(SlimefunBackpack backpack, @Nullable ItemStack item) { if (item == null || item.getType() == Material.AIR) { return true; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java index 836fe372d7..2856d87632 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java @@ -1,6 +1,7 @@ package io.github.thebusybiscuit.slimefun4.implementation.listeners; import com.xzavier0722.mc.plugin.slimefun4.storage.callback.IAsyncReadCallback; +import com.xzavier0722.mc.plugin.slimefun4.storage.controller.ASlimefunDataContainer; import com.xzavier0722.mc.plugin.slimefun4.storage.controller.BlockDataController; import com.xzavier0722.mc.plugin.slimefun4.storage.controller.SlimefunBlockData; import com.xzavier0722.mc.plugin.slimefun4.storage.controller.SlimefunUniversalBlockData; @@ -66,7 +67,7 @@ public void onBlockPlaceExisting(BlockPlaceEvent e) { // Fixes #2636 - This will solve the "ghost blocks" issue if (e.getBlockReplacedState().getType().isAir()) { - var blockData = StorageCacheUtils.getBlock(loc); + SlimefunBlockData blockData = StorageCacheUtils.getBlock(loc); if (blockData != null && blockData.isPendingRemove()) { e.setCancelled(true); return; @@ -147,7 +148,7 @@ public void onBlockPlace(BlockPlaceEvent e) { .getBlockDataController() .createUniversalBlock(block.getLocation(), sfItem.getId()); - if (Slimefun.getBlockDataService().isTileEntity(block.getType())) { + if (BlockDataService.isTileEntity(block.getType())) { Slimefun.getBlockDataService().updateUniversalDataUUID(block, data.getKey()); } } else { @@ -174,12 +175,12 @@ public void onBlockBreak(BlockBreakEvent e) { return; } - var heldItem = e.getPlayer().getInventory().getItemInMainHand(); - var block = e.getBlock(); - var blockData = StorageCacheUtils.hasBlock(block.getLocation()) + ItemStack heldItem = e.getPlayer().getInventory().getItemInMainHand(); + Block block = e.getBlock(); + ASlimefunDataContainer blockData = StorageCacheUtils.hasBlock(block.getLocation()) ? StorageCacheUtils.getBlock(block.getLocation()) : StorageCacheUtils.getUniversalBlock(block); - var sfItem = blockData == null ? null : SlimefunItem.getById(blockData.getSfId()); + SlimefunItem sfItem = blockData == null ? null : SlimefunItem.getById(blockData.getSfId()); // If there is a Slimefun Block here, call our BreakEvent and, if cancelled, cancel this event // and return @@ -216,7 +217,7 @@ public void onBlockBreak(BlockBreakEvent e) { if (!blockData.isDataLoaded()) { e.setDropItems(false); - var type = block.getType(); + Material type = block.getType(); StorageCacheUtils.executeAfterLoad( blockData, () -> { @@ -246,7 +247,7 @@ public void onBlockBreak(BlockBreakEvent e) { } } - private void callToolHandler(BlockBreakEvent e, ItemStack item, int fortune, List drops) { + public static void callToolHandler(BlockBreakEvent e, ItemStack item, int fortune, List drops) { SlimefunItem tool = SlimefunItem.getByItem(item); if (tool != null) { @@ -258,8 +259,8 @@ private void callToolHandler(BlockBreakEvent e, ItemStack item, int fortune, Lis } } - private void callBlockHandler(BlockBreakEvent e, ItemStack item, List drops) { - var loc = e.getBlock().getLocation(); + public static void callBlockHandler(BlockBreakEvent e, ItemStack item, List drops) { + Location loc = e.getBlock().getLocation(); SlimefunItem sfItem = StorageCacheUtils.getSfItem(loc); if (sfItem != null && !sfItem.useVanillaBlockBreaking()) { @@ -274,7 +275,7 @@ private void callBlockHandler(BlockBreakEvent e, ItemStack item, List } } - private void dropItems( + public static void dropItems( BlockBreakEvent e, ItemStack item, Block block, @Nullable SlimefunItem sfBlock, List drops) { if (!drops.isEmpty()) { // Fixes #2560 @@ -308,8 +309,8 @@ private void checkForSensitiveBlockAbove(Player player, Block block, ItemStack i Block blockAbove = block.getRelative(BlockFace.UP); if (SlimefunTag.SENSITIVE_MATERIALS.isTagged(blockAbove.getType())) { - var loc = blockAbove.getLocation(); - var blockData = StorageCacheUtils.getBlock(loc); + Location loc = blockAbove.getLocation(); + SlimefunBlockData blockData = StorageCacheUtils.getBlock(loc); SlimefunItem sfItem = StorageCacheUtils.getSfItem(loc); if (sfItem != null && !sfItem.useVanillaBlockBreaking()) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockPhysicsListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockPhysicsListener.java index ae54c5abf9..7a9a041861 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockPhysicsListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockPhysicsListener.java @@ -101,7 +101,7 @@ public void onResult(SlimefunBlockData result) { } } - private void callHandler(BlockBreakHandler handler, Block b) { + public static void callHandler(BlockBreakHandler handler, Block b) { if (handler.isExplosionAllowed(b)) { b.setType(Material.AIR); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ButcherAndroidListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ButcherAndroidListener.java index bbe7111c0f..ba8d762121 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ButcherAndroidListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ButcherAndroidListener.java @@ -78,7 +78,7 @@ public void onDeath(EntityDeathEvent e) { * @param entityType * The {@link EntityType} of the killed entity */ - private void addExtraDrops(List drops, EntityType entityType) { + public static void addExtraDrops(List drops, EntityType entityType) { Random random = ThreadLocalRandom.current(); if (entityType == EntityType.WITHER_SKELETON && random.nextInt(250) < 2) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/CargoNodeListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/CargoNodeListener.java index fb093e91bd..b7f8434b40 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/CargoNodeListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/CargoNodeListener.java @@ -51,11 +51,11 @@ public void onCargoNodePlace(BlockPlaceEvent e) { } } - private boolean isCargoNode(ItemStack item) { + public static boolean isCargoNode(ItemStack item) { return SlimefunItem.getByItem(item) instanceof CargoNode; } - private boolean isContainer(Block block) { + public static boolean isContainer(Block block) { return block.getState() instanceof Container || Slimefun.getDatabaseManager().getBlockDataController().getBlockData(block.getLocation()) != null; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ExplosionsListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ExplosionsListener.java index 5bf8683852..c33387c8b4 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ExplosionsListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ExplosionsListener.java @@ -56,7 +56,7 @@ public void onBlockExplode(BlockExplodeEvent e) { removeResistantBlocks(e.blockList().iterator()); } - private void removeResistantBlocks(Iterator blocks) { + public static void removeResistantBlocks(Iterator blocks) { while (blocks.hasNext()) { Block block = blocks.next(); var loc = block.getLocation(); @@ -92,7 +92,7 @@ public void onResult(SlimefunBlockData result) { } } - private void handleExplosion(BlockBreakHandler handler, Block block) { + public static void handleExplosion(BlockBreakHandler handler, Block block) { if (handler.isExplosionAllowed(block)) { block.setType(Material.AIR); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/GadgetsListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/GadgetsListener.java index 97da1d07b3..3024eb0904 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/GadgetsListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/GadgetsListener.java @@ -62,7 +62,7 @@ public void onToggleSneak(PlayerToggleSneakEvent e) { } } - private void handleChestplate(Player p, @Nullable SlimefunItem chestplate) { + public static void handleChestplate(Player p, @Nullable SlimefunItem chestplate) { if (chestplate == null || !chestplate.canUse(p, true)) { return; } @@ -78,7 +78,7 @@ private void handleChestplate(Player p, @Nullable SlimefunItem chestplate) { } } - private void handleBoots(Player p, @Nullable SlimefunItem boots) { + public static void handleBoots(Player p, @Nullable SlimefunItem boots) { if (boots instanceof JetBoots jetBoots && boots.canUse(p, true)) { double speed = jetBoots.getSpeed(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/MiddleClickListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/MiddleClickListener.java index 44ce388b9e..93d976a1fd 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/MiddleClickListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/MiddleClickListener.java @@ -72,7 +72,7 @@ public void onInventoryCreativeEvent(InventoryCreativeEvent e) { } } - private boolean isActualMiddleClick(InventoryCreativeEvent e, Block b) { + public static boolean isActualMiddleClick(InventoryCreativeEvent e, Block b) { /* * On a middle click outside the user inventory, cursor will be set * to the actual block that is middle clicked, while currentItem will be AIR. diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/MultiBlockListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/MultiBlockListener.java index 414d2271cb..cf8b19d710 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/MultiBlockListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/MultiBlockListener.java @@ -95,7 +95,7 @@ private boolean compareMaterialsVertical( && (bottom == null || equals(b.getRelative(BlockFace.DOWN).getType(), bottom)); } - private boolean equals(Material a, Material b) { + public static boolean equals(Material a, Material b) { if (a == b) { return true; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/RadioactivityListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/RadioactivityListener.java index e8d87de12a..bb5b887419 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/RadioactivityListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/RadioactivityListener.java @@ -30,7 +30,7 @@ public void onPlayerJoin(PlayerJoinEvent e) { addGracePeriod(e.getPlayer()); } - private void addGracePeriod(Player entity) { + public static void addGracePeriod(Player entity) { RadiationUtils.clearExposure(entity); RadiationTask.addGracePeriod(entity); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunBootsListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunBootsListener.java index 33e518b8ea..482d918ddd 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunBootsListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunBootsListener.java @@ -63,7 +63,7 @@ private void onFallDamage(EntityDamageEvent e) { return; } - if (boots instanceof StomperBoots stomperBoots) { + if (boots instanceof StomperBoots) { e.setCancelled(true); StomperBoots.stomp(e); } else if (boots instanceof LongFallBoots longFallBoots) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunGuideListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunGuideListener.java index 3f8c7308b0..4f9b49f6e4 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunGuideListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunGuideListener.java @@ -66,7 +66,7 @@ public void onInteract(PlayerRightClickEvent e) { } } - private void openGuide(Player p, PlayerRightClickEvent e, SlimefunGuideMode layout) { + public static void openGuide(Player p, PlayerRightClickEvent e, SlimefunGuideMode layout) { SlimefunGuideOpenEvent event = new SlimefunGuideOpenEvent(p, e.getItem(), layout); Bukkit.getPluginManager().callEvent(event); @@ -76,7 +76,7 @@ private void openGuide(Player p, PlayerRightClickEvent e, SlimefunGuideMode layo } } - private Result tryOpenGuide(Player p, PlayerRightClickEvent e, SlimefunGuideMode layout) { + public static Result tryOpenGuide(Player p, PlayerRightClickEvent e, SlimefunGuideMode layout) { ItemStack item = e.getItem(); if (SlimefunUtils.isItemSimilar(item, SlimefunGuide.getItem(layout), false, false)) { if (!Slimefun.getWorldSettingsService().isWorldEnabled(p.getWorld())) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunItemInteractListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunItemInteractListener.java index 60fbcbbbe9..246f61b383 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunItemInteractListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunItemInteractListener.java @@ -84,7 +84,7 @@ public void onRightClick(PlayerInteractEvent e) { } } - private boolean rightClickItem(PlayerInteractEvent e, PlayerRightClickEvent event, boolean defaultValue) { + public static boolean rightClickItem(PlayerInteractEvent e, PlayerRightClickEvent event, boolean defaultValue) { Optional optional = event.getSlimefunItem(); if (optional.isPresent()) { @@ -100,7 +100,7 @@ private boolean rightClickItem(PlayerInteractEvent e, PlayerRightClickEvent even return defaultValue; } - private boolean rightClickBlock(PlayerRightClickEvent event) { + public static boolean rightClickBlock(PlayerRightClickEvent event) { Optional optional = event.getSlimefunBlock(); if (optional.isPresent()) { @@ -127,7 +127,7 @@ private boolean rightClickBlock(PlayerRightClickEvent event) { return true; } - private void openInventory(Player p, SlimefunItem item, Block clickedBlock, PlayerRightClickEvent event) { + public static void openInventory(Player p, SlimefunItem item, Block clickedBlock, PlayerRightClickEvent event) { try { if (!p.isSneaking() || event.getItem().getType() == Material.AIR) { event.getInteractEvent().setCancelled(true); @@ -195,7 +195,7 @@ public void onResult(SlimefunBlockData result) { } } - private void openMenu(DirtyChestMenu menu, Block b, Player p) { + public static void openMenu(DirtyChestMenu menu, Block b, Player p) { if (menu != null) { if (menu.canOpen(b, p)) { menu.open(p); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java index 48aedd3e06..3271b050e9 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java @@ -116,7 +116,7 @@ private void onProjectileDamage(EntityDamageByEntityEvent e) { * @param projectile * The {@link Projectile} that hit this {@link Player} */ - private void returnProjectile(Player p, Projectile projectile) { + public static void returnProjectile(Player p, Projectile projectile) { Vector direction = p.getEyeLocation().getDirection().multiply(2.0); Location loc = p.getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()); @@ -174,7 +174,7 @@ public void onKill(EntityDeathEvent e) { } } - private Collection getExtraDrops(LivingEntity entity, Collection drops) { + public static Collection getExtraDrops(LivingEntity entity, Collection drops) { List items = new ArrayList<>(drops); // Prevent duplication of items stored inside a Horse's chest @@ -401,7 +401,7 @@ public void onBlockBreak(BlockBreakEvent e) { } } - private int getAmountWithFortune(Material type, int fortuneLevel) { + public static int getAmountWithFortune(Material type, int fortuneLevel) { if (fortuneLevel > 0) { Random random = ThreadLocalRandom.current(); int amount = random.nextInt(fortuneLevel + 2) - 1; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TeleporterListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TeleporterListener.java index 65b18b651b..e8bf6a24b5 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TeleporterListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TeleporterListener.java @@ -90,7 +90,7 @@ public void onResult(SlimefunBlockData result) { } } - private void teleport(String ownerUid, Player p, Block b) { + public static void teleport(String ownerUid, Player p, Block b) { Slimefun.getGPSNetwork().getTeleportationManager().openTeleporterGUI(p, UUID.fromString(ownerUid), b); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/VillagerTradingListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/VillagerTradingListener.java index 3c719b36cc..1f81ae3984 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/VillagerTradingListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/VillagerTradingListener.java @@ -49,7 +49,7 @@ public void onPreTrade(InventoryClickEvent e) { } } - private boolean isUnallowed(@Nullable SlimefunItem item) { + public static boolean isUnallowed(@Nullable SlimefunItem item) { return item != null && !(item instanceof VanillaItem) && !(item instanceof SyntheticEmerald) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/crafting/SmithingTableListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/crafting/SmithingTableListener.java index c9d0ea9ecf..7ed14bb956 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/crafting/SmithingTableListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/crafting/SmithingTableListener.java @@ -40,7 +40,7 @@ public void onPrepareSmith(PrepareSmithingEvent e) { } } - private int materialSlot() { + public static int materialSlot() { if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_20)) { return 2; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/entity/MobDropListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/entity/MobDropListener.java index 023bed8e95..45d29b61c7 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/entity/MobDropListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/entity/MobDropListener.java @@ -57,7 +57,7 @@ public void onEntityKill(EntityDeathEvent e) { } } - private boolean canDrop(Player p, ItemStack item) { + public static boolean canDrop(Player p, ItemStack item) { SlimefunItem sfItem = SlimefunItem.getByItem(item); if (sfItem == null) {