Skip to content

Commit

Permalink
#60 fix version parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
unldenis committed Jul 19, 2024
1 parent a56e221 commit 38aee9c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 16 deletions.
8 changes: 4 additions & 4 deletions README.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
> [!NOTE]
> New update: 3.4.1: [BlockLines & Animations](https://github.com/unldenis/holoeasy?tab=readme-ov-file#blockline--animations). Scroll down for more information.
> New update: 3.4.2: [BlockLines & Animations](https://github.com/unldenis/holoeasy?tab=readme-ov-file#blockline--animations). Scroll down for more information.
HoloEasy is a simple, modern and high-performant Java and Kotlin Minecraft Hologram library for 1.8-1.20.4 servers.

Expand All @@ -20,7 +20,7 @@ Lightweight replacement for Holographic Display. HoloEasy only uses packets inst
<dependency>
<groupId>com.github.unldenis.holoeasy</groupId>
<artifactId>holoeasy-core</artifactId>
<version>3.4.1</version>
<version>3.4.2</version>
</dependency>

<!-- For java projects include also the kotlin stdlib -->
Expand All @@ -34,7 +34,7 @@ Lightweight replacement for Holographic Display. HoloEasy only uses packets inst
#### Gradle

```kotlin
implementation("com.github.unldenis.holoeasy:holoeasy-core:3.4.1")
implementation("com.github.unldenis.holoeasy:holoeasy-core:3.4.2")

// For java projects include also the kotlin stdlib
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.9.21")
Expand Down Expand Up @@ -139,7 +139,7 @@ plugin.registerHolograms {
```

## BlockLine & Animations
From 3.4.1 version, library added support for:
From 3.4.2 version, library added support for:
- BlockLine: Instead of a dropping item it spawns an hologram with the block as helmet.
- Animations: You can apply animations to hologram lines.
<p align="center">
Expand Down
2 changes: 1 addition & 1 deletion holoeasy-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.holoeasy</groupId>
<artifactId>holoeasy</artifactId>
<version>3.4.1</version>
<version>3.4.2</version>
</parent>

<artifactId>holoeasy-core</artifactId>
Expand Down
18 changes: 11 additions & 7 deletions holoeasy-core/src/main/kotlin/org/holoeasy/util/VersionUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,18 @@ object VersionUtil {
val CLEAN_VERSION: VersionEnum

init {
// Bukkit method that was added in 2011
// Example value: 1.20.4-R0.1-SNAPSHOT
val bpName = Bukkit.getServer().bukkitVersion
val version = bpName.substringBefore('-').replace('.', '_')
VERSION = "v$version"
val clean = VERSION.substring(0, VERSION.length - 2)
CLEAN_VERSION = VersionEnum.valueOf(clean.uppercase(Locale.getDefault()))

// Split with '.' and get first two elements
VERSION = bpName.split(".").let { "V${it[0]}_${it[1]}"}

CLEAN_VERSION = VersionEnum.valueOf(VERSION)
}

fun isCompatible(ve: VersionEnum): Boolean {
return VERSION.lowercase(Locale.getDefault()).contains(ve.toString().lowercase(Locale.getDefault()))
return CLEAN_VERSION == ve
}

fun isAbove(ve: VersionEnum): Boolean {
Expand Down Expand Up @@ -69,10 +72,11 @@ enum class VersionEnum(armorstandId: Int, droppedItemId : Int) : Comparable<Vers
V1_18,
V1_19(2, 55),
V1_20,
V1_21,

// for non breaking in future
V1_21,
V1_22
V1_22,
V1_23
;

var armorstandId : Int
Expand Down
2 changes: 1 addition & 1 deletion holoeasy-example-kotlin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.holoeasy</groupId>
<artifactId>holoeasy</artifactId>
<version>3.4.1</version>
<version>3.4.2</version>
</parent>

<artifactId>holoeasy-example-kotlin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion holoeasy-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.holoeasy</groupId>
<artifactId>holoeasy</artifactId>
<version>3.4.1</version>
<version>3.4.2</version>
</parent>
<artifactId>holoeasy-example</artifactId>

Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<groupId>org.holoeasy</groupId>
<artifactId>holoeasy</artifactId>
<version>3.4.1</version>
<version>3.4.2</version>
<packaging>pom</packaging>
<modules>
<module>holoeasy-core</module>
Expand Down Expand Up @@ -99,7 +99,7 @@
<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-jar-plugin</artifactId>-->
<!-- <version>3.4.1</version>-->
<!-- <version>3.4.2</version>-->
<!-- <configuration>-->
<!-- <outputDirectory>C:\Users\mehil\OneDrive\Desktop\Spigot 1.16.5\plugins</outputDirectory>-->
<!-- </configuration>-->
Expand Down

0 comments on commit 38aee9c

Please sign in to comment.