lundi 16 décembre 2019

Calling private constructor errors

I'm trying to call this constructor:

private EntityType(String name, Class<? extends Entity> clazz, int typeId) {
    this(name, clazz, typeId, true);
}

with this code:

try
    {
        final Constructor<EntityType> con = EntityType.class.getDeclaredConstructor(String.class, Class.class, int.class);
        con.setAccessible(true);

        entityType = con.newInstance("PrimedTnt", DestroyTNT.class, 20);
    } catch (NoSuchMethodException | InstantiationException | InvocationTargetException | IllegalAccessException e)
    {
        e.printStackTrace();
    }

but I get this error:

[18:25:19 WARN]: java.lang.NoSuchMethodException: org.bukkit.entity.EntityType.<init>(java.lang.String, java.lang.Class, int)

Any ideas?





Aucun commentaire:

Enregistrer un commentaire