Solved Arguments Help

Discussion in 'Plugin Development' started by motionfrog, Feb 9, 2014.

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

    motionfrog

    Hi,
    I want to make a plugin that can load args[1] to the last arguments. For Example, take a look at this command: "/kick motionfrog Griefing other player's building", that "motionfrog" is player, and "Griefing other player's building" is the reason, so what's the arguments' code for the reason?
    My Code:
    Code:java
    1. if(args.length >= 2){
    2. if(target == null || !target.isOnline()){
    3. pl.sendMessage(ChatColor.RED + "Player is not online right now!");
    4. return true;
    5. }else{
    6. if(!pl.hasPermission("negutools.dominate.reason")){
    7. pl.sendMessage(ChatColor.RED + "You don't have permissions to do this!");
    8. return true;
    9. }else{
    10. target.setHealth(0.0);
    11. target.sendMessage(ChatColor.RED + "You have been killed for reason " + args[1] + ".");
    12. pl.sendMessage(ChatColor.RED + target.getName() + ChatColor.GREEN + " has been killed.");
    13. Bukkit.getServer().broadcastMessage(ChatColor.RED + target.getName() + ChatColor.GREEN + " has been killed for " + args[1] + ".");
    14. return true;
    15. }
    16. }
    17. }


    That "args[1]" on that code just load "Griefing" word on command below. So, I want all the reason words loaded on arguments. Thank You. And Sorry for my bad English. :D
     
  2. Offline

    Harmings

    motionfrog likes this.
  3. Offline

    motionfrog

Thread Status:
Not open for further replies.

Share This Page