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"/>
## The next generation, feature packed disguise plugin for Minecraft.
## The feature packed, next generation disguise plugin for Minecraft.
### Download:

View file

@ -158,6 +158,4 @@ public class NickoBukkit extends JavaPlugin {
public LocaleFileManager getLocaleFileManager() {
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;
public class AdminGUI {
public static final String TITLE = "Nicko > Administration";
private final String title = "Nicko > Administration";
private final Player player;
private final Gui gui;
public AdminGUI(Player player) {
final MainGUI parent = new MainGUI(player);
this.gui = Gui.normal()
.setStructure(
"# # # # # # # # #",
@ -20,7 +20,7 @@ public class AdminGUI {
"B # # # # # # # #"
)
.addIngredient('S', new ManageCache())
.addIngredient('B', new GoBack(new MainGUI(player).getGUI()))
.addIngredient('B', new GoBack(parent.getGUI(), title))
.build();
this.player = player;
}
@ -29,7 +29,11 @@ public class AdminGUI {
return gui;
}
public String getTitle() {
return title;
}
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;
public class MainGUI {
private final String title = "Nicko - Home";
private final Player player;
private final Gui gui;
@ -40,7 +41,11 @@ public class MainGUI {
return gui;
}
public String getTitle() {
return title;
}
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
dynamicStructure[1] = dynamicStructure[1].replace("T", "U");
final MainGUI parent = new MainGUI(player);
this.gui = Gui.normal()
.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('T', new BungeeCordCycling().get(player))
.build();

View file

@ -10,15 +10,15 @@ import xyz.xenondevs.invui.gui.Gui;
import xyz.xenondevs.invui.window.Window;
public class CacheManagementGUI {
public static final String TITLE = "Nicko > Admin... > Cache";
private final String title = "Nicko > Admin... > Cache";
private final Player player;
private final Gui gui;
public CacheManagementGUI(Player player) {
final AdminGUI parent = new AdminGUI(player);
this.gui = Gui.normal()
.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('A', new InvalidateCompleteCache())
.addIngredient('D', new InvalidateSpecificEntry())
@ -30,7 +30,11 @@ public class CacheManagementGUI {
return gui;
}
public String getTitle() {
return title;
}
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)
.collect(Collectors.toList());
final CacheManagementGUI parent = new CacheManagementGUI(player);
gui = ScrollGui.items(guiItemBuilder -> {
guiItemBuilder.setStructure(
"# # # # # # # # #",
@ -48,7 +49,7 @@ public class CacheDetailedGUI {
guiItemBuilder.addIngredient('x', Markers.CONTENT_LIST_SLOT_HORIZONTAL);
guiItemBuilder.addIngredient('U', new ScrollUp());
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);
});

View file

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

View file

@ -17,6 +17,14 @@ event:
fail: "§cImpossible d''appliquer votre précédent déguisement. §7§o({0})"
success: "§aVotre précédent déguisement a été appliqué."
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."
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é."