Class VersionManager

java.lang.Object
com.ranull.graves.manager.VersionManager

public final class VersionManager extends Object
Manages version-specific functionality for the Graves plugin.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final boolean
    Indicates whether the API version is present or supported.
    private final boolean
    Indicates whether block data is supported.
    private final boolean
    Indicates whether compass meta data is supported.
    private final boolean
    Indicates whether the configuration contains specific settings or features.
    private final boolean
    Indicates whether curse enchantments are supported.
    private final boolean
    Indicates whether hex color codes are supported.
    private final boolean
    Indicates whether particle effects are supported.
    private final boolean
    Indicates whether persistent data is supported.
    private final boolean
    Indicates whether scoreboard tags are supported.
    private final boolean
    Indicates whether a second hand item is supported.
    private final boolean
    Indicates whether hand swing actions are supported.
    private final boolean
    Indicates whether world height data is supported.
    private boolean
    Indicates whether the server or plugin is based on the Bukkit API.
    private boolean
     
    private boolean
    Indicates whether the server is older than 1.20.5/1.20.6.
    private boolean
    Indicates whether the server or plugin is based on Mohist.
    private boolean
     
    private final boolean
     
    private final String
    The version of the server or plugin.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Initializes a new instance of the VersionManager class.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bukkit.enchantments.Enchantment
    Retrieves the appropriate enchantment type for the given version.
    org.bukkit.Material
    Retrieves the appropriate enchantment type for the given version.
    org.bukkit.Particle
    Retrieves the appropriate particle type for the given version.
    org.bukkit.potion.PotionEffectType
     
    Retrieves the server version.
    boolean
    Checks if the server version has the API version.
    boolean
    Checks if the server version has block data support.
    boolean
    Checks if the server version has compass meta support.
    boolean
    Checks if the server version has the config contains method.
    boolean
    Checks if the server version has enchantment curse support.
    boolean
    Checks if the server version has hex color support.
    boolean
    Checks if the server version has min height support.
    boolean
    Checks if the server version has particle support.
    boolean
    Checks if the server version has persistent data support.
    boolean
    Checks if the server version has scoreboard tags support.
    boolean
    Checks if the server version has second hand support.
    boolean
    Checks if the server version has swing hand support.
    boolean
    Checks if the server version is 1.10.
    boolean
    Checks if the server version is 1.11.
    boolean
    Checks if the server version is 1.12.
    boolean
    Checks if the server version is 1.13.
    boolean
    Checks if the server version is 1.14.
    boolean
    Checks if the server version is 1.15.
    boolean
    Checks if the server version is 1.16.
    boolean
    Checks if the server version is 1.17.
    boolean
    Checks if the server version is 1.18.
    boolean
    Checks if the server version is 1.19.
    boolean
    Checks if the server version is 1.20.
    boolean
    Checks if the server version is 1.20.5/6.
    boolean
    Checks if the server version is 1.21/1.21.1.
    boolean
    Checks if the server version is 1.7.
    boolean
    Checks if the server version is 1.8.
    boolean
    Checks if the server version is 1.9.
    boolean
    Checks if the server is running on Bukkit.
    boolean
    Checks if the server is running on Folia.
    boolean
    Checks if the server is running on Bukkit versions older than 1.20.5/1.20.6.
    boolean
    Checks if the server is running on Mohist.
    boolean
     
    boolean
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • version

      private final String version
      The version of the server or plugin.

      This String holds the version information, which is used to check compatibility and feature availability.

    • hasConfigContains

      private final boolean hasConfigContains
      Indicates whether the configuration contains specific settings or features.

      This boolean flag shows if certain configuration settings or features are present in the plugin's configuration.

    • hasAPIVersion

      private final boolean hasAPIVersion
      Indicates whether the API version is present or supported.

      This boolean flag indicates if the API version information is available and supported by the server or plugin.

    • hasBlockData

      private final boolean hasBlockData
      Indicates whether block data is supported.

      This boolean flag indicates if the server or plugin supports block data manipulation or retrieval.

    • hasPersistentData

      private final boolean hasPersistentData
      Indicates whether persistent data is supported.

      This boolean flag shows if the server or plugin supports the use of persistent data containers.

    • hasScoreboardTags

      private final boolean hasScoreboardTags
      Indicates whether scoreboard tags are supported.

      This boolean flag indicates if the server or plugin supports scoreboard tags for entities.

    • hasHexColors

      private final boolean hasHexColors
      Indicates whether hex color codes are supported.

      This boolean flag shows if the server or plugin supports hexadecimal color codes for text or other elements.

    • hasCompassMeta

      private final boolean hasCompassMeta
      Indicates whether compass meta data is supported.

      This boolean flag indicates if the server or plugin supports compass meta data functionality.

    • hasSwingHand

      private final boolean hasSwingHand
      Indicates whether hand swing actions are supported.

      This boolean flag shows if the server or plugin supports actions related to hand swings.

    • hasWorldHeight

      private final boolean hasWorldHeight
      Indicates whether world height data is supported.

      This boolean flag indicates if the server or plugin supports retrieving or managing world height information.

    • hasSecondHand

      private final boolean hasSecondHand
      Indicates whether a second hand item is supported.

      This boolean flag shows if the server or plugin supports having items in a second hand slot.

    • hasEnchantmentCurse

      private final boolean hasEnchantmentCurse
      Indicates whether curse enchantments are supported.

      This boolean flag indicates if the server or plugin supports curse enchantments on items.

    • hasParticle

      private final boolean hasParticle
      Indicates whether particle effects are supported.

      This boolean flag shows if the server or plugin supports particle effects for visual effects or gameplay.

    • isBukkit

      private boolean isBukkit
      Indicates whether the server or plugin is based on the Bukkit API.

      This boolean flag shows if the server or plugin is using the Bukkit API.

    • isMohist

      private boolean isMohist
      Indicates whether the server or plugin is based on Mohist.

      This boolean flag shows if the server or plugin is using Mohist, a server software that combines Bukkit and Forge.

    • isPaper

      private boolean isPaper
    • isFolia

      private boolean isFolia
    • isPost1_20_5

      private final boolean isPost1_20_5
    • isLegacyVersion

      private boolean isLegacyVersion
      Indicates whether the server is older than 1.20.5/1.20.6.

      This boolean flag shows if the server or plugin is older than 1.20.5/1.20.6.

  • Constructor Details

    • VersionManager

      public VersionManager()
      Initializes a new instance of the VersionManager class.
  • Method Details

    • getVersion

      public String getVersion()
      Retrieves the server version.
      Returns:
      The server version string.
    • isLegacyVersion

      public boolean isLegacyVersion()
      Checks if the server is running on Bukkit versions older than 1.20.5/1.20.6.
      Returns:
      True if the server is running on versions of Bukkit if older than 1.20.5/1.20.6.
    • isBukkit

      public boolean isBukkit()
      Checks if the server is running on Bukkit.
      Returns:
      True if the server is running on Bukkit, otherwise false.
    • isPaper

      public boolean isPaper()
    • isMohist

      public boolean isMohist()
      Checks if the server is running on Mohist.
      Returns:
      True if the server is running on Mohist, otherwise false.
    • isFolia

      public boolean isFolia()
      Checks if the server is running on Folia.
      Returns:
      True if the server is running on Folia, otherwise false.
    • hasConfigContains

      public boolean hasConfigContains()
      Checks if the server version has the config contains method.
      Returns:
      True if the server version has the config contains method, otherwise false.
    • hasAPIVersion

      public boolean hasAPIVersion()
      Checks if the server version has the API version.
      Returns:
      True if the server version has the API version, otherwise false.
    • hasBlockData

      public boolean hasBlockData()
      Checks if the server version has block data support.
      Returns:
      True if the server version has block data support, otherwise false.
    • hasPersistentData

      public boolean hasPersistentData()
      Checks if the server version has persistent data support.
      Returns:
      True if the server version has persistent data support, otherwise false.
    • hasScoreboardTags

      public boolean hasScoreboardTags()
      Checks if the server version has scoreboard tags support.
      Returns:
      True if the server version has scoreboard tags support, otherwise false.
    • hasHexColors

      public boolean hasHexColors()
      Checks if the server version has hex color support.
      Returns:
      True if the server version has hex color support, otherwise false.
    • hasCompassMeta

      public boolean hasCompassMeta()
      Checks if the server version has compass meta support.
      Returns:
      True if the server version has compass meta support, otherwise false.
    • hasSwingHand

      public boolean hasSwingHand()
      Checks if the server version has swing hand support.
      Returns:
      True if the server version has swing hand support, otherwise false.
    • hasMinHeight

      public boolean hasMinHeight()
      Checks if the server version has min height support.
      Returns:
      True if the server version has min height support, otherwise false.
    • hasSecondHand

      public boolean hasSecondHand()
      Checks if the server version has second hand support.
      Returns:
      True if the server version has second hand support, otherwise false.
    • hasEnchantmentCurse

      public boolean hasEnchantmentCurse()
      Checks if the server version has enchantment curse support.
      Returns:
      True if the server version has enchantment curse support, otherwise false.
    • hasParticle

      public boolean hasParticle()
      Checks if the server version has particle support.
      Returns:
      True if the server version has particle support, otherwise false.
    • is_v1_7

      public boolean is_v1_7()
      Checks if the server version is 1.7.
      Returns:
      True if the server version is 1.7, otherwise false.
    • is_v1_8

      public boolean is_v1_8()
      Checks if the server version is 1.8.
      Returns:
      True if the server version is 1.8, otherwise false.
    • is_v1_9

      public boolean is_v1_9()
      Checks if the server version is 1.9.
      Returns:
      True if the server version is 1.9, otherwise false.
    • is_v1_10

      public boolean is_v1_10()
      Checks if the server version is 1.10.
      Returns:
      True if the server version is 1.10, otherwise false.
    • is_v1_11

      public boolean is_v1_11()
      Checks if the server version is 1.11.
      Returns:
      True if the server version is 1.11, otherwise false.
    • is_v1_12

      public boolean is_v1_12()
      Checks if the server version is 1.12.
      Returns:
      True if the server version is 1.12, otherwise false.
    • is_v1_13

      public boolean is_v1_13()
      Checks if the server version is 1.13.
      Returns:
      True if the server version is 1.13, otherwise false.
    • is_v1_14

      public boolean is_v1_14()
      Checks if the server version is 1.14.
      Returns:
      True if the server version is 1.14, otherwise false.
    • is_v1_15

      public boolean is_v1_15()
      Checks if the server version is 1.15.
      Returns:
      True if the server version is 1.15, otherwise false.
    • is_v1_16

      public boolean is_v1_16()
      Checks if the server version is 1.16.
      Returns:
      True if the server version is 1.16, otherwise false.
    • is_v1_17

      public boolean is_v1_17()
      Checks if the server version is 1.17.
      Returns:
      True if the server version is 1.17, otherwise false.
    • is_v1_18

      public boolean is_v1_18()
      Checks if the server version is 1.18.
      Returns:
      True if the server version is 1.18, otherwise false.
    • is_v1_19

      public boolean is_v1_19()
      Checks if the server version is 1.19.
      Returns:
      True if the server version is 1.19, otherwise false.
    • is_v1_20

      public boolean is_v1_20()
      Checks if the server version is 1.20.
      Returns:
      True if the server version is 1.20, otherwise false.
    • is_v1_20_5

      public boolean is_v1_20_5()
      Checks if the server version is 1.20.5/6.
      Returns:
      True if the server version is 1.20.5/6, otherwise false.
    • is_v1_21

      public boolean is_v1_21()
      Checks if the server version is 1.21/1.21.1.
      Returns:
      True if the server version is 1.21/1.21.1, otherwise false.
    • isPost1_20_5

      public boolean isPost1_20_5()
    • getParticleForVersion

      public org.bukkit.Particle getParticleForVersion(String particle)
      Retrieves the appropriate particle type for the given version.
      Parameters:
      particle - The particle name.
      Returns:
      The Particle enum corresponding to the given particle name.
    • getEnchantmentForVersion

      public org.bukkit.enchantments.Enchantment getEnchantmentForVersion(String enchantment)
      Retrieves the appropriate enchantment type for the given version.
      Parameters:
      enchantment - The enchantment name.
      Returns:
      The Enchantment enum corresponding to the given enchantment name.
    • getMaterialForVersion

      public org.bukkit.Material getMaterialForVersion(String material)
      Retrieves the appropriate enchantment type for the given version.
      Parameters:
      material - The enchantment name.
      Returns:
      The Material enum corresponding to the given material name.
    • getPotionEffectTypeFromVersion

      public org.bukkit.potion.PotionEffectType getPotionEffectTypeFromVersion(String potionEffect)