-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/main/java/uk/betacraft/legacyfix/protocol/impl/Minecraft1_6AvailableHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
); | ||
} | ||
} |