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 ( ) ) {
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 ) ;
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 ) ;
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 ) ;
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 ) ;
2022-03-10 21:54:01 +00:00
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 ) ;
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
}
}