Adding BlockStateMeta layer. Initial shield banner support.

This commit is contained in:
Olof Larsson 2016-04-24 13:40:19 +02:00
parent a6a97d1962
commit 2c5fb79d9e
No known key found for this signature in database
GPG Key ID: BBEF14F97DA52474
38 changed files with 297 additions and 103 deletions

View File

@ -1,8 +0,0 @@
package com.massivecraft.massivecore.item;
import org.bukkit.inventory.meta.ItemMeta;
public abstract class WriterAbstractItemMeta<M, FA, FB> extends WriterAbstractMeta<ItemMeta, M, FA, FB>
{
}

View File

@ -1,11 +1,8 @@
package com.massivecraft.massivecore.item; package com.massivecraft.massivecore.item;
import org.bukkit.inventory.ItemStack;
import com.massivecraft.massivecore.nms.NmsItemStack; import com.massivecraft.massivecore.nms.NmsItemStack;
public abstract class WriterAbstractItemStack<OB, CB, FA, FB> extends WriterAbstract<DataItemStack, OB, DataItemStack, CB, FA, FB>
public abstract class WriterAbstractItemStack<FA, FB> extends WriterAbstract<DataItemStack, ItemStack, DataItemStack, ItemStack, FA, FB>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// CREATE // CREATE
@ -17,10 +14,11 @@ public abstract class WriterAbstractItemStack<FA, FB> extends WriterAbstract<Dat
return new DataItemStack(); return new DataItemStack();
} }
@SuppressWarnings("unchecked")
@Override @Override
public ItemStack createB() public CB createB()
{ {
return NmsItemStack.get().createItemStack(); return (CB) NmsItemStack.get().createItemStack();
} }
} }

View File

@ -0,0 +1,10 @@
package com.massivecraft.massivecore.item;
import org.bukkit.inventory.ItemStack;
public abstract class WriterAbstractItemStackField<FA, FB> extends WriterAbstractItemStack<ItemStack, ItemStack, FA, FB>
{
}

View File

@ -1,31 +1,35 @@
package com.massivecraft.massivecore.item; package com.massivecraft.massivecore.item;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
public abstract class WriterAbstractItemStackMeta<FA, FB> extends WriterAbstractMeta<ItemStack, ItemMeta, FA, FB> public abstract class WriterAbstractItemStackMeta<OB, CB, FA, FB> extends WriterAbstractItemStack<OB, CB, FA, FB>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// MORPH // FIELDS
// -------------------------------------------- // // -------------------------------------------- //
@Override private Material material = Material.STONE;
public ItemMeta morphB(ItemStack ob) public Material getMaterial() { return this.material; }
@SuppressWarnings("unchecked")
public void setMaterial(Material material)
{ {
return ob.getItemMeta(); this.material = material;
CB cb = this.createB();
this.setClassB((Class<CB>) cb.getClass());
} }
// -------------------------------------------- // // -------------------------------------------- //
// WRITE // CREATE
// -------------------------------------------- // // -------------------------------------------- //
@SuppressWarnings("unchecked")
@Override @Override
public void writeInner(DataItemStack oa, ItemStack ob, DataItemStack ca, ItemMeta cb, boolean a2b) public CB createB()
{ {
super.writeInner(oa, ob, ca, cb, a2b); ItemStack itemStack = (ItemStack) super.createB();
itemStack.setType(this.getMaterial());
// Write back the meta return (CB) itemStack.getItemMeta();
if (a2b) ob.setItemMeta(cb);
} }
} }

View File

@ -0,0 +1,8 @@
package com.massivecraft.massivecore.item;
import org.bukkit.inventory.meta.ItemMeta;
public abstract class WriterAbstractItemStackMetaField<M, FA, FB> extends WriterAbstractItemStackMeta<ItemMeta, M, FA, FB>
{
}

View File

@ -0,0 +1,31 @@
package com.massivecraft.massivecore.item;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
public abstract class WriterAbstractItemStackMetaMorph<FA, FB> extends WriterAbstractItemStackMeta<ItemStack, ItemMeta, FA, FB>
{
// -------------------------------------------- //
// MORPH
// -------------------------------------------- //
@Override
public ItemMeta morphB(ItemStack ob)
{
return ob.getItemMeta();
}
// -------------------------------------------- //
// WRITE
// -------------------------------------------- //
@Override
public void writeInner(DataItemStack oa, ItemStack ob, DataItemStack ca, ItemMeta cb, boolean a2b)
{
super.writeInner(oa, ob, ca, cb, a2b);
// Write Back
if (a2b) ob.setItemMeta(cb);
}
}

