soft depend issues

Discussion in 'Plugin Development' started by moose517, Aug 28, 2013.

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

    moose517

    I'm revising a plugin of mine and now that patPeter requries you to download a plugin instead of just having the files in my plugin i'm running into a problem I have the SQLibrary soft depended on because its not critical to run but having it allows more storage options of course. Well right before i call my code to load from disk i check to make sure the plugin actually exists before proceeding any further. With a softdepend or even depend the SQLibrary starts loading but doesn't finish in time so my plugin resorts back to file storage. what can i do to solve this? Here is my startup code.

    Code:java
    1. @Override
    2. public void onEnable() {
    3. // go ahead and create config file if it doesn't exist
    4. setupConfig();
    5.  
    6. // load the config
    7. loadConfig();
    8.  
    9. // check if SQLibrary is found before proceeding
    10. if ((backend == Backend.SQLITE) || (backend == Backend.MYSQL)) {
    11. if (getServer().getPluginManager().getPlugin("SQLibrary") == null)
    12. // warn user that sqlibrary wasn't found, defaulting to flat file this time around
    13. log.warning(prefix + "SQlibrary was not found and is required for mysql and sqlite database storage.");
    14. log.warning(prefix + "Please download it from [url]http://dev.bukkit.org/bukkit-plugins/sqlibrary[/url]");
    15. log.warning(prefix + "Defaulting to flatfile for now");
    16. backend = Backend.FLATFILE;
    17. }
    18.  
    19. // set the backend at this point
    20. NoteManager.getInstance().setBackend(backend);
    21. NoteManager.getInstance().init();
    22.  
    23. // init based on backend method currently set
    24. if (NoteManager.getInstance().getBackend() == Backend.FLATFILE)
    25. NoteManager.getInstance().initFlatFile(getConfig().getString("storage.flatfile.filename"));
    26. else if (NoteManager.getInstance().getBackend() == Backend.SQLITE)
    27. NoteManager.getInstance().initSqlite(getConfig().getString("storage.sqlite.filename"));
    28. else if (NoteManager.getInstance().getBackend() == Backend.MYSQL)
    29. NoteManager.getInstance().initMysql();
    30.  
    31. // register the command executor
    32. noteExecutor = new NotebookCommandExecutorBukkit(this);
    33. getCommand("note").setExecutor(noteExecutor);
    34.  
    35. try {
    36. Metrics metrics = new Metrics(this);
    37.  
    38. Graph graph = metrics.createGraph("Number of note entries");
    39. graph.addPlotter(new Metrics.Plotter("Notes") {
    40. @Override
    41. public int getValue() {
    42. return NoteManager.getInstance().getNumNotes();
    43. }
    44. });
    45.  
    46. metrics.start();
    47. } catch (IOException e) {
    48. e.printStackTrace();
    49. }
    50.  
    51. // everything is done, at this point let the player know its enabled.
    52. pdfFile = this.getDescription();
    53. log.info("[" + pdfFile.getName() + "] version " + pdfFile.getVersion() + " is enabled");
    54. }
    55.  
     
  2. Offline

    moose517

    anybody?
     
Thread Status:
Not open for further replies.

Share This Page