Bukkit .spawn() with Custom Class Type

Discussion in 'Plugin Development' started by m16, Nov 16, 2018.

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

    m16

    Hi there,

    I have a custom Class called "Snowman" that I'm currently trying to code. I'm trying to put a custom "Snowman" entity within the game.

    In the code for this class Snowman, I am trying to call the .spawn(Location, Class<T>) function to spawn it in my world.

    For example, I'm doing something like this.

    Code:
    LivingEntity snowMan = (LivingEntity) Bukkit.getServer().getWorld(s).spawn(spawn.toLocation(), Snowman.class);
    
    Where s is a string name for a World. What am I doing wrong here? It specifically says:

    " The method spawn(Location, Class<T>) in the type World is not applicable for the arguments (Location, Class<Snowman>)".

    Thank you for the help!
     
    Last edited: Nov 16, 2018
  2. @m16
    The most likely problem is that your class Snowman needs to implement LivingEntity.
     
Thread Status:
Not open for further replies.

Share This Page