Fixed 2 NPE errors.

This commit is contained in:
Steffion 2013-08-05 11:57:18 +02:00
parent 56eec348de
commit 0a9e4d48b5
2 changed files with 10 additions and 6 deletions

View File

@ -183,8 +183,10 @@ public class InventoryHandler {
arenaNameNote_IM.setLore(lores);
arenaNameNote.setItemMeta(arenaNameNote_IM);
panel.setItem(0, arenaNameNote);
for (int i = arena.disguiseBlocks.size(); i > 0; i = i - 1) {
panel.setItem(i, arena.disguiseBlocks.get(i - 1));
if (arena.disguiseBlocks != null) {
for (int i = arena.disguiseBlocks.size(); i > 0; i = i - 1) {
panel.setItem(i, arena.disguiseBlocks.get(i - 1));
}
}
player.openInventory(panel);
}

View File

@ -28,10 +28,12 @@ public class OnInventoryClickEvent implements Listener {
if (inv.getType().equals(InventoryType.CHEST)) {
if (inv.getName().startsWith("\u00A7r")) {
if (inv.getName().contains("DisguiseBlocks")) {
if (!event.getCurrentItem().getType().isBlock()) {
event.setCancelled(true);
MessageM.sendFMessage(player,
ConfigC.error_setNotABlock, true);
if (event.getCurrentItem() != null) {
if (!event.getCurrentItem().getType().isBlock()) {
event.setCancelled(true);
MessageM.sendFMessage(player,
ConfigC.error_setNotABlock, true);
}
}
return;