Locales : added meta.banner, meta.auhors and meta.version

This commit is contained in:
Florian CUNY 2018-08-07 16:26:37 +02:00
parent cd7f8ddf24
commit 1455d6e7f5
8 changed files with 70 additions and 52 deletions

View File

@ -1,5 +1,7 @@
package world.bentobox.bentobox.api.localization;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import org.bukkit.configuration.file.YamlConfiguration;
@ -15,13 +17,22 @@ public class BentoBoxLocale {
private Locale locale;
private YamlConfiguration config;
private ItemStack banner;
private List<String> authors;
private boolean obsolete;
public BentoBoxLocale(Locale locale, YamlConfiguration config) {
this.locale = locale;
this.config = config;
// Load the banner from the configuration
banner = ItemParser.parse(config.getString("banner"));
banner = ItemParser.parse(config.getString("meta.banner"));
// Load authors from the configuration
authors = new LinkedList<>();
updateAuthors(config);
// TODO Check if obsolete
obsolete = false;
}
/**
@ -76,19 +87,39 @@ public class BentoBoxLocale {
return banner;
}
public List<String> getAuthors() {
return authors;
}
public boolean isObsolete() {
return obsolete;
}
/**
* Merges a language YAML file to this locale
* @param toBeMerged the YamlConfiguration of the language file
*/
public void merge(YamlConfiguration toBeMerged) {
for (String key : toBeMerged.getKeys(true)) {
if (!config.contains(key)) {
if (!key.startsWith("meta") && !config.contains(key)) {
config.set(key, toBeMerged.get(key));
}
}
updateAuthors(toBeMerged);
}
public boolean contains(String reference) {
return config.contains(reference);
}
private void updateAuthors(YamlConfiguration yamlConfiguration) {
List<String> list = yamlConfiguration.getStringList("meta.authors");
if (!list.isEmpty()) {
for (String author : list) {
if (!authors.contains(author)) {
authors.add(author);
}
}
}
}
}

View File

@ -3,14 +3,11 @@
# the one at http://yaml-online-parser.appspot.com #
###########################################################################################
### Credits ###
# Tastybento: maintainer
# Poslovitch: maintainer
# markusmarkusz: translator
#
# This translation is adapted to version : [alpha-1]
meta:
authors:
- markusmarkusz
banner: "RED_BANNER:1:STRIPE_RIGHT:BLACK:STRIPE_LEFT:YELLOW"
version: "alpha-1"
not-setup:
header: |-

View File

@ -3,13 +3,11 @@
# the one at http://yaml-online-parser.appspot.com #
###########################################################################################
### Credits ###
# Tastybento: maintainer
# Poslovitch: maintainer
#
# This translation is adapted to version : [alpha-1]
meta:
authors:
- tastybento
banner: "BLUE_BANNER:1:STRIPE_DOWNLEFT:WHITE:STRIPE_DOWNRIGHT:WHITE:STRIPE_CENTER:WHITE:STRIPE_MIDDLE:WHITE:STRAIGHT_CROSS:RED:CROSS:RED"
version: "alpha-1"
protection:
flags:

View File

@ -3,13 +3,12 @@
# the one at http://yaml-online-parser.appspot.com #
###########################################################################################
### Credits ###
# tastybento: maintainer
# Poslovitch: maintainer
#
# This translation is adapted to version : [alpha-2]
meta:
authors:
- tastybento
- Poslovitch
banner: "WHITE_BANNER:1:STRIPE_SMALL:RED:SQUARE_TOP_RIGHT:CYAN:SQUARE_TOP_RIGHT:BLUE"
version: "FC-0.81"
general:
success: "&aSuccess!"

View File

@ -3,13 +3,12 @@
# utilisant un parser YAML, tel que http://yaml-online-parser.appspot.com #
###########################################################################################
### Credits ###
# MrSheepSheep: translater
# Poslovitch: maintainer
#
# Cette traduction est adaptée pour la version : [alpha-2]
meta:
authors:
- MrSheepSheep
- Poslovitch
banner: "WHITE_BANNER:1:STRIPE_BOTTOM:RED:STRIPE_TOP:BLUE"
version: "alpha-1"
general:
deaths: "morts"

View File

@ -3,12 +3,11 @@
# the one at http://yaml-online-parser.appspot.com #
###########################################################################################
### Credits ###
# RikoDEV: maintainer
#
# This translation is adapted to version : [alpha-2]
meta:
authors:
- RikoDEV
banner: "WHITE_BANNER:1:HALF_VERTICAL:RED"
version: "FC-0.8"
general:
success: "&aSukces!"

View File

@ -3,14 +3,11 @@
# cái này http://yaml-online-parser.appspot.com #
###########################################################################################
### Credits ###
# tastybento: Người cung cấp bản YML gốc
# Poslovitch: Người cung cấp bản YML gốc
#
# Banbeucmas: Người dịch bản YML gốc
# This translation is adapted to version : [alpha-2]
meta:
authors:
- Banbeucmas
banner: "RED_BANNER:1:CREEPER:YELLOW:RHOMBUS_MIDDLE:YELLOW:TRIANGLES_BOTTOM:RED:SQUARE_BOTTOM_LEFT:RED:SQUARE_BOTTOM_RIGHT:RED"
version: "alpha-1"
general:
deaths: "Chết"

View File

@ -3,13 +3,11 @@
# the one at http://yaml-online-parser.appspot.com #
###########################################################################################
### Credits ###
# Tastybento: maintainer
# Poslovitch: maintainer
# DuckSoft: translator
# This translation is adapted to version : [alpha-1]
meta:
authors:
- DuckSoft
banner: "RED_BANNER:1:SQUARE_TOP_RIGHT:YELLOW:CROSS:RED:CURLY_BORDER:RED:MOJANG:YELLOW:HALF_HORIZONTAL_MIRROR:RED:HALF_VERTICAL:RED"
version: "alpha-1"
not-setup:
header: |-