2.13.1 Release

language file dynamic generation from en.yml
This commit is contained in:
SuperRonanCraft 2020-09-23 11:01:06 -04:00
parent 60458c35f9
commit afcb76bfd7
10 changed files with 104 additions and 76 deletions

View File

@ -6,7 +6,7 @@
<groupId>me.SuperRonanCraft</groupId>
<artifactId>BetterRTP</artifactId>
<version>2.13.0</version>
<version>2.13.1</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>

View File

@ -31,37 +31,65 @@ public class LangFile {
@SuppressWarnings("all")
public void load() {
Main pl = Main.getInstance();
String fileName = "lang" + File.separator + pl.getFiles().getType(FileBasics.FILETYPE.CONFIG).getString("Language-File");
File file = new File(pl.getDataFolder(), fileName);
if (!file.exists())
pl.saveResource(fileName, false);
generateDefaults();
String fileName = "lang" + File.separator + getPl().getFiles().getType(FileBasics.FILETYPE.CONFIG).getString("Language-File");
File file = new File(getPl().getDataFolder(), fileName);
if (!file.exists()) {
fileName = "lang" + File.separator + defaultLangs[0]; //Default to english
file = new File(getPl().getDataFolder(), fileName);
}
try {
config.load(file);
InputStream defConfigStream = Main.getInstance().getResource(fileName);
if (defConfigStream == null)
defConfigStream = pl.getResource(fileName.replace(File.separator, "/"));
if (defConfigStream != null) {
config.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(defConfigStream)));
InputStream in = Main.getInstance().getResource(fileName);
if (in == null)
in = getPl().getResource(fileName.replace(File.separator, "/"));
if (in != null) {
config.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(in)));
config.options().copyDefaults(true);
in.close();
}
config.save(file);
} catch (Exception e) {
e.printStackTrace();
}
generateDefaults(pl);
}
private String[] defaultLangs = {"en.yml", "fr.yml", "ja.yml", "ru.yml", "chn.yml", "cht.yml", "du.yml"};
private void generateDefaults(Main pl) {
private void generateDefaults() {
//Generate all language files
for (String yaml : defaultLangs) {
if (yaml.equals(defaultLangs[0]) && config.getName().equals(defaultLangs[0]))
continue;
File f = new File(pl.getDataFolder(), "lang" + File.separator + yaml);
if (!f.exists())
pl.saveResource("lang" + File.separator + f.getName(), false);
generateDefaultConfig(yaml, yaml); //Generate its own defaults
if (!yaml.equals(defaultLangs[0]))
generateDefaultConfig(yaml, defaultLangs[0]); //Generate the english defaults (incase)
}
}
private void generateDefaultConfig(String fName, String fNameDef /*Name of file to generate defaults*/) {
String fileName = "lang" + File.separator + fName;
File file = new File(getPl().getDataFolder(), fileName);
if (!file.exists())
getPl().saveResource(fileName, false);
try {
YamlConfiguration config = new YamlConfiguration();
config.load(file);
String fileNameDef = "lang" + File.separator + fNameDef;
InputStream in = Main.getInstance().getResource(fileNameDef);
if (in == null)
in = getPl().getResource(fileNameDef.replace(File.separator, "/"));
if (in != null) {
config.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(in)));
config.options().copyDefaults(true);
in.close();
}
config.save(file);
} catch (Exception e) {
e.printStackTrace();
}
}
private Main getPl() {
return Main.getInstance();
}
}

View File

