Search in sources :

Example 1 with LocationAdjuster

use of me.deecaad.core.file.serializers.LocationAdjuster in project MechanicsMain by WeaponMechanics.

the class FireworkMechanic method serialize.

@Override
@Nonnull
public FireworkMechanic serialize(SerializeData data) throws SerializerException {
    ItemStack fireworkItem = data.of("Item").assertExists().serializeNonStandardSerializer(new ItemSerializer());
    if (!(fireworkItem.getItemMeta() instanceof FireworkMeta)) {
        throw data.exception(null, "Item Type should be a firework when using a Firework Mechanic");
    }
    LocationAdjuster locationAdjuster = data.of("Location_Adjuster").serialize(LocationAdjuster.class);
    return new FireworkMechanic(locationAdjuster, fireworkItem);
}
Also used : ItemSerializer(me.deecaad.core.file.serializers.ItemSerializer) FireworkMeta(org.bukkit.inventory.meta.FireworkMeta) LocationAdjuster(me.deecaad.core.file.serializers.LocationAdjuster) ItemStack(org.bukkit.inventory.ItemStack) Nonnull(javax.annotation.Nonnull)

Aggregations

Nonnull (javax.annotation.Nonnull)1 ItemSerializer (me.deecaad.core.file.serializers.ItemSerializer)1 LocationAdjuster (me.deecaad.core.file.serializers.LocationAdjuster)1 ItemStack (org.bukkit.inventory.ItemStack)1 FireworkMeta (org.bukkit.inventory.meta.FireworkMeta)1