diff --git a/src/engine/db/handlers/dbAccountHandler.java b/src/engine/db/handlers/dbAccountHandler.java index 850e4eac..ad790a3b 100644 --- a/src/engine/db/handlers/dbAccountHandler.java +++ b/src/engine/db/handlers/dbAccountHandler.java @@ -89,7 +89,6 @@ public class dbAccountHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); } - } public ArrayList GET_TRASH_LIST() { @@ -107,7 +106,6 @@ public class dbAccountHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); } - return machineList; } @@ -122,7 +120,6 @@ public class dbAccountHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); } - } public ArrayList GET_ALL_CHARS_FOR_MACHINE(String machineID) { @@ -155,7 +152,6 @@ public class dbAccountHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); } - return trashList; } @@ -169,7 +165,6 @@ public class dbAccountHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); } - } public void CREATE_SINGLE(String accountName, String password) { @@ -185,7 +180,6 @@ public class dbAccountHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); } - } public Account GET_ACCOUNT(String uname) { @@ -238,7 +232,6 @@ public class dbAccountHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); } - } public void updateDatabase(final Account acc) { @@ -260,7 +253,6 @@ public class dbAccountHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); } - } public void INVALIDATE_LOGIN_CACHE(long accountUID, String objectType) { @@ -276,7 +268,6 @@ public class dbAccountHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); } - } } diff --git a/src/engine/db/handlers/dbBaneHandler.java b/src/engine/db/handlers/dbBaneHandler.java index 08794bc5..904f0cdd 100644 --- a/src/engine/db/handlers/dbBaneHandler.java +++ b/src/engine/db/handlers/dbBaneHandler.java @@ -104,7 +104,7 @@ public class dbBaneHandler extends dbHandlerBase { Logger.error(e); return false; } - return true; + return true; } } diff --git a/src/engine/db/handlers/dbBaseClassHandler.java b/src/engine/db/handlers/dbBaseClassHandler.java index ce4e1d41..30f476e6 100644 --- a/src/engine/db/handlers/dbBaseClassHandler.java +++ b/src/engine/db/handlers/dbBaseClassHandler.java @@ -87,6 +87,5 @@ public class dbBaseClassHandler extends dbHandlerBase { } return baseClasses; - } } diff --git a/src/engine/db/handlers/dbBuildingHandler.java b/src/engine/db/handlers/dbBuildingHandler.java index c175e11a..3550214d 100644 --- a/src/engine/db/handlers/dbBuildingHandler.java +++ b/src/engine/db/handlers/dbBuildingHandler.java @@ -204,12 +204,12 @@ public class dbBuildingHandler extends dbHandlerBase { preparedStatement.setLong(1, b.getObjectUUID()); preparedStatement.execute(); + return true; } catch (SQLException e) { Logger.error(e); - return false; } - return true; + return false; } public boolean CHANGE_NAME(Building b, String newName) { @@ -224,9 +224,8 @@ public class dbBuildingHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } public boolean SET_RESERVE(Building b, int reserveAmount) { @@ -241,9 +240,9 @@ public class dbBuildingHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } //CAS update to rank @@ -259,9 +258,8 @@ public class dbBuildingHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } public boolean UPDATE_BUILDING_HEALTH(final long buildingID, int NewHealth) { @@ -276,9 +274,8 @@ public class dbBuildingHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } public boolean UPDATE_BUILDING_ALTITUDE(final long buildingID, float newAltitude) { @@ -293,9 +290,8 @@ public class dbBuildingHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } public boolean UPDATE_PROTECTIONSTATE(final long buildingUUID, ProtectionState protectionState) { @@ -310,9 +306,8 @@ public class dbBuildingHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } public boolean UPDATE_DOOR_LOCK(final int buildingUUID, int doorFlags) { @@ -327,9 +322,8 @@ public class dbBuildingHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } public boolean ADD_TO_FRIENDS_LIST(final long buildingID, final long friendID, final long guildID, final int friendType) { @@ -346,9 +340,8 @@ public class dbBuildingHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } public boolean REMOVE_FROM_FRIENDS_LIST(final long buildingID, long friendID, long guildID, int friendType) { @@ -365,9 +358,8 @@ public class dbBuildingHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } public boolean REMOVE_FROM_CONDEMNED_LIST(final long buildingID, long friendID, long guildID, int friendType) { @@ -384,9 +376,8 @@ public class dbBuildingHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } public void CLEAR_FRIENDS_LIST(final long buildingID) { @@ -427,9 +418,8 @@ public class dbBuildingHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } public void LOAD_ALL_FRIENDS_FOR_BUILDING(Building building) { @@ -536,9 +526,8 @@ public class dbBuildingHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } public boolean ADD_TO_PATROL(final long parentUID, final Vector3fImmutable patrolPoint) { @@ -555,9 +544,8 @@ public class dbBuildingHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } public HashMap> LOAD_BUILDING_REGIONS() { @@ -589,7 +577,6 @@ public class dbBuildingHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return null; } Logger.info("read: " + recordsRead + " cached: " + regionList.size()); @@ -702,8 +689,8 @@ public class dbBuildingHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public boolean updateReverseKOS(final Building b, boolean reverse) { @@ -718,9 +705,8 @@ public class dbBuildingHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } public boolean updateActiveCondemn(final Condemned condemn, boolean active) { @@ -739,9 +725,8 @@ public class dbBuildingHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } public boolean updateBuildingOwner(final Building building, int ownerUUID) { @@ -757,9 +742,8 @@ public class dbBuildingHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } public boolean updateBuildingUpgradeTime(LocalDateTime upgradeDateTime, Building toUpgrade, int costToUpgrade) { @@ -781,8 +765,8 @@ public class dbBuildingHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public boolean updateMaintDate(Building building) { @@ -802,8 +786,8 @@ public class dbBuildingHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public boolean addTaxes(Building building, TaxType taxType, int amount, boolean enforceKOS) { @@ -821,9 +805,8 @@ public class dbBuildingHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } public boolean removeTaxes(Building building) { @@ -842,8 +825,8 @@ public class dbBuildingHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public boolean acceptTaxes(Building building) { @@ -859,8 +842,8 @@ public class dbBuildingHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } } diff --git a/src/engine/db/handlers/dbCSSessionHandler.java b/src/engine/db/handlers/dbCSSessionHandler.java index f14def21..b56341cc 100644 --- a/src/engine/db/handlers/dbCSSessionHandler.java +++ b/src/engine/db/handlers/dbCSSessionHandler.java @@ -44,9 +44,8 @@ public class dbCSSessionHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } public boolean DELETE_UNUSED_CSSESSION(String secKey) { @@ -59,9 +58,8 @@ public class dbCSSessionHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } public boolean DELETE_CSSESSION(String secKey) { @@ -74,9 +72,8 @@ public class dbCSSessionHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } public boolean UPDATE_CSSESSION(String secKey, int charID) { @@ -91,9 +88,8 @@ public class dbCSSessionHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } public CSSession GET_CSSESSION(String secKey) { diff --git a/src/engine/db/handlers/dbCharacterRuneHandler.java b/src/engine/db/handlers/dbCharacterRuneHandler.java index d905f0e2..e708dcea 100644 --- a/src/engine/db/handlers/dbCharacterRuneHandler.java +++ b/src/engine/db/handlers/dbCharacterRuneHandler.java @@ -83,9 +83,8 @@ public class dbCharacterRuneHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } public ArrayList GET_RUNES_FOR_CHARACTER(final int characterId) { diff --git a/src/engine/db/handlers/dbCharacterSkillHandler.java b/src/engine/db/handlers/dbCharacterSkillHandler.java index d2e4909e..c966b77e 100644 --- a/src/engine/db/handlers/dbCharacterSkillHandler.java +++ b/src/engine/db/handlers/dbCharacterSkillHandler.java @@ -69,8 +69,8 @@ public class dbCharacterSkillHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public CharacterSkill GET_SKILL(final int objectUUID) { diff --git a/src/engine/db/handlers/dbContractHandler.java b/src/engine/db/handlers/dbContractHandler.java index 893dbcf4..479695f5 100644 --- a/src/engine/db/handlers/dbContractHandler.java +++ b/src/engine/db/handlers/dbContractHandler.java @@ -139,8 +139,8 @@ public class dbContractHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public boolean updateDatabase(final Contract con) { @@ -162,8 +162,7 @@ public class dbContractHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } } diff --git a/src/engine/db/handlers/dbEnchantmentHandler.java b/src/engine/db/handlers/dbEnchantmentHandler.java index 61ab7a3d..1ba8c316 100644 --- a/src/engine/db/handlers/dbEnchantmentHandler.java +++ b/src/engine/db/handlers/dbEnchantmentHandler.java @@ -55,10 +55,10 @@ public class dbEnchantmentHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } + public boolean CLEAR_ENCHANTMENTS(long itemID) { try (Connection connection = DbManager.getConnection(); @@ -69,7 +69,7 @@ public class dbEnchantmentHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } } diff --git a/src/engine/db/handlers/dbGuildHandler.java b/src/engine/db/handlers/dbGuildHandler.java index 58a87441..b5a6dc70 100644 --- a/src/engine/db/handlers/dbGuildHandler.java +++ b/src/engine/db/handlers/dbGuildHandler.java @@ -68,9 +68,8 @@ public class dbGuildHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } public boolean REMOVE_FROM_BANISH_LIST(int target, long characterID) { @@ -85,8 +84,8 @@ public class dbGuildHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public boolean ADD_TO_GUILDHISTORY(int target, PlayerCharacter playerCharacter, DateTime historyDate, GuildHistoryType historyType) { @@ -108,9 +107,8 @@ public class dbGuildHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } //TODO Need to get this working. @@ -346,8 +344,8 @@ public class dbGuildHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public boolean SET_GUILD_LEADER(int objectUUID,int guildID) { @@ -362,9 +360,8 @@ public class dbGuildHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } public boolean IS_NAME_UNIQUE(final String name) { @@ -382,8 +379,8 @@ public class dbGuildHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return valid; } @@ -436,8 +433,8 @@ public class dbGuildHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public boolean UPDATE_PARENT(int guildUID, int parentUID) { @@ -452,9 +449,8 @@ public class dbGuildHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } public int DELETE_GUILD(final Guild guild) { @@ -485,9 +481,8 @@ public class dbGuildHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } public int UPDATE_GUILD_STATUS_OFFLINE(int target, boolean isInnerCouncil, boolean isRecruiter, boolean isTaxCollector, int guildId) { @@ -563,8 +558,8 @@ public class dbGuildHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public boolean ADD_TO_ALLIANCE_LIST(final long sourceGuildID, final long targetGuildID, boolean isRecommended, boolean isAlly, String recommender) { @@ -582,8 +577,8 @@ public class dbGuildHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public boolean REMOVE_FROM_ALLIANCE_LIST(final long sourceGuildID, long targetGuildID) { @@ -598,8 +593,8 @@ public class dbGuildHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public boolean UPDATE_RECOMMENDED(final long sourceGuildID, long targetGuildID) { diff --git a/src/engine/db/handlers/dbItemHandler.java b/src/engine/db/handlers/dbItemHandler.java index bd61223b..49f7f828 100644 --- a/src/engine/db/handlers/dbItemHandler.java +++ b/src/engine/db/handlers/dbItemHandler.java @@ -137,7 +137,6 @@ public class dbItemHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } return worked; } @@ -277,9 +276,8 @@ public class dbItemHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } public boolean ORPHAN_INVENTORY(final HashSet inventory) { diff --git a/src/engine/db/handlers/dbMineHandler.java b/src/engine/db/handlers/dbMineHandler.java index c8e35d57..2c527de9 100644 --- a/src/engine/db/handlers/dbMineHandler.java +++ b/src/engine/db/handlers/dbMineHandler.java @@ -80,8 +80,8 @@ public class dbMineHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public boolean CHANGE_RESOURCE(Mine mine, Resource resource) { @@ -96,8 +96,8 @@ public class dbMineHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public boolean CHANGE_TYPE(Mine mine, MineProduction productionType) { @@ -112,9 +112,8 @@ public class dbMineHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } public boolean SET_FLAGS(Mine mine, int newFlags) { @@ -129,8 +128,8 @@ public class dbMineHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } } diff --git a/src/engine/db/handlers/dbMobBaseHandler.java b/src/engine/db/handlers/dbMobBaseHandler.java index 531c1415..2c278492 100644 --- a/src/engine/db/handlers/dbMobBaseHandler.java +++ b/src/engine/db/handlers/dbMobBaseHandler.java @@ -108,8 +108,8 @@ public class dbMobBaseHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public HashMap LOAD_STATIC_POWERS(int mobBaseUUID) { diff --git a/src/engine/db/handlers/dbPlayerCharacterHandler.java b/src/engine/db/handlers/dbPlayerCharacterHandler.java index 94c17d52..f74e3d49 100644 --- a/src/engine/db/handlers/dbPlayerCharacterHandler.java +++ b/src/engine/db/handlers/dbPlayerCharacterHandler.java @@ -95,9 +95,8 @@ public class dbPlayerCharacterHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } public ArrayList GET_CHARACTERS_FOR_ACCOUNT(final int id) { @@ -231,9 +230,8 @@ public class dbPlayerCharacterHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } - + return false; } public boolean SET_DELETED(final PlayerCharacter pc) { @@ -248,8 +246,8 @@ public class dbPlayerCharacterHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public boolean SET_ACTIVE(final PlayerCharacter pc, boolean status) { @@ -264,8 +262,8 @@ public class dbPlayerCharacterHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public boolean SET_BIND_BUILDING(final PlayerCharacter pc, int bindBuildingID) { @@ -280,8 +278,8 @@ public class dbPlayerCharacterHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public boolean SET_ANNIVERSERY(final PlayerCharacter pc, boolean flag) { @@ -296,8 +294,8 @@ public class dbPlayerCharacterHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } @@ -313,8 +311,8 @@ public class dbPlayerCharacterHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public boolean UPDATE_GUILD(final PlayerCharacter pc, int guildUUID) { @@ -329,8 +327,8 @@ public class dbPlayerCharacterHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public boolean UPDATE_CHARACTER_STATS(final PlayerCharacter pc) { @@ -349,8 +347,8 @@ public class dbPlayerCharacterHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public String SET_PROPERTY(final PlayerCharacter playerCharacter, String name, Object new_value) { @@ -386,8 +384,8 @@ public class dbPlayerCharacterHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public boolean SET_INNERCOUNCIL(PlayerCharacter player, boolean isInnerCouncil) { @@ -402,8 +400,8 @@ public class dbPlayerCharacterHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public boolean SET_FULL_MEMBER(PlayerCharacter player, boolean isFullMember) { @@ -418,8 +416,8 @@ public class dbPlayerCharacterHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public boolean SET_TAX_COLLECTOR(PlayerCharacter player, boolean isTaxCollector) { @@ -434,8 +432,8 @@ public class dbPlayerCharacterHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public boolean SET_RECRUITER(PlayerCharacter player, boolean isRecruiter) { @@ -450,8 +448,8 @@ public class dbPlayerCharacterHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public boolean SET_GUILD_TITLE(PlayerCharacter player, int title) { @@ -466,8 +464,8 @@ public class dbPlayerCharacterHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public boolean ADD_FRIEND(int source, long friend) { @@ -482,8 +480,8 @@ public class dbPlayerCharacterHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public boolean REMOVE_FRIEND(int source, int friend) { @@ -498,8 +496,8 @@ public class dbPlayerCharacterHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public void LOAD_PLAYER_FRIENDS() { @@ -534,8 +532,8 @@ public class dbPlayerCharacterHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public boolean REMOVE_HERALDY(int source, int characterUID) { @@ -550,8 +548,8 @@ public class dbPlayerCharacterHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); - return false; } + return false; } public void LOAD_HERALDY() { diff --git a/src/engine/db/handlers/dbWarehouseHandler.java b/src/engine/db/handlers/dbWarehouseHandler.java index c59142dd..9ecb6348 100644 --- a/src/engine/db/handlers/dbWarehouseHandler.java +++ b/src/engine/db/handlers/dbWarehouseHandler.java @@ -20,6 +20,8 @@ import org.joda.time.DateTime; import org.pmw.tinylog.Logger; import java.net.UnknownHostException; +import java.sql.Connection; +import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; @@ -100,10 +102,19 @@ public class dbWarehouseHandler extends dbHandlerBase { } public boolean updateLocks(final Warehouse wh, long locks) { - prepareCallable("UPDATE `obj_warehouse` SET `warehouse_locks`=? WHERE `UID` = ?"); - setLong(1, locks); - setInt(2, wh.getUID()); - return (executeUpdate() != 0); + + try (Connection connection = DbManager.getConnection(); + PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_locks`=? WHERE `UID` = ?")) { + + preparedStatement.setLong(1, locks); + preparedStatement.setInt(2, wh.getUID()); + + return (preparedStatement.executeUpdate() > 0); + + } catch (SQLException e) { + Logger.error(e); + } + return false; } public boolean updateGold(final Warehouse wh, int amount ) {