ModsJava
nYAML
Java mod listed for Minecraft 1.8–1.10. Downloads from the MC Java Mods app on Android.
⬇ Download on Spigot- What is it
- Configs
- Other features
- Methods explanation
- Incomming features
This API consists basicly on the methods that I use for managing internally the configs that are on my plugin. With it, I've created very plugins, and it has been improving over the time, but, as all my others plugins, I keep improving them for learning new things. Hope you like it.
In this plugin I have only one, and yeah, I know it's an API xD
Spoiler: console.yml
Code (console.yml):
messages:
prefix: "&3[&bnYAML&3]"
load: "%p% &fEl plugin se ha cargado"
enable: "%p% &fEl plugin se ha activado"
disable: "%p% &fEl plugin se ha desactivado"
updater:
enabled: true
disabled: "%p% &fUpdater is &7disabled"
available: "%p% &fNew version is available at Spigot: &7%v%"
updated: "%p% &fThe plugin is up to date"
error: "%p% &fUnabled to access Spigot"
prefix: "&3[&bnYAML&3]"
load: "%p% &fEl plugin se ha cargado"
enable: "%p% &fEl plugin se ha activado"
disable: "%p% &fEl plugin se ha desactivado"
updater:
enabled: true
disabled: "%p% &fUpdater is &7disabled"
available: "%p% &fNew version is available at Spigot: &7%v%"
updated: "%p% &fThe plugin is up to date"
error: "%p% &fUnabled to access Spigot"
- Update checker: Like in my other plugins, this one has got it
- If you don't want it, take a look at the section updater.enabled and set it to false
- If you want to see if the plugin is updated when you join the server, add the permission "nyaml.updater" to your permissions manager plugin
Okey, so, in order to let you use my API in the best way possible, I'm gonna explain each method. I'll try my best on this explanation. If you have any question, pm me and I'll answer you. The points inside the spoilers are in the order of the completion of the method.
Spoiler: YAML instantiation
Initialize a new YAML:
yaml.load(File file ):
- Just do the same as with other initializations, YAML yaml = new YAML();
- Does not retun anything
yaml.load(File file ):
- You have to put the file in which the yaml will be saved. It mustn't exist, because if it does, the contents won't be copied. For example, new File("plugins" + File.separator + "nyaml.yml")
- The file you enter will be the one that will be used in each of the following methods
- Note that in the destination file, you can put the name that you want to the file, and all the folders must exist (use mkdirs() before this method)
- Does not return anything
Spoiler: YAML generation
yaml.generate(Plugin plugin
, String yamlName
):
- For using it, you have to put a Plugin instance where is indicated. If it is in the main class, just put "this", else, put <name of main class>.getPlugin(<name of main class>.class)
- Also, you have to indicate which is the name of the yaml file that you want to "export" from inside your plugin, for example, "nyaml.yml". It has to exists, if it doesn't, it won't work
- Does not return anything
Spoiler: Path creation
yaml.create(String newPath
):
- Put the name path that you want to be created, for example, "nyaml.example"
- Note that it will only create the path if it does no exist
- Does not return anything
Spoiler: Path content assignation
yaml.put(String path
, Object content
):
- Put the name path that you want to assign some info, for example, "nyaml.example"
- Put the info that you want to asign, for example "This is an API"
- Note that it will only set the content the path if it exists
- Does not return anything
Spoiler: Path existance comprobation
yaml.ckeck(File yaml
, String path
):
- Put the name path that you want to check the existance of, for example, "nyaml.noexists"
- Returns a boolean
Spoiler: Path content obtainance
YAML.get(File yamlPath
, String path
):
- Put the name path that you want to get the contents of, for example, "nyaml.example"
- Note that it will only get the contents of the path if it exists
- Returns an Object, that lets you to cast it to all variables types
Spoiler: Path deletion
yaml.delete(String path
):
- Put the name path that you want to delete, for example, "nyaml.example"
- Note that it will only delete the path if it exists
- Does not return anything
Spoiler: Path list
yaml.list(String path
, boolean subpaths
):
- Put the name path that you want to list the subpaths, for example, "nyaml"
- Note that it will only list the paths (or also the subpaths if the boolean equals ture)
- Return a Set, in this case, the contents would be "example", but if the path example had a subpath named "test", the result would be: ["example", "example.test"]
If you didn't understand it, here is a piece of example code:
Spoiler: Example
Code (Text):
YAML example = new YAML();
example.load(new File("plugins" + File.separator + "nYaml" + File.separator + "example.yml"));
example.generate("example.yml");
sender.sendMessage(example.get("example.path").toString());
example.load(new File("plugins" + File.separator + "nYaml" + File.separator + "example.yml"));
example.generate("example.yml");
sender.sendMessage(example.get("example.path").toString());
Okey, that's nice! This is the to-do list:
- In the list method, let you choose between list only subpaths, or all the path under one
For the moment, nothing more, so give me ideas!
And please, rate and give your opinion about the plugin :3
And please, rate and give your opinion about the plugin :3
Quick facts
- Edition: Minecraft Java
- File type: .jar
- Minecraft versions listed: 1.8, 1.9, 1.10
- How to install: Install the matching mod loader (Forge, Fabric or NeoForge) for your Minecraft version. → Download the .jar. → Put it in the .minecraft/mods folder and launch that loader profile.
- Where to get it: Opens on Spigot — not every file is mirrored on our own servers.
Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.
nYAML is a free Minecraft Java mod. Compatible with Minecraft 1.8, 1.9, 1.10. Downloaded 329 times (via Spigot). Download it and open it directly in the game.
![[IMG]](http://proxy.spigotmc.org/ca6d68877b76b148d54cbe57dbdb6dc7e62f4247?url=https%3A%2F%2Fwww.paypalobjects.com%2Fen_GB%2Fi%2Fbtn%2Fbtn_donate_LG.gif)