forked from SteamWar/SteamWar
Add customModelData to Velocity SWItem
This commit is contained in:
@@ -142,6 +142,9 @@ public class SWItem {
|
|||||||
loreArray.forEach(jsonElement -> lore.add(jsonElement.getAsString()));
|
loreArray.forEach(jsonElement -> lore.add(jsonElement.getAsString()));
|
||||||
item.setLore(lore);
|
item.setLore(lore);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (itemJson.has("customModelData"))
|
||||||
|
item.setCustomModelData(itemJson.get("customModelData").getAsInt());
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ public class SWItem {
|
|||||||
@Getter
|
@Getter
|
||||||
private InvCallback callback;
|
private InvCallback callback;
|
||||||
private int color = 0;
|
private int color = 0;
|
||||||
|
private int customModelData = 0;
|
||||||
|
|
||||||
public SWItem(String material, Message title) {
|
public SWItem(String material, Message title) {
|
||||||
this.material = material.toUpperCase();
|
this.material = material.toUpperCase();
|
||||||
@@ -64,6 +65,11 @@ public class SWItem {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SWItem setCustomModelData(int customModelData) {
|
||||||
|
this.customModelData = customModelData;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public JsonObject writeToString(Chatter player, int position) {
|
public JsonObject writeToString(Chatter player, int position) {
|
||||||
JsonObject object = new JsonObject();
|
JsonObject object = new JsonObject();
|
||||||
object.addProperty("material", material);
|
object.addProperty("material", material);
|
||||||
@@ -84,6 +90,9 @@ public class SWItem {
|
|||||||
}
|
}
|
||||||
object.add("lore", array);
|
object.add("lore", array);
|
||||||
}
|
}
|
||||||
|
if (customModelData > 0) {
|
||||||
|
object.addProperty("customModelData", customModelData);
|
||||||
|
}
|
||||||
|
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user