- Баллы
- 173
Решил сделать проверку md5 в minecraft 1.4.2 взяв за основу тутор Сашка. Код вставил, подправил, осталась единственная проблема, при компиляции выдает это:
Отрывок из GUIMainMenu.java:
Что не так?
P.S. Понимаю, вопрос нубский, но я абсолютно не знаю Java.
Код:
== MCP 7.19 (data: 7.19, client: 1.4.2, server: 1.4.2) ==
# found ff, ff patches, srgs, name csvs, doc csvs, param csvs, renumber csv, ast
yle, astyle config
== Recompiling client ==
> Cleaning bin
> Recompiling
'"C:\Program Files\Java\jdk1.7.0_02\bin\javac" -Xlint:-options -deprecation -g -
source 1.6 -target 1....' failed : 1
== ERRORS FOUND ==
src\minecraft\net\minecraft\src\GuiMainMenu.java:49: error: cannot find symbol
HttpURLConnection httpurlconnection = (HttpURLConnection)(new URL("h
ttp://minecraft.uogames.ru/mcraftServer/MinecraftDownload/check.php?md5=" + calc
)).openConnection();
^
symbol: variable calc
location: class GuiMainMenu
1 error
==================
!! Can not find server sources, try decompiling !!
Для продолжения нажмите любую клавишу . . .
Java:
package net.minecraft.src;
import java.awt.image.BufferedImage;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Random;
import net.minecraft.client.Minecraft;
import org.lwjgl.opengl.GL11;
import org.lwjgl.util.glu.GLU;
public class GuiMainMenu extends GuiScreen
{
/** The RNG used by the Main Menu Screen. */
private static final Random rand = new Random();
/** Counts the number of screen updates. */
private float updateCounter = 0.0F;
/** The splash message. */
private String splashText = "missingno";
private GuiButton buttonResetDemo;
/** Timer used to rotate the panorama, increases every tick. */
private int panoramaTimer = 0;
/**
* Texture allocated for the current viewport of the main menu's panorama background.
*/
private int viewportTexture;
/** An array of all the paths to the panorama pictures. */
private static final String[] titlePanoramaPaths = new String[] {"/title/bg/panorama0.png", "/title/bg/panorama1.png", "/title/bg/panorama2.png", "/title/bg/panorama3.png", "/title/bg/panorama4.png", "/title/bg/panorama5.png"};
public boolean checkMd5(String s)
{
try
{
s = URLEncoder.encode(s, "UTF-8");
HttpURLConnection.setFollowRedirects(false);
HttpURLConnection httpurlconnection = (HttpURLConnection)(new URL("http://minecraft.uogames.ru/mcraftServer/MinecraftDownload/check.php?md5=" + calc)).openConnection();
httpurlconnection.setRequestMethod("POST");
httpurlconnection.setDoInput(true);
httpurlconnection.setDoOutput(true);
httpurlconnection.setUseCaches(false);
httpurlconnection.setAllowUserInteraction(false);
httpurlconnection.setInstanceFollowRedirects(false);
httpurlconnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(httpurlconnection.getInputStream()));
String s1 = bufferedreader.readLine();
boolean flag = s1 != null && s1.equalsIgnoreCase("OK");
bufferedreader.close();
return flag;
}
catch(Exception exception)
{
return false;
}
}
P.S. Понимаю, вопрос нубский, но я абсолютно не знаю Java.