From 7f61f21a0b1a57b483814facf1095bd013a0e167 Mon Sep 17 00:00:00 2001 From: Gravit Date: Fri, 8 Mar 2019 18:15:01 +0700 Subject: [PATCH] =?UTF-8?q?[FEATURE]=20compareMode=20=D0=B2=20HWIDHandler?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/hwid/MysqlHWIDHandler.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/hwid/MysqlHWIDHandler.java b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/hwid/MysqlHWIDHandler.java index b3852c7e..ce907c4e 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/hwid/MysqlHWIDHandler.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/hwid/MysqlHWIDHandler.java @@ -36,6 +36,11 @@ public class MysqlHWIDHandler extends HWIDHandler { private String banMessage; + private boolean compareMode = false; + //Using queryHWID "queryHwids": "SELECT * FROM `users_hwids` WHERE `totalMemory` = ? or `serialNumber` = ? or `HWDiskSerial` = ? or `processorID` = ?" + private int compare = 50; //При наборе схожести в 50 очков + private boolean oneCompareMode = false; + /* //Добавить поля hwid в базу с пользователями @@ -136,12 +141,22 @@ public void onCheckInfo(OshiHWID hwid, String username, Connection c) throws HWI a.setString(i + 1, CommonHelper.replace(paramsHwids[i], replaceParams)); } ResultSet set = a.executeQuery(); - if (set.next()) { + boolean isOne = false; + while(set.next()) { + if(!oneCompareMode) isOne = true; + OshiHWID db_hwid = new OshiHWID(); + db_hwid.serialNumber = set.getString(hwidFieldSerialNumber); + db_hwid.processorID = set.getString(hwidFieldProcessorID); + db_hwid.HWDiskSerial = set.getString(hwidFieldHWDiskSerial); + db_hwid.totalMemory = Long.valueOf(set.getString(hwidFieldTotalMemory)); + if(hwid.compare(db_hwid) < compare) continue; + if(oneCompareMode) isOne = true; boolean isBanned = set.getBoolean(hwidFieldBanned); if (isBanned) { throw new HWIDException(banMessage); } - } else { + } + if(isOne) { onUpdateInfo(hwid, username, c); } } catch (SQLException e) {