feat: updated the localization files, translated coice gui
This commit is contained in:
parent
292e9a4a6b
commit
b24202e8ab
12 changed files with 143 additions and 89 deletions
42
src/main/java/xyz/atnrch/nicko/gui/ChoiceGUI.java
Normal file
42
src/main/java/xyz/atnrch/nicko/gui/ChoiceGUI.java
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
package xyz.atnrch.nicko.gui;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import xyz.atnrch.nicko.gui.items.common.choice.CancelItem;
|
||||||
|
import xyz.atnrch.nicko.gui.items.common.choice.ChoiceCallback;
|
||||||
|
import xyz.atnrch.nicko.gui.items.common.choice.ConfirmItem;
|
||||||
|
import xyz.atnrch.nicko.i18n.I18N;
|
||||||
|
import xyz.atnrch.nicko.i18n.I18NDict;
|
||||||
|
import xyz.atnrch.nicko.i18n.ItemTranslation;
|
||||||
|
import xyz.xenondevs.invui.gui.Gui;
|
||||||
|
import xyz.xenondevs.invui.item.builder.ItemBuilder;
|
||||||
|
import xyz.xenondevs.invui.item.impl.SimpleItem;
|
||||||
|
import xyz.xenondevs.invui.window.Window;
|
||||||
|
|
||||||
|
public class ChoiceGUI {
|
||||||
|
private final Player player;
|
||||||
|
private final Gui gui;
|
||||||
|
|
||||||
|
public ChoiceGUI(Player player, ChoiceCallback callback) {
|
||||||
|
final I18N i18n = new I18N(player);
|
||||||
|
final ConfirmItem confirmItem = new ConfirmItem(player, callback);
|
||||||
|
final CancelItem cancelItem = new CancelItem(player, callback);
|
||||||
|
final ItemTranslation chooseItemTranslation = i18n.translateItem(I18NDict.GUI.Choice.CHOOSE);
|
||||||
|
|
||||||
|
this.gui = Gui.normal()
|
||||||
|
.setStructure(
|
||||||
|
"@ @ @ @ % & & & &",
|
||||||
|
"@ @ @ @ I & & & &",
|
||||||
|
"@ @ @ @ % & & & &"
|
||||||
|
)
|
||||||
|
.addIngredient('@', confirmItem.get())
|
||||||
|
.addIngredient('&', cancelItem.get())
|
||||||
|
.addIngredient('I', new SimpleItem(new ItemBuilder(Material.PAPER).setDisplayName(chooseItemTranslation.getName()).get()))
|
||||||
|
.build();
|
||||||
|
this.player = player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void open() {
|
||||||
|
Window.single().setGui(gui).setTitle("... > Invalidate > Confirm").open(player);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,34 +0,0 @@
|
||||||
package xyz.atnrch.nicko.gui;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import xyz.atnrch.nicko.gui.items.common.confirm.ChoiceCallback;
|
|
||||||
import xyz.atnrch.nicko.gui.items.common.confirm.CancelItem;
|
|
||||||
import xyz.atnrch.nicko.gui.items.common.confirm.ConfirmItem;
|
|
||||||
import xyz.xenondevs.invui.gui.Gui;
|
|
||||||
import xyz.xenondevs.invui.item.builder.ItemBuilder;
|
|
||||||
import xyz.xenondevs.invui.item.impl.SimpleItem;
|
|
||||||
import xyz.xenondevs.invui.window.Window;
|
|
||||||
|
|
||||||
public class ConfirmGUI {
|
|
||||||
private final Player player;
|
|
||||||
private final Gui gui;
|
|
||||||
|
|
||||||
public ConfirmGUI(Player player, ChoiceCallback callback) {
|
|
||||||
this.gui = Gui.normal()
|
|
||||||
.setStructure(
|
|
||||||
"@ @ @ @ % & & & &",
|
|
||||||
"@ @ @ @ I & & & &",
|
|
||||||
"@ @ @ @ % & & & &"
|
|
||||||
)
|
|
||||||
.addIngredient('@', new ConfirmItem(callback))
|
|
||||||
.addIngredient('&', new CancelItem(callback))
|
|
||||||
.addIngredient('I', new SimpleItem(new ItemBuilder(Material.PAPER).setDisplayName("§6Select an option").get()))
|
|
||||||
.build();
|
|
||||||
this.player = player;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void open() {
|
|
||||||
Window.single().setGui(gui).setTitle("... > Invalidate > Confirm").open(player);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -6,9 +6,9 @@ import org.bukkit.event.inventory.ClickType;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import xyz.atnrch.nicko.NickoBukkit;
|
import xyz.atnrch.nicko.NickoBukkit;
|
||||||
import xyz.atnrch.nicko.gui.ConfirmGUI;
|
import xyz.atnrch.nicko.gui.ChoiceGUI;
|
||||||
import xyz.atnrch.nicko.gui.CacheDetailedGUI;
|
import xyz.atnrch.nicko.gui.CacheDetailedGUI;
|
||||||
import xyz.atnrch.nicko.gui.items.common.confirm.ChoiceCallback;
|
import xyz.atnrch.nicko.gui.items.common.choice.ChoiceCallback;
|
||||||
import xyz.atnrch.nicko.i18n.I18N;
|
import xyz.atnrch.nicko.i18n.I18N;
|
||||||
import xyz.atnrch.nicko.i18n.I18NDict;
|
import xyz.atnrch.nicko.i18n.I18NDict;
|
||||||
import xyz.atnrch.nicko.mojang.MojangAPI;
|
import xyz.atnrch.nicko.mojang.MojangAPI;
|
||||||
|
@ -40,7 +40,7 @@ public class CacheEntryItem extends AsyncItem {
|
||||||
public void handleClick(@NotNull ClickType click, @NotNull Player player, @NotNull InventoryClickEvent event) {
|
public void handleClick(@NotNull ClickType click, @NotNull Player player, @NotNull InventoryClickEvent event) {
|
||||||
if (click.isLeftClick() || click.isRightClick()) {
|
if (click.isLeftClick() || click.isRightClick()) {
|
||||||
event.getView().close();
|
event.getView().close();
|
||||||
new ConfirmGUI(player, new ChoiceCallback() {
|
new ChoiceGUI(player, new ChoiceCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onConfirm() {
|
public void onConfirm() {
|
||||||
final I18N i18n = new I18N(player);
|
final I18N i18n = new I18N(player);
|
||||||
|
|
|
@ -21,8 +21,6 @@ public class UnavailableItem {
|
||||||
final ItemTranslation translation = i18n.translateItem(I18NDict.GUI.UNAVAILABLE);
|
final ItemTranslation translation = i18n.translateItem(I18NDict.GUI.UNAVAILABLE);
|
||||||
builder.setDisplayName(translation.getName());
|
builder.setDisplayName(translation.getName());
|
||||||
translation.getLore().forEach(builder::addLoreLines);
|
translation.getLore().forEach(builder::addLoreLines);
|
||||||
builder.setDisplayName("Unavailable");
|
|
||||||
builder.addLoreLines("§7§oThis button is disabled.");
|
|
||||||
return builder;
|
return builder;
|
||||||
}, click -> true);
|
}, click -> true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
package xyz.atnrch.nicko.gui.items.common.choice;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import xyz.atnrch.nicko.i18n.I18N;
|
||||||
|
import xyz.atnrch.nicko.i18n.I18NDict;
|
||||||
|
import xyz.atnrch.nicko.i18n.ItemTranslation;
|
||||||
|
import xyz.xenondevs.invui.item.builder.ItemBuilder;
|
||||||
|
import xyz.xenondevs.invui.item.impl.SuppliedItem;
|
||||||
|
|
||||||
|
public class CancelItem {
|
||||||
|
private final I18N i18n;
|
||||||
|
private final ChoiceCallback callback;
|
||||||
|
|
||||||
|
public CancelItem(Player player, ChoiceCallback callback) {
|
||||||
|
this.i18n = new I18N(player);
|
||||||
|
this.callback = callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SuppliedItem get() {
|
||||||
|
return new SuppliedItem(() -> {
|
||||||
|
final ItemBuilder builder = new ItemBuilder(Material.RED_STAINED_GLASS_PANE);
|
||||||
|
final ItemTranslation translation = i18n.translateItem(I18NDict.GUI.Choice.CANCEL);
|
||||||
|
builder.setDisplayName(translation.getName());
|
||||||
|
return builder;
|
||||||
|
}, click -> {
|
||||||
|
click.getEvent().getView().close();
|
||||||
|
callback.onCancel();
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package xyz.atnrch.nicko.gui.items.common.confirm;
|
package xyz.atnrch.nicko.gui.items.common.choice;
|
||||||
|
|
||||||
public interface ChoiceCallback {
|
public interface ChoiceCallback {
|
||||||
void onConfirm();
|
void onConfirm();
|
|
@ -0,0 +1,32 @@
|
||||||
|
package xyz.atnrch.nicko.gui.items.common.choice;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import xyz.atnrch.nicko.i18n.I18N;
|
||||||
|
import xyz.atnrch.nicko.i18n.I18NDict;
|
||||||
|
import xyz.atnrch.nicko.i18n.ItemTranslation;
|
||||||
|
import xyz.xenondevs.invui.item.builder.ItemBuilder;
|
||||||
|
import xyz.xenondevs.invui.item.impl.SuppliedItem;
|
||||||
|
|
||||||
|
public class ConfirmItem {
|
||||||
|
private final I18N i18n;
|
||||||
|
private final ChoiceCallback callback;
|
||||||
|
|
||||||
|
public ConfirmItem(Player player, ChoiceCallback callback) {
|
||||||
|
this.i18n = new I18N(player);
|
||||||
|
this.callback = callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SuppliedItem get() {
|
||||||
|
return new SuppliedItem(() -> {
|
||||||
|
final ItemBuilder builder = new ItemBuilder(Material.GREEN_STAINED_GLASS_PANE);
|
||||||
|
final ItemTranslation translation = i18n.translateItem(I18NDict.GUI.Choice.CONFIRM);
|
||||||
|
builder.setDisplayName(translation.getName());
|
||||||
|
return builder;
|
||||||
|
}, click -> {
|
||||||
|
click.getEvent().getView().close();
|
||||||
|
callback.onConfirm();
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,19 +0,0 @@
|
||||||
package xyz.atnrch.nicko.gui.items.common.confirm;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import xyz.xenondevs.invui.item.builder.ItemBuilder;
|
|
||||||
import xyz.xenondevs.invui.item.impl.SuppliedItem;
|
|
||||||
|
|
||||||
public class CancelItem extends SuppliedItem {
|
|
||||||
public CancelItem(ChoiceCallback callback) {
|
|
||||||
super(() -> {
|
|
||||||
final ItemBuilder builder = new ItemBuilder(Material.RED_STAINED_GLASS_PANE);
|
|
||||||
builder.setDisplayName("§cCancel");
|
|
||||||
return builder;
|
|
||||||
}, click -> {
|
|
||||||
click.getEvent().getView().close();
|
|
||||||
callback.onCancel();
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
package xyz.atnrch.nicko.gui.items.common.confirm;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import xyz.xenondevs.invui.item.builder.ItemBuilder;
|
|
||||||
import xyz.xenondevs.invui.item.impl.SuppliedItem;
|
|
||||||
|
|
||||||
public class ConfirmItem extends SuppliedItem {
|
|
||||||
public ConfirmItem(ChoiceCallback callback) {
|
|
||||||
super(() -> {
|
|
||||||
final ItemBuilder builder = new ItemBuilder(Material.GREEN_STAINED_GLASS_PANE);
|
|
||||||
builder.setDisplayName("§aConfirm");
|
|
||||||
return builder;
|
|
||||||
}, click -> {
|
|
||||||
click.getEvent().getView().close();
|
|
||||||
callback.onConfirm();
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -70,6 +70,14 @@ public class I18NDict {
|
||||||
public static final String UNAVAILABLE = GUI_KEY + "unavailable";
|
public static final String UNAVAILABLE = GUI_KEY + "unavailable";
|
||||||
public static final String GO_BACK = GUI_KEY + "go_back";
|
public static final String GO_BACK = GUI_KEY + "go_back";
|
||||||
|
|
||||||
|
public static class Choice {
|
||||||
|
private static final String CHOICE_KEY = GUI_KEY + "choice.";
|
||||||
|
|
||||||
|
public static final String CONFIRM = CHOICE_KEY + "confirm";
|
||||||
|
public static final String CHOOSE = CHOICE_KEY + "choose";
|
||||||
|
public static final String CANCEL = CHOICE_KEY + "cancel";
|
||||||
|
}
|
||||||
|
|
||||||
public static class Home {
|
public static class Home {
|
||||||
private static final String HOME_KEY = GUI_KEY + "home.";
|
private static final String HOME_KEY = GUI_KEY + "home.";
|
||||||
|
|
||||||
|
|
|
@ -36,16 +36,23 @@ gui:
|
||||||
name: "Unavailable"
|
name: "Unavailable"
|
||||||
lore:
|
lore:
|
||||||
- "§7§oThis button is disabled."
|
- "§7§oThis button is disabled."
|
||||||
|
choice:
|
||||||
|
confirm:
|
||||||
|
name: "§aConfirm"
|
||||||
|
choose:
|
||||||
|
name: "§6§oChoose an option..."
|
||||||
|
cancel:
|
||||||
|
name: "§cCancel"
|
||||||
home:
|
home:
|
||||||
title: "Nicko - Home"
|
title: "Nicko - Home"
|
||||||
admin:
|
admin:
|
||||||
name: "Administration panel"
|
name: "Administration panel"
|
||||||
lore:
|
lore:
|
||||||
- "Configure and manage Nicko."
|
- "§7Configure and manage Nicko."
|
||||||
settings:
|
settings:
|
||||||
name: "Settings"
|
name: "Settings"
|
||||||
lore:
|
lore:
|
||||||
- "Fine tune your experience with Nicko."
|
- "§7Fine tune your experience with Nicko."
|
||||||
change_name:
|
change_name:
|
||||||
name: "§6Nickname §fchange"
|
name: "§6Nickname §fchange"
|
||||||
change_skin:
|
change_skin:
|
||||||
|
@ -55,7 +62,7 @@ gui:
|
||||||
reset:
|
reset:
|
||||||
name: "Reset appearance"
|
name: "Reset appearance"
|
||||||
lore:
|
lore:
|
||||||
- "Completely remove your disguise."
|
- "§7Completely remove your disguise."
|
||||||
admin:
|
admin:
|
||||||
title: "Nicko > Administration"
|
title: "Nicko > Administration"
|
||||||
manage_cache:
|
manage_cache:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
error:
|
error:
|
||||||
generic: "Une erreur inconnue c'est produite."
|
generic: "Une erreur inconnue c'est produite."
|
||||||
permission: "§cVous ne possédez pas la permission."
|
permission: "§cVous ne possédez pas la permission."
|
||||||
invalid_username: "§cLe pseudo n''est pas un pseudo Minecraft valide."
|
invalid_username: "§cLe pseudo n'est pas un pseudo Minecraft valide."
|
||||||
mojang_name: "Un compte Minecraft avec ce nom n'existe pas."
|
mojang_name: "Un compte Minecraft avec ce nom n'existe pas."
|
||||||
mojang_skin: "Ce compte Minecraft n'a pas de skin."
|
mojang_skin: "Ce compte Minecraft n'a pas de skin."
|
||||||
cache: "Impossible de récupérer le skin depuis le cache."
|
cache: "Impossible de récupérer le skin depuis le cache."
|
||||||
|
@ -13,14 +13,14 @@ event:
|
||||||
error: "§cImpossible de mettre à jour vos paramètres. §7§o({0})"
|
error: "§cImpossible de mettre à jour vos paramètres. §7§o({0})"
|
||||||
appearance:
|
appearance:
|
||||||
set:
|
set:
|
||||||
error: "§cImpossible d''appliquer votre déguisement. §7§o({0})"
|
error: "§cImpossible d'appliquer votre déguisement. §7§o({0})"
|
||||||
ok: "§fDéguisement appliqué."
|
ok: "§fDéguisement appliqué."
|
||||||
restore:
|
restore:
|
||||||
error: "§cImpossible d''appliquer votre précédent déguisement. §7§o({0})"
|
error: "§cImpossible d'appliquer votre précédent déguisement. §7§o({0})"
|
||||||
ok: "§aVotre précédent déguisement a été appliqué."
|
ok: "§aVotre précédent déguisement a été appliqué."
|
||||||
remove:
|
remove:
|
||||||
error: "§cImpossible de retirer votre déguisement. Il sera réinitialisé à votre prochaine reconnexion."
|
error: "§cImpossible de retirer votre déguisement. Il sera réinitialisé à votre prochaine reconnexion."
|
||||||
missing: "§cVous n''avez pas de déguisement."
|
missing: "§cVous n'avez pas de déguisement."
|
||||||
ok: "§fDéguisement retiré."
|
ok: "§fDéguisement retiré."
|
||||||
admin:
|
admin:
|
||||||
cache:
|
cache:
|
||||||
|
@ -36,16 +36,23 @@ gui:
|
||||||
name: "Indisponible"
|
name: "Indisponible"
|
||||||
lore:
|
lore:
|
||||||
- "§7§oCe boutton est désactivé."
|
- "§7§oCe boutton est désactivé."
|
||||||
|
choice:
|
||||||
|
confirm:
|
||||||
|
name: "§aConfirmer"
|
||||||
|
choose:
|
||||||
|
name: "§6§oChoisissez une option..."
|
||||||
|
cancel:
|
||||||
|
name: "§cAnnuler"
|
||||||
home:
|
home:
|
||||||
title: "Nicko - Accueil"
|
title: "Nicko - Accueil"
|
||||||
admin:
|
admin:
|
||||||
name: "Panel d''administration"
|
name: "Panel d'administration"
|
||||||
lore:
|
lore:
|
||||||
- "Configurez et gérez Nicko."
|
- "§7Configurez et gérez Nicko."
|
||||||
settings:
|
settings:
|
||||||
name: "Paramètres"
|
name: "Paramètres"
|
||||||
lore:
|
lore:
|
||||||
- "Gérez votre expérience avec Nicko."
|
- "§7Gérez votre expérience avec Nicko."
|
||||||
change_name:
|
change_name:
|
||||||
name: "Changer le §6pseudo"
|
name: "Changer le §6pseudo"
|
||||||
change_skin:
|
change_skin:
|
||||||
|
@ -55,7 +62,7 @@ gui:
|
||||||
reset:
|
reset:
|
||||||
name: "Réinitialiser l'apparence"
|
name: "Réinitialiser l'apparence"
|
||||||
lore:
|
lore:
|
||||||
- "Supprime complètement votre déguisement."
|
- "§7Supprime complètement votre déguisement."
|
||||||
admin:
|
admin:
|
||||||
title: "Nicko > Administration"
|
title: "Nicko > Administration"
|
||||||
manage_cache:
|
manage_cache:
|
||||||
|
|
Loading…
Reference in a new issue