Mob is not summoned, strangely

Discussion in 'Plugin Development' started by glatteis, Oct 28, 2014.

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

    glatteis

    So, when a player joins, I want a fur sheep (or goat) to spawn besides him. So, the plugin does call the function (I tested) but it does not spawn the "goat" and does not show an error too.
    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
    Player player = event.getPlayer();
    Sheep livingGoat = (Sheep) player.getWorld().spawnEntity(player.getLocation(), EntityType.SHEEP);
    livingGoat.setSheared(true);
    livingGoat.setCustomName(player.getName());
    livingGoat.setCustomNameVisible(true);
    }
     
  2. Offline

    fireblast709

    glatteis have you registered your Listener?
     
  3. Offline

    wesley27

    glatteis I could be wrong about this, but I think it isn't spawning because your method to spawn is simply part of the Sheep "livingGoat." I believe you actually need to execute the spawnEntity() method, rather than just include it as part of an object.
     
  4. Offline

    teej107

    wesley27
    He is executing it. That method also returns the entity as well. It's probably a lack of registering a listener.
     
  5. Offline

    glatteis

    Update:
    Like I said, it calls the onPlayerJoin function and when I put something else ( like sendMessage) into it it does execute it. The only thing it does not do is spawn the sheep.
     
  6. Offline

    Cirno

    Strange. Try scheduling a task for it?
     
  7. Offline

    xTrollxDudex

    And you know it is called because...?
     
  8. Offline

    OffLuffy

    You may make sure that another plugin isn't cancelling spawn events for entities. Primarily WorldGuard or Multiverse
     
Thread Status:
Not open for further replies.

Share This Page