View File

@ -0,0 +1,19 @@
package com.massivecraft.massivecore.item;
import org.bukkit.inventory.meta.BlockStateMeta;
public abstract class WriterAbstractItemStackMetaState<OB, CB, FA, FB> extends WriterAbstractItemStackMeta<OB, CB, FA, FB>
{
// -------------------------------------------- //
// CREATE
// -------------------------------------------- //
@SuppressWarnings("unchecked")
@Override
public CB createB()
{
BlockStateMeta blockStateMeta = (BlockStateMeta) super.createB();
return (CB) blockStateMeta.getBlockState();
}
}

View File

@ -0,0 +1,8 @@
package com.massivecraft.massivecore.item;
import org.bukkit.block.BlockState;
public abstract class WriterAbstractItemStackMetaStateField<S, FA, FB> extends WriterAbstractItemStackMetaState<BlockState, S, FA, FB>
{
}

View File

@ -0,0 +1,37 @@
package com.massivecraft.massivecore.item;
import org.bukkit.block.BlockState;
import org.bukkit.inventory.meta.BlockStateMeta;
import org.bukkit.inventory.meta.ItemMeta;
public abstract class WriterAbstractItemStackMetaStateMorph<FA, FB> extends WriterAbstractItemStackMetaState<ItemMeta, BlockState, FA, FB>
{
// -------------------------------------------- //
// MORPH
// -------------------------------------------- //
@Override
public BlockState morphB(ItemMeta ob)
{
BlockStateMeta state = (BlockStateMeta)ob;
return state.getBlockState();
}
// -------------------------------------------- //
// WRITE
// -------------------------------------------- //
@Override
public void writeInner(DataItemStack oa, ItemMeta ob, DataItemStack ca, BlockState cb, boolean a2b)
{
super.writeInner(oa, ob, ca, cb, a2b);
// Write Back
if (a2b)
{
BlockStateMeta blockStateMeta = (BlockStateMeta)ob;
blockStateMeta.setBlockState(cb);
}
}
}

View File

@ -1,43 +0,0 @@
package com.massivecraft.massivecore.item;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import com.massivecraft.massivecore.nms.NmsItemStack;
public abstract class WriterAbstractMeta<OB, CB, FA, FB> extends WriterAbstract<DataItemStack, OB, DataItemStack, CB, FA, FB>
{
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private Material material = Material.STONE;
public Material getMaterial() { return this.material; }
@SuppressWarnings("unchecked")
public void setMaterial(Material material)
{
this.material = material;
CB cb = this.createB();
this.setClassB((Class<CB>) cb.getClass());
}
// -------------------------------------------- //
// CREATE
// -------------------------------------------- //
@Override
public DataItemStack createA()
{
return new DataItemStack();
}
@SuppressWarnings("unchecked")
@Override
public CB createB()
{
ItemStack itemStack = NmsItemStack.get().createItemStack();
itemStack.setType(this.getMaterial());
return (CB) itemStack.getItemMeta();
}
}

View File

@ -1,6 +1,6 @@
package com.massivecraft.massivecore.item; package com.massivecraft.massivecore.item;
public class WriterItemStack extends WriterAbstractItemStack<Object, Object> public class WriterItemStack extends WriterAbstractItemStackField<Object, Object>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT

View File

@ -2,7 +2,7 @@ package com.massivecraft.massivecore.item;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
public class WriterItemStackCount extends WriterAbstractItemStack<Integer, Integer> public class WriterItemStackCount extends WriterAbstractItemStackField<Integer, Integer>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT

View File

@ -2,7 +2,7 @@ package com.massivecraft.massivecore.item;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
public class WriterItemStackDamage extends WriterAbstractItemStack<Integer, Integer> public class WriterItemStackDamage extends WriterAbstractItemStackField<Integer, Integer>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT

View File

@ -2,7 +2,7 @@ package com.massivecraft.massivecore.item;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
public class WriterItemStackId extends WriterAbstractItemStack<Integer, Integer> public class WriterItemStackId extends WriterAbstractItemStackField<Integer, Integer>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT

View File

