String literal is not properly closed by a double-quote

Discussion in 'Plugin Development' started by ShadowRaidNET, Dec 3, 2013.

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


    I got the error message String literal is not properly closed by a double-quote on the line
                if("enderchest".equalsIgnoreCase(cmd.getName()) & (!sender.hasPermission(sbasic.enderchest")))
    Please help!
  2. Offline

    Sagacious_Zed Bukkit Docs

    ShadowRaidNET go through ever character and look for double quotes. Find where it is not followed by one.
  3. Offline


    Right there
  4. Code:java
    1. (sbasic.enderchest"))
    is your issue. Looks like you have put an s instead of " causing the " at the end of enderchest to be recognized as the start of a new string which has no ending.
    Also to say
    if statement1 and statement2 are true then do stuff
    you need an && instead of only a single &
    Hope this helps and happy coding :)
  5. Offline


    Sagacious_Zed I cannot find it, perhaps you may help me? That would be helpful.
                if("enderchest".equalsIgnoreCase(cmd.getName()) & (args[0] == null) & sender.hasPermission("sbasic.enderchest"))
                    return true;
                if("enderchest".equalsIgnoreCase(cmd.getName()) & (!sender.hasPermission(sbasic.enderchest"))) //error here!
                    p.sendMessage((new StringBuilder()).append(ChatColor.RED).append("Only donators are allowed to do this!").toString());
                if("enderchest".equalsIgnoreCase(cmd.getName()) & sender.hasPermission("sBasic.Enderchest.others") & (Bukkit.getPlayer(args[0]) != null))
                if("enderchest".equalsIgnoreCase(cmd.getName()) & (args[0] != null) & (!sender.hasPermission("sBasic.Enderchest.others")))
                    p.sendMessage((new StringBuilder()).append(ChatColor.RED).append("You do not have permission to view another player's ender chest inventory.").toString());
                return false;
  6. Offline


    If you can't find it you're not looking close enough.
    Garris0n, Cirno and L33m4n123 like this.
  7. Offline


    You need && not &
  8. Offline


    mike546378 I can't figure this out! I added && but I don't know how to do the other half. Thanks for your support.
  9. Offline

    Sagacious_Zed Bukkit Docs

    ShadowRaidNET You should write in an editor that has Java syntax highlighting, it will become obvious where the colors are not right.
  10. ShadowRaidNET
    Don't know how it could be any more obvious..
    What IDE are you using? Most will basically show you the error.
    If you are using eclipse then it shows strings in blue, you want sbasic.enderchest to be a string. Strings need both an opening " and a closing "
    Just look closely
    johnnywoof and lDucks like this.
  11. Offline


  12. Offline


    Your issue was already solved by the first two posts.
  13. Offline


    Are you even reading or are you just waiting for someone to give the *fixed* code? Put the code in the syntax code blocks and it will show you where you've gone wrong.
Thread Status:
Not open for further replies.

Share This Page