Restoring an argument feature by removing to strong security.

This commit is contained in:
Olof Larsson 2015-08-04 11:08:17 +02:00
parent 593dd65e2e
commit 5ee293a87b

View File

@ -1231,11 +1231,16 @@ public class MassiveCommand
// Return the default in the setting. // Return the default in the setting.
if ( ! this.argIsSet(idx) && setting.isDefaultValueSet()) return setting.getDefaultValue(); if ( ! this.argIsSet(idx) && setting.isDefaultValueSet()) return setting.getDefaultValue();
// The was no arg, or default value in the setting. // OLD: Throw error if there was no arg, or default value in the setting.
if ( ! this.argIsSet(idx)) throw new IllegalArgumentException("Trying to access arg: " + idx + " but that is not set."); // OLD: if ( ! this.argIsSet(idx)) throw new IllegalArgumentException("Trying to access arg: " + idx + " but that is not set.");
// NOTE: This security actually blocks some functionality. Certain AR handle null argument values and specify their own default from within.
// NOTE: An example is the MassiveQuest ARMNode which defaults to the used node of the player but must error when the player has no used node: "You must use a quest to skip the optional argument.".
// Just read the arg normally. // Get the arg.
String arg = this.getArgs().get(idx); String arg = null;
if (this.argIsSet(idx)) arg = this.getArgs().get(idx);
// Read and return the arg.
return setting.getReader().read(arg, sender); return setting.getReader().read(arg, sender);
} }