Spawners

Discussion in 'Spigot Plugin Development' started by William029, Jun 4, 2017.

  1. I want to make a spawner plugin that changes the rate that they spawn at is that possible with spigot or is that off limits?
     
  2. The way I did it was just create a repeating task and every few seconds spawn mobs near the spawner.
     
  3. ohh yea we can do that how can i get the type of spawner?
     
  4. Well, when a player sets a spawner you can store the location in a configuration file.

    Then you can do something like this:

    Code (Text):
    double x = plugin.spawners.getDouble("Spawners.X");
    double y = plugin.spawners.getDouble("Spawners.Y");
    double z = plugin.spawners.getDouble("Spawners.Z");
    String world = plugin.spawners.getString("Spawners.World");
    Location spawner_location = new Location(Bukkit.getWorld(world), x, y, z);

    if(spawner_location.getBlock().getType().equals(Material.MOB_SPAWNER))
    {
         CreatureSpawner spawner = (CreatureSpawner) spawner_location.getBlock().getState();
         EntityType type = spawner.getSpawnedType();
    }
     
     
  5. i mean the spawner type like zombie creeper
     
  6. Look at the code I just added, it tells you how to get the type. :p
     
  7. plugin.spawners isnt a thing
     
    • Funny Funny x 1
  8. Instead of copying my code, read what I told you... *facepalm*

    EDIT:
    EntityType type = spawner.getSpawnedType();
     
    • Agree Agree x 1