Fixed Colors for 1.12 #60
@ -116,6 +116,10 @@ public class SWItem {
|
||||
this(material, (byte)0, name, new ArrayList<>(), false, null);
|
||||
}
|
||||
|
||||
public SWItem(Material material, byte meta, String name){
|
||||
this(material, meta, name, new ArrayList<>(), false, null);
|
||||
}
|
||||
|
||||
public SWItem(Material material, String name, List<String> lore, boolean enchanted, InvCallback c) {
|
||||
this(material, (byte)0, name, lore, enchanted, c);
|
||||
}
|
||||
@ -142,7 +146,13 @@ public class SWItem {
|
||||
public static SWItem getItemFromJson(JsonObject itemJson) {
|
||||
SWItem item = null;
|
||||
try {
|
||||
item = new SWItem(Material.valueOf(itemJson.get("material").getAsString()), itemJson.get("title").getAsString());
|
||||
if(itemJson.has("color")) {
|
||||
item = new SWItem(SWItem.getDye(itemJson.get("color").getAsInt()),
|
||||
itemJson.has("color")?itemJson.get("color").getAsByte():0,
|
||||
itemJson.get("title").getAsString());
|
||||
}else {
|
||||
item = new SWItem(Material.valueOf(itemJson.get("material").getAsString()), itemJson.get("title").getAsString());
|
||||
}
|
||||
}catch (IllegalArgumentException e) {
|
||||
item = new SWItem(Material.STONE, itemJson.get("title").getAsString());
|
||||
}
|
||||
@ -150,9 +160,7 @@ public class SWItem {
|
||||
item = SWItem.getPlayerSkull(itemJson.get("skullOwner").getAsString());
|
||||
item.setName(itemJson.get("title").getAsString());
|
||||
}
|
||||
if(itemJson.has("color")) {
|
||||
item.getItemStack().setType(SWItem.getDye(itemJson.get("color").getAsInt()));
|
||||
}
|
||||
|
||||
if(itemJson.has("enchanted"))
|
||||
item.setEnchanted(true);
|
||||
if(itemJson.has("lore")) {
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren