I need help

Discussion in 'Plugin Development' started by alex3413, Jan 31, 2016.

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

    alex3413

    This is a plugin I am creating, and It's not working. the third arg is not working the rest is.

    also this is a part of my plugin not the main

    CODE: http://pastebin.com/Y0jmzyCU
     
  2. Offline

    Zombie_Striker

    1. Don't blind cast! How do you know the player is the one sending the command? You can't just say that you will never use it in the console. Check if the sender is an instanceof Player before casting.
    2. There is already a command called "help" already. You either need to remove the help command from bukkit, or change your command.
    3. Instead of doing dozens of useless checks, checking the length of the args over and over again, check it once and add any secondary checks under that one if statement.
    Can you explain what does not work, and how you know it does not work?
     
  3. Offline

    alex3413

  4. Offline

    Comrad Gaming

    @Zombie_Striker My friend my not be that good at saying things, What we can't get to work is so when peopel do /help 3 it does not show the message that we have set, we where able to get it so we could do /help and /help 2 but we can't get help 3 to work thats why we are asking for help on and we have it so p.sendMessage the p stands for player..
     
  5. Offline

    Zombie_Striker

    @alex3413 @Comrad Gaming
    You are not actually checking the player put in "3".

    BTW: If you are making pages, you are doing it in a very inefficient manner. Instead of creating each and every page, why not just add all the choices to an array or collection, loop through a section (e.g. 0-9, 10- 19, 20-,29, ect.) and use the first arg to figure out which set to print. This will clean up your code tremendously.
     
  6. Offline

    alex3413

    Even then when we have it look for /help 3 it doesn't work.
     
  7. Offline

    Zombie_Striker

  8. Offline

    alex3413

  9. Offline

    Zombie_Striker

    @alex3413
    Please, look at that last section and use the Rubber-Duck-Debugging method. You should easily see your mistake if you talk out what each line does.

    [Edit ]Look some more at your code, your problem can and cannot be solved just by using Rubber Duck debugging. Your code is messy and because of that even I had a hard time spotting some of your mistakes. You sometimes have double brackets for if statements, and sometime even forget to add brackets. Please choose one of the following:
    • Go through your code again and rewrite your code to be more efficient and easier to read.
    • Go with what I said before and store all the pages in an array and have the computer print the pages for you (recommended)
     
  10. Offline

    tobiyas

    @alex3413 Is it only me, or does this make no sence:
    Code:
    if(args.length == 0)
    if(args[0].equalsIgnoreCase(""))
    ...
    You only execute that when there is no args. And then you are trying to fetch the arg that is not present?!?
    You probably wanted to check if args == 1, I guess.
     
Thread Status:
Not open for further replies.

Share This Page