public static String func_146317_a(ISaveFormat p_146317_0_, String p_146317_1_) { p_146317_1_ = p_146317_1_.replaceAll("[\\./\"]", "_"); for (String s : disallowedFilenames) { if (p_146317_1_.equalsIgnoreCase(s)) { p_146317_1_ = "_" + p_146317_1_ + "_"; } } while (p_146317_0_.getWorldInfo(p_146317_1_) != null) { p_146317_1_ = p_146317_1_ + "-"; } return p_146317_1_; }
public void confirmClicked(boolean result, int id) { if (this.field_146643_x) { this.field_146643_x = false; if (result) { ISaveFormat isaveformat = this.mc.getSaveLoader(); isaveformat.flushCache(); isaveformat.deleteWorldDirectory(this.func_146621_a(id)); try { this.func_146627_h(); } catch (AnvilConverterException anvilconverterexception) { logger.error((String)"Couldn\'t load level list", (Throwable)anvilconverterexception); } } this.mc.displayGuiScreen(this); } }
/** * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) */ protected void actionPerformed(GuiButton button) throws IOException { if (button.enabled) { if (button.id == 1) { this.mc.displayGuiScreen(this.parentScreen); } else if (button.id == 0) { ISaveFormat isaveformat = this.mc.getSaveLoader(); isaveformat.renameWorld(this.saveName, this.field_146583_f.getText().trim()); this.mc.displayGuiScreen(this.parentScreen); } } }
/** * Attempts to delete all Minecraft Worlds with "TEMP_" in front of the name * @param currentWorld excludes this world from deletion, can be null */ public static void cleanupTemporaryWorlds(String currentWorld){ List<SaveFormatComparator> saveList; ISaveFormat isaveformat = Minecraft.getMinecraft().getSaveLoader(); isaveformat.flushCache(); try{ saveList = isaveformat.getSaveList(); } catch (AnvilConverterException e){ e.printStackTrace(); return; } String searchString = tempMark + AddressHelper.getMissionControlPort() + "_"; for (SaveFormatComparator s: saveList){ String folderName = s.getFileName(); if (folderName.startsWith(searchString) && !folderName.equals(currentWorld)){ isaveformat.deleteWorldDirectory(folderName); } } }
public GuiListWorldSelectionEntry(GuiListWorldSelection listWorldSelIn, WorldSummary p_i46591_2_, ISaveFormat p_i46591_3_) { this.containingListSel = listWorldSelIn; this.worldSelScreen = listWorldSelIn.getGuiWorldSelection(); this.worldSummary = p_i46591_2_; this.client = Minecraft.getMinecraft(); this.iconLocation = new ResourceLocation("worlds/" + p_i46591_2_.getFileName() + "/icon"); this.iconFile = p_i46591_3_.getFile(p_i46591_2_.getFileName(), "icon.png"); if (!this.iconFile.isFile()) { this.iconFile = null; } this.loadServerIcon(); }
public void deleteWorld() { this.client.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback() { public void confirmClicked(boolean result, int id) { if (result) { GuiListWorldSelectionEntry.this.client.displayGuiScreen(new GuiScreenWorking()); ISaveFormat isaveformat = GuiListWorldSelectionEntry.this.client.getSaveLoader(); isaveformat.flushCache(); isaveformat.deleteWorldDirectory(GuiListWorldSelectionEntry.this.worldSummary.getFileName()); GuiListWorldSelectionEntry.this.containingListSel.refreshList(); } GuiListWorldSelectionEntry.this.client.displayGuiScreen(GuiListWorldSelectionEntry.this.worldSelScreen); } }, I18n.format("selectWorld.deleteQuestion", new Object[0]), "\'" + this.worldSummary.getDisplayName() + "\' " + I18n.format("selectWorld.deleteWarning", new Object[0]), I18n.format("selectWorld.deleteButton", new Object[0]), I18n.format("gui.cancel", new Object[0]), 0)); }
/** * Ensures that a proposed directory name doesn't collide with existing names. * Returns the name, possibly modified to avoid collisions. */ public static String getUncollidingSaveDirName(ISaveFormat saveLoader, String name) { name = name.replaceAll("[\\./\"]", "_"); for (String s : DISALLOWED_FILENAMES) { if (name.equalsIgnoreCase(s)) { name = "_" + name + "_"; } } while (saveLoader.getWorldInfo(name) != null) { name = name + "-"; } return name; }
public void refreshList() { ISaveFormat isaveformat = this.mc.getSaveLoader(); List<WorldSummary> list; try { list = isaveformat.getSaveList(); } catch (AnvilConverterException anvilconverterexception) { LOGGER.error((String)"Couldn\'t load level list", (Throwable)anvilconverterexception); this.mc.displayGuiScreen(new GuiErrorScreen(I18n.format("selectWorld.unable_to_load", new Object[0]), anvilconverterexception.getMessage())); return; } Collections.sort(list); for (WorldSummary worldsummary : list) { this.entries.add(new GuiListWorldSelectionEntry(this, worldsummary, this.mc.getSaveLoader())); } }
/** * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the * window resizes, the buttonList is cleared beforehand. */ public void initGui() { Keyboard.enableRepeatEvents(true); this.buttonList.clear(); GuiButton guibutton = this.addButton(new GuiButton(3, this.width / 2 - 100, this.height / 4 + 24 + 12, I18n.format("selectWorld.edit.resetIcon", new Object[0]))); this.buttonList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 48 + 12, I18n.format("selectWorld.edit.openFolder", new Object[0]))); this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 12, I18n.format("selectWorld.edit.save", new Object[0]))); this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 12, I18n.format("gui.cancel", new Object[0]))); guibutton.enabled = this.mc.getSaveLoader().getFile(this.worldId, "icon.png").isFile(); ISaveFormat isaveformat = this.mc.getSaveLoader(); WorldInfo worldinfo = isaveformat.getWorldInfo(this.worldId); String s = worldinfo == null ? "" : worldinfo.getWorldName(); this.nameEdit = new GuiTextField(2, this.fontRendererObj, this.width / 2 - 100, 60, 200, 20); this.nameEdit.setFocused(true); this.nameEdit.setText(s); }
public void confirmClicked(boolean result, int id) { if (result && id == 12) { ISaveFormat isaveformat = this.mc.getSaveLoader(); isaveformat.flushCache(); isaveformat.deleteWorldDirectory("Demo_World"); this.mc.displayGuiScreen(this); } else if (id == 12) { this.mc.displayGuiScreen(this); } else if (id == 13) { if (result) { try { Class<?> oclass = Class.forName("java.awt.Desktop"); Object object = oclass.getMethod("getDesktop", new Class[0]).invoke((Object) null, new Object[0]); oclass.getMethod("browse", new Class[] { URI.class }).invoke(object, new Object[] { new URI(this.openGLWarningLink) }); } catch (Throwable throwable) { LOGGER.error("Couldn\'t open link", throwable); } } this.mc.displayGuiScreen(this); } }
public void refreshList() { ISaveFormat isaveformat = this.mc.getSaveLoader(); List<WorldSummary> list; try { list = isaveformat.getSaveList(); } catch (AnvilConverterException anvilconverterexception) { LOGGER.error((String)"Couldn\'t load level list", (Throwable)anvilconverterexception); this.mc.displayGuiScreen(new GuiErrorScreen("Unable to load worlds", anvilconverterexception.getMessage())); return; } Collections.sort(list); for (WorldSummary worldsummary : list) { this.entries.add(new GuiListWorldSelectionEntry(this, worldsummary, this.mc.getSaveLoader())); } }
/** * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the * window resizes, the buttonList is cleared beforehand. */ public void initGui() { Keyboard.enableRepeatEvents(true); this.buttonList.clear(); GuiButton guibutton = this.addButton(new GuiButton(3, this.width / 2 - 100, this.height / 4 + 24 + 12, I18n.format("selectWorld.edit.resetIcon", new Object[0]))); this.buttonList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 48 + 12, I18n.format("selectWorld.edit.openFolder", new Object[0]))); this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 12, I18n.format("selectWorld.edit.save", new Object[0]))); this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 12, I18n.format("gui.cancel", new Object[0]))); guibutton.enabled = this.mc.getSaveLoader().getFile(this.worldId, "icon.png").isFile(); ISaveFormat isaveformat = this.mc.getSaveLoader(); WorldInfo worldinfo = isaveformat.getWorldInfo(this.worldId); String s = worldinfo.getWorldName(); this.nameEdit = new GuiTextField(2, this.fontRendererObj, this.width / 2 - 100, 60, 200, 20); this.nameEdit.setFocused(true); this.nameEdit.setText(s); }
public static String func_146317_a(ISaveFormat p_146317_0_, String p_146317_1_) { p_146317_1_ = p_146317_1_.replaceAll("[\\./\"]", "_"); String[] astring = disallowedFilenames; int i = astring.length; for (int j = 0; j < i; ++j) { String s1 = astring[j]; if (p_146317_1_.equalsIgnoreCase(s1)) { p_146317_1_ = "_" + p_146317_1_ + "_"; } } while (p_146317_0_.getWorldInfo(p_146317_1_) != null) { p_146317_1_ = p_146317_1_ + "-"; } return p_146317_1_; }
/** * Attempts to delete all Minecraft Worlds with "TEMP_" in front of the name * @param currentWorld excludes this world from deletion, can be null */ public static void cleanupTemporaryWorlds(String currentWorld){ List<WorldSummary> saveList; ISaveFormat isaveformat = Minecraft.getMinecraft().getSaveLoader(); isaveformat.flushCache(); try{ saveList = isaveformat.getSaveList(); } catch (AnvilConverterException e){ e.printStackTrace(); return; } String searchString = tempMark + AddressHelper.getMissionControlPort() + "_"; for (WorldSummary s: saveList){ String folderName = s.getFileName(); if (folderName.startsWith(searchString) && !folderName.equals(currentWorld)){ isaveformat.deleteWorldDirectory(folderName); } } }
public static String func_146317_a(ISaveFormat p_146317_0_, String p_146317_1_) { p_146317_1_ = p_146317_1_.replaceAll("[\\./\"]", "_"); String[] var2 = field_146327_L; int var3 = var2.length; for (int var4 = 0; var4 < var3; ++var4) { String var5 = var2[var4]; if (p_146317_1_.equalsIgnoreCase(var5)) { p_146317_1_ = "_" + p_146317_1_ + "_"; } } while (p_146317_0_.getWorldInfo(p_146317_1_) != null) { p_146317_1_ = p_146317_1_ + "-"; } return p_146317_1_; }
public void confirmClicked(boolean par1, int par2) { if (this.field_146643_x) { this.field_146643_x = false; if (par1) { ISaveFormat var3 = this.mc.getSaveLoader(); var3.flushCache(); var3.deleteWorldDirectory(this.func_146621_a(par2)); try { this.func_146627_h(); } catch (AnvilConverterException var5) { logger.error("Couldn\'t load level list", var5); } } this.mc.displayGuiScreen(this); } }
protected void actionPerformed(GuiButton p_146284_1_) { if (p_146284_1_.enabled) { if (p_146284_1_.id == 1) { this.mc.displayGuiScreen(this.field_146585_a); } else if (p_146284_1_.id == 0) { ISaveFormat var2 = this.mc.getSaveLoader(); var2.renameWorld(this.field_146584_g, this.field_146583_f.getText().trim()); this.mc.displayGuiScreen(this.field_146585_a); } } }
/** * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the * window resizes, the buttonList is cleared beforehand. */ public void initGui() { Keyboard.enableRepeatEvents(true); this.buttonList.clear(); GuiButton guibutton = this.func_189646_b(new GuiButton(3, this.width / 2 - 100, this.height / 4 + 24 + 12, I18n.format("selectWorld.edit.resetIcon", new Object[0]))); this.buttonList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 48 + 12, I18n.format("selectWorld.edit.openFolder", new Object[0]))); this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 12, I18n.format("selectWorld.edit.save", new Object[0]))); this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 12, I18n.format("gui.cancel", new Object[0]))); guibutton.enabled = this.mc.getSaveLoader().getFile(this.worldId, "icon.png").isFile(); ISaveFormat isaveformat = this.mc.getSaveLoader(); WorldInfo worldinfo = isaveformat.getWorldInfo(this.worldId); String s = worldinfo.getWorldName(); this.nameEdit = new GuiTextField(2, this.fontRendererObj, this.width / 2 - 100, 60, 200, 20); this.nameEdit.setFocused(true); this.nameEdit.setText(s); }
public static String func_146317_a(ISaveFormat p_146317_0_, String p_146317_1_) { p_146317_1_ = p_146317_1_.replaceAll("[\\./\"]", "_"); String[] astring = field_146327_L; int i = astring.length; for (int j = 0; j < i; ++j) { String s1 = astring[j]; if (p_146317_1_.equalsIgnoreCase(s1)) { p_146317_1_ = "_" + p_146317_1_ + "_"; } } while (p_146317_0_.getWorldInfo(p_146317_1_) != null) { p_146317_1_ = p_146317_1_ + "-"; } return p_146317_1_; }
public void confirmClicked(boolean p_73878_1_, int p_73878_2_) { if (this.field_146643_x) { this.field_146643_x = false; if (p_73878_1_) { ISaveFormat isaveformat = this.mc.getSaveLoader(); isaveformat.flushCache(); isaveformat.deleteWorldDirectory(this.func_146621_a(p_73878_2_)); try { this.func_146627_h(); } catch (AnvilConverterException anvilconverterexception) { logger.error("Couldn\'t load level list", anvilconverterexception); } } this.mc.displayGuiScreen(this); } }
protected void actionPerformed(GuiButton p_146284_1_) { if (p_146284_1_.enabled) { if (p_146284_1_.id == 1) { this.mc.displayGuiScreen(this.field_146585_a); } else if (p_146284_1_.id == 0) { ISaveFormat isaveformat = this.mc.getSaveLoader(); isaveformat.renameWorld(this.field_146584_g, this.field_146583_f.getText().trim()); this.mc.displayGuiScreen(this.field_146585_a); } } }
public static String func_73913_a(ISaveFormat p_73913_0_, String p_73913_1_) { p_73913_1_ = p_73913_1_.replaceAll("[\\./\"]", "_"); String[] var2 = field_73917_F; int var3 = var2.length; for(int var4 = 0; var4 < var3; ++var4) { String var5 = var2[var4]; if(p_73913_1_.equalsIgnoreCase(var5)) { p_73913_1_ = "_" + p_73913_1_ + "_"; } } while(p_73913_0_.func_75803_c(p_73913_1_) != null) { p_73913_1_ = p_73913_1_ + "-"; } return p_73913_1_; }
public void func_73878_a(boolean p_73878_1_, int p_73878_2_) { if(this.field_74084_s) { this.field_74084_s = false; if(p_73878_1_) { ISaveFormat var3 = this.field_73882_e.func_71359_d(); var3.func_75800_d(); var3.func_75802_e(this.func_74069_a(p_73878_2_)); try { this.func_74073_h(); } catch (AnvilConverterException var5) { var5.printStackTrace(); } } this.field_73882_e.func_71373_a(this); } }