mirror of
https://github.com/ProjectSWGCore/Holocore.git
synced 2026-09-28 13:12:59 -04:00
Merge branch 'quality_assurance' of bitbucket.org:projectswg/holocore into quality_assurance
This commit is contained in:
@@ -65,12 +65,12 @@ import java.util.Locale;
|
||||
|
||||
public class ChatManager extends Manager {
|
||||
|
||||
private ObjectDatabase<Mail> mails;
|
||||
private final ObjectDatabase<Mail> mails;
|
||||
private final ChatRoomService roomService;
|
||||
private int maxMailId;
|
||||
private ChatRoomService roomService;
|
||||
|
||||
public ChatManager() {
|
||||
roomService = new ChatRoomService();
|
||||
public ChatManager(Galaxy g) {
|
||||
roomService = new ChatRoomService(g);
|
||||
mails = new CachedObjectDatabase<>("odb/mails.db");
|
||||
maxMailId = 1;
|
||||
|
||||
@@ -227,10 +227,6 @@ public class ChatManager extends Manager {
|
||||
}
|
||||
}
|
||||
|
||||
public void initializeGalaxyChannels(Galaxy galaxy) {
|
||||
roomService.createSystemChannels(galaxy.getName());
|
||||
}
|
||||
|
||||
/* Friends List */
|
||||
|
||||
private void handleRequestFriendList(Player player) {
|
||||
|
||||
@@ -61,6 +61,7 @@ import network.packets.swg.zone.chat.ChatSendToRoom;
|
||||
import network.packets.swg.zone.chat.ChatUnbanAvatarFromRoom;
|
||||
import network.packets.swg.zone.chat.ChatUninviteFromRoom;
|
||||
import network.packets.swg.zone.insertion.ChatRoomList;
|
||||
import resources.Galaxy;
|
||||
import resources.Terrain;
|
||||
import resources.chat.ChatAvatar;
|
||||
import resources.chat.ChatResult;
|
||||
@@ -87,24 +88,19 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* @author Waverunner
|
||||
*/
|
||||
public class ChatRoomService extends Service {
|
||||
private int maxChatRoomId;
|
||||
private Map<Integer, ChatRoom> roomMap;
|
||||
// Map to keep track of each player's recent message for a room to prevent duplicates from client
|
||||
private Map<Long, Map<Integer, Integer>> messages;
|
||||
private ObjectDatabase<ChatRoom> database;
|
||||
private final Map<Long, Map<Integer, Integer>> messages;
|
||||
private final ObjectDatabase<ChatRoom> database;
|
||||
private final Map<Integer, ChatRoom> roomMap;
|
||||
private final Galaxy galaxy;
|
||||
private int maxChatRoomId;
|
||||
|
||||
public ChatRoomService() {
|
||||
public ChatRoomService(Galaxy g) {
|
||||
galaxy = g;
|
||||
database = new CachedObjectDatabase<>("odb/chat_rooms.db");
|
||||
roomMap = new ConcurrentHashMap<>();
|
||||
messages = new ConcurrentHashMap<>();
|
||||
maxChatRoomId = 1;
|
||||
|
||||
database.load();
|
||||
database.traverse((room) -> {
|
||||
if (room.getId() >= maxChatRoomId)
|
||||
maxChatRoomId++;
|
||||
roomMap.put(room.getId(), room);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -112,6 +108,14 @@ public class ChatRoomService extends Service {
|
||||
registerForIntent(ChatRoomUpdateIntent.TYPE);
|
||||
registerForIntent(GalacticPacketIntent.TYPE);
|
||||
|
||||
database.load();
|
||||
database.traverse((room) -> {
|
||||
if (room.getId() >= maxChatRoomId)
|
||||
maxChatRoomId++;
|
||||
roomMap.put(room.getId(), room);
|
||||
});
|
||||
|
||||
createSystemChannels(galaxy.getName());
|
||||
return super.initialize();
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ public class GalacticManager extends Manager {
|
||||
objectManager = new ObjectManager();
|
||||
playerManager = new PlayerManager();
|
||||
gameManager = new GameManager();
|
||||
chatManager = new ChatManager();
|
||||
chatManager = new ChatManager(g);
|
||||
prevPacketIntent = null;
|
||||
|
||||
addChildService(objectManager);
|
||||
@@ -65,7 +65,6 @@ public class GalacticManager extends Manager {
|
||||
@Override
|
||||
public boolean initialize() {
|
||||
registerForIntent(InboundPacketIntent.TYPE);
|
||||
chatManager.initializeGalaxyChannels(galaxy);
|
||||
return super.initialize();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user