Files
Holocore/scripts/commands/generic/groupChat.js
T
2016-09-16 08:36:42 +02:00

23 lines
853 B
JavaScript

function executeCommand(galacticManager, player, target, args) {
if(args.isEmpty()) {
// Should there for some reason be no actual message to display, do nothing
return;
}
var groupObjectId = player.getCreatureObject().getGroupId();
if(groupObjectId == 0) {
// If their group object ID is 0, they're ungrouped. Ungrouped players can't send group messages.
return;
}
var CoreManager = Java.type("services.CoreManager");
var galaxy = CoreManager.getGalaxy().getName();
var groupChatPath = "SWG." + galaxy + ".group." + groupObjectId + ".GroupChat";
var ChatRoomUpdateIntent = Java.type("intents.chat.ChatRoomUpdateIntent");
var UpdateType = Java.type("intents.chat.ChatRoomUpdateIntent.UpdateType");
new ChatRoomUpdateIntent(player, groupChatPath, groupObjectId, null,
args, UpdateType.SEND_MESSAGE, false).broadcast();
}