diff options
Diffstat (limited to 'src/main/java/kr/syeyoung')
5 files changed, 49 insertions, 17 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/Keybinds.java b/src/main/java/kr/syeyoung/dungeonsguide/Keybinds.java index 22701528..91ab880e 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/Keybinds.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/Keybinds.java @@ -12,7 +12,7 @@ public class Keybinds public static void register() { if (e.DEBUG) { - editingSession = new KeyBinding("start editing session", Keyboard.KEY_R, "key.categories.misc"); + editingSession = new KeyBinding("start editing session", Keyboard.KEY_NONE, "key.categories.misc"); ClientRegistry.registerKeyBinding(editingSession); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/a.java b/src/main/java/kr/syeyoung/dungeonsguide/a.java index dbc066fa..8664ed79 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/a.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/a.java @@ -4,6 +4,7 @@ import com.mojang.authlib.exceptions.AuthenticationException; import kr.syeyoung.dungeonsguide.d.c; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiErrorScreen; import net.minecraft.client.gui.GuiScreen; import net.minecraft.launchwrapper.LaunchClassLoader; @@ -39,7 +40,7 @@ public class a this.a = this; d.init(a); } - +// // @EventHandler // public void a(FMLPreInitializationEvent a) { // b b = new b(); @@ -86,7 +87,7 @@ public class a // a(new String[]{ // "Can't validate current installation of Dungeons Guide", // "Steps to fix", -// "1. check if other people can't join minecraft servers. If they can't it's impossible to validate", +// "1. check if other people can't join minecraft servers.", // "2. restart minecraft launcher", // "3. make sure you're on the right account", // "4. restart your computer", @@ -108,21 +109,24 @@ public class a public void a(final String[] a) { final GuiScreen b = new GuiErrorScreen(null, null) { - @Override - public void handleMouseInput() { + public void drawScreen(int par1, int par2, float par3) { + super.drawScreen(par1, par2, par3); + for (int i = 0; i < a.length; ++i) { + drawCenteredString(fontRendererObj, a[i], width / 2, height / 3 + 12 * i, 0xFFFFFFFF); + } } @Override - public void handleKeyboardInput() { + public void initGui() { + super.initGui(); + this.buttonList.clear(); + this.buttonList.add(new GuiButton(0, width / 2 - 50, height - 50, 100,20, "close")); } @Override - public void drawScreen(int par1, int par2, float par3) { - drawDefaultBackground(); - for (int i = 0; i < a.length; ++i) { - drawCenteredString(fontRendererObj, a[i], width / 2, height / 3 + 12 * i, 0xFFFFFFFF); - } + protected void actionPerformed(GuiButton button) throws IOException { + System.exit(-1); } }; @SuppressWarnings("serial") CustomModLoadingErrorDisplayException e = new CustomModLoadingErrorDisplayException() { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/b.java b/src/main/java/kr/syeyoung/dungeonsguide/b.java index d0422526..032d8e4e 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/b.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/b.java @@ -8,6 +8,7 @@ import com.mojang.authlib.minecraft.MinecraftSessionService; import lombok.Getter; import net.minecraft.client.Minecraft; import net.minecraft.util.Session; +import org.apache.commons.codec.binary.Base64; import javax.crypto.*; import javax.crypto.spec.IvParameterSpec; @@ -51,8 +52,8 @@ public class b { String c = a(a.getProfile()); MinecraftSessionService yggdrasilMinecraftSessionService = Minecraft.getMinecraft().getSessionService(); JsonObject d = a(c); - String hash = a(DatatypeConverter.parseBase64Binary(d.get("sharedSecret").getAsString()), - DatatypeConverter.parseBase64Binary(d.get("publicKey").getAsString())); + String hash = a(Base64.decodeBase64(d.get("sharedSecret").getAsString()), + Base64.decodeBase64(d.get("publicKey").getAsString())); yggdrasilMinecraftSessionService.joinServer(a.getProfile(), b, hash); this.b = a(c, this.a.getPublic()); b(this.b); @@ -61,7 +62,7 @@ public class b { public JsonObject a(String c) { String a = c.split("\\.")[1].replace("+", "-").replace("/", "_"); - String b = new String(DatatypeConverter.parseBase64Binary(a)); + String b = new String(Base64.decodeBase64(a)); // padding return (JsonObject) new JsonParser().parse(b); } @@ -89,7 +90,7 @@ public class b { c.setDoInput(true); c.setDoOutput(true); - c.getOutputStream().write(("{\"jwt\":\""+a+"\",\"publicKey\":\""+DatatypeConverter.printBase64Binary(b.getEncoded())+"\"}").getBytes()); + c.getOutputStream().write(("{\"jwt\":\""+a+"\",\"publicKey\":\""+Base64.encodeBase64URLSafeString(b.getEncoded())+"\"}").getBytes()); InputStreamReader d = new InputStreamReader(c.getInputStream()); JsonObject e = (JsonObject) new JsonParser().parse(d); if (!"ok".equals(e.get("status").getAsString())) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandSaveData.java b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandSaveData.java index 4d17787c..e7fdc454 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandSaveData.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandSaveData.java @@ -18,7 +18,8 @@ public class CommandSaveData extends CommandBase { @Override public void processCommand(ICommandSender sender, String[] args) { - DungeonRoomInfoRegistry.saveAll(e.getDungeonsGuide().getConfigDir()); + if (e.DEBUG) + DungeonRoomInfoRegistry.saveAll(e.getDungeonsGuide().getConfigDir()); } @Override public int getRequiredPermissionLevel() { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/e.java b/src/main/java/kr/syeyoung/dungeonsguide/e.java index 201a9b3c..d9f0e68a 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/e.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/e.java @@ -7,14 +7,18 @@ import net.minecraft.client.Minecraft; import net.minecraft.util.IChatComponent; import net.minecraftforge.client.ClientCommandHandler; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.config.Configuration; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import org.apache.commons.io.IOUtils; import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; import java.io.File; +import java.io.FileOutputStream; import java.io.IOException; +import java.io.InputStream; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; @@ -29,6 +33,10 @@ public class e implements c { @Getter private b authenticator; + + @Getter + private Configuration configuration; + public e(b authenticator) { this.authenticator = authenticator; } @@ -68,7 +76,25 @@ public class e implements c { Keybinds.register(); } public void pre(FMLPreInitializationEvent event) { - configDir = new File(event.getModConfigurationDirectory(),"z"); + configDir = new File(event.getModConfigurationDirectory(),"dungeonsguide"); + File configFile = new File(configDir, "config.conf"); + if (!configFile.exists()) { + configDir.mkdirs(); + try { + copy(e.class.getResourceAsStream("defaultConfig.conf"), configFile); + } catch (IOException e) { + e.printStackTrace(); + } + } + configuration = new Configuration(configFile); + configuration.load(); + } + private void copy(InputStream inputStream, File f) throws IOException { + FileOutputStream fos = new FileOutputStream(f); + IOUtils.copy(inputStream, fos); + fos.flush(); + fos.close(); + inputStream.close(); } @Getter |