mirror of
https://github.com/trainerlord/WorldSystem.git
synced 2024-11-30 13:03:23 +01:00
Added zh + fi + AutoUpdater enhancment
This commit is contained in:
parent
cc35b1f29f
commit
8a875e3a55
@ -1,5 +1,5 @@
|
||||
name: WorldSystem
|
||||
version: 2.0.3.1
|
||||
version: 2.1.1
|
||||
author: Butzlabben
|
||||
main: de.butzlabben.world.WorldSystem
|
||||
|
||||
|
@ -10,9 +10,9 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import de.butzlabben.world.WorldSystem;
|
||||
import de.butzlabben.world.config.PluginConfig;
|
||||
|
||||
/**
|
||||
@ -36,22 +36,26 @@ public class AutoUpdater implements Listener {
|
||||
|
||||
public static synchronized AutoUpdater getInstance() {
|
||||
if (instance == null)
|
||||
instance = new AutoUpdater(WorldSystem.getInstance());
|
||||
instance = new AutoUpdater();
|
||||
return instance;
|
||||
}
|
||||
|
||||
private AutoUpdater(JavaPlugin plugin) {
|
||||
private AutoUpdater() {
|
||||
confirmNeed = PluginConfig.confirmNeed();
|
||||
UpdateInformations ui = UpdateInformations.getInformations();
|
||||
if (ui == null) {
|
||||
Bukkit.getConsoleSender().sendMessage(
|
||||
PluginConfig.getPrefix() + "§cCouldn't contact autoupdate server");
|
||||
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "§cCouldn't contact autoupdate server");
|
||||
return;
|
||||
}
|
||||
Plugin plugin = Bukkit.getPluginManager().getPlugin(ui.getPlugin());
|
||||
if (plugin == null)
|
||||
return;
|
||||
String v = plugin.getDescription().getVersion();
|
||||
if (!ui.getVersion().equals(plugin.getDescription().getVersion())) {
|
||||
Bukkit.getConsoleSender().sendMessage(
|
||||
PluginConfig.getPrefix() + "Found new version. Current: " + v + ", Available: " + ui.getVersion());
|
||||
|
||||
if (!ui.isSilent())
|
||||
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "Found new version. Current: " + v
|
||||
+ ", Available: " + ui.getVersion());
|
||||
|
||||
// Get jar file
|
||||
Method getFileMethod = null;
|
||||
@ -75,10 +79,11 @@ public class AutoUpdater implements Listener {
|
||||
|
||||
String jar = file.getAbsolutePath();
|
||||
au = new AutoUpdate(ui, jar);
|
||||
if (!confirmNeed) {
|
||||
if (ui.isSilent() || !confirmNeed) {
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(au));
|
||||
Bukkit.getConsoleSender()
|
||||
.sendMessage(PluginConfig.getPrefix() + "§aAutoupdate confirmed, §crestart §ato apply changes");
|
||||
if (!ui.isSilent())
|
||||
Bukkit.getConsoleSender().sendMessage(
|
||||
PluginConfig.getPrefix() + "§aAutoupdate confirmed, §crestart §ato apply changes");
|
||||
confirmed = true;
|
||||
} else {
|
||||
Bukkit.getPluginManager().registerEvents(this, plugin);
|
||||
|
@ -15,7 +15,8 @@ import com.google.gson.GsonBuilder;
|
||||
*/
|
||||
public class UpdateInformations {
|
||||
|
||||
private final String version, url;
|
||||
private final String version, url, plugin;
|
||||
private final boolean silent;
|
||||
|
||||
public static synchronized UpdateInformations getInformations() {
|
||||
String json = callURL("https://seagiants.eu/worldsystem/info.php");
|
||||
@ -62,9 +63,19 @@ public class UpdateInformations {
|
||||
public String getURL() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public String getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
public boolean isSilent() {
|
||||
return silent;
|
||||
}
|
||||
|
||||
public UpdateInformations(String version, String url) {
|
||||
public UpdateInformations(String version, String url, String plugin, boolean silent) {
|
||||
this.version = version;
|
||||
this.url = url;
|
||||
this.plugin = plugin;
|
||||
this.silent = silent;
|
||||
}
|
||||
}
|
||||
|
@ -180,6 +180,9 @@ public class WorldSystem extends JavaPlugin {
|
||||
MessageConfig.checkConfig(new File(languages, "pl.yml"));
|
||||
MessageConfig.checkConfig(new File(languages, "es.yml"));
|
||||
MessageConfig.checkConfig(new File(languages, "ru.yml"));
|
||||
MessageConfig.checkConfig(new File(languages, "fi.yml"));
|
||||
// Here we are for #5
|
||||
MessageConfig.checkConfig(new File(languages, "zh.yml"));
|
||||
MessageConfig.checkConfig(new File(languages, PluginConfig.getLanguage() + ".yml"));
|
||||
if (!dconfig.exists()) {
|
||||
try {
|
||||
|
@ -1,8 +1,12 @@
|
||||
package de.butzlabben.world.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -20,7 +24,6 @@ public class MessageConfig {
|
||||
}
|
||||
|
||||
private static List<String> defaultCmdHelp = new ArrayList<>(20);
|
||||
|
||||
{
|
||||
defaultCmdHelp.add("/ws get §8- §7Will give you a World");
|
||||
defaultCmdHelp.add("/ws home §8- §7Teleports you on your World");
|
||||
@ -41,7 +44,6 @@ public class MessageConfig {
|
||||
|
||||
public static void checkConfig(File f) {
|
||||
file = f;
|
||||
// languages.put(f.getName().split(".yml")[0], f);
|
||||
if (file.exists() == false) {
|
||||
try {
|
||||
InputStream in = JavaPlugin.getPlugin(WorldSystem.class).getResource(f.getName());
|
||||
@ -58,7 +60,12 @@ public class MessageConfig {
|
||||
}
|
||||
|
||||
private static YamlConfiguration getConfig() {
|
||||
return YamlConfiguration.loadConfiguration(file);
|
||||
try {
|
||||
return YamlConfiguration.loadConfiguration(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")));
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String getRawMessage(String path, String alt) {
|
||||
|
80
WorldSystem/src/fi.yml
Normal file
80
WorldSystem/src/fi.yml
Normal file
@ -0,0 +1,80 @@
|
||||
nopermission: "&cSinulla ei ole lupaa tuohon komentoon!"
|
||||
unknown_error: "&cJotain meni pieleen..."
|
||||
lagdetection: "Lagia havaittu maailmassa: &c%world"
|
||||
wrong_usage: "&c%usage"
|
||||
not_registered: "&cTämä pelaaja ei ole liittynyt vielä!"
|
||||
|
||||
world:
|
||||
reseted: "Maailmasi nollautui!"
|
||||
still_loaded: "&cMailmasi on vieläkin ladattu!"
|
||||
not_on: "&cEt ole maailmassa!"
|
||||
created: "Maailmasi on nyt valmis. Pääset sinne komennolla &a/ws home"
|
||||
already_exists: "&cSinulla on jo maailma!"
|
||||
delete:
|
||||
own: "&cMaailmasi poistettiin!"
|
||||
other: "Poistit pelaajan &c%player&6 maailman&6!"
|
||||
does_not_exists:
|
||||
own: "&cSinulla ei ole maailmaa!"
|
||||
other: "&cKyseisellä pelaajalla ei ole maailmaa!"
|
||||
setting_up: "&aAlustetaan maailmaa..."
|
||||
playerlist: "Pelaajat tässä maailmassa: %players"
|
||||
|
||||
member:
|
||||
removed: "Poistit pelaajan &c%player&6 maailmastasi!"
|
||||
added: "Lisäsit pelaajan &c%player&6 maailmaasi!"
|
||||
already_added: "&cKyseinen pelaaja on jo jäsen!"
|
||||
not_added:
|
||||
own: "&cKyseinen pelaaja ei ole jäsen!"
|
||||
other: "&cSinua ei ole lisätty tähän maailmaan"
|
||||
|
||||
request:
|
||||
expired: "&cPyyntösi on vanhentunut!"
|
||||
confirm: "&cVahvista maailmasi nollaaminen: %command"
|
||||
until_expire: "&cPyyntösi vanhentuu %time seconds sekunnin kuluttua!"
|
||||
already_sent: "&cLähetit jo pyynnön!"
|
||||
not_sent: "&cEt lähettänyt pyyntöä!"
|
||||
invalid_input: "&cSyöte ei ole kelvollinen!"
|
||||
|
||||
toggle:
|
||||
gamemode:
|
||||
enabled: "&a%player&6 voi nyt vaihtaa pelimuotonsa!"
|
||||
disabled: "&c%player&6 ei voi enää vaihtaa pelimuotoansa!"
|
||||
teleport:
|
||||
enabled: "&a%player&6 voi nyt teleportata!"
|
||||
disabled: "&c%player&6 ei voi enään teleportata!"
|
||||
build:
|
||||
enabled: "&a%player&6 voi nyt rakentaa!"
|
||||
disabled: "&c%player&6 ei voi enään rakentaa!"
|
||||
fire:
|
||||
enabled: "&aSinä aktivoit tulen!"
|
||||
disabled: "&cSinä deaktivoit tulen!"
|
||||
tnt:
|
||||
enabled: "&aSinä aktivoit TNT-Damagen!"
|
||||
disabled: "&cSinä deaktivoit TNT-Damagen!"
|
||||
|
||||
info:
|
||||
owner: "Omistaja: %data"
|
||||
id: "ID: %data"
|
||||
member: "Jäsen: %data"
|
||||
tnt: "TNT: %data"
|
||||
fire: "Tuli: %data"
|
||||
enabled: "&aOn"
|
||||
disabled: "&cOff"
|
||||
|
||||
command_help:
|
||||
list:
|
||||
- "/ws get &8- &7Luo sinulle maailman"
|
||||
- "/ws home &8- &7Teleporttaa sinut maailmaasi"
|
||||
- "/ws gui &8- &7Avaa sinulle valikon jos omistat tämän maailman"
|
||||
- "/ws tp &8- &7Teleporttaa sinut tiettyyn maailmaan"
|
||||
- "/ws addmember &8- &7Lisää pelaajan sinun maailmaasi"
|
||||
- "/ws delmember &8- &7Poistaa pelaajan sinun maailmastasi"
|
||||
- "/ws leave &8- &7Lähtee maailmasta"
|
||||
- "/ws tnt &8- &7Sallii/Kieltää TNT sinun maailmastasi"
|
||||
- "/ws fire &8- &7Sallii/Kieltää Tulen sinun maailmastasi"
|
||||
- "/ws togglegm &8- &7Sallii/Kieltää pelaajan vaihtamasta pelimuotoansa"
|
||||
- "/ws togglebuild &8- &7Sallii/Kieltää pelaajan rakentamasta"
|
||||
- "/ws toggletp &8- &7Sallii/Kieltää pelaajan treleporttaamasta"
|
||||
- "/ws info &8- &7Näyttää tietoa aktiivisesta maailmasta"
|
||||
- "/ws reset &8- &7Nollaa sinun maailmasi"
|
||||
delete_command: "/ws delete &8- &7Poistaa maailman"
|
@ -1,5 +1,5 @@
|
||||
name: WorldSystem
|
||||
version: 2.0.3.1
|
||||
version: 2.1.1
|
||||
author: Butzlabben
|
||||
main: de.butzlabben.world.WorldSystem
|
||||
|
||||
|
80
WorldSystem/src/zh.yml
Normal file
80
WorldSystem/src/zh.yml
Normal file
@ -0,0 +1,80 @@
|
||||
nopermission: "&c你没有权限!"
|
||||
unknown_error: "&c出错..."
|
||||
lagdetection: "滞后: &c%world"
|
||||
wrong_usage: "&c%usage"
|
||||
not_registered: "&c该玩家未在线!"
|
||||
|
||||
world:
|
||||
reseted: "你的世界已重置!"
|
||||
still_loaded: "&c你的世界正在加载!"
|
||||
not_on: "&c你未在世界里!"
|
||||
created: "你的世界已准备就绪,输入 &a/ws home &6前往"
|
||||
already_exists: "&c你已拥有一个世界!"
|
||||
delete:
|
||||
own: "&c你的世界已删除!"
|
||||
other: "你删除了 &c%player &6的世界"
|
||||
does_not_exists:
|
||||
own: "&c你没有世界!"
|
||||
other: "&c这个玩家没有世界!"
|
||||
setting_up: "&a正在建立世界..."
|
||||
playerlist: "玩家: %players 在这个世界上"
|
||||
|
||||
member:
|
||||
removed: "玩家 &c%player&6 从你的世界移除!"
|
||||
added: "你添加 &c%player&6 到你的世界!"
|
||||
already_added: "&c这个玩家已经在你的世界里了!"
|
||||
not_added:
|
||||
own: "&c该玩家未在你的世界里!"
|
||||
other: "&c你未加入这个世界"
|
||||
|
||||
request:
|
||||
expired: "&c确认超时!"
|
||||
confirm: "&c请确认,重置你的世界: %command"
|
||||
until_expire: "&c请在 %time 秒,内确认!"
|
||||
already_sent: "&c你已发送请求!"
|
||||
not_sent: "&c你未发送请求!"
|
||||
invalid_input: "&c%input 错误!"
|
||||
|
||||
toggle:
|
||||
gamemode:
|
||||
enabled: "&a%player&6 可以改变游戏模式!"
|
||||
disabled: "&c%player&6 不能游戏模式!"
|
||||
teleport:
|
||||
enabled: "&a%player&6 可以传送!"
|
||||
disabled: "&c%player&6 不能传送!"
|
||||
build:
|
||||
enabled: "&a%player&6 可以建筑!"
|
||||
disabled: "&c%player&6 不能建筑!"
|
||||
fire:
|
||||
enabled: "&a你开启了 火!"
|
||||
disabled: "&c你禁用了 火!"
|
||||
tnt:
|
||||
enabled: "&a你开启了 TNT-爆炸!"
|
||||
disabled: "&c你禁用了 TNT-爆炸!"
|
||||
|
||||
info:
|
||||
owner: "管理者: %data"
|
||||
id: "ID: %data"
|
||||
member: "成员: %data"
|
||||
tnt: "TNT: %data"
|
||||
fire: "火: %data"
|
||||
enabled: "&a开启"
|
||||
disabled: "&c关闭"
|
||||
|
||||
command_help:
|
||||
list:
|
||||
- "/ws get &8- &7创建一个世界"
|
||||
- "/ws home &8- &7返回你的世界"
|
||||
- "/ws gui &8- &7如果你是世界管理者,使用该指令打开菜单"
|
||||
- "/ws tp &8- &7传送到指定世界"
|
||||
- "/ws addmember &8- &7添加一个玩家到你的世界"
|
||||
- "/ws delmember &8- &7将一个玩家从你的世界删除"
|
||||
- "/ws leave &8- &7离开一个世界"
|
||||
- "/ws tnt &8- &7开启/禁用 TNT爆炸"
|
||||
- "/ws fire &8- &7开启/禁用,火"
|
||||
- "/ws togglegm &8- &7开启/禁用,玩家切换模式"
|
||||
- "/ws togglebuild &8- &7开启/禁用,玩家建筑"
|
||||
- "/ws toggletp &8- &7开启/禁用,玩家传送"
|
||||
- "/ws info &8- &7查看世界信息"
|
||||
- "/ws reset &8- &7重置你的世界"
|
||||
delete_command: "/ws delete &8- &7删除一个世界"
|
Loading…
Reference in New Issue
Block a user