Merge pull request 'Fixed Colors for 1.12' (#60) from color-fix into master
Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Commit
74c3a5ab41
@ -116,6 +116,10 @@ public class SWItem {
|
|||||||
this(material, (byte)0, name, new ArrayList<>(), false, null);
|
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) {
|
public SWItem(Material material, String name, List<String> lore, boolean enchanted, InvCallback c) {
|
||||||
this(material, (byte)0, name, lore, enchanted, c);
|
this(material, (byte)0, name, lore, enchanted, c);
|
||||||
}
|
}
|
||||||
@ -142,7 +146,13 @@ public class SWItem {
|
|||||||
public static SWItem getItemFromJson(JsonObject itemJson) {
|
public static SWItem getItemFromJson(JsonObject itemJson) {
|
||||||
SWItem item = null;
|
SWItem item = null;
|
||||||
try {
|
try {
|
||||||
|
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());
|
item = new SWItem(Material.valueOf(itemJson.get("material").getAsString()), itemJson.get("title").getAsString());
|
||||||
|
}
|
||||||
}catch (IllegalArgumentException e) {
|
}catch (IllegalArgumentException e) {
|
||||||
item = new SWItem(Material.STONE, itemJson.get("title").getAsString());
|
item = new SWItem(Material.STONE, itemJson.get("title").getAsString());
|
||||||
}
|
}
|
||||||
@ -150,9 +160,7 @@ public class SWItem {
|
|||||||
item = SWItem.getPlayerSkull(itemJson.get("skullOwner").getAsString());
|
item = SWItem.getPlayerSkull(itemJson.get("skullOwner").getAsString());
|
||||||
item.setName(itemJson.get("title").getAsString());
|
item.setName(itemJson.get("title").getAsString());
|
||||||
}
|
}
|
||||||
if(itemJson.has("color")) {
|
|
||||||
item.getItemStack().setType(SWItem.getDye(itemJson.get("color").getAsInt()));
|
|
||||||
}
|
|
||||||
if(itemJson.has("enchanted"))
|
if(itemJson.has("enchanted"))
|
||||||
item.setEnchanted(true);
|
item.setEnchanted(true);
|
||||||
if(itemJson.has("lore")) {
|
if(itemJson.has("lore")) {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren