Make old /createkit toggleable in config.

This commit is contained in:
Ali Moghnieh 2016-07-13 23:25:20 +01:00
parent e0d69d05eb
commit 6cbb8c846b
No known key found for this signature in database
GPG key ID: F09D3A1BAF2E6D70
28 changed files with 51 additions and 7 deletions

View file

@ -70,15 +70,21 @@ public class Commandcreatekit extends EssentialsCommand {
list.add(serialized);
}
}
ConfigurationSection config = new MemoryConfiguration();
config.set("kits." + kitname + ".delay", delay);
config.set("kits." + kitname + ".items", list);
// Some users might want to directly write to config knowing the consequences. *shrug*
if (!ess.getSettings().isPastebinCreateKit()) {
ess.getSettings().addKit(kitname, list, delay);
user.sendMessage(tl("createdKit", kitname, list.size(), delay));
} else {
ConfigurationSection config = new MemoryConfiguration();
config.set("kits." + kitname + ".delay", delay);
config.set("kits." + kitname + ".items", list);
final Yaml yaml = new Yaml(yamlConstructor, yamlRepresenter, yamlOptions);
String fileContents = "# Copy the kit code below into the kits section in your config.yml file\n";
fileContents += yaml.dump(config.getValues(false));
final Yaml yaml = new Yaml(yamlConstructor, yamlRepresenter, yamlOptions);
String fileContents = "# Copy the kit code below into the kits section in your config.yml file\n";
fileContents += yaml.dump(config.getValues(false));
gist(user.getSource(), kitname, delay, fileContents);
gist(user.getSource(), kitname, delay, fileContents);
}
}
/**