Skip to content

Commit 8be9487

Browse files
committed
Precision + french translation.
* NEW: Added specific message while displaying the ping of another player. * NEW: added french translation. * NEW: added configuration file with language.
1 parent a487e24 commit 8be9487

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/main/java/fr/zcraft/Ping/Ping.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package fr.zcraft.Ping;
22

33
import fr.zcraft.zlib.components.i18n.I;
4+
import fr.zcraft.zlib.components.i18n.I18n;
45
import fr.zcraft.zlib.components.rawtext.RawText;
56
import fr.zcraft.zlib.core.ZPlugin;
67
import fr.zcraft.zlib.tools.PluginLogger;
@@ -40,7 +41,10 @@ public final class Ping extends ZPlugin
4041
@Override
4142
public void onEnable()
4243
{
44+
saveDefaultConfig();
45+
loadComponents(I18n.class, PingConfig.class);
4346

47+
I18n.setPrimaryLocale(PingConfig.LOCALE.get());
4448
}
4549

4650
/**
@@ -167,7 +171,11 @@ else if (label.equalsIgnoreCase("ping"))
167171

168172
sender.sendMessage(ChatColor.GRAY + "⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅");
169173

170-
if (label.equalsIgnoreCase("ping") && isSelf)
174+
if (!isSelf)
175+
{
176+
sender.sendMessage(I.t("{green}{bold}Ping, {0}!", target.getName()));
177+
}
178+
else if (label.equalsIgnoreCase("ping"))
171179
{
172180
sender.sendMessage(I.t("{green}{bold}Pong!"));
173181
sender.sendMessage("");

0 commit comments

Comments
 (0)