@ -97,18 +97,18 @@ WorldType: # Available types are NORMAL, NETHER
- world_nether: NETHER
- world_the_end: NORMAL
PermissionConfigs: #Player requires "betterrtp.config.<world_name>" to trigger these configs
- vip: #betterrtp.config.vip
- Build_World: #World named "Build_World"
MaxRadius: 10000
MinRadius: 1000
- Survival_World:
MaxRadius: 5000
MinRadius: 1000
- vip2:
- Build_World:
MaxRadius: 25000
MinRadius: 10000
- Survival_World:
MaxRadius: 15000
MinRadius: 1000
#PermissionConfigs: #Player requires "betterrtp.config.<world_name>" to trigger these configs
#- vip: #betterrtp.config.vip
# - Build_World: #World named "Build_World"
# MaxRadius: 10000
# MinRadius: 1000
# - Survival_World:
# MaxRadius: 5000
# MinRadius: 1000
#- vip2:
# - Build_World:
# MaxRadius: 25000
# MinRadius: 10000
# - Survival_World:
# MaxRadius: 15000
# MinRadius: 1000

View File

@ -3,12 +3,12 @@ Messages:
Success: ## Placeholders! %x% %y% and %z% are the x, y, and z coordinates that the player is being teleported to! #
Paid: '&a你花费了&c$%price%&7被传送到了&7 x=%x% y=%y% z=%z%。共尝试&f%attempts%&7次'
Bypass: '&a你被传送到了&7 x=%x% y=%y% z=%z%。共尝试&f%attempts%&7次'
Loading: '&aSafe spot located! &7Loading chunks...'
Teleport: '&aTeleporting... &fplease wait while we find a safe location!'
# Loading: '&aSafe spot located! &7Loading chunks...'
# Teleport: '&aTeleporting... &fplease wait while we find a safe location!'
Failed:
Price: '&c你的钱不够了&7你至少要有$%price%&7才能随机传送'
NotSafe: '&c由于在%attempts%次尝试内未能找到安全的位置,&7你未被传送'
Hunger: '&cCould not rtp because you are... &7too hungry&c, eat something fella!'
# Hunger: '&cCould not rtp because you are... &7too hungry&c, eat something fella!'
Other:
Success: '&a%player%被传送到了&7 x=%x% y=%y% z=%z%。共尝试&f%attempts%&7次'
NotSafe: '&c由于在%attempts%次尝试内未能找到安全的位置,&7%player%未被传送!'
@ -45,7 +45,7 @@ Usage:
Player: '&cUsage&7: /%command% player <玩家> [世界] [生物群系1, 生物群系2]'
World: '&cUsage&7: /%command% world <世界> [生物群系1, 生物群系2...]'
Biome: '&cUsage&7: /%command% biome <生物群系1, 生物群系2...>'
Edit:
Base: '&cUsage&7: /%command% edit <default/world> [args...]'
Default: '&cUsage&7: /%command% edit default <max/min/useworldborder/center> <value>'
World: '&cUsage&7: /%command% edit world <world> <max/min/useworldborder/center> <value>'
# Edit:
# Base: '&cUsage&7: /%command% edit <default/world> [args...]'
# Default: '&cUsage&7: /%command% edit default <max/min/useworldborder/center> <value>'
# World: '&cUsage&7: /%command% edit world <world> <max/min/useworldborder/center> <value>'

View File

