mirror of
https://github.com/garbagemule/MobArena.git
synced 2024-11-30 06:33:55 +01:00
Return null before trying to add enchantments to null items.
This commit is contained in:
parent
f96eb5ac47
commit
4ce99aaa05
@ -5,6 +5,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.garbagemule.MobArena.Messenger;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
@ -142,6 +143,10 @@ public class ItemParser
|
||||
result = withDataAndAmount(parts[0], parts[1], parts[2]);
|
||||
break;
|
||||
}
|
||||
if (result == null || result.getTypeId() == 0) {
|
||||
Messenger.warning("Failed to parse item: " + item);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (space.length == 2) {
|
||||
addEnchantments(result, space[1]);
|
||||
|
Loading…
Reference in New Issue
Block a user