[ADMN] SpawnCreature v1.0 - Barebones mob spawning [953]

Discussion in 'Inactive/Unsupported Plugins' started by Protected, Apr 1, 2011.

  1. Offline

    Protected

    SpawnCreature - Barebones mob spawning
    Version 1.0 - Download JAR

    So I wanted to spawn some mobs for testing purposes and was much annoyed to find this feature was only provided by multi-command bundle plugins, on blocks, by outdated plugins, or by plugins that are overly complicated and rely on things like direct CraftBukkit access. So I whipped this up in 10 minutes, enjoy.

    WARNING: This is "common" knowledge but sometimes knowledge is so common no one will actually tell you: All mob names are capitalized, for example, Pig will work, pig won't.

    Features:
    • No Permissions support! Uses isOp (you must be an operator to use). No other dependencies.
    • Spawns mobs! /spawncreature NAME [AMOUNT]
    Changelog:

    v1.0 - initial release​

    Installation:

    Put the jar in the plugins directory and reload/restart.

    The complete source code (open)

    Code:
    package net.myshelter.minecraft;
    
    import java.util.logging.Logger;
    
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.CreatureType;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class SpawnCreature extends JavaPlugin {
    
        public static Logger log = Logger.getLogger("Minecraft");
    
        public void onEnable() {
            log.info("SpawnCreature is on!");
        }
    
        public void onDisable() {
            log.info("SpawnCreature is off...");
        }
    
        public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args)  {
            if (!(sender instanceof Player)) return false;
            Player player = (Player)sender;
            if (!player.isOp()) return false;
            if (command.getName().equalsIgnoreCase("spawncreature")) {
                if (args.length < 1) return true;
                CreatureType ct = CreatureType.fromName(args[0]);
                if (ct == null) return true;
                int amount = 1;
                if (args.length > 1) amount = Integer.parseInt(args[1]);
                for (int i = 0; i < amount; i++)
                    player.getWorld().spawnCreature(player.getLocation(), ct);
                return true;
            }
            return false;
        }
    
    }
    
     
    Macios14 and tombik like this.
  2. Offline

    Malicious

    Are you sure it works for the new minecraft update?
     
  3. Offline

    Protected

    The build in which it was tested is in the thread title.
     
  4. I've tested it on 617 - no errors but no mobs.

    /spawncreature pig 1
    /spawncreature wolf 1
    /spawncreature zombie 10

    None of these work - I'm afraid there was no errors whatsoever in the console so I can't provide and other help.
     
  5. Offline

    kman2010

    you need to put it like this
    /spawncreature Wolf 1
     
  6. Offline

    Protected

    I'll grudgingly admit that in this instance the problem isn't all user stupidity, since people didn't necessarily know mob names are always capitalized. I'll add that information to the top post.
     
  7. Offline

    Plague

    Well common knowledge is that programmers can make it easy by sanitizing the inputs. This has been known for at least 30 years...
     
    greekguy and HawnSolo like this.
  8. Offline

    Protected

    No one asked you anything.
     
  9. Offline

    krandor

    Don't feed the troll :3
     
    chrisc97 likes this.
  10. Offline

    ben1996123

    Awesome!
     
  11. Offline

    ENH

    How would one spawn a Zombie Pigman or a Spider Jockey
     
  12. Offline

    Protected

    This is an extremely basic plugin and can't spawn spider jockeys, but you can modify it!

    PigZombie is the ID of the zombie pigman.
     
  13. Offline

    Eloth

    when i type /spawncreature zombie 1 nothing happens :/ any help?
     
  14. Offline

    Skirmisher

    You have to capitalize the first letter of mobs' names.

    @Protected - quick, make the warning text in the topic post bigger! :p
    Oh, and nice plugin BTW. I just wish it had Permissions support, as I want to give the /spawncreature command to my Trusted people who aren't OPs.
     
  15. Offline

    elitestryker

    So...when I type /spawncreature Spider Jockey.... it says in internal error has occurred. Everything else works.
     
  16. Offline

    umar

    k im pretty sure i installed it correctly... put the jar in the plugins folder then restarted the server.
    i type /spawncreature Pig 1
    nothing happens.. no message no nothing..
    im running minecraft 1.4_01
     
    Jambokid likes this.
  17. Offline

    Protected

    Are you opped?

    Tested in 670 and working.
     
  18. Offline

    muoch10

    everything works except for:
    /spawncreature Wolf 1
    or anything with wolf, although besides that great plugin
     
  19. Offline

    PandaK551

    Will you ever add permissions support, because that would be very practical, appart from that amazing plugin
     
  20. I would be nice if you could add animal types and spawning them at any player.
    /spawncreature Wolf 10 [player] [angry/wild/tame]

    It would really be good griefer control.
    Looks cool, haven't tried it yet, but I will when I get a chance.
     
  21. Offline

    Protected

    I don't like Permissions via plugin and I'll never add it. I won't make anything spawn riding anything else, or near someone else, or anything like that. See the thread title? BAREBONES mob spawning. If you want something more complicated have you tried this? Otherwise feel free to modify the source code to implement whatever features you need, but please don't ask for my help. My plugins that are open for suggestions usually do not include the source code and explicitly state in the top post that you can make suggestions.
     
  22. Offline

    M0rti

    Does this plugin change the overall spawn rate of mobs?
    I almost have no mobs spawning since i spawned some wolfs.
     
  23. Offline

    Protected

    No, it can't possibly do such a thing. Look at the source code in the top post :p The meat of the plugin is only half dozen lines. It checks if the monster you're trying to spawn exists in Bukkit and then call's Bukkit's command for spawning monsters X times. Nothing else.
     
  24. Offline

    M0rti

    Ok, thanks a lot.
     
  25. Offline

    jakethesnake

    is there a way to create a spawn point for the creatures?
     
  26. Offline

    Mitch C

    ddoes ur plugin accindently disable the ability to milk cows cause i spwaned two and couldnt milk em
     
  27. Offline

    Landonrocksatgh

    Cool Plugin and easy i even spawned a giant what all can you spawn anyway?
     
  28. Offline

    Nitoxdoan

    How do i modify it?
     
  29. Offline

    5*stunner

    do you think you could add a feature to control mob spawners?
     
  30. Offline

    Emission

    Works great with the latest build (684?), thanks!
     

Share This Page