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;
|
package com.willfp.eco.core.proxy;
|
||||||
|
|
||||||
|
import com.willfp.eco.core.version.Version;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -12,7 +13,7 @@ public final class ProxyConstants {
|
|||||||
/**
|
/**
|
||||||
* The NMS version that the server is running on.
|
* 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.
|
* All supported NMS versions.
|
||||||
@@ -32,4 +33,17 @@ public final class ProxyConstants {
|
|||||||
private ProxyConstants() {
|
private ProxyConstants() {
|
||||||
throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
|
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 pluginVersion = Version(extensionYml.getStringOrNull("plugin-version") ?: "0.0.0")
|
||||||
val pluginName = extensionYml.getStringOrNull("plugin")
|
val pluginName = extensionYml.getStringOrNull("plugin")
|
||||||
|
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
if (pluginName != null && !pluginName.equals(this.plugin.description.name, ignoreCase = true)) {
|
if (pluginName != null && !pluginName.equals(this.plugin.description.name, ignoreCase = true)) {
|
||||||
throw ExtensionLoadException("${extensionJar.name} is only compatible with $pluginName!")
|
throw ExtensionLoadException("${extensionJar.name} is only compatible with $pluginName!")
|
||||||
}
|
}
|
||||||
@@ -83,6 +84,7 @@ class EcoExtensionLoader(
|
|||||||
author = "Unnamed Author"
|
author = "Unnamed Author"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
if (Version(this.plugin.description.version) < pluginVersion) {
|
if (Version(this.plugin.description.version) < pluginVersion) {
|
||||||
throw ExtensionLoadException("Plugin version is too low for ${extensionJar.name}!")
|
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 {
|
override fun create(key: String): NamespacedKey {
|
||||||
return NamespacedKeyUtils.create(plugin.id, key)
|
return NamespacedKeyUtils.create(plugin.id, key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,14 +21,17 @@ class PAPIExpansion(private val plugin: EcoPlugin) : PlaceholderExpansion() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getAuthor(): String {
|
override fun getAuthor(): String {
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
return java.lang.String.join(", ", plugin.description.authors)
|
return java.lang.String.join(", ", plugin.description.authors)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getIdentifier(): String {
|
override fun getIdentifier(): String {
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
return plugin.description.name.lowercase()
|
return plugin.description.name.lowercase()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getVersion(): String {
|
override fun getVersion(): String {
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
return plugin.description.version
|
return plugin.description.version
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ version = rootProject.version
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(project(":eco-core:core-nms:nms-common"))
|
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") {
|
implementation("net.kyori:adventure-text-minimessage:4.11.0") {
|
||||||
version {
|
version {
|
||||||
|
|||||||
@@ -46,17 +46,17 @@ class ExtendedPersistentDataContainerFactory : ExtendedPersistentDataContainerFa
|
|||||||
|
|
||||||
override fun <T : Any, Z : Any> set(key: String, dataType: PersistentDataType<T, Z>, value: Z) {
|
override fun <T : Any, Z : Any> set(key: String, dataType: PersistentDataType<T, Z>, value: Z) {
|
||||||
customDataTags[key] =
|
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 {
|
override fun <T : Any, Z : Any> has(key: String, dataType: PersistentDataType<T, Z>): Boolean {
|
||||||
val value = customDataTags[key] ?: return false
|
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? {
|
override fun <T : Any, Z : Any> get(key: String, dataType: PersistentDataType<T, Z>): Z? {
|
||||||
val value = customDataTags[key] ?: return null
|
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(
|
override fun <T : Any, Z : Any> getOrDefault(
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class AntigriefIridiumSkyblock : AntigriefIntegration {
|
|||||||
player: Player,
|
player: Player,
|
||||||
block: Block
|
block: Block
|
||||||
): Boolean {
|
): 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)
|
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,
|
player: Player,
|
||||||
location: Location
|
location: Location
|
||||||
): Boolean {
|
): 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)
|
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,
|
player: Player,
|
||||||
block: Block
|
block: Block
|
||||||
): Boolean {
|
): 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)
|
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,
|
player: Player,
|
||||||
victim: LivingEntity
|
victim: LivingEntity
|
||||||
): Boolean {
|
): Boolean {
|
||||||
val api = IridiumSkyblockAPI.getInstance()
|
val api = IridiumSkyblockAPI.getInstance() ?: return false
|
||||||
|
|
||||||
return when (victim) {
|
return when (victim) {
|
||||||
is Player -> api.getIslandViaLocation(victim.location).orElse(null) != null
|
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
|
kotlin.incremental.useClasspathSnapshot=false
|
||||||
Reference in New Issue
Block a user