@ -4,11 +4,11 @@ Messages:
Paid: '&a您花費了&c$%price%&7被傳送到了&7 x=%x% y=%y% z=%z%。一共嘗試&f%attempts%&7次'
Bypass: '&a您被傳送到了&7 x=%x% y=%y% z=%z%。一共嘗試&f%attempts%&7次'
Loading: '&a已定位安全位置! &7正在讀取區塊...'
Teleport: '&aTeleporting... &fplease wait while we find a safe location!'
# Teleport: '&aTeleporting... &fplease wait while we find a safe location!'
Failed:
Price: '&c您的資金不夠了&7您需要有$%price%&7才能嘗試RTP'
NotSafe: '&c由於%attempts%次嘗試內未能找到適合的地方傳送,&7您未被傳送'
Hunger: '&cCould not rtp because you are... &7too hungry&c, eat something fella!'
# Hunger: '&cCould not rtp because you are... &7too hungry&c, eat something fella!'
Other:
Success: '&a%player%被傳送到了&7 x=%x% y=%y% z=%z%。一共嘗試&f%attempts%&7次'
NotSafe: '&c由於%attempts%次嘗試內未能找到適合的地方傳送,&7%player%未被傳送!'
@ -45,7 +45,7 @@ Usage:
Player: '&cUsage&7: /%command% player <玩家> [世界] [生態域1, 生態域2]'
World: '&cUsage&7: /%command% world <世界> [生態域1, 生態域2...]'
Biome: '&cUsage&7: /%command% biome <生態域1, 生態域2...>'
Edit:
Base: '&cUsage&7: /%command% edit <default/world> [args...]'
Default: '&cUsage&7: /%command% edit default <max/min/useworldborder/center> <value>'
World: '&cUsage&7: /%command% edit world <world> <max/min/useworldborder/center> <value>'
# Edit:
# Base: '&cUsage&7: /%command% edit <default/world> [args...]'
# Default: '&cUsage&7: /%command% edit default <max/min/useworldborder/center> <value>'
# World: '&cUsage&7: /%command% edit world <world> <max/min/useworldborder/center> <value>'

View File

@ -3,12 +3,12 @@ Messages:
Success: ## Placeholders! %x% %y% and %z% are the x, y, and z coordinates that the player is being teleported to! #
Paid: '&aJe bent getp''d naar&7 x=%x% y=%y% z=%z% for &c$%price%&7 in &f%attempts% &7attempts!'
Bypass: '&aJe bent getp''d naar&7 x=%x% y=%y% z=%z%'
Loading: '&aSafe spot located! &7Loading chunks...'
Teleport: '&aTeleporting... &fplease wait while we find a safe location!'
# Loading: '&aSafe spot located! &7Loading chunks...'
# Teleport: '&aTeleporting... &fplease wait while we find a safe location!'
Failed:
Price: '&cKan niet rtpen vanwege onvoldoende saldo! &7Je moet minstens $%price% &7hebben om te rtpen!'
NotSafe: '&cKon geen veilige plek vinden, Probeer opnieuw! &7Je bent niet ge tp''d!'
Hunger: '&cCould not rtp because you are... &7too hungry&c, eat something fella!'
# Hunger: '&cCould not rtp because you are... &7too hungry&c, eat something fella!'
Other:
Success: '&a%player% is getp''d naar&7 x=%x% y=%y% z=%z% in &f%attempts% &7pogingen!'
NotSafe: '&cKon geen veilige plek binnenin %attempts% pogingen! &7%player% is niet gertp''d!'
@ -44,7 +44,7 @@ Usage:
Player: '&cUsage&7: /%command% player <player> [world] [biome1, biome2]'
World: '&cUsage&7: /%command% world <world> [biome1, biome2...]'
Biome: '&cUsage&7: /%command% biome <biome1, biome2...>'
Edit:
Base: '&cUsage&7: /%command% edit <default/world> [args...]'
Default: '&cUsage&7: /%command% edit default <max/min/useworldborder/center> <value>'
World: '&cUsage&7: /%command% edit world <world> <max/min/useworldborder/center> <value>'
# Edit:
# Base: '&cUsage&7: /%command% edit <default/world> [args...]'
# Default: '&cUsage&7: /%command% edit default <max/min/useworldborder/center> <value>'
# World: '&cUsage&7: /%command% edit world <world> <max/min/useworldborder/center> <value>'

View File

