New collection created in handled and loaded from db
This commit is contained in:
@@ -427,7 +427,6 @@ public class dbBuildingHandler extends dbHandlerBase {
|
||||
|
||||
public void LOAD_BUILDING_FRIENDS() {
|
||||
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_building_friends`")) {
|
||||
|
||||
@@ -458,6 +457,38 @@ public class dbBuildingHandler extends dbHandlerBase {
|
||||
|
||||
}
|
||||
|
||||
public void LOAD_BUILDING_CONDEMNED() {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_building_condemned`")) {
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
|
||||
Condemned condemned = new Condemned(rs);
|
||||
|
||||
// Create map if it does not yet exist
|
||||
|
||||
if (!BuildingManager._buildingCondemned.containsKey(condemned.buildingUUID))
|
||||
BuildingManager._buildingCondemned.put(condemned.buildingUUID, new ConcurrentHashMap<>());
|
||||
|
||||
switch (condemned.friendType) {
|
||||
case 2:
|
||||
BuildingManager._buildingCondemned.get(condemned.buildingUUID).put(condemned.playerUID, condemned);
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
BuildingManager._buildingCondemned.get(condemned.buildingUUID).put(condemned.guildUID, condemned);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void LOAD_ALL_CONDEMNED_FOR_BUILDING(Building building) {
|
||||
|
||||
if (building == null)
|
||||
@@ -471,13 +502,13 @@ public class dbBuildingHandler extends dbHandlerBase {
|
||||
|
||||
while (rs.next()) {
|
||||
Condemned condemned = new Condemned(rs);
|
||||
switch (condemned.getFriendType()) {
|
||||
switch (condemned.friendType) {
|
||||
case 2:
|
||||
building.getCondemned().put(condemned.getPlayerUID(), condemned);
|
||||
building.getCondemned().put(condemned.playerUID, condemned);
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
building.getCondemned().put(condemned.getGuildUID(), condemned);
|
||||
building.getCondemned().put(condemned.guildUID, condemned);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -725,10 +756,10 @@ public class dbBuildingHandler extends dbHandlerBase {
|
||||
+ "WHERE`buildingUID` = ? AND `playerUID` = ? AND `guildUID` = ? AND `friendType` = ?")) {
|
||||
|
||||
preparedStatement.setBoolean(1, active);
|
||||
preparedStatement.setInt(2, condemn.getParent());
|
||||
preparedStatement.setInt(3, condemn.getPlayerUID());
|
||||
preparedStatement.setInt(4, condemn.getGuildUID());
|
||||
preparedStatement.setInt(5, condemn.getFriendType());
|
||||
preparedStatement.setInt(2, condemn.buildingUUID);
|
||||
preparedStatement.setInt(3, condemn.playerUID);
|
||||
preparedStatement.setInt(4, condemn.guildUID);
|
||||
preparedStatement.setInt(5, condemn.friendType);
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user