@ -1,6 +1,6 @@
package com.massivecraft.massivecore.item; package com.massivecraft.massivecore.item;
public class WriterItemStackMeta extends WriterAbstractItemStackMeta<Object, Object> public class WriterItemStackMeta extends WriterAbstractItemStackMetaMorph<Object, Object>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
@ -60,17 +60,15 @@ public class WriterItemStackMeta extends WriterAbstractItemStackMeta<Object, Obj
// FLAGS // FLAGS
WriterItemStackMetaFlags.class, WriterItemStackMetaFlags.class,
// BANNER BASE // BANNER
WriterItemStackMetaBannerBase.class, WriterItemStackMetaBannerBase.class,
// TODO: Shield? WriterItemStackMetaBannerPatterns.class,
// BANNER PATTERNS // STATE
WriterItemStackMetaBannerPatterns.class WriterItemStackMetaState.class
// TODO
// TODO: Shield?
// POTION // POTION
// TODO // TODO Merge with potion above?
); );
} }

View File

@ -3,7 +3,7 @@ package com.massivecraft.massivecore.item;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.meta.BookMeta; import org.bukkit.inventory.meta.BookMeta;
public class WriterItemStackMetaAuthor extends WriterAbstractItemMeta<BookMeta, String, String> public class WriterItemStackMetaAuthor extends WriterAbstractItemStackMetaField<BookMeta, String, String>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT

View File

@ -4,7 +4,7 @@ import org.bukkit.DyeColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.meta.BannerMeta; import org.bukkit.inventory.meta.BannerMeta;
public class WriterItemStackMetaBannerBase extends WriterAbstractItemMeta<BannerMeta, Integer, DyeColor> public class WriterItemStackMetaBannerBase extends WriterAbstractItemStackMetaField<BannerMeta, Integer, DyeColor>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
@ -15,6 +15,8 @@ public class WriterItemStackMetaBannerBase extends WriterAbstractItemMeta<Banner
public WriterItemStackMetaBannerBase() public WriterItemStackMetaBannerBase()
{ {
this.setMaterial(Material.BANNER); this.setMaterial(Material.BANNER);
this.setConverterTo(ConverterToDyeColor.get());
this.setConverterFrom(ConverterFromDyeColor.get());
} }
// -------------------------------------------- // // -------------------------------------------- //

View File

@ -6,7 +6,7 @@ import org.bukkit.Material;
import org.bukkit.block.banner.Pattern; import org.bukkit.block.banner.Pattern;
import org.bukkit.inventory.meta.BannerMeta; import org.bukkit.inventory.meta.BannerMeta;
public class WriterItemStackMetaBannerPatterns extends WriterAbstractItemMeta<BannerMeta, List<DataBannerPattern>, List<Pattern>> public class WriterItemStackMetaBannerPatterns extends WriterAbstractItemStackMetaField<BannerMeta, List<DataBannerPattern>, List<Pattern>>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT

View File

@ -4,7 +4,7 @@ import org.bukkit.Color;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.meta.LeatherArmorMeta; import org.bukkit.inventory.meta.LeatherArmorMeta;
public class WriterItemStackMetaColor extends WriterAbstractItemMeta<LeatherArmorMeta, Integer, Color> public class WriterItemStackMetaColor extends WriterAbstractItemStackMetaField<LeatherArmorMeta, Integer, Color>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT

View File

@ -6,7 +6,7 @@ import java.util.Map.Entry;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
public class WriterItemStackMetaEnchants extends WriterAbstractItemMeta<ItemMeta, Map<Integer, Integer>, Map<Enchantment, Integer>> public class WriterItemStackMetaEnchants extends WriterAbstractItemStackMetaField<ItemMeta, Map<Integer, Integer>, Map<Enchantment, Integer>>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT

View File

@ -4,7 +4,7 @@ import org.bukkit.FireworkEffect;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.meta.FireworkEffectMeta; import org.bukkit.inventory.meta.FireworkEffectMeta;
public class WriterItemStackMetaFireworkEffect extends WriterAbstractItemMeta<FireworkEffectMeta, DataFireworkEffect, FireworkEffect> public class WriterItemStackMetaFireworkEffect extends WriterAbstractItemStackMetaField<FireworkEffectMeta, DataFireworkEffect, FireworkEffect>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT

View File