@ -4,12 +4,12 @@ Messages:
Success:
Paid: '&aTu a été téléporté à&7 x=%x% y=%y% z=%z% pour &c$%price%&7 en &f%attempts% &7tentatives!'
Bypass: '&aTu a été téléporté à&7 x=%x% y=%y% z=%z% en &f%attempts% &7tentatives!'
Loading: '&aSafe spot located! &7Loading chunks...'
Teleport: '&aTeleporting... &fplease wait while we find a safe location!'
# Loading: '&aSafe spot located! &7Loading chunks...'
# Teleport: '&aTeleporting... &fplease wait while we find a safe location!'
Failed:
Price: '&cTu n''a pas pu être téléporté; Manque de fonds! &7Tu doit avoir au moins $%price% &7pour te téléporter!'
NotSafe: '&cImpossible de trouver un endroit sûr en %attempts% tentatives! &7Tu n''a pas été téléporté!'
Hunger: '&cCould not rtp because you are... &7too hungry&c, eat something fella!'
# Hunger: '&cCould not rtp because you are... &7too hungry&c, eat something fella!'
Other:
Success: '&a%player% a été téléporté à&7 x=%x% y=%y% z=%z% em &f%attempts% &7tentatives!'
NotSafe: '&cImpossible de trouver un endroit sûr en %attempts% tentatives! &7%player% n''a pas été téléporté!'
@ -27,7 +27,7 @@ Messages:
Moved: '&cTu a bougé! &7Téléportation annulée!'
NotExist: '&cLe monde &7%world% &cn''existe pas!'
Already: '&cOups! &7Il semblerait que tu essaie déjà de te téléporter...Patiente un peu!'
Sign: '&7Command sign has been created! &7Command is... ''&f/rtp %command%&7'''
# Sign: '&7Command sign has been created! &7Command is... ''&f/rtp %command%&7'''
Help:
List:

View File

@ -3,16 +3,16 @@ Messages:
Success:
Paid: '&aあなたは&c$%price%&aで&7x=%x% y=%y% z=%z% に&f%attempts%&7回の試行でTPされました'
Bypass: '&aあなたは&7x=%x% y=%y% z=%z% に&f%attempts%&7回の試行でTPされました'
Loading: '&aSafe spot located! &7Loading chunks...'
Teleport: '&aTeleporting... &fplease wait while we find a safe location!'
# Loading: '&aSafe spot located! &7Loading chunks...'
# Teleport: '&aTeleporting... &fplease wait while we find a safe location!'
Failed:
Price: '&c資金が不十分のためRTPできませんでした &7RTPには最低$%price%&7が必要です'
NotSafe: '&c%attempts%回の試行で安全な場所が見つかりませんでした! &7あなたははRTPされませんでした'
Hunger: '&cCould not rtp because you are... &7too hungry&c, eat something fella!'
# Hunger: '&cCould not rtp because you are... &7too hungry&c, eat something fella!'
Other:
Success: '&a%player%が&7x=%x% y=%y% z=%z% に&f%attempts%&7回の試行でテレポートしました'
NotSafe: '&c%attempts%回の試行で安全な場所が見つかりませんでした! &7%player%はRTPされませんでした'
Biome: '&cSeems like the biome&7 %biome%&c does not exist! &7Try using the tab list!'
# Biome: '&cSeems like the biome&7 %biome%&c does not exist! &7Try using the tab list!'
Reload: '&eコンフィグは正常にリロードされました'
NoPermission:
Basic: '&cごめんなさい &7このコマンドを使う権限がありません'
@ -27,7 +27,7 @@ Messages:
Moved: '&cあなたは移動しました &7RTPはキャンセルされました'
NotExist: '&cワールド&7%world%&cが存在しないようです。'
Already: '&cおっと &7あなたはすでにRTPしているように見えます。'
Sign: '&7Command sign has been created! &7Command is... ''&f/rtp %command%&7'''
# Sign: '&7Command sign has been created! &7Command is... ''&f/rtp %command%&7'''
Help:
List:
@ -45,7 +45,7 @@ Usage:
Player: '&c使い方&7: /%command% player <プレイヤー> [ワールド]'
World: '&c使い方&7: /%command% world <ワールド>'
Biome: '&cUsage&7: /%command% biome <biome1, biome2...>'
Edit:
Base: '&cUsage&7: /%command% edit <default/world> [args...]'
Default: '&cUsage&7: /%command% edit default <max/min/useworldborder/center> <value>'
World: '&cUsage&7: /%command% edit world <world> <max/min/useworldborder/center> <value>'
# Edit:
# Base: '&cUsage&7: /%command% edit <default/world> [args...]'
# Default: '&cUsage&7: /%command% edit default <max/min/useworldborder/center> <value>'
# World: '&cUsage&7: /%command% edit world <world> <max/min/useworldborder/center> <value>'

