Help please!

Discussion in 'Plugin Development' started by SirFrill, Nov 13, 2014.

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

    SirFrill

    I am trying to make a plugin that spawns a creeper on a player that logs on a server. and it does not appear to work. any help?

    package me.sirfrill.spawnmobonjoin;

    import org.bukkit.Bukkit;
    import org.bukkit.Location;
    import org.bukkit.entity.EntityType;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.plugin.java.JavaPlugin;

    public class Main extends JavaPlugin implements Listener {


    public void onEnable(){
    Bukkit.getServer().getPluginManager().registerEvents(this, this);
    }


    @EventHandler
    public void onPlayerJoin (final PlayerJoinEvent pje) {
    Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable(){
    Player player = (Player) pje;
    public void run(){




    Location location = player.getLocation();
    player.getWorld().spawnEntity(location, EntityType.CREEPER);


    }

    }, (20));

    }
    }
     
  2. Offline

    davidp027

    Player player = (Player) pje.getPlayer();
     
  3. Offline

    SirFrill

    Thank you so much! I love you!
     
  4. Offline

    mine-care

    Please use code tags next time :)
     
    davidp027 likes this.
Thread Status:
Not open for further replies.

Share This Page