mirror of
https://github.com/ProjectSWGCore/Holocore.git
synced 2026-10-17 07:02:54 -04:00
Added basics of ChatService
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package services.chat;
|
||||
|
||||
import intents.GalacticPacketIntent;
|
||||
import network.packets.Packet;
|
||||
import network.packets.swg.zone.ChatRequestRoomList;
|
||||
import network.packets.swg.zone.insertion.ChatRoomList;
|
||||
import network.packets.swg.zone.insertion.ChatRoomList.ChatRoom;
|
||||
import resources.control.Intent;
|
||||
import resources.control.Service;
|
||||
import resources.player.Player;
|
||||
|
||||
public class ChatService extends Service {
|
||||
|
||||
public ChatService() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean initialize() {
|
||||
registerForIntent(GalacticPacketIntent.TYPE);
|
||||
return super.initialize();
|
||||
}
|
||||
|
||||
public void onIntentReceived(Intent i) {
|
||||
if (i instanceof GalacticPacketIntent) {
|
||||
Packet p = ((GalacticPacketIntent) i).getPacket();
|
||||
long netId = ((GalacticPacketIntent) i).getNetworkId();
|
||||
Player player = ((GalacticPacketIntent) i).getPlayerManager().getPlayerFromNetworkId(netId);
|
||||
if (player != null) {
|
||||
if (p instanceof ChatRequestRoomList)
|
||||
handleChatRoomListRequest(player, (ChatRequestRoomList) p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void handleChatRoomListRequest(Player player, ChatRequestRoomList request) {
|
||||
// ChatRoomList list = new ChatRoomList();
|
||||
// list.addChatRoom(new ChatRoom(1, 0, 0, "SWG.Josh Wifi.Chat.tcpa", "SWG", "Josh Wifi", player.getCreatureObject().getName(), player.getCreatureObject().getName(), "Chat"));
|
||||
// sendPacket(player, list);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user