File lister from a directory

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

  1. Offline


    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

    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

  2. Offline


    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.
    1. File scriptsFolder = new File(Skript.getInstance().getDataFolder(), Skript.SCRIPTSFOLDER + File.separator);
    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


    MostFunGuy done for you.. Download here:

    Config file:
    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.

    - Run ingame:

    - None

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


    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


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


    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


    MostFunGuy yeh no 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