From a7011030fa05539cfe3d3bbe3111deea60333b12 Mon Sep 17 00:00:00 2001 From: jojo Date: Sun, 6 Sep 2020 18:33:43 +0200 Subject: [PATCH] Shorten NAME --- src/de/steamwar/misslewars/items/Missile.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/misslewars/items/Missile.java b/src/de/steamwar/misslewars/items/Missile.java index 7df6130..da81e7f 100644 --- a/src/de/steamwar/misslewars/items/Missile.java +++ b/src/de/steamwar/misslewars/items/Missile.java @@ -51,8 +51,13 @@ public class Missile extends SpecialItem { private final ItemStack item; private Missile(File missileFile){ - String name = missileFile.getName().split("\\.")[0]; - Material itemType = Material.valueOf(missileFile.getName().split("\\.")[1]); + String[] strings = missileFile.getName().split("\\."); + String name = strings[0]; + String material = strings[1]; + if (!material.endsWith("_SPAWN_EGG")) { + material += "_SPAWN_EGG"; + } + Material itemType = Material.valueOf(material); ClipboardFormat format = ClipboardFormats.findByFile(missileFile);