feat(i18n): title update when going back

This commit is contained in:
ineanto 2023-06-19 21:52:46 +02:00
parent 7cab66a70e
commit c3e10ae81d
9 changed files with 39 additions and 19 deletions

View file

@ -1,6 +1,6 @@
# _Nicko_ <img style="vertical-align:middle" src="./img/LOGO.png" alt="" width="50"/> # _Nicko_ <img style="vertical-align:middle" src="./img/LOGO.png" alt="" width="50"/>
## The next generation, feature packed disguise plugin for Minecraft. ## The feature packed, next generation disguise plugin for Minecraft.
### Download: ### Download:

View file

@ -158,6 +158,4 @@ public class NickoBukkit extends JavaPlugin {
public LocaleFileManager getLocaleFileManager() { public LocaleFileManager getLocaleFileManager() {
return localeFileManager; return localeFileManager;
} }
public ProtocolManager getProtocolManager() { return protocolManager; }
} }

View file

@ -7,12 +7,12 @@ import xyz.xenondevs.invui.gui.Gui;
import xyz.xenondevs.invui.window.Window; import xyz.xenondevs.invui.window.Window;
public class AdminGUI { public class AdminGUI {
public static final String TITLE = "Nicko > Administration"; private final String title = "Nicko > Administration";
private final Player player; private final Player player;
private final Gui gui; private final Gui gui;
public AdminGUI(Player player) { public AdminGUI(Player player) {
final MainGUI parent = new MainGUI(player);
this.gui = Gui.normal() this.gui = Gui.normal()
.setStructure( .setStructure(
"# # # # # # # # #", "# # # # # # # # #",
@ -20,7 +20,7 @@ public class AdminGUI {
"B # # # # # # # #" "B # # # # # # # #"
) )
.addIngredient('S', new ManageCache()) .addIngredient('S', new ManageCache())
.addIngredient('B', new GoBack(new MainGUI(player).getGUI())) .addIngredient('B', new GoBack(parent.getGUI(), title))
.build(); .build();
this.player = player; this.player = player;
} }
@ -29,7 +29,11 @@ public class AdminGUI {
return gui; return gui;
} }
public String getTitle() {
return title;
}
public void open() { public void open() {
Window.single().setGui(gui).setTitle(TITLE).open(player); Window.single().setGui(gui).setTitle(title).open(player);
} }
} }

View file

@ -11,6 +11,7 @@ import xyz.xenondevs.invui.gui.Gui;
import xyz.xenondevs.invui.window.Window; import xyz.xenondevs.invui.window.Window;
public class MainGUI { public class MainGUI {
private final String title = "Nicko - Home";
private final Player player; private final Player player;
private final Gui gui; private final Gui gui;
@ -40,7 +41,11 @@ public class MainGUI {
return gui; return gui;
} }
public String getTitle() {
return title;
}
public void open() { public void open() {
Window.single().setGui(gui).setTitle("Nicko - Home").open(player); Window.single().setGui(gui).setTitle(title).open(player);
} }
} }

View file

