2022-01-27 08:04:30 +00:00
package net.t2code.autoresponse.Spigot.config.languages ;
import net.t2code.autoresponse.Util ;
import net.t2code.autoresponse.Spigot.Main ;
2022-11-15 22:44:45 +00:00
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend ;
import net.t2code.t2codelib.SPIGOT.api.yaml.T2Cconfig ;
2022-01-27 08:04:30 +00:00
import org.bukkit.configuration.file.YamlConfiguration ;
import org.bukkit.plugin.Plugin ;
import java.io.File ;
import java.io.IOException ;
public class CreateMessages {
2022-07-25 22:46:29 +00:00
private static Plugin plugin = Main . getPlugin ( ) ;
2022-01-27 08:04:30 +00:00
public static void langCreate ( ) {
2022-11-15 22:44:45 +00:00
T2Csend . debug ( plugin , " §4Language files are created / updated... " ) ;
2022-01-27 08:04:30 +00:00
Long long_ = Long . valueOf ( System . currentTimeMillis ( ) ) ;
/ * *
*
* ENGLISH
*
* /
File messagesEN = new File ( Main . getPath ( ) , " languages/english_messages.yml " ) ;
YamlConfiguration yamlConfigurationEN = YamlConfiguration . loadConfiguration ( messagesEN ) ;
2022-11-15 22:44:45 +00:00
T2Cconfig . set ( " Plugin.Reload.Start " , MSG . EN_ReloadStart , yamlConfigurationEN ) ;
T2Cconfig . set ( " Plugin.Reload.End " , MSG . EN_ReloadEnd , yamlConfigurationEN ) ;
T2Cconfig . set ( " Plugin.ForCommand " , MSG . EN_NoPermissionForCommand , yamlConfigurationEN ) ;
2022-01-27 08:04:30 +00:00
try {
yamlConfigurationEN . save ( messagesEN ) ;
} catch ( IOException e ) {
2022-11-15 22:44:45 +00:00
T2Csend . warning ( plugin , e . getMessage ( ) ) ;
2022-01-27 08:04:30 +00:00
e . printStackTrace ( ) ;
}
/ * *
*
* GERMAN
*
* /
File messagesDE = new File ( Main . getPath ( ) , " languages/german_messages.yml " ) ;
YamlConfiguration yamlConfigurationDE = YamlConfiguration . loadConfiguration ( messagesDE ) ;
2022-11-15 22:44:45 +00:00
T2Cconfig . set ( " Plugin.Reload.Start " , MSG . DE_ReloadStart , yamlConfigurationDE ) ;
T2Cconfig . set ( " Plugin.Reload.End " , MSG . DE_ReloadEnd , yamlConfigurationDE ) ;
T2Cconfig . set ( " Plugin.ForCommand " , MSG . DE_NoPermissionForCommand , yamlConfigurationDE ) ;
2022-01-27 08:04:30 +00:00
try {
yamlConfigurationDE . save ( messagesDE ) ;
} catch ( IOException e ) {
2022-11-15 22:44:45 +00:00
T2Csend . warning ( plugin , e . getMessage ( ) ) ;
2022-01-27 08:04:30 +00:00
e . printStackTrace ( ) ;
}
2022-11-15 22:44:45 +00:00
T2Csend . console ( Util . getPrefix ( ) + " §2Language files were successfully created / updated. " + " §7- §e " + ( System . currentTimeMillis ( ) - long_ . longValue ( ) ) + " ms " ) ;
2022-01-27 08:04:30 +00:00
}
}