@ -6,7 +6,7 @@ import org.bukkit.FireworkEffect;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.meta.FireworkMeta; import org.bukkit.inventory.meta.FireworkMeta;
public class WriterItemStackMetaFireworkEffects extends WriterAbstractItemMeta<FireworkMeta, List<DataFireworkEffect>, List<FireworkEffect>> public class WriterItemStackMetaFireworkEffects extends WriterAbstractItemStackMetaField<FireworkMeta, List<DataFireworkEffect>, List<FireworkEffect>>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT

View File

@ -3,7 +3,7 @@ package com.massivecraft.massivecore.item;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.meta.FireworkMeta; import org.bukkit.inventory.meta.FireworkMeta;
public class WriterItemStackMetaFireworkFlight extends WriterAbstractItemMeta<FireworkMeta, Integer, Integer> public class WriterItemStackMetaFireworkFlight extends WriterAbstractItemStackMetaField<FireworkMeta, Integer, Integer>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT

View File

@ -5,7 +5,7 @@ import java.util.Set;
import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
public class WriterItemStackMetaFlags extends WriterAbstractItemMeta<ItemMeta, Set<String>, Set<ItemFlag>> public class WriterItemStackMetaFlags extends WriterAbstractItemStackMetaField<ItemMeta, Set<String>, Set<ItemFlag>>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT

View File

@ -4,7 +4,7 @@ import java.util.List;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
public class WriterItemStackMetaLore extends WriterAbstractItemMeta<ItemMeta, List<String>, List<String>> public class WriterItemStackMetaLore extends WriterAbstractItemStackMetaField<ItemMeta, List<String>, List<String>>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT

View File

@ -2,7 +2,7 @@ package com.massivecraft.massivecore.item;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
public class WriterItemStackMetaName extends WriterAbstractItemMeta<ItemMeta, String, String> public class WriterItemStackMetaName extends WriterAbstractItemStackMetaField<ItemMeta, String, String>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT

View File

@ -5,7 +5,7 @@ import java.util.List;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.meta.BookMeta; import org.bukkit.inventory.meta.BookMeta;
public class WriterItemStackMetaPages extends WriterAbstractItemMeta<BookMeta, List<String>, List<String>> public class WriterItemStackMetaPages extends WriterAbstractItemStackMetaField<BookMeta, List<String>, List<String>>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT

View File

@ -6,7 +6,7 @@ import org.bukkit.Material;
import org.bukkit.inventory.meta.PotionMeta; import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
public class WriterItemStackMetaPotionEffects extends WriterAbstractItemMeta<PotionMeta, List<DataPotionEffect>, List<PotionEffect>> public class WriterItemStackMetaPotionEffects extends WriterAbstractItemStackMetaField<PotionMeta, List<DataPotionEffect>, List<PotionEffect>>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT

View File

@ -3,7 +3,7 @@ package com.massivecraft.massivecore.item;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.meta.Repairable; import org.bukkit.inventory.meta.Repairable;
public class WriterItemStackMetaRepaircost extends WriterAbstractItemMeta<Repairable, Integer, Integer> public class WriterItemStackMetaRepaircost extends WriterAbstractItemStackMetaField<Repairable, Integer, Integer>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT

View File

@ -3,7 +3,7 @@ package com.massivecraft.massivecore.item;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.meta.MapMeta; import org.bukkit.inventory.meta.MapMeta;
public class WriterItemStackMetaScaling extends WriterAbstractItemMeta<MapMeta, Boolean, Boolean> public class WriterItemStackMetaScaling extends WriterAbstractItemStackMetaField<MapMeta, Boolean, Boolean>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT

View File

@ -3,7 +3,7 @@ package com.massivecraft.massivecore.item;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.inventory.meta.SkullMeta;
public class WriterItemStackMetaSkull17 extends WriterAbstractItemMeta<SkullMeta, String, String> public class WriterItemStackMetaSkull17 extends WriterAbstractItemStackMetaField<SkullMeta, String, String>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT

View File

@ -8,7 +8,7 @@ import org.bukkit.inventory.meta.SkullMeta;
import com.massivecraft.massivecore.Couple; import com.massivecraft.massivecore.Couple;
import com.massivecraft.massivecore.nms.NmsHead; import com.massivecraft.massivecore.nms.NmsHead;
public class WriterItemStackMetaSkull18 extends WriterAbstractItemMeta<SkullMeta, String, String> public class WriterItemStackMetaSkull18 extends WriterAbstractItemStackMetaField<SkullMeta, String, String>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT

