Killing Entities

Discussion in 'Plugin Development' started by KaiBB, Dec 20, 2011.

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

    Chiller

    Yes ik but I rarely use console commands, but yes I did do that, if you are wondering...
    Hehe two different topics going on in this Topic! :)
     
  2. Offline

    chriztopia

    I would make two sperate commands one for killdragon and one for spawndragon I tested this and it works.
    Code:
    if (cmd.getName().equalsIgnoreCase("spawndragon")){
    
                if (player.isOp()){
                    player.getWorld().spawnCreature(player.getLocation(), CreatureType.ENDER_DRAGON);
                } else {
                    player.sendMessage(player.getName() + "You are not OP!");
                }
    
                return true;
            }
      
            if (cmd.getName().equalsIgnoreCase("killdragon")){
     
                if (player.isOp()){
    
                    for (World w : Bukkit.getWorlds()) {
                        for (Entity e : w.getEntities()) {
                        if (e instanceof EnderDragon) {
                        ((EnderDragon) e).damage(1000000000);
                        }
                        }
                        }
    
                } else {
                    player.sendMessage(player.getName() + "You are not OP!");
                }
     
  3. Haha I know, but its the stupid administrator who doesn't understand what player only means that I'm targeting :p
    @chriztopia Yep...
     
  4. Offline

    KaiBB

    I did create two commands, followed instructions. Neither command works, and the plugin does not show up when I type /pl .
    @Chiller
    @tips48
    @chriztopia
     
  5. Have you registered the command in your plugin.yml? Is the command in its own executor or your plugin main? If the second, have you registered it in your plugin main?
     
  6. Offline

    Chiller

    Put this in on enable:
    getCommand("pl").setExcacutor(new commands() {
    //put onCommand function here
    });
     
  7. I would give it its own class, thats pretty hefty to be embedded...
     
  8. Offline

    KaiBB

    Thanks, guys!
    @Chiller
     
  9. Offline

    Chiller

    Thats what i meant by you have to register the command...
     
  10. Oh, my bad :)
     
Thread Status:
Not open for further replies.

Share This Page