File lister from a directory

Discussion in 'Archived: Plugin Requests' started by MostFunGuy, Feb 18, 2014.

  1. Offline

    MostFunGuy

    Plugin category: Misc

    Suggested Name: FileLister (meh)

    What I Want: Hey guys, I program in a little known language called Skript. We write skripts, that function almost like plugins.

    I'm basically requesting a plugin that, from a given directory listed in a config, can list files. We've never had a system for listing all the skripts (plugins) available to a server. I've got a long list of Skripts running on the server, and cannot actively view the list of them without going into the file system.

    If you want to be really fancy, it can be seperated into two categories, active and unactive (unactive files are preceded by a dash(I.E -MostFunGuyLovesYou.sk)

    Commands: /listskripts and /listskript

    Permissions: skript.list (or configurable in a config)

    When I'd like it by: Whenever you fine gents get around to it. <3

    Pretty simple file structure, with some disabled ones thrown in as examples

    [​IMG]
     
  2. Offline

    Goblom

    I currently dont have time to write this but i can help out people who are going to want to make to this or at least try.

    Skript has a few static methods that you can use to get its instance (its faster then going through the PluginManager)

    Here is an EXTREMELY simple way to get a list of all scripts that Skript uses to store/load all the scripts in is possession.
    Code:java
    1. File scriptsFolder = new File(Skript.getInstance().getDataFolder(), Skript.SCRIPTSFOLDER + File.separator);
    2.  
    3. if (scriptsFolder.isDirectory()) {
    4. for (File f : scriptsFolder.listFiles()) {
    5. System.out.println(f.getName());
    6. }
    7. }

    Of course you would have to modify it to print all the files into chat.

    Doing it this way requires you to import The Skript jar into your project, or add as a dependency using maven.
     
    MostFunGuy likes this.
  3. Offline

    wizzinangel

    MostFunGuy done for you.. Download here: http://www.filedropper.com/showdownload.php/listskript

    Config file:
    Code:java
    1. Settings:
    2. SkriptDirectory: "plugins/other"
    3. SkriptExtension: ".sk"
    4. InactiveSkriptStart: "-"


    Set the 'SkriptDirectory' to the directory the skripts are kept.
    Set 'SkriptExtension' to the file extension for the skripts
    Set 'InactiveSkriptStart' to the character the inactive skripts start with. Which i think you said was a hyphen.

    Commands:
    - Run ingame:
    /list-skript

    Permissions:
    - None


    Let me know any issues or you want other commands/permissions added. Just PM Me.
     
    MostFunGuy and Goblom like this.
  4. Offline

    MostFunGuy

    Awesome! I posted an example picture of how the directory looks to help you guys, but it seems to still be "under moderator approval". Well guys, thank you very much for the quick turnaround, I shall test this tonight (Im at work).
     
  5. Offline

    wizzinangel

    just saw the part about permissions ill add them shortly for you *Note to self - read tbe whole post next time lol
     
  6. Offline

    MostFunGuy

    Eh, the permission was sort of a sprinkle on it. I don't intend to use it, but other Skripters might want it.

    I linked them this thread, so others may DL it as well.
     
  7. Offline

    wizzinangel

    MostFunGuy yeh no worries..im going to add the permission..and ill add other commands for listing inactive and active skripts themselves, so something like:

    /list-skript active and /list-skript inactive
     

Share This Page