Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to disable "[LangUtils] Skipped {lang}" log messages #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
Language Utils
==============

[![Gitter](https://badges.gitter.im/MascusJeoraly/LanguageUtils.svg)](https://gitter.im/MascusJeoraly/LanguageUtils?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Build Status](https://snap-ci.com/MascusJeoraly/LanguageUtils/branch/master/build_image)](https://snap-ci.com/MascusJeoraly/LanguageUtils/branch/master)

A Bukkit/Spigot API offering the ability to get the name of **vanilla** items, entities, enchantments, and enchantment levels.

The major version of this API supports 1.12. If you are using 1.7.10, 1.8.9, 1.9.4, 1.10.2, or 1.11.2, please download `1.4.0` version for 1.7.10(with suffix `-1.7.10`) or `1.4.0` for 1.8.9(no suffix), `1.5.x` for 1.9.4, or `1.6.x` for 1.10.2, `1.8.x` for 1.11.2 accordingly.
Expand All @@ -11,7 +9,7 @@ Loading language files may cost 100-300 ms, but it should be fine to wait, and y

Also, if you want to know how to add customized language entries, just read the `README.txt` inside `lang/` folder.

You can get the latest build [here](https://drone.io/github.com/MeowInnovation/LanguageUtils/files "here").
Look also [this fork](https://github.com/NyaaCat/LanguageUtils)

You CAN install this plugin on Cauldron/KCauldron servers if you are using 1.2.0.1-1.7.10+ version of this plugin. Again, the API only supports **vanilla** language entries. It will just return the auto-generated material name of an item in mods.

Expand Down Expand Up @@ -112,4 +110,4 @@ If you are using Eclipse(not tested)

### Pull Request

If you find any problems or want to improve the efficiency, please send me PR or issues.
If you find any problems or want to improve the efficiency, please send me PR or issues.
1 change: 1 addition & 0 deletions src/main/java/com/meowj/langutils/LangUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public void onEnable() {
List<String> defaultLang = new ArrayList<>();
defaultLang.add("en_us");
config.addDefault("LoadLanguage", defaultLang);
config.addDefault("LogSkipped", false);
config.options().copyDefaults(true);
saveConfig();

Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/meowj/langutils/lang/convert/EnumLang.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,11 @@ public static EnumLang get(String locale) {
* Initialize this class, load all the languages to the corresponding HashMap.
*/
public static void init() {
boolean logSkipped = LangUtils.plugin.config.getBoolean("LogSkipped",false);
for (EnumLang enumLang : EnumLang.values()) {
if (!LangUtils.plugin.config.getStringList("LoadLanguage").contains("all") && !LangUtils.plugin.config.getStringList("LoadLanguage").contains(enumLang.getLocale())) {
LangUtils.plugin.info("Skipped " + enumLang.getLocale());
if(logSkipped)
LangUtils.plugin.info("Skipped " + enumLang.getLocale());
continue;
}
try {
Expand Down