2022-01-27 08:04:30 +00:00
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 ;
2022-03-10 20:02:31 +00:00
import java.util.Collections ;
2022-01-27 08:04:30 +00:00
public class CreateExampleResponse {
public static void configCreate ( ) {
2022-03-10 20:02:31 +00:00
long long_ = System . currentTimeMillis ( ) ;
2022-01-27 08:04:30 +00:00
if ( new File ( Main . getPath ( ) , " config.yml " ) . exists ( ) ) {
2022-07-25 22:46:29 +00:00
if ( Main . getPlugin ( ) . getConfig ( ) . getBoolean ( " Plugin.Debug " ) ) send . console ( Util . getPrefix ( ) + " §5DEBUG: §6 " + " §4config.yml are created / updated... " ) ;
2022-01-27 08:04:30 +00:00
} 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 ) ;
2022-03-10 20:02:31 +00:00
Config . set ( " Response.ResponseKeys " , Collections . singletonList ( " .example " ) , yamlConfiguration ) ;
2022-01-27 08:04:30 +00:00
Config . set ( " Response.Contains " , false , yamlConfiguration ) ;
2022-07-25 22:46:29 +00:00
Config . set ( " Response.BlockKeyMessage " , true , yamlConfiguration ) ;
2022-01-27 08:04:30 +00:00
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 ) ;
2022-03-10 20:02:31 +00:00
Config . set ( " Response.Command.Commands " , Collections . singletonList ( " say hi " ) , yamlConfiguration ) ;
2022-01-27 08:04:30 +00:00
Config . set ( " Response.Message.Enable " , true , yamlConfiguration ) ;
2022-07-25 22:46:29 +00:00
Config . set ( " Response.Message.Global.Enable " , false , yamlConfiguration ) ;
Config . set ( " Response.Message.Global.Bungee " , false , yamlConfiguration ) ;
Config . set ( " Response.Message.Messages " , Arrays . asList ( " [prefix] <dark_green>This is an Automated response from <dark_gray>[<dark_red>T2Code</dark_red><gray>-</gray><aqua>AutoResponse</aqua>]</dark_gray>.</dark_green> " , " [prefix] <gold>Contact us for questions / support on our <dark_purple><hover:show_text:'<dark_purple>Discord:</dark_purple> <yellow>dc.t2code.net</yellow>'><click:open_url:'http://dc.t2code.net'>Discord</click></hover></dark_purple>.</gold> " ) , yamlConfiguration ) ;
2022-03-10 21:54:01 +00:00
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 ) ;
2022-01-27 08:04:30 +00:00
try {
yamlConfiguration . save ( config ) ;
} catch ( IOException e ) {
e . printStackTrace ( ) ;
}
2022-03-10 20:02:31 +00:00
send . console ( Util . getPrefix ( ) + " §2config.yml were successfully created / updated. " + " §7- §e " + ( System . currentTimeMillis ( ) - long_ ) + " ms " ) ;
2022-01-27 08:04:30 +00:00
}
}