Killing a Player with the Specified Reason

Discussion in 'Plugin Development' started by dlcruz129, Feb 26, 2014.

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

    dlcruz129

    Hello everyone!

    I am currently developing a plugin which adds the command /explode <player>. I already have set it up so that an explosion is created that does not damage blocks, however, I want to be sure that the player dies. How would I kill the player, while changing the broadcast in the chat to "{PLAYERNAME} was exploded."?

    Any help is appreciated. :)

    dlcruz129
     
  2. dlcruz129
    Just set their health to 0. As for changing the death message you can just edit the death message for that player by listening to the player death event.
     
  3. Offline

    MordorKing78

    Not hard to do:
    Just make a command /killplayer <player> using arguments
    than make an argument with <reason> Like this:
    Code:java
    1. public class Commands implements CommandExecutor {
    2. public String glueArgs(String[] args) {
    3. String glued = "";
    4.  
    5. if(args != null) {
    6. for(int index = 1; args.length > index; index++) {
    7. glued += args[index] + " ";
    8. }
    9. }
    10. return glued;
    11. }

    Than type:
    Code:java
    1. }else{
    2. target.sendMessage(ChatColor.RED + glueArgs(args));


    that else one isnt needed! its just how you coded your plugin!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 6, 2016
Thread Status:
Not open for further replies.

Share This Page