コード例 #1
0
 @Override
 public void onEnable() {
   // Create a new manager
   manager = new TranslationManager();
   // Scan this file for all @Translations
   try {
     TranslationManager.scan(TranslationPlugin.class, manager);
   } catch (final Exception e) {
     e.printStackTrace();
   }
   // Now let's create some default files :D
   this.english =
       new YamlTranslationFile(
               BukkitTranslation.getParent(),
               TranslationLanguage.englishAmerican,
               getName(),
               manager,
               true)
           .read()
           .header("Example file", "@author Citymonstret");
   // That created the file, read it, and made a default header
   getLogger()
       .log(
           Level.INFO,
           BukkitTranslation.convert(
               manager.getTranslated("translator_loaded", TranslationLanguage.englishAmerican)));
 }
コード例 #2
0
 @Override
 public void onDisable() {
   // Add all translations and save the file
   manager.saveAll(this.english).saveFile(this.english);
   getLogger()
       .log(
           Level.INFO,
           BukkitTranslation.convert(
               manager.getTranslated("translator_disabled", TranslationLanguage.englishAmerican)));
 }