mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 04:20:41 +00:00
Simply using the SnakeYaml default (which in turn defaults to Class.forName) appears to be enough to get the classes for our custom configuration. This avoid Bukkit depreciation.
This commit is contained in:
parent
9ba5f43315
commit
e2e6bb3876
1 changed files with 2 additions and 26 deletions
|
@ -284,7 +284,8 @@ public class BukkitConstructor extends Constructor
|
||||||
final Field typeDefField = Constructor.class.getDeclaredField("typeDefinitions");
|
final Field typeDefField = Constructor.class.getDeclaredField("typeDefinitions");
|
||||||
typeDefField.setAccessible(true);
|
typeDefField.setAccessible(true);
|
||||||
typeDefinitions = (Map<Class<? extends Object>, TypeDescription>)typeDefField.get((Constructor)BukkitConstructor.this);
|
typeDefinitions = (Map<Class<? extends Object>, TypeDescription>)typeDefField.get((Constructor)BukkitConstructor.this);
|
||||||
if (typeDefinitions == null) {
|
if (typeDefinitions == null)
|
||||||
|
{
|
||||||
throw new NullPointerException();
|
throw new NullPointerException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -402,29 +403,4 @@ public class BukkitConstructor extends Constructor
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Class<?> getClassForNode(final Node node)
|
|
||||||
{
|
|
||||||
Class<?> clazz;
|
|
||||||
final String name = node.getTag().getClassName();
|
|
||||||
if (plugin == null)
|
|
||||||
{
|
|
||||||
clazz = super.getClassForNode(node);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
final JavaPluginLoader jpl = (JavaPluginLoader)plugin.getPluginLoader();
|
|
||||||
clazz = jpl.getClassByName(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (clazz == null)
|
|
||||||
{
|
|
||||||
throw new YAMLException("Class not found: " + name);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return clazz;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue