Fix error regarding deprecated command
This commit is contained in:
parent
043ea853f8
commit
c9dec9a7ef
@ -320,6 +320,8 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
|
|||||||
// Apply
|
// Apply
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
parent.addChild(this);
|
parent.addChild(this);
|
||||||
|
|
||||||
|
if (parent instanceof MassiveCommandDeprecated) MUtil.stackTraceDebug(getClassOrEnclosing(this).getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@ -982,6 +984,8 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
|
|||||||
|
|
||||||
public void setupAddChildren()
|
public void setupAddChildren()
|
||||||
{
|
{
|
||||||
|
if (this instanceof MassiveCommandDeprecated) return;
|
||||||
|
|
||||||
for (Field field : this.getClassOrEnclosing(this).getDeclaredFields())
|
for (Field field : this.getClassOrEnclosing(this).getDeclaredFields())
|
||||||
{
|
{
|
||||||
ReflectionUtil.makeAccessible(field);
|
ReflectionUtil.makeAccessible(field);
|
||||||
@ -989,7 +993,6 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
|
|||||||
|
|
||||||
if (!MassiveCommand.class.isAssignableFrom(fieldType)) continue;
|
if (!MassiveCommand.class.isAssignableFrom(fieldType)) continue;
|
||||||
if (Modifier.isStatic(field.getModifiers())) continue;
|
if (Modifier.isStatic(field.getModifiers())) continue;
|
||||||
|
|
||||||
MassiveCommand child = ReflectionUtil.getField(field, this);
|
MassiveCommand child = ReflectionUtil.getField(field, this);
|
||||||
this.addChild(child);
|
this.addChild(child);
|
||||||
}
|
}
|
||||||
@ -1015,11 +1018,14 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
|
|||||||
if (this.isRoot()) return null;
|
if (this.isRoot()) return null;
|
||||||
|
|
||||||
// ... get name of parent ...
|
// ... get name of parent ...
|
||||||
String parentName = this.getClassOrEnclosing(this.getParent()).getSimpleName();
|
String parentName = getClassOrEnclosing(this.getParent()).getSimpleName();
|
||||||
|
|
||||||
// ... and only try if the names match ...
|
// ... and only try if the names match ...
|
||||||
String name = this.getClass().getSimpleName();
|
String name = this.getClass().getSimpleName();
|
||||||
if ( ! name.startsWith(parentName)) return null;
|
if ( ! name.startsWith(parentName))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// ... and without parent prefix ...
|
// ... and without parent prefix ...
|
||||||
String ret = name.substring(parentName.length());
|
String ret = name.substring(parentName.length());
|
||||||
|
Loading…
Reference in New Issue
Block a user