[FUN]Prankcreeper

Discussion in 'Archived: Plugin Requests' started by Xariez, Jun 10, 2012.

  1. Offline

    Xariez

    Plugin Category : FUN

    Suggested name : Prankcreeper

    A bit about me : Just going to say, i know i requested many plugins, but , well when i get ideas i think about it as a plugin, and if i see it might be possible i post it :)

    What i want : A Plugin which can scare/frustrate players with "fake" creepers, instead of spawning real creepers next to them, you can type a command (see below) and it will spawn a creeper, which will make the SssSss sound, and after a while it will "transform" to a pig, which is its real form.

    Ideas for commands : /pc <playername>

    Ideas for permissions : prankpig.command.pp

    When i'd like it by : As soon as possible

    Similar plugin requests : None

    Devs who might be interested in this : None
     
  2. Offline

    Xariez

  3. Offline

    PhoenixFlight

  4. Offline

    Xariez

  5. Offline

    PhoenixFlight

    That plugin should work exactly as you requested.
     
  6. Offline

    Xariez

    PhoenixFlight

    Thanks really much, still didnt test it but i will soon, i will post the results here..
    Why didnt u btw reply and type like "Okay, im doing it.." or similar?
     
  7. Offline

    mtbub996

    You..You did it?[​IMG]
     
  8. Offline

    Xariez

    mtbub996

    What do you mean? First of all i cannot see the picture, and second, i just said that because i got shocked that actually someone cared about this post..
     
  9. Offline

    PhoenixFlight

    Because it's such a simple request that it only took about 5 minutes... particularly since I already had the creeper block code on another plugin.

    Source for anyone who cares (it's horrible and lazy, lol)

    Code:
    package com.zephyrr.prankcreeper;
    
    import java.util.HashSet;
    import org.bukkit.Location;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Creeper;
    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.EntityExplodeEvent;
    import org.bukkit.event.entity.ExplosionPrimeEvent;
    import org.bukkit.plugin.java.JavaPlugin;
    
    /**
     *
     * @author Phoenix
     */
    public class PrankCreeper extends JavaPlugin implements Listener {
        private HashSet<Creeper> prankList;
    
        @Override
        public void onEnable() {
            prankList = new HashSet<Creeper>();
            getServer().getPluginManager().registerEvents(this, this);
        }
        
        @EventHandler
        public void onPrime(ExplosionPrimeEvent event) {
            if(event.getEntityType() == EntityType.CREEPER)
                if(prankList.contains((Creeper)event.getEntity())) {
                    event.setRadius(0f);
                    event.setFire(false);
                }
        }
        
        @EventHandler
        public void onExplode(EntityExplodeEvent event) {
            if(event.getEntityType() == EntityType.CREEPER)
                if(prankList.contains((Creeper)event.getEntity())) {
                    prankList.remove((Creeper)event.getEntity());
                    Location loc = event.getEntity().getLocation();
                    event.getEntity().getWorld().spawnCreature(loc, EntityType.PIG);
                }
        }
    
        @Override
        public void onDisable() {}
    
        @Override
        public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
            if(command.getName().equalsIgnoreCase("pc")) {
                if(args.length >= 1) {
                    String name = args[0];
                    Player p = getServer().getPlayer(name);
                    if(p != null) {
                        Creeper ent = (Creeper)(p.getWorld().spawnCreature(p.getLocation(), EntityType.CREEPER));
                        prankList.add(ent);
                        return true;
                    }
                }
            }
            return false;
        }
    }
     
  10. Offline

    Xariez

    PhoenixFlight

    Lol how do u actually understand anything of that? xD
     
  11. Offline

    -_Husky_-

    Thats not "bad" code.. Hehe
     
  12. Offline

    Xariez

  13. Offline

    PhoenixFlight

    Oh one thing I should probably mention... Don't just spawn a bunch of creepers like that and then reload or restart your server. The second you reload, they become real creepers and will blow up your shit.
     
  14. Offline

    izak12345678910

    That is a great idea for after a while people think there fake then you reload and they blow them all up!
     

Share This Page