View File

@ -0,0 +1,29 @@
package com.massivecraft.massivecore.item;
public class WriterItemStackMetaState extends WriterAbstractItemStackMetaStateMorph<Object, Object>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static final WriterItemStackMetaState i = new WriterItemStackMetaState();
public static WriterItemStackMetaState get() { return i; }
// -------------------------------------------- //
// ACTIVE
// -------------------------------------------- //
@Override
public void setActiveInner(boolean active)
{
if ( ! active) return;
this.clearWriters();
this.addWriters(
// SHIELD
WriterItemStackMetaStateShieldBase.class,
WriterItemStackMetaStateShieldPatterns.class
);
}
}

View File

@ -0,0 +1,50 @@
package com.massivecraft.massivecore.item;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.block.Banner;
public class WriterItemStackMetaStateShieldBase extends WriterAbstractItemStackMetaStateField<Banner, Integer, DyeColor>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static final WriterItemStackMetaStateShieldBase i = new WriterItemStackMetaStateShieldBase();
public static WriterItemStackMetaStateShieldBase get() { return i; }
public WriterItemStackMetaStateShieldBase()
{
this.setMaterial(Material.SHIELD);
this.setConverterTo(ConverterToDyeColor.get());
this.setConverterFrom(ConverterFromDyeColor.get());
}
// -------------------------------------------- //
// ACCESS
// -------------------------------------------- //
@Override
public Integer getA(DataItemStack ca)
{
return ca.getBannerBase();
}
@Override
public void setA(DataItemStack ca, Integer fa)
{
ca.setBannerBase(fa);
}
@Override
public DyeColor getB(Banner cb)
{
return cb.getBaseColor();
}
@Override
public void setB(Banner cb, DyeColor fb)
{
cb.setBaseColor(fb);
}
}

View File

@ -0,0 +1,51 @@
package com.massivecraft.massivecore.item;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.block.Banner;
import org.bukkit.block.banner.Pattern;
public class WriterItemStackMetaStateShieldPatterns extends WriterAbstractItemStackMetaStateField<Banner, List<DataBannerPattern>, List<Pattern>>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static final WriterItemStackMetaStateShieldPatterns i = new WriterItemStackMetaStateShieldPatterns();
public static WriterItemStackMetaStateShieldPatterns get() { return i; }
{
this.setMaterial(Material.SHIELD);
this.setConverterTo(ConverterToBannerPatterns.get());
this.setConverterFrom(ConverterFromBannerPatterns.get());
}
// -------------------------------------------- //
// ACCESS
// -------------------------------------------- //
@Override
public List<DataBannerPattern> getA(DataItemStack ca)
{
return ca.getBannerPatterns();
}
@Override
public void setA(DataItemStack ca, List<DataBannerPattern> fa)
{
ca.setBannerPatterns(fa);
}
@Override
public List<Pattern> getB(Banner cb)
{
return cb.getPatterns();
}
@Override
public void setB(Banner cb, List<Pattern> fb)
{
cb.setPatterns(fb);
}
}

View File

@ -7,7 +7,7 @@ import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.meta.EnchantmentStorageMeta; import org.bukkit.inventory.meta.EnchantmentStorageMeta;
public class WriterItemStackMetaStoredEnchants extends WriterAbstractItemMeta<EnchantmentStorageMeta, Map<Integer, Integer>, Map<Enchantment, Integer>> public class WriterItemStackMetaStoredEnchants extends WriterAbstractItemStackMetaField<EnchantmentStorageMeta, Map<Integer, Integer>, Map<Enchantment, Integer>>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT

View File

@ -3,7 +3,7 @@ package com.massivecraft.massivecore.item;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.meta.BookMeta; import org.bukkit.inventory.meta.BookMeta;
public class WriterItemStackMetaTitle extends WriterAbstractItemMeta<BookMeta, String, String> public class WriterItemStackMetaTitle extends WriterAbstractItemStackMetaField<BookMeta, String, String>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT

View File

@ -2,7 +2,7 @@ package com.massivecraft.massivecore.item;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
public class WriterItemStackMetaUnbreakable extends WriterAbstractItemMeta<ItemMeta, Boolean, Boolean> public class WriterItemStackMetaUnbreakable extends WriterAbstractItemStackMetaField<ItemMeta, Boolean, Boolean>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT