how to spawn mobs on a target

Discussion in 'Plugin Development' started by RangerNuk, Sep 20, 2012.

  1. Offline

    RangerNuk

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    How do u spawn mobs on specified target?

    such as /pig Notch would spawn a pig on notch

    also, how do u add banning, i have this and it doesnt ban the player

    target.setFireTicks(100);
  2. Offline

    Infamous Jeezy

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Something like this..
    Code:
    if(cmd.getName().equalsIgnoreCase("pig") && args.length == 1)
    {
    Player selPlr = Bukkit.getServer().getPlayer(args[0]);
    if(selPlr!=null)
    {
    Location plrLocation = selPlr.getLocation();
    World plrWorld = selPlr.getWorld();
    plrWorld.spawnCreature(plrLocation, EntityType.PIG);
    }
    if(selPlr==null)
    {
    //tell sender that player specified does not exist or is not online.
    }
    }
    
    Also a ban command is already implemented in bukkit, target.SetFireTickets(1000); just sets the player on fire for 1000 ticks. I'm not exactly sure what you were asking there.

    This post has been edited 3 times. It was last edited by Infamous Jeezy Sep 20, 2012.
  3. Offline

    HouseMD

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    You might want to offset the entities spawn location from your players a bit?
    Or you will make a cross animal centipede.
  4. Offline

    Infamous Jeezy

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Yeah probably, I was just trying to show him the basic method of doing this.
  5. Offline

    TfT_02

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    spawnCreature() is deprecated right? You should use spawnEntity(), if I'm not mistaken.
  6. Offline

    RangerNuk

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    also, how should i make more than one spawn at one command?

Share This Page