Better variable naming
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
parent
c0b8c53e69
commit
a7b1700d42
@ -84,7 +84,6 @@ public final class Launcher extends Applet implements AppletStub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Launcher(Applet applet, URL documentBase) {
|
public Launcher(Applet applet, URL documentBase) {
|
||||||
super();
|
|
||||||
this.setLayout(new BorderLayout());
|
this.setLayout(new BorderLayout());
|
||||||
|
|
||||||
this.add(applet, "Center");
|
this.add(applet, "Center");
|
||||||
@ -167,8 +166,8 @@ public final class Launcher extends Applet implements AppletStub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resize(Dimension d) {
|
public void resize(Dimension size) {
|
||||||
wrappedApplet.resize(d);
|
wrappedApplet.resize(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -209,11 +208,11 @@ public final class Launcher extends Applet implements AppletStub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics paramGraphics) {
|
public void paint(Graphics graphics) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics paramGraphics) {
|
public void update(Graphics graphics) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParameter(String name, String value) {
|
public void setParameter(String name, String value) {
|
||||||
|
@ -74,19 +74,18 @@ import java.util.List;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@SuppressWarnings("removal")
|
|
||||||
public final class LegacyFrame extends Frame {
|
public final class LegacyFrame extends Frame {
|
||||||
|
|
||||||
private static final Logger LOGGER = Logger.getLogger("LegacyFrame");
|
private static final Logger LOGGER = Logger.getLogger("LegacyFrame");
|
||||||
|
|
||||||
private final Launcher appletWrap;
|
private final Launcher launcher;
|
||||||
|
|
||||||
public LegacyFrame(String title, Applet mcApplet) {
|
public LegacyFrame(String title, Applet applet) {
|
||||||
super(title);
|
super(title);
|
||||||
|
|
||||||
appletWrap = new Launcher(mcApplet);
|
launcher = new Launcher(applet);
|
||||||
|
|
||||||
mcApplet.setStub(appletWrap);
|
applet.setStub(launcher);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setIconImage(ImageIO.read(new File("icon.png")));
|
setIconImage(ImageIO.read(new File("icon.png")));
|
||||||
@ -100,8 +99,8 @@ public final class LegacyFrame extends Frame {
|
|||||||
public void start (
|
public void start (
|
||||||
String user,
|
String user,
|
||||||
String session,
|
String session,
|
||||||
int winSizeW,
|
int width,
|
||||||
int winSizeH,
|
int height,
|
||||||
boolean maximize,
|
boolean maximize,
|
||||||
String serverAddress,
|
String serverAddress,
|
||||||
String serverPort,
|
String serverPort,
|
||||||
@ -130,9 +129,9 @@ public final class LegacyFrame extends Frame {
|
|||||||
LOGGER.warning("Mpticket file is corrupted!");
|
LOGGER.warning("Mpticket file is corrupted!");
|
||||||
} else {
|
} else {
|
||||||
// Assumes parameters are valid and in the correct order
|
// Assumes parameters are valid and in the correct order
|
||||||
appletWrap.setParameter("server", lines.get(0));
|
launcher.setParameter("server", lines.get(0));
|
||||||
appletWrap.setParameter("port", lines.get(1));
|
launcher.setParameter("port", lines.get(1));
|
||||||
appletWrap.setParameter("mppass", lines.get(2));
|
launcher.setParameter("mppass", lines.get(2));
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOGGER.log(Level.WARNING, "Unable to read mpticket file!", e);
|
LOGGER.log(Level.WARNING, "Unable to read mpticket file!", e);
|
||||||
@ -140,20 +139,20 @@ public final class LegacyFrame extends Frame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (serverAddress != null) {
|
if (serverAddress != null) {
|
||||||
appletWrap.setParameter("server", serverAddress);
|
launcher.setParameter("server", serverAddress);
|
||||||
appletWrap.setParameter("port", serverPort);
|
launcher.setParameter("port", serverPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
appletWrap.setParameter("username", user);
|
launcher.setParameter("username", user);
|
||||||
appletWrap.setParameter("sessionid", session);
|
launcher.setParameter("sessionid", session);
|
||||||
appletWrap.setParameter("stand-alone", "true"); // Show the quit button. TODO: why won't this work?
|
launcher.setParameter("stand-alone", "true"); // Show the quit button. TODO: why won't this work?
|
||||||
appletWrap.setParameter("haspaid", "true"); // Some old versions need this for world saves to work.
|
launcher.setParameter("haspaid", "true"); // Some old versions need this for world saves to work.
|
||||||
appletWrap.setParameter("demo", isDemo ? "true" : "false");
|
launcher.setParameter("demo", isDemo ? "true" : "false");
|
||||||
appletWrap.setParameter("fullscreen", "false");
|
launcher.setParameter("fullscreen", "false");
|
||||||
|
|
||||||
add(appletWrap);
|
add(launcher);
|
||||||
|
|
||||||
appletWrap.setPreferredSize(new Dimension(winSizeW, winSizeH));
|
launcher.setPreferredSize(new Dimension(width, height));
|
||||||
|
|
||||||
pack();
|
pack();
|
||||||
|
|
||||||
@ -165,8 +164,8 @@ public final class LegacyFrame extends Frame {
|
|||||||
|
|
||||||
validate();
|
validate();
|
||||||
|
|
||||||
appletWrap.init();
|
launcher.init();
|
||||||
appletWrap.start();
|
launcher.start();
|
||||||
|
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
}
|
}
|
||||||
@ -174,14 +173,14 @@ public final class LegacyFrame extends Frame {
|
|||||||
private final class ForceExitHandler extends WindowAdapter {
|
private final class ForceExitHandler extends WindowAdapter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void windowClosing(WindowEvent e) {
|
public void windowClosing(WindowEvent event) {
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(30000L);
|
Thread.sleep(30000L);
|
||||||
} catch (InterruptedException localInterruptedException) {
|
} catch (InterruptedException e) {
|
||||||
localInterruptedException.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGGER.info("Forcing exit!");
|
LOGGER.info("Forcing exit!");
|
||||||
@ -190,9 +189,9 @@ public final class LegacyFrame extends Frame {
|
|||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
|
|
||||||
if (appletWrap != null) {
|
if (launcher != null) {
|
||||||
appletWrap.stop();
|
launcher.stop();
|
||||||
appletWrap.destroy();
|
launcher.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
// old minecraft versions can hang without this >_<
|
// old minecraft versions can hang without this >_<
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.prismlauncher.launcher;
|
package org.prismlauncher.launcher;
|
||||||
|
|
||||||
public interface Launcher {
|
public interface Launcher {
|
||||||
|
@ -70,7 +70,9 @@ import java.util.List;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@SuppressWarnings("removal")
|
/**
|
||||||
|
* Used to launch old versions that support applets.
|
||||||
|
*/
|
||||||
public final class LegacyLauncher extends AbstractLauncher {
|
public final class LegacyLauncher extends AbstractLauncher {
|
||||||
|
|
||||||
private static final Logger LOGGER = Logger.getLogger("LegacyLauncher");
|
private static final Logger LOGGER = Logger.getLogger("LegacyLauncher");
|
||||||
|
Loading…
Reference in New Issue
Block a user