More minor fixes

This commit is contained in:
icelimetea
2022-05-03 03:19:26 +01:00
parent 860a7af679
commit 9a87ae575e
8 changed files with 47 additions and 64 deletions

View File

@ -23,8 +23,6 @@ import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
@ -38,11 +36,15 @@ public final class LegacyFrame extends Frame {
private static final Logger LOGGER = Logger.getLogger("LegacyFrame");
private Launcher appletWrap;
private final Launcher appletWrap;
public LegacyFrame(String title) {
public LegacyFrame(String title, Applet mcApplet) {
super(title);
appletWrap = new Launcher(mcApplet);
mcApplet.setStub(appletWrap);
try {
setIconImage(ImageIO.read(new File("icon.png")));
} catch (IOException e) {
@ -53,7 +55,6 @@ public final class LegacyFrame extends Frame {
}
public void start (
Applet mcApplet,
String user,
String session,
int winSizeW,
@ -62,14 +63,14 @@ public final class LegacyFrame extends Frame {
String serverAddress,
String serverPort
) {
try {
appletWrap = new Launcher(mcApplet, new URL("http://www.minecraft.net/game"));
} catch (MalformedURLException ignored) {}
// Implements support for launching in to multiplayer on classic servers using a mpticket
// file generated by an external program and stored in the instance's root folder.
Path mpticketFile = Paths.get(System.getProperty("user.dir") + "/../mpticket");
Path mpticketFileCorrupt = Paths.get(System.getProperty("user.dir") + "/../mpticket.corrupt");
Path mpticketFile =
Paths.get(System.getProperty("user.dir"), "..", "mpticket");
Path mpticketFileCorrupt =
Paths.get(System.getProperty("user.dir"), "..", "mpticket.corrupt");
if (Files.exists(mpticketFile)) {
try (Scanner fileScanner = new Scanner(
@ -115,8 +116,6 @@ public final class LegacyFrame extends Frame {
appletWrap.setParameter("demo", "false");
appletWrap.setParameter("fullscreen", "false");
mcApplet.setStub(appletWrap);
add(appletWrap);
appletWrap.setPreferredSize(new Dimension(winSizeW, winSizeH));