diff --git a/paper-api/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java b/paper-api/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java index 95505009f8..1b68db4600 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java +++ b/paper-api/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java @@ -202,24 +202,26 @@ public final class PluginDescriptionFile { try { for (Map.Entry command : ((Map) map.get("commands")).entrySet()) { ImmutableMap.Builder commandBuilder = ImmutableMap.builder(); - for (Map.Entry commandEntry : ((Map) command.getValue()).entrySet()) { - if (commandEntry.getValue() instanceof Iterable) { - // This prevents internal alias list changes - ImmutableList.Builder commandSubList = ImmutableList.builder(); - for (Object commandSubListItem : (Iterable) commandEntry.getValue()) { - commandSubList.add(commandSubListItem); + if (command.getValue() != null) { + for (Map.Entry commandEntry : ((Map) command.getValue()).entrySet()) { + if (commandEntry.getValue() instanceof Iterable) { + // This prevents internal alias list changes + ImmutableList.Builder commandSubList = ImmutableList.builder(); + for (Object commandSubListItem : (Iterable) commandEntry.getValue()) { + if (commandSubListItem != null) { + commandSubList.add(commandSubListItem); + } + } + commandBuilder.put(commandEntry.getKey().toString(), commandSubList.build()); + } else if (commandEntry.getValue() != null) { + commandBuilder.put(commandEntry.getKey().toString(), commandEntry.getValue()); } - commandBuilder.put(commandEntry.getKey().toString(), commandSubList.build()); - } else if (commandEntry.getValue() != null) { - commandBuilder.put(commandEntry.getKey().toString(), commandEntry.getValue()); } } commandsBuilder.put(command.getKey().toString(), commandBuilder.build()); } } catch (ClassCastException ex) { throw new InvalidDescriptionException(ex, "commands are of wrong type"); - } catch (NullPointerException ex) { - throw new InvalidDescriptionException(ex, "commands are not properly defined"); } commands = commandsBuilder.build(); }