Skip to content

Commit

Permalink
fix missing XSkull conversion (#472)
Browse files Browse the repository at this point in the history
* update XSeries lib to 11.3.0 to fix skull issues

* update to official shadow repository (gradleup)

* Adjust for XSeries using Optional<T>, increment version
  • Loading branch information
CJCrafter authored Oct 13, 2024
1 parent cb3ccad commit fd8eef9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1005,19 +1005,19 @@ public boolean getBool(boolean def) throws SerializerException {
// Wildcards are not allowed for singleton enums, they are only
// allowed for lists.
input = input.trim();
XEntityType entityType = XEntityType.of(input);
if (entityType == null) {
Optional<XEntityType> entityType = XEntityType.of(input);
if (entityType.isEmpty()) {
throw new SerializerEnumException(serializer, EntityType.class, input, false, getLocation())
.addMessage(wikiLink != null, getWikiMessage());
}

EntityType parsed = entityType.get();
EntityType parsed = entityType.get().get();
if (parsed == null) {
throw exception(relative, "Your version, " + MinecraftVersions.getCURRENT() + ", doesn't support '" + entityType.name() + "'",
throw exception(relative, "Your version, " + MinecraftVersions.getCURRENT() + ", doesn't support '" + entityType.get().name() + "'",
"Try using a different material or update your server to a newer version!");
}

return entityType.get();
return parsed;
}

public @Nullable Particle getParticle(@Nullable Particle defaultValue) throws SerializerException {
Expand All @@ -1030,15 +1030,15 @@ public boolean getBool(boolean def) throws SerializerException {
// Wildcards are not allowed for singleton enums, they are only
// allowed for lists.
input = input.trim();
XParticle particle = XParticle.of(input);
if (particle == null) {
Optional<XParticle> particle = XParticle.of(input);
if (particle.isEmpty()) {
throw new SerializerEnumException(serializer, Particle.class, input, false, getLocation())
.addMessage(wikiLink != null, getWikiMessage());
}

Particle parsed = particle.get();
Particle parsed = particle.get().get();
if (parsed == null) {
throw exception(relative, "Your version, " + MinecraftVersions.getCURRENT() + ", doesn't support '" + particle.name() + "'",
throw exception(relative, "Your version, " + MinecraftVersions.getCURRENT() + ", doesn't support '" + particle.get().name() + "'",
"Try using a different material or update your server to a newer version!");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package me.deecaad.core.file.serializers;

import com.cryptomorin.xseries.XMaterial;
import com.cryptomorin.xseries.XSkull;
import com.cryptomorin.xseries.profiles.builder.XSkull;
import com.cryptomorin.xseries.profiles.objects.ProfileInputType;
import com.cryptomorin.xseries.profiles.objects.Profileable;
import me.deecaad.core.MechanicsCore;
import me.deecaad.core.compatibility.CompatibilityAPI;
import me.deecaad.core.compatibility.nbt.NBTCompatibility;
Expand Down Expand Up @@ -321,7 +323,7 @@ public ItemStack serializeWithoutRecipe(@NotNull SerializeData data) throws Seri
// https://www.spigotmc.org/threads/create-a-skull-item-stack-with-a-custom-texture-base64.82416/
if (uuid != null && url != null) {
// XSkull.of(itemMeta).profile(XSkull.SkullInputType.UUID, id).apply();
XSkull.of(skullMeta).profile(XSkull.SkullInputType.TEXTURE_URL, url).apply();
XSkull.of(skullMeta).profile(Profileable.of(ProfileInputType.TEXTURE_URL, url)).apply();
}

// Standard player name SkullMeta... "CJCrafter", "DeeCaaD", "Darkman_Bree"
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Versions of the 2 plugins stored in this repo.
mechanicsCoreVersion=3.5.0
weaponMechanicsVersion=3.5.1
mechanicsCoreVersion=3.5.1
weaponMechanicsVersion=3.5.2

# Version of the resource pack
resourcePackVersion=2.1.2
Expand Down

0 comments on commit fd8eef9

Please sign in to comment.