Compare commits

...

6 Commits

Author SHA1 Message Date
Auxilor
bcc5e4ef08 Skull improvements 2022-05-09 10:23:35 +01:00
Auxilor
bf8609666a Codestyle 2022-05-09 10:20:05 +01:00
Auxilor
1a02335825 Fixed dumbest error of all time 2022-05-09 10:14:18 +01:00
Auxilor
f5ef98ec5c Improved custom item lookup 2022-05-09 10:11:06 +01:00
Auxilor
45135e2b55 Updated to 6.35.5 2022-05-08 17:27:14 +01:00
Auxilor
758b42ff8e Fixed ItemsAdder integration 2022-05-08 17:26:50 +01:00
7 changed files with 26 additions and 10 deletions

View File

@@ -376,12 +376,12 @@ public abstract class EcoPlugin extends JavaPlugin implements PluginLike {
PlaceholderManager.addIntegration(Eco.getHandler().createPAPIIntegration(this)); PlaceholderManager.addIntegration(Eco.getHandler().createPAPIIntegration(this));
} }
this.loadIntegrationLoaders().forEach((integrationLoader -> { this.loadIntegrationLoaders().forEach(integrationLoader -> {
if (enabledPlugins.contains(integrationLoader.getPluginName().toLowerCase())) { if (enabledPlugins.contains(integrationLoader.getPluginName().toLowerCase())) {
this.loadedIntegrations.add(integrationLoader.getPluginName()); this.loadedIntegrations.add(integrationLoader.getPluginName());
integrationLoader.load(); integrationLoader.load();
} }
})); });
this.getLogger().info("Loaded integrations: " + String.join(", ", this.getLoadedIntegrations())); this.getLogger().info("Loaded integrations: " + String.join(", ", this.getLoadedIntegrations()));

View File

@@ -222,7 +222,10 @@ public final class Items {
if (part == null && PROVIDERS.containsKey(namespace)) { if (part == null && PROVIDERS.containsKey(namespace)) {
ItemProvider provider = PROVIDERS.get(namespace); ItemProvider provider = PROVIDERS.get(namespace);
item = provider.provideForKey(keyID);
String reformattedKey = keyID.replace("__", ":");
item = provider.provideForKey(reformattedKey);
if (item instanceof EmptyTestableItem || item == null) { if (item instanceof EmptyTestableItem || item == null) {
return new EmptyTestableItem(); return new EmptyTestableItem();
} }

View File

@@ -20,6 +20,10 @@ class Skull : SkullProxy {
setProfile = meta.javaClass.getDeclaredMethod("setProfile", GameProfile::class.java) setProfile = meta.javaClass.getDeclaredMethod("setProfile", GameProfile::class.java)
setProfile.isAccessible = true setProfile.isAccessible = true
} }
if (base64.length < 20) {
return
}
val uuid = UUID( val uuid = UUID(
base64.substring(base64.length - 20).hashCode().toLong(), base64.substring(base64.length - 20).hashCode().toLong(),
base64.substring(base64.length - 10).hashCode().toLong() base64.substring(base64.length - 10).hashCode().toLong()
@@ -39,6 +43,6 @@ class Skull : SkullProxy {
val profile = profile[meta] as GameProfile? ?: return null val profile = profile[meta] as GameProfile? ?: return null
val properties = profile.properties ?: return null val properties = profile.properties ?: return null
val prop = properties["textures"] ?: return null val prop = properties["textures"] ?: return null
return prop.toMutableList().firstOrNull()?.value return prop.toMutableList().firstOrNull()?.name
} }
} }

View File

@@ -20,6 +20,10 @@ class Skull : SkullProxy {
setProfile = meta.javaClass.getDeclaredMethod("setProfile", GameProfile::class.java) setProfile = meta.javaClass.getDeclaredMethod("setProfile", GameProfile::class.java)
setProfile.isAccessible = true setProfile.isAccessible = true
} }
if (base64.length < 20) {
return
}
val uuid = UUID( val uuid = UUID(
base64.substring(base64.length - 20).hashCode().toLong(), base64.substring(base64.length - 20).hashCode().toLong(),
base64.substring(base64.length - 10).hashCode().toLong() base64.substring(base64.length - 10).hashCode().toLong()
@@ -39,6 +43,6 @@ class Skull : SkullProxy {
val profile = profile[meta] as GameProfile? ?: return null val profile = profile[meta] as GameProfile? ?: return null
val properties = profile.properties ?: return null val properties = profile.properties ?: return null
val prop = properties["textures"] ?: return null val prop = properties["textures"] ?: return null
return prop.toMutableList().firstOrNull()?.value return prop.toMutableList().firstOrNull()?.name
} }
} }

View File

@@ -20,6 +20,10 @@ class Skull : SkullProxy {
setProfile = meta.javaClass.getDeclaredMethod("setProfile", GameProfile::class.java) setProfile = meta.javaClass.getDeclaredMethod("setProfile", GameProfile::class.java)
setProfile.isAccessible = true setProfile.isAccessible = true
} }
if (base64.length < 20) {
return
}
val uuid = UUID( val uuid = UUID(
base64.substring(base64.length - 20).hashCode().toLong(), base64.substring(base64.length - 20).hashCode().toLong(),
base64.substring(base64.length - 10).hashCode().toLong() base64.substring(base64.length - 10).hashCode().toLong()
@@ -39,6 +43,6 @@ class Skull : SkullProxy {
val profile = profile[meta] as GameProfile? ?: return null val profile = profile[meta] as GameProfile? ?: return null
val properties = profile.properties ?: return null val properties = profile.properties ?: return null
val prop = properties["textures"] ?: return null val prop = properties["textures"] ?: return null
return prop.toMutableList().firstOrNull()?.value return prop.toMutableList().firstOrNull()?.name
} }
} }

View File

@@ -21,7 +21,9 @@ class CustomItemsItemsAdder : CustomItemsIntegration {
private class ItemsAdderProvider : ItemProvider("itemsadder") { private class ItemsAdderProvider : ItemProvider("itemsadder") {
override fun provideForKey(key: String): TestableItem? { override fun provideForKey(key: String): TestableItem? {
val item = CustomStack.getInstance("itemsadder:$key") ?: return null val internalId = if (key.contains(":")) key else "itemsadder:$key"
val item = CustomStack.getInstance(internalId) ?: return null
val id = item.id val id = item.id
val namespacedKey = NamespacedKeyUtils.create("itemsadder", key) val namespacedKey = NamespacedKeyUtils.create("itemsadder", key)
val stack = item.itemStack val stack = item.itemStack
@@ -34,6 +36,5 @@ class CustomItemsItemsAdder : CustomItemsIntegration {
stack stack
) )
} }
} }
} }

View File

@@ -1,3 +1,3 @@
version = 6.35.4 version = 6.35.5
plugin-name = eco plugin-name = eco
kotlin.code.style = official kotlin.code.style = official