Support Active by String

This commit is contained in:
Olof Larsson 2016-10-17 18:33:59 +02:00
parent 863f76d2ae
commit b1426a17b3
No known key found for this signature in database
GPG Key ID: BBEF14F97DA52474

View File

@ -202,6 +202,7 @@ public abstract class MassivePlugin extends JavaPlugin implements Listener, Name
for (Object object : objects)
{
Active active = asActive(object);
if (active == null) continue;
active.setActive(this);
}
}
@ -213,6 +214,20 @@ public abstract class MassivePlugin extends JavaPlugin implements Listener, Name
return (Active)object;
}
if (object instanceof String)
{
String string = (String)object;
try
{
object = Class.forName(string);
}
catch (NoClassDefFoundError | ClassNotFoundException e)
{
// Silently skip and move on
return null;
}
}
if (object instanceof Class<?>)
{
Class<?> clazz = (Class<?>)object;