From 5f187bb7146cb2149b0e7f48b04e1841a8955353 Mon Sep 17 00:00:00 2001 From: ucchy Date: Sat, 13 Jul 2019 23:53:10 +0900 Subject: [PATCH] UndineMailer v1.9.1 : Refined ItemConfigUtility. --- src/main/java/org/bitbucket/ucchy/undine/MailData.java | 2 +- src/main/java/org/bitbucket/ucchy/undine/MailManager.java | 1 + .../bitbucket/ucchy/undine/command/UndineItemCommand.java | 5 ++--- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/bitbucket/ucchy/undine/MailData.java b/src/main/java/org/bitbucket/ucchy/undine/MailData.java index 39dd71b..ae521d8 100644 --- a/src/main/java/org/bitbucket/ucchy/undine/MailData.java +++ b/src/main/java/org/bitbucket/ucchy/undine/MailData.java @@ -287,7 +287,7 @@ protected static MailData loadFromConfigSection(ConfigurationSection section) { ConfigurationSection sub = section.getConfigurationSection("attachments." + name); try { ItemStack item = ItemConfigParser.getItemFromSection(sub); - data.attachments.add(item); + if (item != null) data.attachments.add(item); } catch (ItemConfigParseException e) { e.printStackTrace(); } diff --git a/src/main/java/org/bitbucket/ucchy/undine/MailManager.java b/src/main/java/org/bitbucket/ucchy/undine/MailManager.java index 677b3b7..4fee0dd 100644 --- a/src/main/java/org/bitbucket/ucchy/undine/MailManager.java +++ b/src/main/java/org/bitbucket/ucchy/undine/MailManager.java @@ -1448,6 +1448,7 @@ private int getIndexOfMailList(int index, ArrayList list) { * @return 文字列表現 */ private String getItemDesc(ItemStack item, boolean forDescription) { + if (item == null) return "null"; String desc = item.getDurability() == 0 ? item.getType().toString() : item.getType().toString() + ":" + item.getDurability(); if ( item.getAmount() == 1 ) return desc; diff --git a/src/main/java/org/bitbucket/ucchy/undine/command/UndineItemCommand.java b/src/main/java/org/bitbucket/ucchy/undine/command/UndineItemCommand.java index a286128..e0a650b 100644 --- a/src/main/java/org/bitbucket/ucchy/undine/command/UndineItemCommand.java +++ b/src/main/java/org/bitbucket/ucchy/undine/command/UndineItemCommand.java @@ -63,11 +63,10 @@ public void runCommand(CommandSender sender, String label, String[] args) { // 情報表示 String description = UndineCommandUtil.getItemDesc(hand); -// String isTradable = TradableMaterial.isTradable(hand.getType()) -// ? Messages.get("Yes") : Messages.get("No"); + String isTradable = Messages.get("Yes"); sender.sendMessage(Messages.get("InformationItemDetail", new String[]{"%desc", "%tradable"}, - new String[]{description, Messages.get("Yes")})); + new String[]{description, isTradable})); } /**