From ec572b349c533d98343e2ead249db5c143b65ead Mon Sep 17 00:00:00 2001 From: zaxar163 Date: Fri, 18 Jan 2019 19:36:19 +0300 Subject: [PATCH] =?UTF-8?q?[FIX]=20=D0=A3=D0=B4=D0=B0=D0=BB=D1=91=D0=BD=20?= =?UTF-8?q?=D0=BD=D0=B5=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D1=83?= =?UTF-8?q?=D0=B5=D0=BC=D1=8B=D0=B9=20=D0=BA=D0=BE=D0=B4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/handler/AuthHandler.java | 4 +- .../auth/handler/BinaryFileAuthHandler.java | 37 ------------------- .../auth/provider/JsonAuthProvider.java | 2 +- 3 files changed, 2 insertions(+), 41 deletions(-) delete mode 100644 LaunchServer/src/main/java/ru/gravit/launchserver/auth/handler/BinaryFileAuthHandler.java diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/handler/AuthHandler.java b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/handler/AuthHandler.java index 1f3e9dba..3e80a56c 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/handler/AuthHandler.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/handler/AuthHandler.java @@ -41,9 +41,7 @@ public static void registerHandlers() { if (!registredHandl) { registerHandler("null", NullAuthHandler.class); registerHandler("memory", MemoryAuthHandler.class); - - // Auth handler that doesn't do nothing :D - registerHandler("binaryFile", BinaryFileAuthHandler.class); + registerHandler("file", FileAuthHandler.class); registerHandler("mysql", MySQLAuthHandler.class); registredHandl = true; } diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/handler/BinaryFileAuthHandler.java b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/handler/BinaryFileAuthHandler.java deleted file mode 100644 index 820bfd0c..00000000 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/handler/BinaryFileAuthHandler.java +++ /dev/null @@ -1,37 +0,0 @@ -package ru.gravit.launchserver.auth.handler; - -import ru.gravit.launcher.serialize.HInput; -import ru.gravit.launcher.serialize.HOutput; -import ru.gravit.utils.helper.IOHelper; - -import java.io.IOException; -import java.util.Map; -import java.util.Set; -import java.util.UUID; - -public final class BinaryFileAuthHandler extends FileAuthHandler { - - @Override - protected void readAuthFile() throws IOException { - try (HInput input = new HInput(IOHelper.newInput(file))) { - int count = input.readLength(0); - for (int i = 0; i < count; i++) { - UUID uuid = input.readUUID(); - Entry entry = new Entry(input); - addAuth(uuid, entry); - } - } - } - - @Override - protected void writeAuthFileTmp() throws IOException { - Set> entrySet = entrySet(); - try (HOutput output = new HOutput(IOHelper.newOutput(fileTmp))) { - output.writeLength(entrySet.size(), 0); - for (Map.Entry entry : entrySet) { - output.writeUUID(entry.getKey()); - entry.getValue().write(output); - } - } - } -} diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/JsonAuthProvider.java b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/JsonAuthProvider.java index e024282a..c18e1ace 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/JsonAuthProvider.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/JsonAuthProvider.java @@ -10,7 +10,7 @@ import java.net.URL; public final class JsonAuthProvider extends AuthProvider { - private static Gson gson = new Gson(); + private static final Gson gson = new Gson(); private URL url; private String apiKey;