@ -23,9 +23,10 @@ public class SettingsGUI {
// TODO: 3/6/23 Replace when Redis is not enabled // TODO: 3/6/23 Replace when Redis is not enabled
dynamicStructure[1] = dynamicStructure[1].replace("T", "U"); dynamicStructure[1] = dynamicStructure[1].replace("T", "U");
final MainGUI parent = new MainGUI(player);
this.gui = Gui.normal() this.gui = Gui.normal()
.setStructure(dynamicStructure) .setStructure(dynamicStructure)
.addIngredient('B', new GoBack(new MainGUI(player).getGUI())) .addIngredient('B', new GoBack(parent.getGUI(), parent.getTitle()))
.addIngredient('L', new LanguageCycling().get(player)) .addIngredient('L', new LanguageCycling().get(player))
.addIngredient('T', new BungeeCordCycling().get(player)) .addIngredient('T', new BungeeCordCycling().get(player))
.build(); .build();

View file

@ -10,15 +10,15 @@ import xyz.xenondevs.invui.gui.Gui;
import xyz.xenondevs.invui.window.Window; import xyz.xenondevs.invui.window.Window;
public class CacheManagementGUI { public class CacheManagementGUI {
public static final String TITLE = "Nicko > Admin... > Cache"; private final String title = "Nicko > Admin... > Cache";
private final Player player; private final Player player;
private final Gui gui; private final Gui gui;
public CacheManagementGUI(Player player) { public CacheManagementGUI(Player player) {
final AdminGUI parent = new AdminGUI(player);
this.gui = Gui.normal() this.gui = Gui.normal()
.setStructure("B # S A D") .setStructure("B # S A D")
.addIngredient('B', new GoBack(new AdminGUI(player).getGUI())) .addIngredient('B', new GoBack(parent.getGUI(), parent.getTitle()))
.addIngredient('S', new CacheOverview()) .addIngredient('S', new CacheOverview())
.addIngredient('A', new InvalidateCompleteCache()) .addIngredient('A', new InvalidateCompleteCache())
.addIngredient('D', new InvalidateSpecificEntry()) .addIngredient('D', new InvalidateSpecificEntry())
@ -30,7 +30,11 @@ public class CacheManagementGUI {
return gui; return gui;
} }
public String getTitle() {
return title;
}
public void open() { public void open() {
Window.single().setGui(gui).setTitle(TITLE).open(player); Window.single().setGui(gui).setTitle(title).open(player);
} }
} }

View file

@ -37,6 +37,7 @@ public class CacheDetailedGUI {
.map(EntryPlaceholder::new) .map(EntryPlaceholder::new)
.collect(Collectors.toList()); .collect(Collectors.toList());
final CacheManagementGUI parent = new CacheManagementGUI(player);
gui = ScrollGui.items(guiItemBuilder -> { gui = ScrollGui.items(guiItemBuilder -> {
guiItemBuilder.setStructure( guiItemBuilder.setStructure(
"# # # # # # # # #", "# # # # # # # # #",
@ -48,7 +49,7 @@ public class CacheDetailedGUI {
guiItemBuilder.addIngredient('x', Markers.CONTENT_LIST_SLOT_HORIZONTAL); guiItemBuilder.addIngredient('x', Markers.CONTENT_LIST_SLOT_HORIZONTAL);
guiItemBuilder.addIngredient('U', new ScrollUp()); guiItemBuilder.addIngredient('U', new ScrollUp());
guiItemBuilder.addIngredient('D', new ScrollDown()); guiItemBuilder.addIngredient('D', new ScrollDown());
guiItemBuilder.addIngredient('B', new GoBack(new CacheManagementGUI(player).getGUI())); guiItemBuilder.addIngredient('B', new GoBack(parent.getGUI(), parent.getTitle()));
guiItemBuilder.setContent(items); guiItemBuilder.setContent(items);
}); });

View file

@ -7,7 +7,7 @@ import xyz.xenondevs.invui.item.impl.SuppliedItem;
import xyz.xenondevs.invui.window.Window; import xyz.xenondevs.invui.window.Window;
public class GoBack extends SuppliedItem { public class GoBack extends SuppliedItem {
public GoBack(Gui gui) { public GoBack(Gui gui, String parentTitle) {
super(() -> { super(() -> {
final ItemBuilder builder = new ItemBuilder(Material.ARROW); final ItemBuilder builder = new ItemBuilder(Material.ARROW);
builder.setDisplayName("Go back"); builder.setDisplayName("Go back");
@ -15,8 +15,7 @@ public class GoBack extends SuppliedItem {
return builder; return builder;
}, click -> { }, click -> {
click.getEvent().getView().close(); click.getEvent().getView().close();
// TODO: 4/1/23 Get title of parent GUI Window.single().setGui(gui).setTitle(parentTitle).open(click.getPlayer());
Window.single().setGui(gui).setTitle("Nicko").open(click.getPlayer());
return true; return true;
}); });
} }

View file

@ -17,6 +17,14 @@ event:
fail: "§cImpossible d''appliquer votre précédent déguisement. §7§o({0})" fail: "§cImpossible d''appliquer votre précédent déguisement. §7§o({0})"
success: "§aVotre précédent déguisement a été appliqué." success: "§aVotre précédent déguisement a été appliqué."
undisguise: undisguise:
fail: "§cImpossible de retier votre déguisement. Il sera réinitialisé à votre prochaine reconnexion." fail: "§cImpossible de retirer votre déguisement. Il sera réinitialisé à votre prochaine reconnexion."
none: "§cVous n''avez pas de déguisement." none: "§cVous n''avez pas de déguisement."
success: "§aDéguisement retiré." success: "§aDéguisement retiré."
gui:
common:
exit: "Quitter"
back: "Retour"
l1_back: "Retournez à la fenêtre précédente."
not_available: "Option indisponible :("
l1_not_available: "Ce bouton est désactivé."