Filled Mob Push

Discussion in 'Plugin Requests' started by PhillyCheezsteak, Mar 29, 2015.

Thread Status:
Not open for further replies.
  1. Plugin category: Mechanics

    Suggested name: MobPush

    What I want:
    /MobPush (radius)

    pushes all mobs away from the player. (Not teleporting the mobs, but pushing them away)

    The radius the player radius the mobs will be pushed to.

    Ideas for commands: /MobPush (radius)

    Ideas for permissions: MobPush.use
    When I'd like it by: As soon as you can :)

    NOTE: Mobs will NOT be pushed through blocks. They will be pushed around it if there is a block in the way.
     
  2. Bump

    I just had an idea to make this plugin a lot easier. When you use /MobPush (radius) it creates a creeper explosion and depending on the radius, depends on how big the explosion is. (without sound effects, breaking blocks, etc) And it does not effect players.
     
    Last edited: Mar 31, 2015
  3. Bump
    So basically if you can make a creeper explosion without effecting the Y axis, that would be great. I just dont want mobs getting hurt from fall damage
     
  4. Offline

    Gamecube762

    @PhillyCheezsteak Here you go:
    Commands:
    • /MobPush <range> or /mb <range>
    Permissions:
    • OP | mobpush.command
    Download:
    https://dl.dropboxusercontent.com/u/60725827/Plugins/MobsPush.jar

    Source code for anyone interested: All 42 lines of it.
    Code:
    package com.github.Gamecube762.MobPush;
    
    import org.bukkit.Location;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Entity;
    import org.bukkit.entity.LivingEntity;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    
    /**
    * Created by Gamecube762 on 4/1/2015.
    */
    public class Main extends JavaPlugin {
        @Override
        public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
            if (!(sender instanceof Player)) {
                sender.sendMessage("Must be a player running the command!");
                return true;
            }
    
            if (args.length == 0) {
                sender.sendMessage("Needs a range!");
                return false;
            }
    
            int range;
            try {range = Integer.parseInt(args[0]);}
            catch (IllegalArgumentException ex) {
                sender.sendMessage(args[0] + " is not a number!");
                return true;
            }
    
            Location a = ((Player)sender).getLocation();
    
            for (Entity e : ((Player)sender).getNearbyEntities(range, range, range))
                if (e instanceof LivingEntity)
                    e.setVelocity(a.clone().subtract(e.getLocation()).toVector().multiply(-1).normalize());
    
            return true;
        }
    }
     
  5. @Gamecube762 Thanks :) the only problem is the intensity is not high enough. What I mean by this is say if I use the command /mobpush 30 and if I am right next to a pig, it will barely move 2 blocks. I was wondering if you can fix it so the intensity is higher?
     
  6. Offline

    Gamecube762

    @PhillyCheezsteak I'll see what I can do. How much are you wanting to push them?
     
  7. Offline

    Gamecube762

    @PhillyCheezsteak Sorry for the delay, was playing with the numbers for a while. It should now move them about 5 blocks.

    MobPush.jar

    Tell me if there are any other tweaks you want to it.
     
  8. Offline

    nverdier

    @PhillyCheezsteak Now that this is created, please mark the thread as filled. See this for more info.
     
  9. @Gamecube762 Perfect! Thank you so much! This is exactly what I wanted :)
     
Thread Status:
Not open for further replies.

Share This Page