Skip to content

Commit

Permalink
v4.2.0.1 b93
Browse files Browse the repository at this point in the history
* fix errors with folia when it was built with mojangmap
  • Loading branch information
stumper66 committed Dec 22, 2024
1 parent fcff15a commit ceb2370
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 4.2.0 b92
version = 4.2.0.1 b93
description = The Ultimate RPG Mob Levelling Solution

org.gradle.caching=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.github.arcaneplugins.levelledmobs.nametag

import io.github.arcaneplugins.levelledmobs.LevelledMobs
import io.github.arcaneplugins.levelledmobs.nametag.ServerVersionInfo.MinecraftMajorVersion
import io.github.arcaneplugins.levelledmobs.util.Log
import java.lang.reflect.Constructor
import java.lang.reflect.Field
import java.lang.reflect.Method
Expand Down Expand Up @@ -154,6 +155,8 @@ class Definitions{

fun load(){
ver = LevelledMobs.instance.ver

Log.inf("Building reflection cache, use simple names: ${ver.useSimpleName}")
build()
if (hasMiniMessage) mm = MiniMessage.miniMessage()
}
Expand Down Expand Up @@ -189,10 +192,7 @@ class Definitions{

// if running folia only use simple name if the version is 1.21+

val useSimpleName = (ver.isRunningPaper && isOneTwentyFiveOrNewer || ver.isRunningFabric) &&
(!ver.isRunningFolia || ver.minorVersion >= 22)

return if (useSimpleName) {
return if (ver.useSimpleName) {
"org.bukkit.craftbukkit.$classSuffix"
} else {
("org.bukkit.craftbukkit." + ver.nmsVersion) + "." + classSuffix
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,9 @@ class NametagSenderHandler {
}

this.currentUtil = NmsNametagSender()
val ver = LevelledMobs.instance.ver
val showVersion = if (ver.isRunningPaper && "unknown" == ver.nmsVersion)
Bukkit.getServer().minecraftVersion else ver.nmsVersion

Log.inf(
"Using NMS version $showVersion for nametag support"
"Using NMS version ${LevelledMobs.instance.ver.nmsVersion} for nametag support"
)

return this.currentUtil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ class ServerVersionInfo {
fun load(){
parseServerVersion()
parseNMSVersion()

if (isRunningPaper && "unknown" == nmsVersion) {
nmsVersion = Bukkit.getServer().minecraftVersion
useSimpleName = true
}
}

var majorVersion = 0
Expand All @@ -36,6 +41,8 @@ class ServerVersionInfo {
private set
var allowStructureConditions = false
private set
var useSimpleName = true
private set

// preliminary fabric support. not entirely there yet
private var _isRunningFabric: Boolean? = null
Expand Down Expand Up @@ -64,6 +71,10 @@ class ServerVersionInfo {
useOldEnums = minorVersion < 21 || minorVersion == 21 && revision < 3

useNewHorseJumpAttrib = minorVersion >= 21 || (minorVersion == 20 && revision >= 6)

useSimpleName = (isRunningPaper && isOneTwentyFiveOrNewer && !isRunningFolia
|| isRunningFabric)
&& (!isRunningFolia || minorVersion >= 22)
}

private fun parsePaperVersion(){
Expand Down

0 comments on commit ceb2370

Please sign in to comment.