60 lines
3.4 KiB
Java
60 lines
3.4 KiB
Java
package net.t2code.autoresponse.Spigot.config.response;
|
|
|
|
import net.t2code.autoresponse.Util;
|
|
import net.t2code.autoresponse.Spigot.Main;
|
|
import net.t2code.lib.Spigot.Lib.messages.send;
|
|
import net.t2code.lib.Spigot.Lib.yamlConfiguration.Config;
|
|
import org.bukkit.configuration.file.YamlConfiguration;
|
|
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.util.Arrays;
|
|
import java.util.Collections;
|
|
|
|
public class CreateExampleResponse {
|
|
|
|
public static void configCreate() {
|
|
long long_ = System.currentTimeMillis();
|
|
if (new File(Main.getPath(), "config.yml").exists()) {
|
|
if (Main.plugin.getConfig().getBoolean("Plugin.Debug")) send.console(Util.getPrefix() + " §5DEBUG: §6" + " §4config.yml are created / updated...");
|
|
} else send.console(Util.getPrefix() + " §4config.yml are created...");
|
|
|
|
|
|
File config = new File(Main.getPath(), "Responses/responseexample.yml");
|
|
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
|
|
|
Config.set("Response.Enable", true, yamlConfiguration);
|
|
Config.set("Response.ResponseKeys", Collections.singletonList(".example"), yamlConfiguration);
|
|
Config.set("Response.Contains", false, yamlConfiguration);
|
|
Config.set("Response.Permission.Necessary", true, yamlConfiguration);
|
|
Config.set("Response.Permission.Permission", "t2c-autoresponse.response.example", yamlConfiguration);
|
|
|
|
Config.set("Response.Command.Enable", false, yamlConfiguration);
|
|
Config.set("Response.Command.CommandAsConsole", false, yamlConfiguration);
|
|
Config.set("Response.Command.BungeeCommand", false, yamlConfiguration);
|
|
Config.set("Response.Command.Commands", Collections.singletonList("say hi"), yamlConfiguration);
|
|
|
|
Config.set("Response.Message.Enable", true, yamlConfiguration);
|
|
Config.set("Response.Message.Messages", Arrays.asList("&2This is an Automated response from §8[§4T2Code§7-§bAutoResponse§8]&2.", "&6Contact us for questions / support on our Discord."), yamlConfiguration);
|
|
Config.set("Response.Message.TextBuilder.Enable", true, yamlConfiguration);
|
|
Config.set("Response.Message.TextBuilder.Hover", "&5Discord: &edc.t2code.net", yamlConfiguration);
|
|
Config.set("Response.Message.TextBuilder.ClickEvent.Enable", true, yamlConfiguration);
|
|
Config.set("Response.Message.TextBuilder.ClickEvent.Action", "OPEN_URL", yamlConfiguration);
|
|
Config.set("Response.Message.TextBuilder.ClickEvent.ActionValue", "http://dc.t2code.net", yamlConfiguration);
|
|
|
|
Config.set("Response.Protection.GameMode.Enable", false, yamlConfiguration);
|
|
Config.set("Response.Protection.GameMode.Mode", "blacklist", yamlConfiguration);
|
|
Config.set("Response.Protection.GameMode.List", Arrays.asList("CREATIVE","SPECTATOR"), yamlConfiguration);
|
|
Config.set("Response.Protection.World.Enable", false, yamlConfiguration);
|
|
Config.set("Response.Protection.World.Mode", "blacklist", yamlConfiguration);
|
|
Config.set("Response.Protection.World.List", Arrays.asList("World1","World2"), yamlConfiguration);
|
|
|
|
try {
|
|
yamlConfiguration.save(config);
|
|
} catch (IOException e) {
|
|
e.printStackTrace();
|
|
}
|
|
send.console(Util.getPrefix() + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
|
}
|
|
}
|