Skip to content

Commit b5a45da

Browse files
committed
Added stone types suport
You can now also directly get andesite, diorite and granite converted without you have to do it self.
1 parent d8029e2 commit b5a45da

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

src/main/java/org/brokenarrow/menu/library/utility/Item/ConvertToItemStack.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ public ItemStack createStack(final String item, int amount) {
157157
if (item.equals("PLAYER_HEAD")) {
158158
return new ItemStack(Material.valueOf("SKULL_ITEM"), amount);
159159
}
160+
if (item.contains("_ANDESITE") || item.contains("_DIORITE") || item.contains("_GRANITE")) {
161+
return getStoneTypes(Material.STONE, item, amount);
162+
}
160163
if (item.equals("CHARCOAL")) {
161164
return new ItemStack(Material.valueOf("COAL"), amount, (short) 1);
162165
} else {
@@ -279,6 +282,16 @@ public ItemStack checkAndGetWood(final String itemName, final int amount) {
279282
return null;
280283
}
281284

285+
public ItemStack getStoneTypes(final Material material, final String itemName, final int amount) {
286+
if (material == null) return null;
287+
short stonetype = getStoneTypeData(itemName);
288+
if (stonetype == -1)
289+
return new ItemStack(material, amount);
290+
if (stonetype >= 0)
291+
return new ItemStack(material, amount, stonetype);
292+
return null;
293+
}
294+
282295
public ItemStack getWoodItemStack(final Material material, final String itemName, final int amount) {
283296
return getWoodItemStack(material, (short) -1, itemName, amount);
284297
}
@@ -292,6 +305,28 @@ public ItemStack getWoodItemStack(final Material material, short woodTypeData, f
292305
return null;
293306
}
294307

308+
public short getStoneTypeData(final String itemName) {
309+
if (itemName.equals("GRANITE")) {
310+
return 1;
311+
}
312+
if (itemName.equals("POLISHED_GRANITE")) {
313+
return 2;
314+
}
315+
if (itemName.equals("DIORITE")) {
316+
return 3;
317+
}
318+
if (itemName.equals("POLISHED_DIORITE")) {
319+
return 4;
320+
}
321+
if (itemName.equals("ANDESITE")) {
322+
return 5;
323+
}
324+
if (itemName.equals("POLISHED_ANDESITE")) {
325+
return 6;
326+
}
327+
return -1;
328+
}
329+
295330
public short getWoodTypeData(final String itemName) {
296331
if (itemName.startsWith("DARK_OAK_")) {
297332
return 5;

0 commit comments

Comments
 (0)