Solved The Method getMethod is undefined for Type Object?

Discussion in 'Plugin Development' started by Raxor1234, Aug 4, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    Raxor1234

    I'm trying to make passive mobs follow the player, but I get this error on the Eclipse IDE: The method getMethod(String, Class<capture#1-of ? extends LivingEntity>, int) is undefined for the type Object

    private void navigate(LivingEntity le, Location location, double velocity){
    try{
    Object entityLiving = ReflectionUtil.getMethod("getHandle", le.getClass(), 0).invoke(le);

    }
    }

    Thanks in advance! :)
     
  2. Offline

    xXCapzXx

    Please can you do this in, it will be much easier to read.
    Code:
     [ / code]
                 ^ no spaces
    
    Like this:
    [code]
    player.getLocation();
    
     
  3. .getMethod requires (String name, Class<?> clazz, Class<?>... paramTypes)
    So instead of using 0, use new Class<?>[] {0}
     
  4. Offline

    1Rogue

    If it's a varargs function, passing an empty array is just noise that you don't need.
     
  5. Offline

    pie_flavor

    @Raxor1234 What's a ReflectionUtil? Why not use le.getClass().getMethod("getHandle", (Class<?>[]) null)?
     
  6. Wut? "new Class<?>[] {0}" it has 1 element in it
     
  7. Offline

    Raxor1234

    How do i flag this as solved? I figured it out :D
     
Thread Status:
Not open for further replies.

Share This Page