Add potion & map color fields to DataItemStack.
This commit is contained in:
parent
77b50651dc
commit
1838c9c2ab
@ -42,6 +42,8 @@
|
|||||||
author: str
|
author: str
|
||||||
pages: [str]
|
pages: [str]
|
||||||
map_is_scaling: byte
|
map_is_scaling: byte
|
||||||
|
potionColor: int
|
||||||
|
mapColor: int
|
||||||
SkullOwner: str
|
SkullOwner: str
|
||||||
CustomPotionEffects:
|
CustomPotionEffects:
|
||||||
[
|
[
|
||||||
|
@ -81,6 +81,8 @@ public class DataItemStack implements Comparable<DataItemStack>
|
|||||||
public static final transient List<DataBannerPattern> DEFAULT_BANNER_PATTERNS = Collections.emptyList();
|
public static final transient List<DataBannerPattern> DEFAULT_BANNER_PATTERNS = Collections.emptyList();
|
||||||
public static final transient String DEFAULT_POTION = "water";
|
public static final transient String DEFAULT_POTION = "water";
|
||||||
public static final transient Map<Integer, DataItemStack> DEFAULT_INVENTORY = Collections.emptyMap();
|
public static final transient Map<Integer, DataItemStack> DEFAULT_INVENTORY = Collections.emptyMap();
|
||||||
|
public static final transient Integer DEFAULT_POTION_COLOR = null;
|
||||||
|
public static final transient Integer DEFAULT_MAP_COLOR = null;
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// FIELDS > BASIC
|
// FIELDS > BASIC
|
||||||
@ -276,6 +278,26 @@ public class DataItemStack implements Comparable<DataItemStack>
|
|||||||
public Map<Integer, DataItemStack> getInventory() { return get(this.inventory, DEFAULT_INVENTORY); }
|
public Map<Integer, DataItemStack> getInventory() { return get(this.inventory, DEFAULT_INVENTORY); }
|
||||||
public DataItemStack setInventory(Map<Integer, DataItemStack> inventory) { this.inventory = set(inventory, DEFAULT_INVENTORY); return this; }
|
public DataItemStack setInventory(Map<Integer, DataItemStack> inventory) { this.inventory = set(inventory, DEFAULT_INVENTORY); return this; }
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// FIELDS > POTION COLOR
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// SINCE: 1.11
|
||||||
|
|
||||||
|
@EditorType(TypeConverterColor.class)
|
||||||
|
private Integer potionColor = null;
|
||||||
|
public Integer getPotionColor() { return get(this.potionColor, DEFAULT_POTION_COLOR); }
|
||||||
|
public DataItemStack setPotionColor(Integer potionColor) { this.potionColor = set(potionColor, DEFAULT_POTION_COLOR); return this; }
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// FIELDS > MAP COLOR
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// Since 1.11
|
||||||
|
|
||||||
|
@EditorType(TypeConverterColor.class)
|
||||||
|
private Integer mapColor = null;
|
||||||
|
public Integer getMapColor() { return get(this.mapColor, DEFAULT_MAP_COLOR); }
|
||||||
|
public DataItemStack setMapColor(Integer mapColor) { this.mapColor = set(mapColor, DEFAULT_MAP_COLOR); return this; }
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// CONSTRUCT
|
// CONSTRUCT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
@ -481,7 +503,9 @@ public class DataItemStack implements Comparable<DataItemStack>
|
|||||||
this.getBannerBase(), that.getBannerBase(),
|
this.getBannerBase(), that.getBannerBase(),
|
||||||
this.getBannerPatterns(), that.getBannerPatterns(),
|
this.getBannerPatterns(), that.getBannerPatterns(),
|
||||||
this.getPotion(), that.getPotion(),
|
this.getPotion(), that.getPotion(),
|
||||||
this.getInventory(), that.getInventory()
|
this.getInventory(), that.getInventory(),
|
||||||
|
this.getPotionColor(), that.getPotionColor(),
|
||||||
|
this.getMapColor(), that.getMapColor()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -514,7 +538,9 @@ public class DataItemStack implements Comparable<DataItemStack>
|
|||||||
this.getBannerBase(), that.getBannerBase(),
|
this.getBannerBase(), that.getBannerBase(),
|
||||||
this.getBannerPatterns(), that.getBannerPatterns(),
|
this.getBannerPatterns(), that.getBannerPatterns(),
|
||||||
this.getPotion(), that.getPotion(),
|
this.getPotion(), that.getPotion(),
|
||||||
this.getInventory(), that.getInventory()
|
this.getInventory(), that.getInventory(),
|
||||||
|
this.getPotionColor(), that.getPotionColor(),
|
||||||
|
this.getMapColor(), that.getMapColor()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -554,7 +580,9 @@ public class DataItemStack implements Comparable<DataItemStack>
|
|||||||
this.getBannerBase(), that.getBannerBase(),
|
this.getBannerBase(), that.getBannerBase(),
|
||||||
this.getBannerPatterns(), that.getBannerPatterns(),
|
this.getBannerPatterns(), that.getBannerPatterns(),
|
||||||
this.getPotion(), that.getPotion(),
|
this.getPotion(), that.getPotion(),
|
||||||
this.getInventory(), that.getInventory()
|
this.getInventory(), that.getInventory(),
|
||||||
|
this.getPotionColor(), that.getPotionColor(),
|
||||||
|
this.getMapColor(), that.getMapColor()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -592,7 +620,9 @@ public class DataItemStack implements Comparable<DataItemStack>
|
|||||||
this.getBannerBase(),
|
this.getBannerBase(),
|
||||||
this.getBannerPatterns(),
|
this.getBannerPatterns(),
|
||||||
this.getPotion(),
|
this.getPotion(),
|
||||||
this.getInventory()
|
this.getInventory(),
|
||||||
|
this.getPotionColor(),
|
||||||
|
this.getMapColor()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ public class WriterItemStackMeta extends WriterAbstractItemStackMetaMorph<Object
|
|||||||
|
|
||||||
// MAP
|
// MAP
|
||||||
WriterItemStackMetaScaling.class,
|
WriterItemStackMetaScaling.class,
|
||||||
|
WriterItemStackMetaMapColor.class,
|
||||||
|
|
||||||
// POTION EFFECTS
|
// POTION EFFECTS
|
||||||
WriterItemStackMetaPotionEffects.class,
|
WriterItemStackMetaPotionEffects.class,
|
||||||
@ -60,6 +61,7 @@ public class WriterItemStackMeta extends WriterAbstractItemStackMetaMorph<Object
|
|||||||
|
|
||||||
// POTION
|
// POTION
|
||||||
WriterItemStackMetaPotion.class,
|
WriterItemStackMetaPotion.class,
|
||||||
|
WriterItemStackMetaPotionColor.class,
|
||||||
|
|
||||||
// INVENTORY
|
// INVENTORY
|
||||||
WriterItemStackMetaInventory.class
|
WriterItemStackMetaInventory.class
|
||||||
|
@ -0,0 +1,53 @@
|
|||||||
|
package com.massivecraft.massivecore.item;
|
||||||
|
|
||||||
|
import org.bukkit.Color;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.MapMeta;
|
||||||
|
|
||||||
|
public class WriterItemStackMetaMapColor extends WriterAbstractItemStackMetaField<MapMeta, Integer, Color>
|
||||||
|
{
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// INSTANCE & CONSTRUCT
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
private static final WriterItemStackMetaMapColor i = new WriterItemStackMetaMapColor();
|
||||||
|
public static WriterItemStackMetaMapColor get() { return i; }
|
||||||
|
|
||||||
|
public WriterItemStackMetaMapColor()
|
||||||
|
{
|
||||||
|
super(MapMeta.class);
|
||||||
|
this.setMaterial(Material.MAP);
|
||||||
|
this.setConverterTo(ConverterToColor.get());
|
||||||
|
this.setConverterFrom(ConverterFromColor.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// ACCESS
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getA(DataItemStack ca, ItemStack d)
|
||||||
|
{
|
||||||
|
return ca.getMapColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setA(DataItemStack ca, Integer fa, ItemStack d)
|
||||||
|
{
|
||||||
|
ca.setMapColor(fa);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Color getB(MapMeta cb, ItemStack d)
|
||||||
|
{
|
||||||
|
return cb.getColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setB(MapMeta cb, Color fb, ItemStack d)
|
||||||
|
{
|
||||||
|
cb.setColor(fb);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
package com.massivecraft.massivecore.item;
|
||||||
|
|
||||||
|
import org.bukkit.Color;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.PotionMeta;
|
||||||
|
|
||||||
|
public class WriterItemStackMetaPotionColor extends WriterAbstractItemStackMetaField<PotionMeta, Integer, Color>
|
||||||
|
{
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// INSTANCE & CONSTRUCT
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
private static final WriterItemStackMetaPotionColor i = new WriterItemStackMetaPotionColor();
|
||||||
|
public static WriterItemStackMetaPotionColor get() { return i; }
|
||||||
|
|
||||||
|
public WriterItemStackMetaPotionColor()
|
||||||
|
{
|
||||||
|
super(PotionMeta.class);
|
||||||
|
this.setMaterial(Material.POTION);
|
||||||
|
this.setConverterTo(ConverterToColor.get());
|
||||||
|
this.setConverterFrom(ConverterFromColor.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// ACCESS
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getA(DataItemStack ca, ItemStack d)
|
||||||
|
{
|
||||||
|
return ca.getPotionColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setA(DataItemStack ca, Integer fa, ItemStack d)
|
||||||
|
{
|
||||||
|
ca.setPotionColor(fa);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Color getB(PotionMeta cb, ItemStack d)
|
||||||
|
{
|
||||||
|
return cb.getColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setB(PotionMeta cb, Color fb, ItemStack d)
|
||||||
|
{
|
||||||
|
cb.setColor(fb);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user