use of com.almuradev.almura.feature.menu.main.DisconnectedGui in project Almura by AlmuraDev.
the class MainMenuManager method onGuiOpen.
@SubscribeEvent
public void onGuiOpen(final GuiOpenEvent event) {
final GuiScreen screen = event.getGui();
final GuiScreen currentScreen = Minecraft.getMinecraft().currentScreen;
final GameSettings settings = Minecraft.getMinecraft().gameSettings;
boolean refreshResources = false;
if (screen != null) {
if (currentScreen != null && debug) {
System.out.println("MainMenuManager: current: " + currentScreen.getClass().getSimpleName() + " requested: " + screen.getClass().getSimpleName());
}
if (screen.getClass().equals(GuiMainMenu.class)) {
event.setCanceled(true);
final GeneralCategory general = configAdapter.get().general;
if (general.firstLaunch) {
AlmuraSettings.checkFirstLaunched();
} else {
new PanoramicMainMenu(null).display();
}
} else if (screen.getClass().equals(GuiIngameMenu.class)) {
event.setCanceled(true);
new SimpleIngameMenu().display();
} else if (screen.getClass().equals(GuiGameOver.class)) {
event.setCanceled(true);
// Cancel this, packet sent to client opens the DeathGUI
} else if (screen.getClass().equals(GuiDisconnected.class)) {
event.setCanceled(true);
String message = "";
if (Almura.networkManager != null && Almura.networkManager.getExitMessage() != null) {
message = Almura.networkManager.getExitMessage().getFormattedText();
}
new DisconnectedGui(message).display();
}
}
}
Aggregations