Skip to content

Commit

Permalink
Impl: Minecraft 1.6 release notice
Browse files Browse the repository at this point in the history
  • Loading branch information
Moresteck committed Oct 5, 2024
1 parent 01acd77 commit 8acf872
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/main/java/uk/betacraft/legacyfix/LegacyFixAgent.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,8 @@ public static boolean isDebug() {
public static String getGameDir() {
return getSettings().containsKey("lf.gameDir") ? (String) getSettings().get("lf.gameDir") : "minecraft";
}

public static String getAssetsDir() {
return getSettings().containsKey("lf.assetsDir") ? (String) getSettings().get("lf.assetsDir") : "assets";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public class Handler extends URLStreamHandler {
BetaAntiPiracyHandler.class,
LevelListHandler.class,
LevelSaveHandler.class,
LevelLoadHandler.class
LevelLoadHandler.class,
Minecraft1_6AvailableHandler.class
);

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@

@SuppressWarnings("all")
public class LevelListHandler extends HandlerBase {
public static final String EMPTY_LEVEL = "-";
protected static final String LEVELS_DIR_PATH = System.getProperty("lf.levelsDir", LegacyFixAgent.getGameDir() + "/levels");
private static final Pattern LEVEL_LIST_PATTERN = Pattern.compile("(http:\\/\\/(www\\.)?minecraft\\.net(:(.+)?)?\\/game\\/listmaps\\.jsp\\?user=(.+)?)");

protected static final String LEVELS_DIR_PATH = System.getProperty("lf.levelsDir", LegacyFixAgent.getGameDir() + "/levels");

public static final String EMPTY_LEVEL = "-";

public LevelListHandler(URL u, Pattern patternUsed) {
super(u, patternUsed);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package uk.betacraft.legacyfix.protocol.impl;

import uk.betacraft.legacyfix.LegacyFixAgent;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Pattern;

@SuppressWarnings("all")
public class Minecraft1_6AvailableHandler extends HandlerBase {
private static final Pattern FLAG_PATTERN = Pattern.compile("(http:\\/\\/assets\\.minecraft\\.net\\/1_6_has_been_released\\.flag)");

private static final boolean SHOW_NOTICE = "true".equals(LegacyFixAgent.getSettings().get("lf.showNotice"));

public Minecraft1_6AvailableHandler(URL u, Pattern patternUsed) {
super(u, patternUsed);

byte[] response;
if (SHOW_NOTICE) {
response = "https://web.archive.org/web/20130702232237if_/https://mojang.com/2013/07/minecraft-the-horse-update/".getBytes();
} else {
response = new byte[0];
}

this.stream = new ByteArrayInputStream(response);
}

public static List<Pattern> regexPatterns() {
return Arrays.asList(
FLAG_PATTERN
);
}
}

0 comments on commit 8acf872

Please sign in to comment.