Include inherited methods on register (for precommand/help etc)

This commit is contained in:
Aikar
2017-11-22 22:07:16 -05:00
parent 55d238614f
commit d560beeeab
3 changed files with 4 additions and 10 deletions
-6
View File
@@ -2,14 +2,8 @@
<code_scheme name="Project" version="173">
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="true" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</value>
</option>
<option name="LINE_SEPARATOR" value="&#10;" />
@@ -120,7 +120,7 @@ public abstract class BaseCommand {
boolean foundDefault = false;
boolean foundUnknown = false;
for (Method method : self.getDeclaredMethods()) {
for (Method method : self.getMethods()) {
method.setAccessible(true);
String sublist = null;
String sub = getSubcommandValue(method);
@@ -166,7 +166,7 @@ public abstract class BaseCommand {
ACFUtil.sneaky(new IllegalStateException("Multiple @PreCommand commands, duplicate on " + method.getDeclaringClass().getName() + "#" + method.getName()));
}
}
if (sublist != null) {
if (Objects.equals(method.getDeclaringClass(), this.getClass()) && sublist != null) {
registerSubcommand(method, sublist);
}
}
@@ -128,7 +128,7 @@
<span class="sourceLineNo">120</span><a name="line.120"></a>
<span class="sourceLineNo">121</span> boolean foundDefault = false;<a name="line.121"></a>
<span class="sourceLineNo">122</span> boolean foundUnknown = false;<a name="line.122"></a>
<span class="sourceLineNo">123</span> for (Method method : self.getDeclaredMethods()) {<a name="line.123"></a>
<span class="sourceLineNo">123</span> for (Method method : self.getMethods()) {<a name="line.123"></a>
<span class="sourceLineNo">124</span> method.setAccessible(true);<a name="line.124"></a>
<span class="sourceLineNo">125</span> String sublist = null;<a name="line.125"></a>
<span class="sourceLineNo">126</span> String sub = getSubcommandValue(method);<a name="line.126"></a>
@@ -174,7 +174,7 @@
<span class="sourceLineNo">166</span> ACFUtil.sneaky(new IllegalStateException("Multiple @PreCommand commands, duplicate on " + method.getDeclaringClass().getName() + "#" + method.getName()));<a name="line.166"></a>
<span class="sourceLineNo">167</span> }<a name="line.167"></a>
<span class="sourceLineNo">168</span> }<a name="line.168"></a>
<span class="sourceLineNo">169</span> if (sublist != null) {<a name="line.169"></a>
<span class="sourceLineNo">169</span> if (Objects.equals(method.getDeclaringClass(), this.getClass()) &amp;&amp; sublist != null) {<a name="line.169"></a>
<span class="sourceLineNo">170</span> registerSubcommand(method, sublist);<a name="line.170"></a>
<span class="sourceLineNo">171</span> }<a name="line.171"></a>
<span class="sourceLineNo">172</span> }<a name="line.172"></a>