Solved Where Did I Go Wrong?

Discussion in 'Plugin Development' started by Jack_J12, Oct 29, 2013.

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

    Jack_J12

    It supposed to be that when players type /emotionz help 2 the second page of the emotionz commands should be displayed, however they aren't displayed? The first page is fine, it's just the second I'm having trouble with?

    Code:java
    1. if(cmd.getName().equalsIgnoreCase("emotionz")){
    2. if(sender.hasPermission("Emotionz.emotionz")){
    3. if(args.length == 0){
    4. sender.sendMessage(ChatColor.RED + "Usage: /emotionz help");
    5. return true;
    6. }
    7. if(args.length == 1){
    8. if(args[0].equalsIgnoreCase("help 2")){
    9. Player player = (Player) sender;
    10. Bukkit.getPlayer(args[0]);
    11. player.sendMessage(ChatColor.GRAY + "/Cake");
    12. player.sendMessage(ChatColor.GRAY + "/Chill");
    13. player.sendMessage(ChatColor.GRAY + "/Chillpill");
    14. player.sendMessage(ChatColor.GRAY + "/Cray");
    15. player.sendMessage(ChatColor.GRAY + "/Craycray");
    16. player.sendMessage(ChatColor.GRAY + "/Cry");
    17. player.sendMessage(ChatColor.GRAY + "/Dance");
    18. player.sendMessage(ChatColor.GRAY + "/Date");
    19. player.sendMessage(ChatColor.GRAY + "/Derp");
    20. player.sendMessage(ChatColor.AQUA + "Type" + ChatColor.LIGHT_PURPLE + " /emotionz help 3 " + ChatColor.AQUA + "To read the next page");
    21. }
    22. }
     
  2. Offline

    CakePvP

    You'd have to check if args[0] equals help and args[1] equals 2, as args[0] will never equal "help 2".
     
    Jack_J12 likes this.
  3. Offline

    Mitsugaru

    Command arguments are split up by whitespace. So, "help 2" is never going to work.
    In your command, /emotionz help 2, the arguments given to the method is the following array:
    [help, 2]

    So, really, you need to check the second index, args[1], if it exists and parse it accordingly.

    EDIT: Ninja'd by CakePvP XD
     
    Jack_J12 likes this.
  4. Offline

    user_90854156

    Not sure, but wouldn't "help 2" be multiple arguments? (not args[0])

    edit: ninja'd :c
     
    Jack_J12 likes this.
  5. Offline

    Fred12i12i

    Code:java
    1.  
    2. if(args.length == 2){
    3. if(args[0].equalsIgnoreCase("help")){
    4. if(ars[1].equalsIgnoreCase("2")){
    5. Player player = (Player) sender;
    6. Bukkit.getPlayer(args[0]);
    7. player.sendMessage(ChatColor.GRAY + "/Cake");
    8. player.sendMessage(ChatColor.GRAY + "/Chill");
    9. player.sendMessage(ChatColor.GRAY + "/Chillpill");
    10. player.sendMessage(ChatColor.GRAY + "/Cray");
    11. player.sendMessage(ChatColor.GRAY + "/Craycray");
    12. player.sendMessage(ChatColor.GRAY + "/Cry");
    13. player.sendMessage(ChatColor.GRAY + "/Dance");
    14. player.sendMessage(ChatColor.GRAY + "/Date");
    15. player.sendMessage(ChatColor.GRAY + "/Derp");
    16. player.sendMessage(ChatColor.AQUA + "Type" + ChatColor.LIGHT_PURPLE + " /emotionz help 3 " + ChatColor.AQUA + "To read the next page");
    17.  
    18. }
    19. }
    20. }
     
    Jack_J12 likes this.
  6. Offline

    Iroh

    Delete many post that were off topic, keep your post on topic next time people. The discussion is about the problem not each other.
     
  7. Offline

    The_Doctor_123

    Iroh
    Pardon me if I'm incorrect but, what the discussion was about was indeed a rising issue and was on-topic. There's not really any other place to inform somebody that it would be beneficial to everybody to learn Java before Bukkit.

    Anyway, from now on, I will disregard any of this user's topics until I see he knows what he his doing to prevent these long and worthless arguments(due to ignorance).
     
Thread Status:
Not open for further replies.

Share This Page