From 251f7abc61280b6711f9f76a09a2f19f86bccee6 Mon Sep 17 00:00:00 2001 From: Christian Koop Date: Fri, 19 Jul 2024 19:09:59 +0200 Subject: [PATCH] fix: replace usage of core's ServerVersion with new MajorServerVersion I can't be bothered to update 100+ or whatever usages and conditions. Too much brain work to re-think all those constraints. --- .../java/com/craftaro/skyblock/SkyBlock.java | 17 ++++----- .../skyblock/blockscanner/BlockScanner.java | 3 +- .../blockscanner/MaterialIDHelper.java | 4 +- .../skyblock/generator/GeneratorManager.java | 5 ++- .../craftaro/skyblock/island/IslandLevel.java | 9 +++-- .../skyblock/island/IslandManager.java | 7 ++-- .../levelling/IslandLevelManager.java | 5 ++- .../skyblock/limit/impl/BlockLimitation.java | 5 ++- .../skyblock/listeners/BlockListeners.java | 27 +++++++------- .../skyblock/listeners/EntityListeners.java | 19 +++++----- .../listeners/FallBreakListeners.java | 3 +- .../skyblock/listeners/GrowListeners.java | 3 +- .../skyblock/listeners/MoveListeners.java | 3 +- .../skyblock/listeners/SpawnerListeners.java | 3 +- .../craftaro/skyblock/menus/Levelling.java | 3 +- .../com/craftaro/skyblock/menus/Upgrade.java | 9 +++-- .../skyblock/menus/admin/Creator.java | 5 ++- .../skyblock/menus/admin/Generator.java | 3 +- .../skyblock/menus/admin/Levelling.java | 5 ++- .../skyblock/menus/admin/Upgrade.java | 5 ++- .../permission/PermissionManager.java | 3 +- .../listening/AnimalBreedingPermission.java | 7 ++-- .../listening/DamagePermission.java | 3 +- .../listening/PortalPermission.java | 3 +- .../listening/TradingPermission.java | 3 +- .../craftaro/skyblock/scoreboard/Board.java | 5 ++- .../skyblock/stackable/Stackable.java | 3 +- .../skyblock/tasks/MobNetherWaterTask.java | 3 +- .../skyblock/utils/item/InventoryUtil.java | 5 ++- .../skyblock/utils/item/ItemStackUtil.java | 7 ++-- .../utils/structure/SchematicUtil.java | 3 +- .../utils/version/CompatibleSpawners.java | 3 +- .../skyblock/utils/version/SBiome.java | 3 +- .../skyblock/utils/world/LocationUtil.java | 7 ++-- .../skyblock/utils/world/block/BlockUtil.java | 37 ++++++++++--------- .../utils/world/entity/EntityUtil.java | 11 +++--- .../world/generator/VoidGenerator.java | 3 +- 37 files changed, 143 insertions(+), 109 deletions(-) diff --git a/src/main/java/com/craftaro/skyblock/SkyBlock.java b/src/main/java/com/craftaro/skyblock/SkyBlock.java index 4c441b5d..27e8af42 100644 --- a/src/main/java/com/craftaro/skyblock/SkyBlock.java +++ b/src/main/java/com/craftaro/skyblock/SkyBlock.java @@ -2,13 +2,12 @@ package com.craftaro.skyblock; import com.craftaro.core.SongodaCore; import com.craftaro.core.SongodaPlugin; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerProject; -import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.configuration.Config; import com.craftaro.core.gui.GuiManager; import com.craftaro.core.hooks.HologramManager; import com.craftaro.core.hooks.LogManager; -import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.skyblock.api.SkyBlockAPI; import com.craftaro.skyblock.ban.BanManager; import com.craftaro.skyblock.bank.BankManager; @@ -71,6 +70,7 @@ import com.craftaro.skyblock.usercache.UserCacheManager; import com.craftaro.skyblock.visit.VisitManager; import com.craftaro.skyblock.visit.VisitTask; import com.craftaro.skyblock.world.WorldManager; +import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import net.milkbowl.vault.permission.Permission; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -81,9 +81,7 @@ import org.bukkit.plugin.PluginManager; import org.jetbrains.annotations.NotNull; import java.io.File; -import java.util.HashSet; import java.util.List; -import java.util.Set; public class SkyBlock extends SongodaPlugin { private FileManager fileManager; @@ -154,17 +152,18 @@ public class SkyBlock extends SongodaPlugin { @Override public void onPluginEnable() { - if (ServerVersion.isServerVersionAbove(ServerVersion.V1_20) || ServerVersion.isServerVersionBelow(ServerVersion.V1_8)) { + if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_20) || MajorServerVersion.isServerVersionBelow(MajorServerVersion.V1_8)) { this.getLogger().warning("This Minecraft version is not officially supported."); } - if (this.paper = ServerProject.isServer(ServerProject.PAPER)) { + this.paper = ServerProject.isServer(ServerProject.PAPER); + if (this.paper) { try { Bukkit.spigot().getClass().getMethod("getPaperConfig"); - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_16)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_16)) { this.paperAsync = true; } else { - this.paperAsync = ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13) && + this.paperAsync = MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13) && Bukkit.spigot().getPaperConfig().getBoolean("settings.async-chunks.enable", false); } } catch (NoSuchMethodException ignored) { @@ -266,7 +265,7 @@ public class SkyBlock extends SongodaPlugin { pluginManager.registerEvents(new FallBreakListeners(this), this); pluginManager.registerEvents(new WorldListeners(this), this); - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) { pluginManager.registerEvents(new SpongeListeners(this), this); } diff --git a/src/main/java/com/craftaro/skyblock/blockscanner/BlockScanner.java b/src/main/java/com/craftaro/skyblock/blockscanner/BlockScanner.java index 5f59f0e8..956e13f8 100644 --- a/src/main/java/com/craftaro/skyblock/blockscanner/BlockScanner.java +++ b/src/main/java/com/craftaro/skyblock/blockscanner/BlockScanner.java @@ -1,6 +1,7 @@ package com.craftaro.skyblock.blockscanner; import com.craftaro.core.compatibility.CompatibleMaterial; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.skyblock.utils.world.WorldUtil; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; @@ -272,7 +273,7 @@ public final class BlockScanner extends BukkitRunnable { for (int z = initZ; z <= lastZ; z++) { for (int y = scanY; y < world.getMaxHeight(); y++) { final Optional type = CompatibleMaterial.getMaterial( - ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13) + MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13) ? shot.getSnapshot().getBlockType(x, y, z) : MaterialIDHelper.getLegacyMaterial(getBlockTypeID(shot, x, y, z))); diff --git a/src/main/java/com/craftaro/skyblock/blockscanner/MaterialIDHelper.java b/src/main/java/com/craftaro/skyblock/blockscanner/MaterialIDHelper.java index 44d4d0df..d45b48be 100644 --- a/src/main/java/com/craftaro/skyblock/blockscanner/MaterialIDHelper.java +++ b/src/main/java/com/craftaro/skyblock/blockscanner/MaterialIDHelper.java @@ -1,6 +1,6 @@ package com.craftaro.skyblock.blockscanner; -import com.craftaro.core.compatibility.ServerVersion; +import com.craftaro.core.compatibility.MajorServerVersion; import org.bukkit.Material; import java.util.HashMap; @@ -15,7 +15,7 @@ public final class MaterialIDHelper { static { MATERIALS = new HashMap<>(); - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) { for (Material type : Material.values()) { if (type.isLegacy()) { MATERIALS.put(type.getId(), type); diff --git a/src/main/java/com/craftaro/skyblock/generator/GeneratorManager.java b/src/main/java/com/craftaro/skyblock/generator/GeneratorManager.java index 569b57a5..02b6c61b 100644 --- a/src/main/java/com/craftaro/skyblock/generator/GeneratorManager.java +++ b/src/main/java/com/craftaro/skyblock/generator/GeneratorManager.java @@ -1,6 +1,7 @@ package com.craftaro.skyblock.generator; import com.craftaro.core.compatibility.CompatibleMaterial; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.third_party.com.cryptomorin.xseries.XBlock; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; @@ -109,7 +110,7 @@ public class GeneratorManager { @SuppressWarnings("deprecation") private int getLiquidLevel(Block block) { - if (ServerVersion.isServerVersionAbove(ServerVersion.V1_12) && block.getState().getBlockData() instanceof Levelled) { + if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_12) && block.getState().getBlockData() instanceof Levelled) { Levelled levelled = (Levelled) block.getState().getBlockData(); return levelled.getLevel(); } else { @@ -131,7 +132,7 @@ public class GeneratorManager { this.plugin.getSoundManager().playSound(block.getLocation(), XSound.BLOCK_FIRE_EXTINGUISH, 1, 10); - if (ServerVersion.isServerVersionAbove(ServerVersion.V1_12)) { + if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_12)) { XBlock.setType(block, materials); } else { ItemStack is = materials.parseItem(); diff --git a/src/main/java/com/craftaro/skyblock/island/IslandLevel.java b/src/main/java/com/craftaro/skyblock/island/IslandLevel.java index bd246231..6f74c01f 100644 --- a/src/main/java/com/craftaro/skyblock/island/IslandLevel.java +++ b/src/main/java/com/craftaro/skyblock/island/IslandLevel.java @@ -1,5 +1,6 @@ package com.craftaro.skyblock.island; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.skyblock.SkyBlock; @@ -104,7 +105,7 @@ public class IslandLevel { } public long getMaterialPoints(String material) { - if (ServerVersion.isServerVersion(ServerVersion.V1_8)) { + if (MajorServerVersion.isServerVersion(MajorServerVersion.V1_8)) { switch (material.toUpperCase()) { case "DIODE_BLOCK_OFF": case "DIODE_BLOCK_ON": @@ -216,7 +217,7 @@ public class IslandLevel { } public void setMaterialAmount(String material, long amount) { - if (ServerVersion.isServerVersion(ServerVersion.V1_8)) { + if (MajorServerVersion.isServerVersion(MajorServerVersion.V1_8)) { switch (material.toUpperCase()) { case "DIODE_BLOCK_OFF": case "DIODE_BLOCK_ON": @@ -232,7 +233,7 @@ public class IslandLevel { } public long getMaterialAmount(String material) { - if (ServerVersion.isServerVersion(ServerVersion.V1_8)) { + if (MajorServerVersion.isServerVersion(MajorServerVersion.V1_8)) { switch (material.toUpperCase()) { case "DIODE_BLOCK_OFF": case "DIODE_BLOCK_ON": @@ -244,7 +245,7 @@ public class IslandLevel { } public void removeMaterial(String material) { - if (ServerVersion.isServerVersion(ServerVersion.V1_8)) { + if (MajorServerVersion.isServerVersion(MajorServerVersion.V1_8)) { switch (material.toUpperCase()) { case "DIODE_BLOCK_OFF": case "DIODE_BLOCK_ON": diff --git a/src/main/java/com/craftaro/skyblock/island/IslandManager.java b/src/main/java/com/craftaro/skyblock/island/IslandManager.java index 37c01ed9..189363fd 100644 --- a/src/main/java/com/craftaro/skyblock/island/IslandManager.java +++ b/src/main/java/com/craftaro/skyblock/island/IslandManager.java @@ -5,6 +5,7 @@ import com.bekvon.bukkit.residence.containers.Flags; import com.bekvon.bukkit.residence.protection.ClaimedResidence; import com.craftaro.core.compatibility.CompatibleBiome; import com.craftaro.core.compatibility.CompatibleMaterial; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.nms.Nms; import com.craftaro.skyblock.SkyBlock; @@ -1502,7 +1503,7 @@ public class IslandManager { updateFlight(player); if (world == IslandWorld.NETHER) { - if (ServerVersion.isServerVersionBelow(ServerVersion.V1_13)) { + if (MajorServerVersion.isServerVersionBelow(MajorServerVersion.V1_13)) { return; } } @@ -1665,7 +1666,7 @@ public class IslandManager { double increment = island.getSize() % 2 != 0 ? 0.5d : 0.0d; for (IslandWorld worldList : IslandWorld.getIslandWorlds()) { - if (worldList != IslandWorld.NETHER || ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { + if (worldList != IslandWorld.NETHER || MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) { Bukkit.getScheduler().runTask(this.plugin, () -> { for (Player all : getPlayersAtIsland(island)) { Nms.getImplementations().getWorldBorder().send(all, island.getBorderColor(), island.getSize(), island.getLocation(worldManager.getIslandWorld(all.getWorld()), IslandEnvironment.ISLAND).clone().add(increment, 0, increment)); @@ -1677,7 +1678,7 @@ public class IslandManager { } } else { for (IslandWorld worldList : IslandWorld.getIslandWorlds()) { - if (worldList != IslandWorld.NETHER || ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { + if (worldList != IslandWorld.NETHER || MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) { Bukkit.getScheduler().runTask(this.plugin, () -> { for (Player all : getPlayersAtIsland(island)) { Nms.getImplementations().getWorldBorder().send(all, null, 1.4999992E7D, new Location(all.getWorld(), 0, 0, 0)); diff --git a/src/main/java/com/craftaro/skyblock/levelling/IslandLevelManager.java b/src/main/java/com/craftaro/skyblock/levelling/IslandLevelManager.java index 16be796a..fe1d1a9e 100644 --- a/src/main/java/com/craftaro/skyblock/levelling/IslandLevelManager.java +++ b/src/main/java/com/craftaro/skyblock/levelling/IslandLevelManager.java @@ -1,6 +1,7 @@ package com.craftaro.skyblock.levelling; import com.craftaro.core.compatibility.CompatibleMaterial; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.skyblock.SkyBlock; @@ -260,7 +261,7 @@ public final class IslandLevelManager { // placed. // This shouldn't cause any issues besides the task number being increased // insanely fast. - if (ServerVersion.isServerVersion(ServerVersion.V1_8)) { + if (MajorServerVersion.isServerVersion(MajorServerVersion.V1_8)) { Bukkit.getScheduler().runTask(this.plugin, () -> { updateLevelLocation(island, location); }); @@ -272,7 +273,7 @@ public final class IslandLevelManager { private void updateLevelLocation(Island island, Location location) { Block block = location.getBlock(); XMaterial material = null; - if (ServerVersion.isServerVersion(ServerVersion.V1_8)) { + if (MajorServerVersion.isServerVersion(MajorServerVersion.V1_8)) { switch (block.getType().toString().toUpperCase()) { case "DIODE_BLOCK_OFF": case "DIODE_BLOCK_ON": diff --git a/src/main/java/com/craftaro/skyblock/limit/impl/BlockLimitation.java b/src/main/java/com/craftaro/skyblock/limit/impl/BlockLimitation.java index e9de9074..fd107bf0 100644 --- a/src/main/java/com/craftaro/skyblock/limit/impl/BlockLimitation.java +++ b/src/main/java/com/craftaro/skyblock/limit/impl/BlockLimitation.java @@ -1,6 +1,7 @@ package com.craftaro.skyblock.limit.impl; import com.craftaro.core.compatibility.CompatibleMaterial; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.skyblock.SkyBlock; @@ -73,7 +74,7 @@ public final class BlockLimitation extends EnumLimitation { } XMaterial material = null; - if (ServerVersion.isServerVersion(ServerVersion.V1_8)) { + if (MajorServerVersion.isServerVersion(MajorServerVersion.V1_8)) { switch (type.toString().toUpperCase()) { case "DIODE_BLOCK_OFF": case "DIODE_BLOCK_ON": @@ -111,7 +112,7 @@ public final class BlockLimitation extends EnumLimitation { totalPlaced = island.getLevel().getMaterials().entrySet().stream().filter(x -> x.getKey().contains("SPAWNER")).mapToLong(Map.Entry::getValue).sum(); } else { XMaterial material = null; - if (ServerVersion.isServerVersion(ServerVersion.V1_8)) { + if (MajorServerVersion.isServerVersion(MajorServerVersion.V1_8)) { switch (type.toString().toUpperCase()) { case "DIODE_BLOCK_OFF": case "DIODE_BLOCK_ON": diff --git a/src/main/java/com/craftaro/skyblock/listeners/BlockListeners.java b/src/main/java/com/craftaro/skyblock/listeners/BlockListeners.java index 6da81453..dd2e4de7 100644 --- a/src/main/java/com/craftaro/skyblock/listeners/BlockListeners.java +++ b/src/main/java/com/craftaro/skyblock/listeners/BlockListeners.java @@ -1,6 +1,7 @@ package com.craftaro.skyblock.listeners; import com.craftaro.core.compatibility.CompatibleMaterial; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.hooks.LogManager; import com.craftaro.third_party.com.cryptomorin.xseries.XBlock; @@ -115,7 +116,7 @@ public class BlockListeners implements Listener { Stackable stackable = stackableManager.getStack(block.getLocation(), CompatibleMaterial.getMaterial(block.getType()).get()); if (stackable != null) { XMaterial material = null; - if (ServerVersion.isServerVersion(ServerVersion.V1_8)) { + if (MajorServerVersion.isServerVersion(MajorServerVersion.V1_8)) { switch (block.getType().toString().toUpperCase()) { case "DIODE_BLOCK_OFF": case "DIODE_BLOCK_ON": @@ -194,7 +195,7 @@ public class BlockListeners implements Listener { } XMaterial material = null; - if (ServerVersion.isServerVersion(ServerVersion.V1_8)) { + if (MajorServerVersion.isServerVersion(MajorServerVersion.V1_8)) { switch (block.getType().toString().toUpperCase()) { case "DIODE_BLOCK_OFF": case "DIODE_BLOCK_ON": @@ -271,7 +272,7 @@ public class BlockListeners implements Listener { return; } - if (ServerVersion.isServerVersionAbove(ServerVersion.V1_8)) { + if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_8)) { if (event instanceof BlockMultiPlaceEvent) { for (BlockState blockState : ((BlockMultiPlaceEvent) event).getReplacedBlockStates()) { if (!island.equals(islandManager.getIslandAtLocation(blockState.getLocation()))) { @@ -360,7 +361,7 @@ public class BlockListeners implements Listener { if (limits.isBlockLimitExceeded(block, limit) && !XMaterial.ENDER_EYE.isSimilar(item)) { XMaterial material = null; - if (ServerVersion.isServerVersion(ServerVersion.V1_8)) { + if (MajorServerVersion.isServerVersion(MajorServerVersion.V1_8)) { switch (block.getType().toString().toUpperCase()) { case "DIODE_BLOCK_OFF": case "DIODE_BLOCK_ON": @@ -391,7 +392,7 @@ public class BlockListeners implements Listener { // Not util used 2 islandLevelManager if condition is true // Sponge level dupe fix - if (ServerVersion.isServerVersionBelow(ServerVersion.V1_13) && + if (MajorServerVersion.isServerVersionBelow(MajorServerVersion.V1_13) && block.getType() == XMaterial.SPONGE.parseMaterial()) { Bukkit.getScheduler().runTask(this.plugin, () -> { if (blockLoc.getBlock().getType() == XMaterial.WET_SPONGE.parseMaterial()) { @@ -454,7 +455,7 @@ public class BlockListeners implements Listener { for (Entity ent : entities) { boolean witherSkeleton; - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_11)) { witherSkeleton = ent.getType().equals(EntityType.WITHER_SKELETON); } else { witherSkeleton = ent instanceof Skeleton && ((Skeleton) ent).getSkeletonType().equals(Skeleton.SkeletonType.WITHER); @@ -464,7 +465,7 @@ public class BlockListeners implements Listener { XSound.BLOCK_FIRE_EXTINGUISH.play(block.getLocation()); event.getToBlock().getWorld().playEffect(block.getLocation(), Effect.SMOKE, 1); } else { - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_16)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_16)) { if (((ent instanceof Piglin || ent instanceof Hoglin) || ent instanceof Strider) || ent instanceof Zoglin) { event.setCancelled(true); XSound.BLOCK_FIRE_EXTINGUISH.play(block.getLocation()); @@ -488,7 +489,7 @@ public class BlockListeners implements Listener { return; } - if (ServerVersion.isServerVersionBelow(ServerVersion.V1_12)) { + if (MajorServerVersion.isServerVersionBelow(MajorServerVersion.V1_12)) { Bukkit.getScheduler().runTaskLater(this.plugin, () -> { handleGeneration(block, island, event.getToBlock().getState()); }, 1L); @@ -719,7 +720,7 @@ public class BlockListeners implements Listener { IslandManager islandManager = this.plugin.getIslandManager(); // PortalCreateEvent.getBlocks() changed from ArrayList to // ArrayList in 1.14.1 - if (ServerVersion.isServerVersionAbove(ServerVersion.V1_13)) { + if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_13)) { List blocks = event.getBlocks(); // TODO 1.8 if (event.getBlocks().isEmpty()) { return; @@ -828,7 +829,7 @@ public class BlockListeners implements Listener { if (CompatibleMaterial.isAir(destmaterial)) { return; } - if (ServerVersion.isServerVersion(ServerVersion.V1_8)) { + if (MajorServerVersion.isServerVersion(MajorServerVersion.V1_8)) { switch (event.getToBlock().getType().toString().toUpperCase()) { case "DIODE_BLOCK_OFF": case "DIODE_BLOCK_ON": @@ -868,7 +869,7 @@ public class BlockListeners implements Listener { XMaterial material = CompatibleMaterial.getMaterial(block.getType()).orElse(null); - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_12) + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_12) && material != XMaterial.WATER && material != XMaterial.LAVA) { return false; @@ -952,7 +953,7 @@ public class BlockListeners implements Listener { BlockState genState = generatorManager.generateBlock(generator, block); block.setType(genState.getType()); - if (ServerVersion.isServerVersionBelow(ServerVersion.V1_13)) { + if (MajorServerVersion.isServerVersionBelow(MajorServerVersion.V1_13)) { BlockState tempState = block.getState(); tempState.setData(genState.getData()); tempState.update(true, true); @@ -989,7 +990,7 @@ public class BlockListeners implements Listener { BlockState genState = generatorManager.generateBlock(generator, block); state.setType(genState.getType()); - if (ServerVersion.isServerVersionBelow(ServerVersion.V1_13)) { + if (MajorServerVersion.isServerVersionBelow(MajorServerVersion.V1_13)) { state.setData(genState.getData()); } islandLevelManager.updateLevel(island, genState.getLocation()); diff --git a/src/main/java/com/craftaro/skyblock/listeners/EntityListeners.java b/src/main/java/com/craftaro/skyblock/listeners/EntityListeners.java index 7aeaa741..f9ed59d2 100644 --- a/src/main/java/com/craftaro/skyblock/listeners/EntityListeners.java +++ b/src/main/java/com/craftaro/skyblock/listeners/EntityListeners.java @@ -1,6 +1,7 @@ package com.craftaro.skyblock.listeners; import com.craftaro.core.compatibility.CompatibleMaterial; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.third_party.com.cryptomorin.xseries.XBlock; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; @@ -242,7 +243,7 @@ public class EntityListeners implements Listener { return; } - if (ServerVersion.isServerVersion(ServerVersion.V1_8)) { + if (MajorServerVersion.isServerVersion(MajorServerVersion.V1_8)) { return; } @@ -371,7 +372,7 @@ public class EntityListeners implements Listener { && configLoad.getBoolean("Island.Spawn.Protection")) { FallingBlock fallingBlock = (FallingBlock) event.getEntity(); if (fallingBlock.getDropItem()) { - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) { fallingBlock.getWorld().dropItemNaturally(fallingBlock.getLocation(), new ItemStack(fallingBlock.getBlockData().getMaterial(), 1)); } else { @@ -532,25 +533,25 @@ public class EntityListeners implements Listener { return; } - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_10)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_10)) { if (livingEntity instanceof Donkey || livingEntity instanceof Mule || livingEntity instanceof ElderGuardian) { return; } } - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_11)) { if (livingEntity instanceof Evoker) { return; } } - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_12)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_12)) { if (livingEntity instanceof Llama) { return; } } - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_14)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_14)) { if (livingEntity instanceof Ravager || livingEntity instanceof Illager) { return; } @@ -577,7 +578,7 @@ public class EntityListeners implements Listener { if (upgrades != null && !upgrades.isEmpty() && upgrades.get(0).isEnabled() && island.isUpgrade(Upgrade.Type.DROPS)) { Set dontMultiply = new HashSet<>(); - if (ServerVersion.isServerVersionAbove(ServerVersion.V1_8)) { + if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_8)) { EntityEquipment equipment = livingEntity.getEquipment(); if (equipment != null) { for (ItemStack item : event.getDrops()) { @@ -589,7 +590,7 @@ public class EntityListeners implements Listener { } } - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_16)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_16)) { if (livingEntity instanceof Steerable) { Steerable steerable = (Steerable) livingEntity; if (steerable.hasSaddle()) { @@ -701,7 +702,7 @@ public class EntityListeners implements Listener { return; } Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, () -> { - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)) { // getPassengers() was added in 1.11 + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_11)) { // getPassengers() was added in 1.11 for (org.bukkit.entity.Entity passenger : entity.getPassengers()) { passenger.remove(); } diff --git a/src/main/java/com/craftaro/skyblock/listeners/FallBreakListeners.java b/src/main/java/com/craftaro/skyblock/listeners/FallBreakListeners.java index aed7b78e..fe6e5c7c 100644 --- a/src/main/java/com/craftaro/skyblock/listeners/FallBreakListeners.java +++ b/src/main/java/com/craftaro/skyblock/listeners/FallBreakListeners.java @@ -1,6 +1,7 @@ package com.craftaro.skyblock.listeners; import com.craftaro.core.compatibility.CompatibleMaterial; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.skyblock.SkyBlock; @@ -46,7 +47,7 @@ public class FallBreakListeners implements Listener { if (island != null) { Optional material = Optional.empty(); - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) { material = CompatibleMaterial.getMaterial(ent.getBlockData().getMaterial()); } else { try { diff --git a/src/main/java/com/craftaro/skyblock/listeners/GrowListeners.java b/src/main/java/com/craftaro/skyblock/listeners/GrowListeners.java index e79380e3..413c5b47 100644 --- a/src/main/java/com/craftaro/skyblock/listeners/GrowListeners.java +++ b/src/main/java/com/craftaro/skyblock/listeners/GrowListeners.java @@ -1,6 +1,7 @@ package com.craftaro.skyblock.listeners; import com.craftaro.core.compatibility.CompatibleMaterial; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.skyblock.SkyBlock; @@ -105,7 +106,7 @@ public class GrowListeners implements Listener { return; } - if (ServerVersion.isServerVersionAbove(ServerVersion.V1_12)) { + if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_12)) { try { Object blockData = block.getClass().getMethod("getBlockData").invoke(block); if (blockData instanceof org.bukkit.block.data.Ageable) { diff --git a/src/main/java/com/craftaro/skyblock/listeners/MoveListeners.java b/src/main/java/com/craftaro/skyblock/listeners/MoveListeners.java index 6d6dd1af..c02a2e6a 100644 --- a/src/main/java/com/craftaro/skyblock/listeners/MoveListeners.java +++ b/src/main/java/com/craftaro/skyblock/listeners/MoveListeners.java @@ -1,5 +1,6 @@ package com.craftaro.skyblock.listeners; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.third_party.com.cryptomorin.xseries.XSound; import com.craftaro.skyblock.SkyBlock; @@ -124,7 +125,7 @@ public class MoveListeners implements Listener { player.setLevel(0); player.setExp(0.0F); - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_9)) { player.setHealth(Objects.requireNonNull(player.getAttribute(Attribute.GENERIC_MAX_HEALTH)).getValue()); } else { player.setHealth(player.getMaxHealth()); diff --git a/src/main/java/com/craftaro/skyblock/listeners/SpawnerListeners.java b/src/main/java/com/craftaro/skyblock/listeners/SpawnerListeners.java index 0d2636b0..db5832bb 100644 --- a/src/main/java/com/craftaro/skyblock/listeners/SpawnerListeners.java +++ b/src/main/java/com/craftaro/skyblock/listeners/SpawnerListeners.java @@ -1,5 +1,6 @@ package com.craftaro.skyblock.listeners; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.island.Island; @@ -41,7 +42,7 @@ public class SpawnerListeners implements Listener { if (upgrades != null && !upgrades.isEmpty() && upgrades.get(0).isEnabled() && island.isUpgrade(Upgrade.Type.SPAWNER)) { - if (ServerVersion.isServerVersionAbove(ServerVersion.V1_12)) { + if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_12)) { if (spawner.getDelay() == 20) { spawner.setDelay(10); } diff --git a/src/main/java/com/craftaro/skyblock/menus/Levelling.java b/src/main/java/com/craftaro/skyblock/menus/Levelling.java index 656d50c9..87b2154f 100644 --- a/src/main/java/com/craftaro/skyblock/menus/Levelling.java +++ b/src/main/java/com/craftaro/skyblock/menus/Levelling.java @@ -1,6 +1,7 @@ package com.craftaro.skyblock.menus; import com.craftaro.core.compatibility.CompatibleMaterial; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.utils.SkullItemCreator; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; @@ -278,7 +279,7 @@ public class Levelling { String name = plugin.getLocalizationManager().getLocalizationFor(XMaterial.class).getLocale(materials.get()); - if (materials.get() == XMaterial.FARMLAND && ServerVersion.isServerVersionBelow(ServerVersion.V1_9)) { + if (materials.get() == XMaterial.FARMLAND && MajorServerVersion.isServerVersionBelow(MajorServerVersion.V1_9)) { materials = Optional.of(XMaterial.DIRT); } diff --git a/src/main/java/com/craftaro/skyblock/menus/Upgrade.java b/src/main/java/com/craftaro/skyblock/menus/Upgrade.java index ced41e58..1e5b2741 100644 --- a/src/main/java/com/craftaro/skyblock/menus/Upgrade.java +++ b/src/main/java/com/craftaro/skyblock/menus/Upgrade.java @@ -1,5 +1,6 @@ package com.craftaro.skyblock.menus; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.hooks.economies.Economy; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; @@ -495,10 +496,10 @@ public class Upgrade { if (upgrades != null && !upgrades.isEmpty() && upgrades.get(0).isEnabled()) { com.craftaro.skyblock.upgrade.Upgrade upgrade = upgrades.get(0); - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_9)) { PotionMeta pm = (PotionMeta) potion.getItemMeta(); - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_10)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_10)) { pm.setBasePotionData(new PotionData(PotionType.SPEED)); } else { pm.addCustomEffect(new PotionEffect(PotionEffectType.SPEED, 1, 0), true); @@ -547,11 +548,11 @@ public class Upgrade { if (upgrades != null && !upgrades.isEmpty() && upgrades.get(0).isEnabled()) { com.craftaro.skyblock.upgrade.Upgrade upgrade = upgrades.get(0); - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_8)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_8)) { potion = new ItemStack(Material.POTION); PotionMeta pm = (PotionMeta) potion.getItemMeta(); - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_9)) { pm.setBasePotionData(new PotionData(PotionType.JUMP)); } else { pm.addCustomEffect(new PotionEffect(PotionEffectType.JUMP, 1, 0), true); diff --git a/src/main/java/com/craftaro/skyblock/menus/admin/Creator.java b/src/main/java/com/craftaro/skyblock/menus/admin/Creator.java index 55bdd3c7..4811a429 100644 --- a/src/main/java/com/craftaro/skyblock/menus/admin/Creator.java +++ b/src/main/java/com/craftaro/skyblock/menus/admin/Creator.java @@ -1,6 +1,7 @@ package com.craftaro.skyblock.menus.admin; import com.craftaro.core.compatibility.CompatibleMaterial; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.gui.AnvilGui; import com.craftaro.core.utils.SkullItemCreator; @@ -265,7 +266,7 @@ public class Creator implements Listener { FileConfiguration configLoad = config.getFileConfiguration(); String inventoryName = ""; - if (ServerVersion.isServerVersionAbove(ServerVersion.V1_13)) { + if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_13)) { inventoryName = event.getView().getTitle(); } else { try { @@ -1212,7 +1213,7 @@ public class Creator implements Listener { FileConfiguration configLoad = config.getFileConfiguration(); String inventoryName = ""; - if (ServerVersion.isServerVersionAbove(ServerVersion.V1_13)) { + if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_13)) { inventoryName = event.getView().getTitle(); } else { try { diff --git a/src/main/java/com/craftaro/skyblock/menus/admin/Generator.java b/src/main/java/com/craftaro/skyblock/menus/admin/Generator.java index 84d9197e..81dd172c 100644 --- a/src/main/java/com/craftaro/skyblock/menus/admin/Generator.java +++ b/src/main/java/com/craftaro/skyblock/menus/admin/Generator.java @@ -1,6 +1,7 @@ package com.craftaro.skyblock.menus.admin; import com.craftaro.core.compatibility.CompatibleMaterial; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.gui.AnvilGui; import com.craftaro.core.utils.SkullItemCreator; @@ -194,7 +195,7 @@ public class Generator implements Listener { FileConfiguration configLoad = plugin.getLanguage(); String inventoryName = ""; - if (ServerVersion.isServerVersionAbove(ServerVersion.V1_13)) { + if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_13)) { inventoryName = event.getView().getTitle(); } else { try { diff --git a/src/main/java/com/craftaro/skyblock/menus/admin/Levelling.java b/src/main/java/com/craftaro/skyblock/menus/admin/Levelling.java index ed6c1fa3..2cb37635 100644 --- a/src/main/java/com/craftaro/skyblock/menus/admin/Levelling.java +++ b/src/main/java/com/craftaro/skyblock/menus/admin/Levelling.java @@ -1,6 +1,7 @@ package com.craftaro.skyblock.menus.admin; import com.craftaro.core.compatibility.CompatibleMaterial; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.gui.AnvilGui; import com.craftaro.core.utils.SkullItemCreator; @@ -168,7 +169,7 @@ public class Levelling implements Listener { FileConfiguration configLoad = plugin.getLanguage(); String inventoryName = ""; - if (ServerVersion.isServerVersionAbove(ServerVersion.V1_13)) { + if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_13)) { inventoryName = event.getView().getTitle(); } else { try { @@ -398,7 +399,7 @@ public class Levelling implements Listener { XMaterial materials = CompatibleMaterial.getMaterial(event.getCurrentItem().getType()).get(); - if (ServerVersion.isServerVersionBelow(ServerVersion.V1_13)) { + if (MajorServerVersion.isServerVersionBelow(MajorServerVersion.V1_13)) { materials.parseItem().setData(event.getCurrentItem().getData()); } diff --git a/src/main/java/com/craftaro/skyblock/menus/admin/Upgrade.java b/src/main/java/com/craftaro/skyblock/menus/admin/Upgrade.java index 044e841f..7418447f 100644 --- a/src/main/java/com/craftaro/skyblock/menus/admin/Upgrade.java +++ b/src/main/java/com/craftaro/skyblock/menus/admin/Upgrade.java @@ -1,5 +1,6 @@ package com.craftaro.skyblock.menus.admin; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.gui.AnvilGui; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; @@ -240,7 +241,7 @@ public class Upgrade { ItemStack jumpPotion = new ItemStack(Material.POTION); com.craftaro.skyblock.upgrade.Upgrade upgrade; - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) { PotionMeta pm = (PotionMeta) speedPotion.getItemMeta(); pm.setBasePotionData(new PotionData(PotionType.SPEED)); speedPotion.setItemMeta(pm); @@ -258,7 +259,7 @@ public class Upgrade { new Placeholder("%status", getStatus(upgrade))}, null, new ItemFlag[]{ItemFlag.HIDE_POTION_EFFECTS}), 0); - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) { PotionMeta pm = (PotionMeta) jumpPotion.getItemMeta(); pm.setBasePotionData(new PotionData(PotionType.JUMP)); jumpPotion.setItemMeta(pm); diff --git a/src/main/java/com/craftaro/skyblock/permission/PermissionManager.java b/src/main/java/com/craftaro/skyblock/permission/PermissionManager.java index e7ae2e49..433c2ae3 100644 --- a/src/main/java/com/craftaro/skyblock/permission/PermissionManager.java +++ b/src/main/java/com/craftaro/skyblock/permission/PermissionManager.java @@ -1,5 +1,6 @@ package com.craftaro.skyblock.permission; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.config.FileManager; @@ -142,7 +143,7 @@ public class PermissionManager { registerPermission(new HungerPermission(plugin)); } - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_20)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_20)) { registerPermission(new SignEditPermission(plugin)); } diff --git a/src/main/java/com/craftaro/skyblock/permission/permissions/listening/AnimalBreedingPermission.java b/src/main/java/com/craftaro/skyblock/permission/permissions/listening/AnimalBreedingPermission.java index 615071ee..444360fe 100644 --- a/src/main/java/com/craftaro/skyblock/permission/permissions/listening/AnimalBreedingPermission.java +++ b/src/main/java/com/craftaro/skyblock/permission/permissions/listening/AnimalBreedingPermission.java @@ -1,5 +1,6 @@ package com.craftaro.skyblock.permission.permissions.listening; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.skyblock.SkyBlock; @@ -49,7 +50,7 @@ public class AnimalBreedingPermission extends ListeningPermission { } else if (entity.getType() == EntityType.CHICKEN) { if (!(XMaterial.WHEAT_SEEDS.isSimilar(is) || XMaterial.PUMPKIN_SEEDS.isSimilar(is) || XMaterial.MELON_SEEDS.isSimilar(is))) { - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_9)) { if (!(XMaterial.BEETROOT_SEEDS.isSimilar(is))) { return; } @@ -86,12 +87,12 @@ public class AnimalBreedingPermission extends ListeningPermission { return; } } else { - if (ServerVersion.isServerVersionAbove(ServerVersion.V1_10)) { + if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_10)) { if (entity.getType() == EntityType.LLAMA) { if (!(XMaterial.HAY_BLOCK.isSimilar(is))) { return; } - } else if (ServerVersion.isServerVersionAbove(ServerVersion.V1_12)) { + } else if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_12)) { if (entity.getType() == EntityType.TURTLE) { if (!(XMaterial.SEAGRASS.isSimilar(is))) { return; diff --git a/src/main/java/com/craftaro/skyblock/permission/permissions/listening/DamagePermission.java b/src/main/java/com/craftaro/skyblock/permission/permissions/listening/DamagePermission.java index da79ef49..f358f954 100644 --- a/src/main/java/com/craftaro/skyblock/permission/permissions/listening/DamagePermission.java +++ b/src/main/java/com/craftaro/skyblock/permission/permissions/listening/DamagePermission.java @@ -1,5 +1,6 @@ package com.craftaro.skyblock.permission.permissions.listening; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.skyblock.SkyBlock; @@ -37,7 +38,7 @@ public class DamagePermission extends ListeningPermission { return; } } else { - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_12)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_12)) { if (event.getCause() == EntityDamageEvent.DamageCause.valueOf("ENTITY_SWEEP_ATTACK")) { EntityDamageByEntityEvent entityDamageByEntityEvent = (EntityDamageByEntityEvent) event; diff --git a/src/main/java/com/craftaro/skyblock/permission/permissions/listening/PortalPermission.java b/src/main/java/com/craftaro/skyblock/permission/permissions/listening/PortalPermission.java index 2115b499..537a148e 100644 --- a/src/main/java/com/craftaro/skyblock/permission/permissions/listening/PortalPermission.java +++ b/src/main/java/com/craftaro/skyblock/permission/permissions/listening/PortalPermission.java @@ -1,6 +1,7 @@ package com.craftaro.skyblock.permission.permissions.listening; import com.craftaro.core.compatibility.CompatibleMaterial; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.skyblock.SkyBlock; @@ -59,7 +60,7 @@ public class PortalPermission extends ListeningPermission { if (event.getCause() == PlayerTeleportEvent.TeleportCause.ENDER_PEARL || event.getCause() == PlayerTeleportEvent.TeleportCause.NETHER_PORTAL || event.getCause() == PlayerTeleportEvent.TeleportCause.END_PORTAL - || (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9) + || (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_9) && event.getCause() == PlayerTeleportEvent.TeleportCause.END_GATEWAY)) { /*event.getPlayer().teleport(getToLocation(event.getFrom(), event.getPlayer())); Location to = getToLocation(event.getFrom(), event.getPlayer()); diff --git a/src/main/java/com/craftaro/skyblock/permission/permissions/listening/TradingPermission.java b/src/main/java/com/craftaro/skyblock/permission/permissions/listening/TradingPermission.java index 734f36f0..0b9b448b 100644 --- a/src/main/java/com/craftaro/skyblock/permission/permissions/listening/TradingPermission.java +++ b/src/main/java/com/craftaro/skyblock/permission/permissions/listening/TradingPermission.java @@ -1,5 +1,6 @@ package com.craftaro.skyblock.permission.permissions.listening; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.skyblock.SkyBlock; @@ -26,7 +27,7 @@ public class TradingPermission extends ListeningPermission { Player player = event.getPlayer(); if (event.getRightClicked().getType() == EntityType.VILLAGER - || ServerVersion.isServerVersionAtLeast(ServerVersion.V1_14) + || MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_14) && event.getRightClicked().getType() == EntityType.WANDERING_TRADER) { cancelAndMessage(event, player, this.plugin, this.messageManager); } diff --git a/src/main/java/com/craftaro/skyblock/scoreboard/Board.java b/src/main/java/com/craftaro/skyblock/scoreboard/Board.java index 014e86ea..a919eeea 100644 --- a/src/main/java/com/craftaro/skyblock/scoreboard/Board.java +++ b/src/main/java/com/craftaro/skyblock/scoreboard/Board.java @@ -1,5 +1,6 @@ package com.craftaro.skyblock.scoreboard; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.placeholder.PlaceholderManager; @@ -24,7 +25,7 @@ class Board { this.player = player; this.plugin = plugin; this.board = this.plugin.getServer().getScoreboardManager().getNewScoreboard(); - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) { this.objective = this.board.registerNewObjective("sb1", "sb2", "sb3"); } else { this.objective = this.board.registerNewObjective("sb1", "sb2"); @@ -66,7 +67,7 @@ class Board { this.cache.put(line, string); ScoreboardLine parts; - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) { parts = convertIntoPieces(string, 64); } else { parts = convertIntoPieces(string, 16); diff --git a/src/main/java/com/craftaro/skyblock/stackable/Stackable.java b/src/main/java/com/craftaro/skyblock/stackable/Stackable.java index 7237e98b..2c622c87 100644 --- a/src/main/java/com/craftaro/skyblock/stackable/Stackable.java +++ b/src/main/java/com/craftaro/skyblock/stackable/Stackable.java @@ -1,5 +1,6 @@ package com.craftaro.skyblock.stackable; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XSound; @@ -147,7 +148,7 @@ public class Stackable { as.setVisible(false); as.setGravity(false); as.setSmall(true); - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_9)) { as.setMarker(true); } as.setBasePlate(true); diff --git a/src/main/java/com/craftaro/skyblock/tasks/MobNetherWaterTask.java b/src/main/java/com/craftaro/skyblock/tasks/MobNetherWaterTask.java index 4d56fa2e..ee304af5 100644 --- a/src/main/java/com/craftaro/skyblock/tasks/MobNetherWaterTask.java +++ b/src/main/java/com/craftaro/skyblock/tasks/MobNetherWaterTask.java @@ -1,5 +1,6 @@ package com.craftaro.skyblock.tasks; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.island.IslandWorld; @@ -50,7 +51,7 @@ public class MobNetherWaterTask extends BukkitRunnable { if (ent instanceof Blaze || ent instanceof MagmaCube || ent instanceof Wither || ent instanceof Ghast) return true; - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_11)) { return ent.getType() == EntityType.WITHER_SKELETON; } else { return ent instanceof Skeleton && ((Skeleton) ent).getSkeletonType() == Skeleton.SkeletonType.WITHER; diff --git a/src/main/java/com/craftaro/skyblock/utils/item/InventoryUtil.java b/src/main/java/com/craftaro/skyblock/utils/item/InventoryUtil.java index b1405676..dec8f430 100644 --- a/src/main/java/com/craftaro/skyblock/utils/item/InventoryUtil.java +++ b/src/main/java/com/craftaro/skyblock/utils/item/InventoryUtil.java @@ -1,5 +1,6 @@ package com.craftaro.skyblock.utils.item; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import org.bukkit.GameMode; import org.bukkit.Material; @@ -20,7 +21,7 @@ public class InventoryUtil { ItemStack is = ammo.get(index); ItemMeta im = is.getItemMeta(); - if (ServerVersion.isServerVersionAbove(ServerVersion.V1_12)) { + if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_12)) { if (((Damageable) im).getDamage() != 0) { continue; } @@ -56,7 +57,7 @@ public class InventoryUtil { ItemMeta im = is.getItemMeta(); if (!im.hasDisplayName()) { - if (ServerVersion.isServerVersionAbove(ServerVersion.V1_12)) { + if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_12)) { if (((Damageable) im).getDamage() != 0) { continue; } diff --git a/src/main/java/com/craftaro/skyblock/utils/item/ItemStackUtil.java b/src/main/java/com/craftaro/skyblock/utils/item/ItemStackUtil.java index 9d43f03c..6b276477 100644 --- a/src/main/java/com/craftaro/skyblock/utils/item/ItemStackUtil.java +++ b/src/main/java/com/craftaro/skyblock/utils/item/ItemStackUtil.java @@ -1,6 +1,7 @@ package com.craftaro.skyblock.utils.item; import com.craftaro.core.compatibility.ClassMapping; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.MethodMapping; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; @@ -18,7 +19,7 @@ import java.lang.reflect.Constructor; import java.math.BigInteger; public class ItemStackUtil { - private static final boolean isAbove1_16_R1 = ServerVersion.isServerVersionAtLeast(ServerVersion.V1_16) + private static final boolean isAbove1_16_R1 = MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_16) && !ServerVersion.getServerVersionString().equals("v1_16_R1"); public static ItemStack deserializeItemStack(String data) { @@ -37,9 +38,9 @@ public class ItemStackUtil { Object craftItemStack; assert NMSItemStackClass != null; - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) { craftItemStack = NMSItemStackClass.getMethod("a", NBTTagCompoundClass).invoke(null, NBTTagCompound); - } else if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)) { + } else if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_11)) { craftItemStack = NMSItemStackClass.getConstructor(NBTTagCompoundClass).newInstance(NBTTagCompound); } else { craftItemStack = NMSItemStackClass.getMethod("createStack", NBTTagCompoundClass).invoke(null, diff --git a/src/main/java/com/craftaro/skyblock/utils/structure/SchematicUtil.java b/src/main/java/com/craftaro/skyblock/utils/structure/SchematicUtil.java index ff02e9af..19ed1906 100644 --- a/src/main/java/com/craftaro/skyblock/utils/structure/SchematicUtil.java +++ b/src/main/java/com/craftaro/skyblock/utils/structure/SchematicUtil.java @@ -1,5 +1,6 @@ package com.craftaro.skyblock.utils.structure; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.skyblock.SkyBlock; import org.bukkit.Bukkit; @@ -20,7 +21,7 @@ public class SchematicUtil { } Runnable pasteTask = () -> { - if (ServerVersion.isServerVersionAbove(ServerVersion.V1_12)) { // WorldEdit 7 + if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_12)) { // WorldEdit 7 com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat format = com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats.findByFile(schematicFile); try (com.sk89q.worldedit.extent.clipboard.io.ClipboardReader reader = format.getReader(Files.newInputStream(schematicFile.toPath()))) { com.sk89q.worldedit.extent.clipboard.Clipboard clipboard = reader.read(); diff --git a/src/main/java/com/craftaro/skyblock/utils/version/CompatibleSpawners.java b/src/main/java/com/craftaro/skyblock/utils/version/CompatibleSpawners.java index d72d8288..f95dc6b2 100644 --- a/src/main/java/com/craftaro/skyblock/utils/version/CompatibleSpawners.java +++ b/src/main/java/com/craftaro/skyblock/utils/version/CompatibleSpawners.java @@ -1,5 +1,6 @@ package com.craftaro.skyblock.utils.version; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import org.bukkit.Material; @@ -197,7 +198,7 @@ public enum CompatibleSpawners { } public static CompatibleSpawners getMaterials(Material material, byte data) { - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) { return fromString(material.name()); } diff --git a/src/main/java/com/craftaro/skyblock/utils/version/SBiome.java b/src/main/java/com/craftaro/skyblock/utils/version/SBiome.java index ae5920ef..9eaa7eac 100644 --- a/src/main/java/com/craftaro/skyblock/utils/version/SBiome.java +++ b/src/main/java/com/craftaro/skyblock/utils/version/SBiome.java @@ -1,5 +1,6 @@ package com.craftaro.skyblock.utils.version; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.skyblock.utils.StringUtil; @@ -34,7 +35,7 @@ public enum SBiome { THE_VOID("SKY", XMaterial.OBSIDIAN), WARM_OCEAN(true, XMaterial.TROPICAL_FISH); - private static final boolean isPostVersion = ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13); + private static final boolean isPostVersion = MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13); private final String legacyName; private final boolean isPost13; diff --git a/src/main/java/com/craftaro/skyblock/utils/world/LocationUtil.java b/src/main/java/com/craftaro/skyblock/utils/world/LocationUtil.java index 8d29457e..8fccf4e8 100644 --- a/src/main/java/com/craftaro/skyblock/utils/world/LocationUtil.java +++ b/src/main/java/com/craftaro/skyblock/utils/world/LocationUtil.java @@ -1,6 +1,7 @@ package com.craftaro.skyblock.utils.world; import com.craftaro.core.compatibility.CompatibleMaterial; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.skyblock.SkyBlock; @@ -35,7 +36,7 @@ public final class LocationUtil { Location tempLoc = LocationUtil.getDefinitiveLocation(loc.clone()); if (tempLoc.getBlock().getType() == Material.WATER) { tempLoc.getBlock().setType(Material.AIR); - } else if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { + } else if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) { LocationUtil113.removeWaterLoggedFromLocation(tempLoc); } } @@ -72,7 +73,7 @@ public final class LocationUtil { for (locWorking.setY(locWorking.getBlockY()); locWorking.getBlockY() >= 0; locWorking.setY(locWorking.getBlockY() - 1)) { if (!locWorking.getBlock().isEmpty()) { if (locWorking.getBlock().getType() == XMaterial.WATER.parseMaterial() || - (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13) && + (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13) && locWorking.getBlock().getBlockData() instanceof org.bukkit.block.data.Waterlogged)) { loc = locWorking; } @@ -90,7 +91,7 @@ public final class LocationUtil { locChecked.getBlock().getType().isBlock() && locChecked.add(0d, 1d, 0d).getBlock().getType() == XMaterial.AIR.parseMaterial() && locChecked.add(0d, 2d, 0d).getBlock().getType() == XMaterial.AIR.parseMaterial() && - !(ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13) && locChecked.getBlock().getBlockData() instanceof org.bukkit.block.data.Waterlogged)) { + !(MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13) && locChecked.getBlock().getBlockData() instanceof org.bukkit.block.data.Waterlogged)) { safe = true; switch (CompatibleMaterial.getMaterial(locChecked.getBlock().getType()).orElse(XMaterial.AIR)) { case ACACIA_DOOR: // <= 1.8.8 diff --git a/src/main/java/com/craftaro/skyblock/utils/world/block/BlockUtil.java b/src/main/java/com/craftaro/skyblock/utils/world/block/BlockUtil.java index 6696f1cc..94945d1f 100644 --- a/src/main/java/com/craftaro/skyblock/utils/world/block/BlockUtil.java +++ b/src/main/java/com/craftaro/skyblock/utils/world/block/BlockUtil.java @@ -1,6 +1,7 @@ package com.craftaro.skyblock.utils.world.block; import com.craftaro.core.compatibility.ClassMapping; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.MethodMapping; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; @@ -54,7 +55,7 @@ public final class BlockUtil extends BlockUtils { blockData.setVersion(Integer.parseInt(ServerVersion.getVersionReleaseNumber())); - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) { blockData.setBlockData(block.getBlockData().getAsString()); } @@ -77,7 +78,7 @@ public final class BlockUtil extends BlockUtils { blockData.setPotionEffect(primaryEffectName + ":" + secondaryEffectName); blockData.setStateType(BlockStateType.BEACON.toString()); - } else if (blockState instanceof BrewingStand && ServerVersion.isServerVersionAtLeast(ServerVersion.V1_12)) { + } else if (blockState instanceof BrewingStand && MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_12)) { BrewingStand brewingStand = (BrewingStand) blockState; blockData.setBrewingTime(brewingStand.getBrewingTime()); blockData.setFuelLevel(brewingStand.getFuelLevel()); @@ -191,7 +192,7 @@ public final class BlockUtil extends BlockUtils { blockData.setRotateFace(skull.getRotation().toString()); blockData.setStateType(BlockStateType.SKULL.toString()); } else { - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_9)) { if (blockState instanceof EndGateway) { EndGateway endGateway = (EndGateway) blockState; blockData.setExactTeleport(endGateway.isExactTeleport()); @@ -201,7 +202,7 @@ public final class BlockUtil extends BlockUtils { blockData.setStateType(BlockStateType.ENDGATEWAY.toString()); } - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_11)) { if (blockState instanceof ShulkerBox) { ShulkerBox shulkerBox = (ShulkerBox) blockState; @@ -217,7 +218,7 @@ public final class BlockUtil extends BlockUtils { } } - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_14)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_14)) { if (blockState instanceof Barrel) { Barrel barrel = (Barrel) blockState; @@ -232,7 +233,7 @@ public final class BlockUtil extends BlockUtils { blockData.setStateType(BlockStateType.BARREL.toString()); } - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_16)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_16)) { if (blockState instanceof RespawnAnchor) { RespawnAnchor respawnAnchor = (RespawnAnchor) blockState; blockData.setCharges(respawnAnchor.getCharges()); @@ -247,7 +248,7 @@ public final class BlockUtil extends BlockUtils { blockData.setFacing(((Stairs) materialData).getFacing().toString()); blockData.setDataType(BlockDataType.STAIRS.toString()); } else if (materialData instanceof org.bukkit.material.FlowerPot) { - if (ServerVersion.isServerVersionAtOrBelow(ServerVersion.V1_12)) { + if (MajorServerVersion.isServerVersionAtOrBelow(MajorServerVersion.V1_12)) { try { World world = block.getWorld(); @@ -301,7 +302,7 @@ public final class BlockUtil extends BlockUtils { return; } - if (ServerVersion.isServerVersionAtOrBelow(ServerVersion.V1_12)) { + if (MajorServerVersion.isServerVersionAtOrBelow(MajorServerVersion.V1_12)) { setBlockFast(block.getWorld(), block.getX(), block.getY(), block.getZ(), material, blockData.getData()); } else { block.setBlockData(Bukkit.getServer().createBlockData(blockData.getBlockData())); @@ -334,7 +335,7 @@ public final class BlockUtil extends BlockUtils { beacon.setSecondaryEffect(PotionEffectType.getByName(potionEffect[1].toUpperCase())); } state.update(); - } else if (blockTypeState == BlockStateType.BREWINGSTAND && ServerVersion.isServerVersionAtLeast(ServerVersion.V1_12)) { + } else if (blockTypeState == BlockStateType.BREWINGSTAND && MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_12)) { BrewingStand brewingStand = (BrewingStand) state; brewingStand.setBrewingTime(blockData.getBrewingTime()); brewingStand.setFuelLevel(blockData.getFuelLevel()); @@ -422,14 +423,14 @@ public final class BlockUtil extends BlockUtils { skull.setRotation(BlockFace.valueOf(blockData.getRotateFace().toUpperCase())); skull.setSkullType(SkullType.valueOf(blockData.getSkullType().toUpperCase())); - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_10)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_10)) { skull.setOwningPlayer(Bukkit.getServer().getOfflinePlayer(blockData.getSkullOwner())); } else { skull.setOwner(blockData.getSkullOwner()); } state.update(); } else { - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_9)) { if (blockTypeState == BlockStateType.ENDGATEWAY) { EndGateway endGateway = (EndGateway) state; endGateway.setExactTeleport(blockData.isExactTeleport()); @@ -445,7 +446,7 @@ public final class BlockUtil extends BlockUtils { state.update(); } - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_11)) { if (blockTypeState == BlockStateType.SHULKERBOX) { ShulkerBox shulkerBox = (ShulkerBox) state; @@ -456,7 +457,7 @@ public final class BlockUtil extends BlockUtils { } } } - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_14)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_14)) { if (blockTypeState == BlockStateType.BARREL) { Barrel barrel = (Barrel) state; @@ -469,7 +470,7 @@ public final class BlockUtil extends BlockUtils { } } - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_16)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_16)) { if (blockTypeState == BlockStateType.RESPAWN_ANCHOR) { RespawnAnchor respawnAnchor = (RespawnAnchor) state; respawnAnchor.setCharges(blockData.getCharges()); @@ -488,7 +489,7 @@ public final class BlockUtil extends BlockUtils { state.setData(stairs); } else if (blockDataType == BlockDataType.FLOWERPOT) { setBlockFast(block.getWorld(), block.getX(), block.getY() - 1, block.getZ(), XMaterial.STONE, (byte) 0); - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_8) && ServerVersion.isServerVersionAtOrBelow(ServerVersion.V1_12)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_8) && MajorServerVersion.isServerVersionAtOrBelow(MajorServerVersion.V1_12)) { if (block.getLocation().clone().subtract(0.0D, 1.0D, 0.0D).getBlock().getType() == Material.AIR) { setBlockFast(block.getWorld(), block.getX(), block.getY() - 1, block.getZ(), XMaterial.STONE, (byte) 0); } @@ -533,11 +534,11 @@ public final class BlockUtil extends BlockUtils { materialStr = null; if (blockData.getVersion() > 12) { - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) { materialStr = flower[0].toUpperCase(); } } else { - if (ServerVersion.isServerVersionBelow(ServerVersion.V1_13)) { + if (MajorServerVersion.isServerVersionBelow(MajorServerVersion.V1_13)) { materialStr = flower[0].toUpperCase(); } } @@ -558,7 +559,7 @@ public final class BlockUtil extends BlockUtils { if (bottomBlock.getType() == Material.AIR && !topBlock.getType().name().equals("DOUBLE_PLANT")) { bottomBlock.setType(XMaterial.LARGE_FERN.parseMaterial()); - if (ServerVersion.isServerVersionBelow(ServerVersion.V1_13)) { + if (MajorServerVersion.isServerVersionBelow(MajorServerVersion.V1_13)) { try { bottomBlock.getClass().getMethod("setData", byte.class).invoke(bottomBlock, (byte) 2); } catch (Exception ex) { diff --git a/src/main/java/com/craftaro/skyblock/utils/world/entity/EntityUtil.java b/src/main/java/com/craftaro/skyblock/utils/world/entity/EntityUtil.java index f8f4e35f..0b3b16b0 100644 --- a/src/main/java/com/craftaro/skyblock/utils/world/entity/EntityUtil.java +++ b/src/main/java/com/craftaro/skyblock/utils/world/entity/EntityUtil.java @@ -1,6 +1,7 @@ package com.craftaro.skyblock.utils.world.entity; import com.craftaro.core.compatibility.CompatibleMaterial; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.nms.Nms; import com.craftaro.skyblock.utils.item.ItemStackUtil; @@ -119,8 +120,8 @@ public final class EntityUtil { LivingEntity livingEntity = (LivingEntity) entity; EntityEquipment entityEquipment = livingEntity.getEquipment(); - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) { - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_10)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_9)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_10)) { livingEntity.setAI(entityData.hasAI()); } @@ -175,7 +176,7 @@ public final class EntityUtil { Material material = CompatibleMaterial.getMaterial(materialData[0].toUpperCase()).get().parseMaterial(); if (material != null) { - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) { ((Enderman) entity).setCarriedBlock(Bukkit.getServer().createBlockData(material)); } else { ((Enderman) entity).setCarriedMaterial(new MaterialData(material, data)); @@ -229,7 +230,7 @@ public final class EntityUtil { villager.getInventory().setContents(items.toArray(new ItemStack[0])); } - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_11)) { if (entity instanceof Llama) { Llama llama = ((Llama) entity); llama.setColor(Llama.Color.valueOf(entityData.getLlamaColor().toUpperCase())); @@ -244,7 +245,7 @@ public final class EntityUtil { llama.getInventory().setContents(items.toArray(new ItemStack[0])); } - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)) { + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_11)) { if (entity instanceof Parrot) { ((Parrot) entity) .setVariant(Parrot.Variant.valueOf(entityData.getParrotVariant().toUpperCase())); diff --git a/src/main/java/com/craftaro/skyblock/world/generator/VoidGenerator.java b/src/main/java/com/craftaro/skyblock/world/generator/VoidGenerator.java index b70efbbf..c25fbb43 100644 --- a/src/main/java/com/craftaro/skyblock/world/generator/VoidGenerator.java +++ b/src/main/java/com/craftaro/skyblock/world/generator/VoidGenerator.java @@ -1,6 +1,7 @@ package com.craftaro.skyblock.world.generator; import com.craftaro.core.compatibility.CompatibleBiome; +import com.craftaro.core.compatibility.MajorServerVersion; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.skyblock.SkyBlock; @@ -56,7 +57,7 @@ public class VoidGenerator extends ChunkGenerator { throw new IllegalStateException("Unexpected value: " + world.getEnvironment()); } - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_16)) { // TODO Should be 1.15 but it works fine there + if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_16)) { // TODO Should be 1.15 but it works fine there setChunkBiome3D(biome, biomeGrid, world); } else { setChunkBiome2D(biome, biomeGrid);