Skip to content

Commit

Permalink
removed old lines codes
Browse files Browse the repository at this point in the history
  • Loading branch information
jonagamerpro1234 committed Jan 8, 2023
1 parent 71a4366 commit 7a57277
Show file tree
Hide file tree
Showing 18 changed files with 18 additions and 235 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class Lang {
public String Error_Console;
public String Error_Sound;
public String error_null_group;
private CustomJoinAndQuitMessages plugin;
private final CustomJoinAndQuitMessages plugin;
private FileConfiguration locale = null;
private File localeFile = null;
private final Locale localeObject;
Expand All @@ -32,19 +32,19 @@ public Lang(final CustomJoinAndQuitMessages plugin, final String localeName, fin
this.plugin = plugin;
this.index = index;
this.localeName = localeName;
getlang(localeName);
getLang(localeName);
loadLocale();
localeObject = new Locale(localeName.substring(0, 2), localeName.substring(3, 5));
}

public FileConfiguration getlang(final String localeName) {
public FileConfiguration getLang(final String localeName) {
if (this.locale == null) {
reloadlang(localeName);
reloadLang(localeName);
}
return locale;
}

public void reloadlang(final String localeName) {
public void reloadLang(final String localeName) {
final File localeDir = new File(plugin.getDataFolder() + File.separator + "lang");

if (!localeDir.exists()) {
Expand Down Expand Up @@ -103,4 +103,5 @@ public String getCountryName() {
public int getIndex() {
return index;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public List<String> list() throws IOException {
Logger.debug("Path: " + langDir);

if(Files.exists(langDir)) {
Pattern langFilePattern = Pattern.compile("^[a-z]{2}(-[A-Z]{2})?\\.yml$");
Pattern langFilePattern = Pattern.compile("^[a-z]{2}(_[A-Z]{2})?\\.yml$");

try (DirectoryStream<Path> stream = Files.newDirectoryStream(langDir)) {

Expand Down Expand Up @@ -77,6 +77,12 @@ public List<String> list() throws IOException {
}
}
}
Logger.debug("List of available languages");
for (String s : result){
Logger.debug(" * " + s);
}
Logger.debug("============================");

return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

public class FileManager {

private CustomJoinAndQuitMessages plugin;
private final CustomJoinAndQuitMessages plugin;

public FileManager(CustomJoinAndQuitMessages plugin) {
super();
Expand All @@ -26,8 +26,8 @@ public void createVoidFolder(String name) {
}
}

public void createFolderAndFile(String namefolder, String namefile) {
File folder = new File(getDataFolder(), namefolder);
public void createFolderAndFile(String nameFolder, String nameFile) {
File folder = new File(getDataFolder(), nameFolder);
if (!folder.exists()) {
try {
folder.mkdir();
Expand All @@ -36,7 +36,7 @@ public void createFolderAndFile(String namefolder, String namefile) {
}
}

File file = new File(folder, namefile);
File file = new File(folder, nameFile);
if (!file.exists()) {
try {
file.createNewFile();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public boolean loadLangs() {
plugin.getLogger().severe("Could not add locales!");
}
if (!availableLocales.containsKey(Settings.defaultLanguage)) {
Logger.warning(Util.getPrefix(true) + "&eLoad File: " + Settings.defaultLanguage + ".yml' not found in /locale folder. Using /locale/en-US.yml");
Logger.warning(Util.getPrefix(true) + "&eLoad File: " + Settings.defaultLanguage + ".yml' not found in /lang/ folder. Using /lang/en-US.yml");
Settings.defaultLanguage = "en-US";
availableLocales.put(Settings.defaultLanguage, new Lang(plugin, Settings.defaultLanguage, 0));
}
Expand Down
16 changes: 0 additions & 16 deletions CustomJoinAndQuitMessagesOld/src/main/resources/de_DE.yml

This file was deleted.

16 changes: 0 additions & 16 deletions CustomJoinAndQuitMessagesOld/src/main/resources/en_US.yml

This file was deleted.

16 changes: 0 additions & 16 deletions CustomJoinAndQuitMessagesOld/src/main/resources/es_ES.yml

This file was deleted.

16 changes: 0 additions & 16 deletions CustomJoinAndQuitMessagesOld/src/main/resources/fr_FR.yml

This file was deleted.

16 changes: 0 additions & 16 deletions CustomJoinAndQuitMessagesOld/src/main/resources/lang/de-DE.yml

This file was deleted.

16 changes: 0 additions & 16 deletions CustomJoinAndQuitMessagesOld/src/main/resources/lang/en-US.yml

This file was deleted.

16 changes: 0 additions & 16 deletions CustomJoinAndQuitMessagesOld/src/main/resources/lang/es-ES.yml

This file was deleted.

16 changes: 0 additions & 16 deletions CustomJoinAndQuitMessagesOld/src/main/resources/lang/fr-FR.yml

This file was deleted.

16 changes: 0 additions & 16 deletions CustomJoinAndQuitMessagesOld/src/main/resources/lang/ru-RU.yml

This file was deleted.

16 changes: 0 additions & 16 deletions CustomJoinAndQuitMessagesOld/src/main/resources/lang/zh-CN.yml

This file was deleted.

16 changes: 0 additions & 16 deletions CustomJoinAndQuitMessagesOld/src/main/resources/lang/zh-TW.yml

This file was deleted.

16 changes: 0 additions & 16 deletions CustomJoinAndQuitMessagesOld/src/main/resources/ru_RU.yml

This file was deleted.

16 changes: 0 additions & 16 deletions CustomJoinAndQuitMessagesOld/src/main/resources/zh_CN.yml

This file was deleted.

16 changes: 0 additions & 16 deletions CustomJoinAndQuitMessagesOld/src/main/resources/zh_TW.yml

This file was deleted.

0 comments on commit 7a57277

Please sign in to comment.