diff --git a/runelite-client/src/main/java/com/thatgamerblue/snake/GameHandler.java b/runelite-client/src/main/java/com/thatgamerblue/snake/GameHandler.java index 597830431c..ff1a32fdc7 100644 --- a/runelite-client/src/main/java/com/thatgamerblue/snake/GameHandler.java +++ b/runelite-client/src/main/java/com/thatgamerblue/snake/GameHandler.java @@ -9,6 +9,7 @@ import java.awt.event.KeyListener; import java.util.HashSet; import java.util.Set; +import javax.swing.JOptionPane; public class GameHandler implements KeyListener { private static final int DEFAULT_REFRESH_INTERVAL = 100; @@ -37,6 +38,9 @@ public GameHandler(SnakeGame game) { } public void reset() { + if (score != 0) { + JOptionPane.showMessageDialog(null, "You died! Your score: " + score, "OpenOSRS Snake", JOptionPane.INFORMATION_MESSAGE); + } head = new SnakePart(); SnakePart current = head; current.x = MIDDLE_X; diff --git a/runelite-client/src/main/java/com/thatgamerblue/snake/SnakeGame.java b/runelite-client/src/main/java/com/thatgamerblue/snake/SnakeGame.java index 0ff49333ef..013ec2a858 100644 --- a/runelite-client/src/main/java/com/thatgamerblue/snake/SnakeGame.java +++ b/runelite-client/src/main/java/com/thatgamerblue/snake/SnakeGame.java @@ -5,6 +5,7 @@ import java.awt.Graphics; import java.awt.Image; import javax.swing.JFrame; +import javax.swing.JOptionPane; import javax.swing.JPanel; import lombok.SneakyThrows; import net.runelite.client.RuneLite; @@ -30,13 +31,18 @@ public void start(Component component) { } public void stop() throws Exception { - running = false; - Component c = component; - while (c != null) { - c.setVisible(false); - c = c.getParent(); + int option = JOptionPane.showConfirmDialog(null, + "You scored 40! Press Yes to launch OpenOSRS, press No to keep playing snake.", + "OpenOSRS Snake", JOptionPane.YES_NO_OPTION); + if (option == JOptionPane.YES_OPTION) { + running = false; + Component c = component; + while (c != null) { + c.setVisible(false); + c = c.getParent(); + } + RuneLite.oldMain(arguments); } - RuneLite.oldMain(arguments); } @SneakyThrows