Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab73c2202a | ||
|
|
af640881b0 | ||
|
|
9bd5cb5046 | ||
|
|
2829baf5b0 | ||
|
|
446e7a9534 | ||
|
|
8a8606bea4 | ||
|
|
3f751e8865 | ||
|
|
6a035426b4 | ||
|
|
f9bf97c90c |
@@ -1,5 +1,6 @@
|
||||
package com.willfp.eco.core.proxy;
|
||||
|
||||
import com.willfp.eco.core.version.Version;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -12,7 +13,7 @@ public final class ProxyConstants {
|
||||
/**
|
||||
* The NMS version that the server is running on.
|
||||
*/
|
||||
public static final String NMS_VERSION = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
|
||||
public static final String NMS_VERSION;
|
||||
|
||||
/**
|
||||
* All supported NMS versions.
|
||||
@@ -32,4 +33,17 @@ public final class ProxyConstants {
|
||||
private ProxyConstants() {
|
||||
throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
|
||||
}
|
||||
|
||||
static {
|
||||
String currentMinecraftVersion = Bukkit.getServer().getBukkitVersion().split("-")[0];
|
||||
String nmsVersion;
|
||||
|
||||
if (new Version(currentMinecraftVersion).compareTo(new Version("1.20.5")) < 0) {
|
||||
nmsVersion = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
|
||||
} else {
|
||||
nmsVersion = currentMinecraftVersion.replace(".", "_");
|
||||
}
|
||||
|
||||
NMS_VERSION = nmsVersion;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ class EcoExtensionLoader(
|
||||
val pluginVersion = Version(extensionYml.getStringOrNull("plugin-version") ?: "0.0.0")
|
||||
val pluginName = extensionYml.getStringOrNull("plugin")
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
if (pluginName != null && !pluginName.equals(this.plugin.description.name, ignoreCase = true)) {
|
||||
throw ExtensionLoadException("${extensionJar.name} is only compatible with $pluginName!")
|
||||
}
|
||||
@@ -83,6 +84,7 @@ class EcoExtensionLoader(
|
||||
author = "Unnamed Author"
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
if (Version(this.plugin.description.version) < pluginVersion) {
|
||||
throw ExtensionLoadException("Plugin version is too low for ${extensionJar.name}!")
|
||||
}
|
||||
|
||||
@@ -9,4 +9,4 @@ class EcoNamespacedKeyFactory(private val plugin: EcoPlugin) : NamespacedKeyFact
|
||||
override fun create(key: String): NamespacedKey {
|
||||
return NamespacedKeyUtils.create(plugin.id, key)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,14 +21,17 @@ class PAPIExpansion(private val plugin: EcoPlugin) : PlaceholderExpansion() {
|
||||
}
|
||||
|
||||
override fun getAuthor(): String {
|
||||
@Suppress("DEPRECATION")
|
||||
return java.lang.String.join(", ", plugin.description.authors)
|
||||
}
|
||||
|
||||
override fun getIdentifier(): String {
|
||||
@Suppress("DEPRECATION")
|
||||
return plugin.description.name.lowercase()
|
||||
}
|
||||
|
||||
override fun getVersion(): String {
|
||||
@Suppress("DEPRECATION")
|
||||
return plugin.description.version
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ version = rootProject.version
|
||||
|
||||
dependencies {
|
||||
implementation(project(":eco-core:core-nms:nms-common"))
|
||||
paperweight.paperDevBundle("1.20.3-R0.1-SNAPSHOT")
|
||||
paperweight.paperDevBundle("1.20.4-R0.1-SNAPSHOT")
|
||||
|
||||
implementation("net.kyori:adventure-text-minimessage:4.11.0") {
|
||||
version {
|
||||
|
||||
@@ -46,17 +46,17 @@ class ExtendedPersistentDataContainerFactory : ExtendedPersistentDataContainerFa
|
||||
|
||||
override fun <T : Any, Z : Any> set(key: String, dataType: PersistentDataType<T, Z>, value: Z) {
|
||||
customDataTags[key] =
|
||||
registry.wrap(dataType.primitiveType, dataType.toPrimitive(value, handle.adapterContext))
|
||||
registry.wrap(dataType, dataType.toPrimitive(value, handle.adapterContext))
|
||||
}
|
||||
|
||||
override fun <T : Any, Z : Any> has(key: String, dataType: PersistentDataType<T, Z>): Boolean {
|
||||
val value = customDataTags[key] ?: return false
|
||||
return registry.isInstanceOf(dataType.primitiveType, value)
|
||||
return registry.isInstanceOf(dataType, value)
|
||||
}
|
||||
|
||||
override fun <T : Any, Z : Any> get(key: String, dataType: PersistentDataType<T, Z>): Z? {
|
||||
val value = customDataTags[key] ?: return null
|
||||
return dataType.fromPrimitive(registry.extract(dataType.primitiveType, value), handle.adapterContext)
|
||||
return dataType.fromPrimitive(registry.extract<T, Tag>(dataType, value), handle.adapterContext)
|
||||
}
|
||||
|
||||
override fun <T : Any, Z : Any> getOrDefault(
|
||||
|
||||
@@ -13,7 +13,7 @@ class AntigriefIridiumSkyblock : AntigriefIntegration {
|
||||
player: Player,
|
||||
block: Block
|
||||
): Boolean {
|
||||
val api = IridiumSkyblockAPI.getInstance()
|
||||
val api = IridiumSkyblockAPI.getInstance() ?: return false
|
||||
|
||||
return api.getIslandPermission(api.getIslandViaLocation(block.location).orElse(null) ?: return true, api.getUser(player), PermissionType.BLOCK_BREAK)
|
||||
}
|
||||
@@ -22,7 +22,7 @@ class AntigriefIridiumSkyblock : AntigriefIntegration {
|
||||
player: Player,
|
||||
location: Location
|
||||
): Boolean {
|
||||
val api = IridiumSkyblockAPI.getInstance()
|
||||
val api = IridiumSkyblockAPI.getInstance() ?: return false
|
||||
|
||||
return api.getIslandPermission(api.getIslandViaLocation(location).orElse(null) ?: return true, api.getUser(player), PermissionType.BLOCK_BREAK)
|
||||
}
|
||||
@@ -31,7 +31,7 @@ class AntigriefIridiumSkyblock : AntigriefIntegration {
|
||||
player: Player,
|
||||
block: Block
|
||||
): Boolean {
|
||||
val api = IridiumSkyblockAPI.getInstance()
|
||||
val api = IridiumSkyblockAPI.getInstance() ?: return false
|
||||
|
||||
return api.getIslandPermission(api.getIslandViaLocation(block.location).orElse(null) ?: return true, api.getUser(player), PermissionType.BLOCK_PLACE)
|
||||
}
|
||||
@@ -40,7 +40,7 @@ class AntigriefIridiumSkyblock : AntigriefIntegration {
|
||||
player: Player,
|
||||
victim: LivingEntity
|
||||
): Boolean {
|
||||
val api = IridiumSkyblockAPI.getInstance()
|
||||
val api = IridiumSkyblockAPI.getInstance() ?: return false
|
||||
|
||||
return when (victim) {
|
||||
is Player -> api.getIslandViaLocation(victim.location).orElse(null) != null
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
version = 6.69.0
|
||||
version = 6.69.1
|
||||
kotlin.incremental.useClasspathSnapshot=false
|
||||
Reference in New Issue
Block a user