Config.yml Help

Discussion in 'Plugin Development' started by SixFeedUnder, Oct 13, 2015.

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

    SixFeedUnder

    Hello I have made a NightVision plugin and I have added a config.yml recently because I was going to add more potion effects and when I added my config.yml I did not have any errors in eclipse or on my server but when I do the command "/nv on" or "/nv off" nothing shows up on the screen and there are not any errors in the console. Can someone please help me fix this problem, I am new to java and im still learning alot.

    Main.java > http://pastebin.com/1KE99ttU
    config.yml > http://pastebin.com/JJPHWnqn
    plugin.yml > http://pastebin.com/wHxE4Hg7
     
  2. Offline

    Zombie_Striker

    Code:
    }} else {
    BAD. Don't double bracket.

    Code:
    .NIGHT_VISION, 999999999, 1));
    Really? I belive that is the power, correct? Having the effect over 100 causes the game to get "glitchy". Also, you want it to be applied for 1 tick? 1/20 of second?
     
    Gonmarte likes this.
  3. Offline

    caseif

    Minecraft only uses 1 byte to store the power, so the maximum it will ever be is 255. That being said, a lot of effects use the first bit as some sort of flag to reverse or alter the effect (e.g. Slowness 128 causes the player to move extremely quickly), so values above 127 may cause very unexpected behavior.
     
  4. Offline

    SixFeedUnder

    If I do not add a double bracket it sends a error, how can i fix that? also with the bower being 999999999 it adds infinite Night Vision.
     
  5. Offline

    caseif

    Analyzing brackets can be a pain, but unfortunately it's the only fully effective way to fix this. You'll need to go through and match each opening bracket to its counterpart, and figure out where you need to put the missing closing bracket.

    You do seem to be correct about the potion effect parameters (@Zombie_Striker got his arguments mixed up), although rather than use some explicit number you should use Integer.MAX_VALUE (which equates to 2^32-1, the largest signed integer that can be stored in 4 bytes). Alternatively, I think using a value of -1 will make the effect infinite, but I could very well be mistaken.
     
  6. Offline

    SixFeedUnder

    Alright, thank you and I have done this but every time I remove the bracket from the second } else { it tells me "Syntax error on token "else", delete this token. but when i remove the bracket on the first else it tells me "Syntax error insert "}" to complete this Statement.
     
  7. Offline

    caseif

    That would imply that your closing bracket before the else is mismatched to some other block, so you'll need to look upward in the file to find the issue.
     
  8. Offline

    SixFeedUnder

    Is there a way you can do it for me? I still do not know what is causing it after tracing back through the code and checking every bracket.
     
  9. Offline

    Xerox262

    I looked at it for you, the first } is the end of your fors and the second } is the end of your ifs, what you have is correct, you just need to format it a little to make it easier to read and understand. Also rather that nesting your ifs inside an else you can just change it to an else if. To ensure you don't get any errors like this again remember you can use comments to remind yourself where blocks start and end, after a while this will become second nature, you will know how to correct it and where it should end.
     
    Last edited: Oct 13, 2015
Thread Status:
Not open for further replies.

Share This Page