View File

@ -3,16 +3,16 @@ Messages:
Success: ## Placeholders! %x% %y% and %z% are the x, y, and z coordinates that the player is being teleported to! #
Paid: '&aВас телепортировало на&7 x=%x% y=%y% z=%z% за &c$%price%&7, за &f%attempts% &7попыток!'
Bypass: '&aВас телепортировало на&7 x=%x% y=%y% z=%z% за &f%attempts% &7попыток'
Loading: '&aSafe spot located! &7Loading chunks...'
Teleport: '&aTeleporting... &fplease wait while we find a safe location!'
# Loading: '&aSafe spot located! &7Loading chunks...'
# Teleport: '&aTeleporting... &fplease wait while we find a safe location!'
Failed:
Price: '&cУ вас недостаточно денег для телепортации! &7У вас должно быть хотябы $%price% &7для rtp!'
NotSafe: '&cНе удалось найти безопасное место за %attempts% попыток! &7Вас не телепортировало!'
Hunger: '&cCould not rtp because you are... &7too hungry&c, eat something fella!'
# Hunger: '&cCould not rtp because you are... &7too hungry&c, eat something fella!'
Other:
Success: '&a%player% был телепортирован на&7 x=%x% y=%y% z=%z% за &f%attempts% &7попыток!'
NotSafe: '&cНе удалось найти безопасное место за %attempts% попыток! &7%player% не был телепортирован!'
Biome: '&cSeems like the biome&7 %biome%&c does not exist! &7Try using the tab list!'
# Biome: '&cSeems like the biome&7 %biome%&c does not exist! &7Try using the tab list!'
Reload: '&eКонфиг удачно перезагружен!'
NoPermission:
Basic: '&cИзвините! &7У вас недостаточно прав для использования этой команды!'
@ -38,14 +38,14 @@ Help:
Player: ' &7- &e/%command% player <игрок> [мир] &7- случайно телепортирует игрока'
World: ' &7- &e/%command% world <мир> &7- случайно телепортирует в другой мир'
##If the player has permission to reload the plugin this message will be added under the list!
Biome: ' &7- &e/%command% biome <biome1, biome2...> &7- Randomly teleport withing these biomes'
# Biome: ' &7- &e/%command% biome <biome1, biome2...> &7- Randomly teleport withing these biomes'
Reload: ' &7- &e/%command% reload &7- перезагружает плагин'
Usage:
Player: '&cИспользование&7: /%command% player <игрок> [мир]'
World: '&cИспользование&7: /%command% world <мир>'
Biome: '&cUsage&7: /%command% biome <biome1, biome2...>'
Edit:
Base: '&cUsage&7: /%command% edit <default/world> [args...]'
Default: '&cUsage&7: /%command% edit default <max/min/useworldborder/center> <value>'
World: '&cUsage&7: /%command% edit world <world> <max/min/useworldborder/center> <value>'
# Edit:
# Base: '&cUsage&7: /%command% edit <default/world> [args...]'
# Default: '&cUsage&7: /%command% edit default <max/min/useworldborder/center> <value>'
# World: '&cUsage&7: /%command% edit world <world> <max/min/useworldborder/center> <value>'

View File

@ -1,5 +1,5 @@
main: me.SuperRonanCraft.BetterRTP.Main
version: '2.13.0'
version: '2.13.1'
name: BetterRTP
author: SuperRonanCraft
softdepend: [Vault, WorldGuard, GriefPrevention, Towny, Factions, RedProtect]