Development Assistance Error custom config file

Discussion in 'Plugin Help/Development/Requests' started by SlagHoedje, Nov 20, 2014.

Thread Status:
Not open for further replies.
  1. Hi,
    I want to make a messages file for my plugin i am making but it gives me an error:
    Here is my code:
    Code:java
    1. package com.SlagHoedje.Minigavers.SkyWars.handlers;
    2.  
    3. import java.io.File;
    4.  
    5. import org.bukkit.ChatColor;
    6. import org.bukkit.configuration.file.FileConfiguration;
    7. import org.bukkit.configuration.file.YamlConfiguration;
    8.  
    9. import com.SlagHoedje.Minigavers.SkyWars.Main;
    10.  
    11. public class MessageHandler {
    12.  
    13. private File file;
    14. private FileConfiguration config;
    15.  
    16. public MessageHandler() {
    17. file = new File(Main.getPlugin().getDataFolder(), "messages.yml");
    18.  
    19. if (!file.exists()) {
    20. try {
    21. file.createNewFile();
    22. } catch (Exception e) {
    23. e.printStackTrace();
    24. }
    25. }
    26.  
    27. config = YamlConfiguration.loadConfiguration(file);
    28. }
    29.  
    30. public String getCaption(String name) {
    31. return this.getCaption(name, true);
    32. }
    33.  
    34. public String getCaption(String name, boolean color) {
    35. String caption = this.config.getString(name);
    36. if (caption == null) {
    37. Main.getPlugin().getLogger().warning("Missing caption: " + name);
    38. if (this.config.getString("CaptionNotFoundError") == null) {
    39. return "Didn't find message: Ask staff for more info!";
    40. }
    41. caption = getCaption("CaptionNotFoundError").replaceAll("&caption", name);
    42. }
    43.  
    44. if (color) {
    45. caption = ChatColor.translateAlternateColorCodes('&', caption);
    46. }
    47. caption = getCaption("prefix") + caption;
    48. return caption;
    49. }
    50. }
     
  2. Offline

    mine-care

    what is line 17?
     
  3. Online

    timtower Administrator Administrator Moderator

    Moved to alternate versions.
     
  4. Line 17:
    Code:java
    1. file = new File(Main.getPlugin().getDataFolder(), "messages.yml");
     
Thread Status:
Not open for further replies.

Share This Page