feat(i18n): translate unavailable item
This commit is contained in:
parent
6633ac94a8
commit
292e9a4a6b
7 changed files with 37 additions and 6 deletions
|
@ -9,7 +9,6 @@ import xyz.atnrch.nicko.config.Configuration;
|
|||
import xyz.atnrch.nicko.config.ConfigurationManager;
|
||||
import xyz.atnrch.nicko.event.PlayerJoinListener;
|
||||
import xyz.atnrch.nicko.event.PlayerQuitListener;
|
||||
import xyz.atnrch.nicko.gui.items.common.UnavailableItem;
|
||||
import xyz.atnrch.nicko.i18n.Locale;
|
||||
import xyz.atnrch.nicko.i18n.LocaleFileManager;
|
||||
import xyz.atnrch.nicko.mojang.MojangAPI;
|
||||
|
@ -92,7 +91,6 @@ public class NickoBukkit extends JavaPlugin {
|
|||
|
||||
Structure.addGlobalIngredient('#', new SimpleItem(new ItemBuilder(Material.AIR)));
|
||||
Structure.addGlobalIngredient('%', new SimpleItem(new ItemBuilder(Material.BLACK_STAINED_GLASS_PANE).setDisplayName(" ")));
|
||||
Structure.addGlobalIngredient('U', new UnavailableItem());
|
||||
|
||||
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
||||
getLogger().info("Enabling PlaceHolderAPI support...");
|
||||
|
|
|
@ -4,17 +4,24 @@ import xyz.atnrch.nicko.gui.items.admin.ManageCacheItem;
|
|||
import xyz.atnrch.nicko.gui.items.admin.ManagePlayerItem;
|
||||
import xyz.atnrch.nicko.gui.items.common.GoBackItem;
|
||||
import org.bukkit.entity.Player;
|
||||
import xyz.atnrch.nicko.gui.items.common.UnavailableItem;
|
||||
import xyz.atnrch.nicko.i18n.I18N;
|
||||
import xyz.atnrch.nicko.i18n.I18NDict;
|
||||
import xyz.xenondevs.invui.gui.Gui;
|
||||
import xyz.xenondevs.invui.window.Window;
|
||||
|
||||
public class AdminGUI {
|
||||
private final String title = "Nicko > Administration";
|
||||
private final Player player;
|
||||
private final Gui gui;
|
||||
private final String title;
|
||||
|
||||
public AdminGUI(Player player) {
|
||||
final I18N i18n = new I18N(player);
|
||||
this.title = i18n.translatePrefixless(I18NDict.GUI.Admin.TITLE);
|
||||
|
||||
final HomeGUI parent = new HomeGUI(player);
|
||||
final GoBackItem backItem = new GoBackItem(player);
|
||||
final UnavailableItem unavailableItem = new UnavailableItem(player);
|
||||
|
||||
this.gui = Gui.normal()
|
||||
.setStructure(
|
||||
|
@ -23,6 +30,7 @@ public class AdminGUI {
|
|||
"B # # # # # # # #"
|
||||
)
|
||||
.addIngredient('S', new ManageCacheItem())
|
||||
.addIngredient('U', unavailableItem.get())
|
||||
.addIngredient('C', new ManagePlayerItem())
|
||||
.addIngredient('B', backItem.get(parent.getGUI(), parent.getTitle()))
|
||||
.build();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package xyz.atnrch.nicko.gui;
|
||||
|
||||
import xyz.atnrch.nicko.gui.items.common.GoBackItem;
|
||||
import xyz.atnrch.nicko.gui.items.common.UnavailableItem;
|
||||
import xyz.atnrch.nicko.gui.items.settings.BungeeCordCyclingItem;
|
||||
import xyz.atnrch.nicko.gui.items.settings.LanguageCyclingItem;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -28,6 +29,7 @@ public class SettingsGUI {
|
|||
this.title = i18n.translatePrefixless(I18NDict.GUI.Settings.TITLE);
|
||||
|
||||
final HomeGUI parent = new HomeGUI(player);
|
||||
final UnavailableItem unavailableItem = new UnavailableItem(player);
|
||||
final LanguageCyclingItem languageItem = new LanguageCyclingItem(player);
|
||||
final BungeeCordCyclingItem bungeeCordItem = new BungeeCordCyclingItem(player);
|
||||
final GoBackItem backItem = new GoBackItem(player);
|
||||
|
@ -36,6 +38,7 @@ public class SettingsGUI {
|
|||
.setStructure(dynamicStructure)
|
||||
.addIngredient('B', backItem.get(parent.getGUI(), parent.getTitle()))
|
||||
.addIngredient('L', languageItem.get())
|
||||
.addIngredient('U', unavailableItem.get())
|
||||
.addIngredient('T', bungeeCordItem.get())
|
||||
.build();
|
||||
this.player = player;
|
||||
|
|
|
@ -1,13 +1,26 @@
|
|||
package xyz.atnrch.nicko.gui.items.common;
|
||||
|
||||
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 UnavailableItem extends SuppliedItem {
|
||||
public UnavailableItem() {
|
||||
super(() -> {
|
||||
public class UnavailableItem {
|
||||
private final I18N i18n;
|
||||
|
||||
public UnavailableItem(Player player) {
|
||||
this.i18n = new I18N(player);
|
||||
}
|
||||
|
||||
public SuppliedItem get() {
|
||||
return new SuppliedItem(() -> {
|
||||
final ItemBuilder builder = new ItemBuilder(Material.RED_TERRACOTTA);
|
||||
final ItemTranslation translation = i18n.translateItem(I18NDict.GUI.UNAVAILABLE);
|
||||
builder.setDisplayName(translation.getName());
|
||||
translation.getLore().forEach(builder::addLoreLines);
|
||||
builder.setDisplayName("Unavailable");
|
||||
builder.addLoreLines("§7§oThis button is disabled.");
|
||||
return builder;
|
||||
|
|
|
@ -67,6 +67,7 @@ public class I18NDict {
|
|||
private static final String GUI_KEY = "gui.";
|
||||
|
||||
public static final String EXIT = GUI_KEY + "exit";
|
||||
public static final String UNAVAILABLE = GUI_KEY + "unavailable";
|
||||
public static final String GO_BACK = GUI_KEY + "go_back";
|
||||
|
||||
public static class Home {
|
||||
|
|
|
@ -32,6 +32,10 @@ gui:
|
|||
name: "Exit"
|
||||
go_back:
|
||||
name: "Back"
|
||||
unavailable:
|
||||
name: "Unavailable"
|
||||
lore:
|
||||
- "§7§oThis button is disabled."
|
||||
home:
|
||||
title: "Nicko - Home"
|
||||
admin:
|
||||
|
|
|
@ -32,6 +32,10 @@ gui:
|
|||
name: "Quitter"
|
||||
go_back:
|
||||
name: "Retour"
|
||||
unavailable:
|
||||
name: "Indisponible"
|
||||
lore:
|
||||
- "§7§oCe boutton est désactivé."
|
||||
home:
|
||||
title: "Nicko - Accueil"
|
||||
admin:
|
||||
|
|
Loading…
Reference in a new issue