Solved Creating a config - NPE

Discussion in 'Plugin Development' started by ReeseNator, Dec 16, 2015.

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

    boomboompower

    @ReeseNator
    Code:
    public class JoinPlugin extends JavaPlugin implements Listener {
    
        @Override
        public void onEnable() {
          getServer().getPluginManager().registerEvents(this, this);
          saveDefaultConfig();
    
        @EventHandler
         public void onPlayerJoin(PlayerJoinEvent event) {
            Player p = event.getPlayer();
            getConfig().set("name", "ReeseNator");
            String myName = plugin.getConfig().getString("name");
            p.sendMessage(myName);
            saveConfig();
       }
    }
    You could simply do that in 1 class file.
     
  2. Offline

    ReeseNator

    I have since fixed my problem.
     
Thread Status:
Not open for further replies.

Share This Page