Fix all warnings

Add and make use of Lombok
Remove Mojang API
Remove ZipFileUtils
Remove StreamTools in favor of Apache IOUtils
Keyframe should be abstract all derivatives final
Replace clone in Keyframe with copy
Move some constants from GuiReplaySetttings to GuiConstants
This commit is contained in:
johni0702
2015-06-29 21:45:37 +02:00
parent 3122c0a71e
commit a058497727
110 changed files with 487 additions and 1921 deletions

View File

@@ -74,7 +74,7 @@ public class GuiConnectPart extends GuiStudioPart {
@Override
public void initGui() {
if(!initialized) {
concatList = new GuiEntryList(1, fontRendererObj, 30, yPos, 150, 0);
concatList = new GuiEntryList<String>(1, fontRendererObj, 30, yPos, 150, 0);
filesToConcat = new ArrayList<String>();
String selectedName = FilenameUtils.getBaseName(GuiReplayEditor.instance.getSelectedFile().getAbsolutePath());
filesToConcat.add(selectedName);
@@ -82,7 +82,7 @@ public class GuiConnectPart extends GuiStudioPart {
concatList.setSelectionIndex(0);
replayDropdown = new GuiDropdown(1, fontRendererObj, 250, yPos + 5, 0, 4);
replayDropdown = new GuiDropdown<String>(1, fontRendererObj, 250, yPos + 5, 0, 4);
replayDropdown.clearElements();
replayFiles = ReplayFileIO.getAllReplayFiles();
@@ -107,14 +107,15 @@ public class GuiConnectPart extends GuiStudioPart {
filesToConcat.set(concatList.getSelectionIndex(), replayDropdown.getElement(selectionIndex));
concatList.setElements(filesToConcat);
} catch(Exception e) {
} //Sorry, too lazy to properly avoid this Exception here
// TODO Prevent exception
}
}
});
concatList.addSelectionListener(new SelectionListener() {
@Override
public void onSelectionChanged(int selectionIndex) {
String selName = (String) concatList.getElement(selectionIndex);
String selName = concatList.getElement(selectionIndex);
int i = 0;
for(Object s : replayDropdown.getAllElements()) {
String str = (String) s;
@@ -130,14 +131,15 @@ public class GuiConnectPart extends GuiStudioPart {
}
});
@SuppressWarnings("unchecked")
List<GuiButton> buttonList = this.buttonList;
upButton = new GuiArrowButton(GuiConstants.REPLAY_EDITOR_UP_BUTTON, 195, yPos + 40, "", GuiArrowButton.Direction.UP);
buttonList.add(upButton);
downButton = new GuiArrowButton(GuiConstants.REPLAY_EDITOR_DOWN_BUTTON, 219, yPos + 40, "", GuiArrowButton.Direction.DOWN);
buttonList.add(downButton);
int w = GuiReplayEditor.instance.width - 243 - 20 - 4;
removeButton = new GuiButton(GuiConstants.REPLAY_EDITOR_REMOVE_BUTTON, 249, yPos + 40, I18n.format("replaymod.gui.remove"));
buttonList.add(removeButton);

View File

@@ -22,8 +22,8 @@ public class GuiReplayEditor extends GuiScreen {
private static final int tabYPos = 110;
public static GuiReplayEditor instance = null;
private StudioTab currentTab = StudioTab.TRIM;
private GuiDropdown replayDropdown;
private GuiButton saveModeButton, saveButton;
private GuiDropdown<String> replayDropdown;
private GuiButton saveModeButton;
private boolean overrideSave = false;
private boolean initialized = false;
private List<File> replayFiles = new ArrayList<File>();
@@ -56,6 +56,8 @@ public class GuiReplayEditor extends GuiScreen {
@Override
public void initGui() {
@SuppressWarnings("unchecked")
List<GuiButton> buttonList = this.buttonList;
List<GuiButton> tabButtons = new ArrayList<GuiButton>();
tabButtons.add(new GuiButton(GuiConstants.REPLAY_EDITOR_TRIM_TAB, 0, 0, I18n.format("replaymod.gui.editor.trim.title")));
@@ -79,7 +81,7 @@ public class GuiReplayEditor extends GuiScreen {
int modeWidth = tabButtons.get(0).width;
if(!initialized) {
replayDropdown = new GuiDropdown(1, fontRendererObj, 15 + 2 + 1 + 80, 60, this.width - 30 - 8 - 80 - modeWidth - 4, 5);
replayDropdown = new GuiDropdown<String>(1, fontRendererObj, 15 + 2 + 1 + 80, 60, this.width - 30 - 8 - 80 - modeWidth - 4, 5);
refreshReplayDropdown();
} else {
replayDropdown.width = this.width - 30 - 8 - 80 - modeWidth - 4;
@@ -98,7 +100,7 @@ public class GuiReplayEditor extends GuiScreen {
backButton.width = 70;
buttonList.add(backButton);
saveButton = new GuiButton(GuiConstants.REPLAY_EDITOR_SAVE_BUTTON, width - 70 - 18, height - (2 * 20) - 5 - 3, I18n.format("replaymod.gui.save"));
GuiButton saveButton = new GuiButton(GuiConstants.REPLAY_EDITOR_SAVE_BUTTON, width - 70 - 18, height - (2 * 20) - 5 - 3, I18n.format("replaymod.gui.save"));
saveButton.width = 70;
buttonList.add(saveButton);
@@ -113,8 +115,6 @@ public class GuiReplayEditor extends GuiScreen {
return overrideSave ? I18n.format("replaymod.gui.editor.savemode.override") : I18n.format("replaymod.gui.editor.savemode.newfile");
}
;
@Override
protected void actionPerformed(GuiButton button) throws IOException {
if(!button.enabled) return;
@@ -194,7 +194,7 @@ public class GuiReplayEditor extends GuiScreen {
private GuiStudioPart studioPart;
private StudioTab(GuiStudioPart part) {
StudioTab(GuiStudioPart part) {
this.studioPart = part;
}