Load collection from db
This commit is contained in:
@@ -13,6 +13,7 @@ import engine.Enum;
|
||||
import engine.Enum.DbObjectType;
|
||||
import engine.Enum.ProtectionState;
|
||||
import engine.Enum.TaxType;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
@@ -423,6 +424,34 @@ public class dbBuildingHandler extends dbHandlerBase {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void LOAD_BUILDING_FRIENDS() {
|
||||
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_building_friends`")) {
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
BuildingFriends friend = new BuildingFriends(rs);
|
||||
|
||||
switch (friend.friendType) {
|
||||
case 7:
|
||||
BuildingManager._buildingFriends.get(friend.buildingUID).put(friend.playerUID, friend);
|
||||
break;
|
||||
case 8:
|
||||
case 9:
|
||||
BuildingManager._buildingFriends.get(friend.buildingUID).put(friend.guildUID, friend);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void LOAD_ALL_FRIENDS_FOR_BUILDING(Building building) {
|
||||
|
||||
if (building == null)
|
||||
@@ -436,13 +465,13 @@ public class dbBuildingHandler extends dbHandlerBase {
|
||||
|
||||
while (rs.next()) {
|
||||
BuildingFriends friend = new BuildingFriends(rs);
|
||||
switch (friend.getFriendType()) {
|
||||
switch (friend.friendType) {
|
||||
case 7:
|
||||
building.getFriends().put(friend.getPlayerUID(), friend);
|
||||
building.getFriends().put(friend.playerUID, friend);
|
||||
break;
|
||||
case 8:
|
||||
case 9:
|
||||
building.getFriends().put(friend.getGuildUID(), friend);
|
||||
building.getFriends().put(friend.guildUID, friend);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user