Config error

Discussion in 'Plugin Development' started by gamelord327, Nov 22, 2013.

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

    gamelord327

    Hi,
    Im coding a plugin for custom messages and im getting a config error in my code.

    The code

    Code:java
    1. @EventHandler
    2. public void onPlayerJoin(PlayerJoinEvent e){
    3. Player p = e.getPlayer();
    4. FileConfiguration config = plugin.getConfig();
    5. String message = "";
    6. if(!e.getPlayer().hasPlayedBefore()) {
    7. message = config.getString("FirstJoin");
    8. }
    9. else{
    10. message = config.getString("Login");
    11. String currentWorld = p.getWorld().getName();
    12. message = message.replace("%world%", currentWorld);
    13. }
    14. message = FormatMessage(p,message);
    15. e.setJoinMessage(message);
    16. FileConfiguration config = plugin.getConfig();
    17. }


    And this is the part that has errors

    Code:java
    1. message = FormatMessage(p,message);
    2. e.setJoinMessage(message);
    3. FileConfiguration config = plugin.getConfig();
     
  2. Offline

    Java Script

    have you tried to download a virtual machine that will detect all your errors and that will help you I can't see anything wrong just
    Code:java
    1. Player p = e.getPlayer();

    try this one. and see if you get no errors.
    Code:java
    1. Player p == (e.Playerget);
     
  3. Offline

    felixfritz

    What's happening in the "FormatMessage" method? Why are you putting the line "FileConfiguration config = plugin.getConfig();" in there twice?
     
Thread Status:
Not open for further replies.

Share This Page