MyMobs [Easy to code?]

Discussion in 'Plugin Requests' started by Thejust219, Mar 14, 2015.

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

    Thejust219

    So I would like a tiny, tiny, plugin that basically makes it so that if you spawn the HOSTILE mob, it won't attack you, and you only

    For example:
    *spawn 1 creeper* blows up other players, not you, and doesn't hurt you (you dont lose health)
    *spawn 1 skeleton* shoots other players, not you, and only hurts them.

    Commands:
    none needed!

    Permissions:
    none needed!
     
  2. Offline

    pie_flavor

    @Thejust219 Remove Easy to code from your title please. Custom mob AI is not easy.
     
    Kilorbine and Huffmanbran like this.
  3. Offline

    Abstract97

    @pie_flavor This is not AI, this is extremely easy to code, EntityTargetLivingEntityEvent simply cancel the event if the target player is you, then for other players leave it, this could take like 5 minutes to code, for any experienced developer. So this guy can leave the title in here.
     
    Thejust219 and Kilorbine like this.
  4. Offline

    Thejust219

  5. Offline

    Thejust219

  6. Offline

    Faith

    I'll do this

    Edit: Couldn't figure out how to stop the mod attacking the player who spawned it.

    I have this for anyone who might want to use it(Not sure if it would even work).
    Code (open)
    Code:
    import org.bukkit.entity.Entity;
    import org.bukkit.entity.EntityType;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.entity.CreatureSpawnEvent;
    import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class MobOwner extends JavaPlugin implements Listener {
       
       
       
        @EventHandler
        public void onCreatureSpawn(CreatureSpawnEvent event) {
            final Entity e=event.getEntity();
            Player spawner=null;
            if(spawner != null &&
                    e.getType() == EntityType.SKELETON ||
                    e.getType() == EntityType.CREEPER  ||               
                    e.getType() == EntityType.WITHER ||
                    e.getType() == EntityType.ZOMBIE ||
                    e.getType() == EntityType.SKELETON ||
                    e.getType() == EntityType.PIG_ZOMBIE ||
                    e.getType() == EntityType.SPIDER ||               
                    e.getType() == EntityType.CAVE_SPIDER ||
                    e.getType() == EntityType.BLAZE ||
                    e.getType() == EntityType.SKELETON ||
                    e.getType() == EntityType.ENDERMAN ||
                    e.getType() == EntityType.GHAST ||
                    e.getType() == EntityType.WITCH ||
                    e.getType() == EntityType.SILVERFISH ||
                    e.getType() == EntityType.IRON_GOLEM &&
                    ((CreatureSpawnEvent) e).getSpawnReason() == SpawnReason.EGG) {
               
            }
        }
    
    }
    
     
    Last edited: Mar 20, 2015
  7. Offline

    aaomidi

    Do you want the effects to persist after server restarts or no? If not i could make this in 5 minutes.
     
  8. Offline

    Thejust219

    @Faith
    @aaomidi I would like the mob to die if the player dies, like somewhat of a connection, does that make sense?
     
Thread Status:
Not open for further replies.

Share This Page