summaryrefslogtreecommitdiffstats
path: root/src/main/java/org
diff options
context:
space:
mode:
authorWesley Wolfe <weswolf@aol.com>2012-03-10 13:11:21 -0600
committerEvilSeph <evilseph@gmail.com>2012-03-15 06:45:44 -0400
commitff9fa6b32e8767765134b07be1082a8b3935b608 (patch)
treef0cecda05f6d71a17d89672cdf89f66a01356d60 /src/main/java/org
parent2ab4e6bdc792ef5dbb1cc4b47ca66ecf6b2b3fac (diff)
downloadbukkit-ff9fa6b32e8767765134b07be1082a8b3935b608.tar
bukkit-ff9fa6b32e8767765134b07be1082a8b3935b608.tar.gz
bukkit-ff9fa6b32e8767765134b07be1082a8b3935b608.tar.lz
bukkit-ff9fa6b32e8767765134b07be1082a8b3935b608.tar.xz
bukkit-ff9fa6b32e8767765134b07be1082a8b3935b608.zip
[Bleeding] More lenient command creation from plugin.yml. Fixes BUKKIT-1093
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/bukkit/plugin/PluginDescriptionFile.java24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java b/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java
index 95505009..1b68db46 100644
--- a/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java
+++ b/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<String, Object> commandBuilder = ImmutableMap.<String, Object>builder();
- for (Map.Entry<?, ?> commandEntry : ((Map<?, ?>) command.getValue()).entrySet()) {
- if (commandEntry.getValue() instanceof Iterable) {
- // This prevents internal alias list changes
- ImmutableList.Builder<Object> commandSubList = ImmutableList.<Object>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<Object> commandSubList = ImmutableList.<Object>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();
}