Files
Holocore/scripts/commands/generic/removeFriend.js
T
Waverunner e257611842 Command java callbacks (ICmdCallback implementations) are instantiated once the command is called
Added new common methods to IntentFactory as well as suitable JavaDoc for all methods
Renamed "objManager" function variable in command scripts execute function to galManager (GalacticManager instance)
2015-08-05 15:17:22 -04:00

25 lines
829 B
JavaScript

var execute = function(galManager, player, target, args) {
var ChatAvatarRequestIntent = Java.type("intents.chat.ChatAvatarRequestIntent");
var RequestType = Java.type("intents.chat.ChatAvatarRequestIntent.RequestType");
var ProsePackage = Java.type("resources.encodables.ProsePackage");
var ChatBroadcastIntent = Java.type("intents.chat.ChatBroadcastIntent");
var ghost = player.getPlayerObject();
var name;
if(ghost == null || args == null) {
return;
}
name = args.split(" ")[0].toLowerCase(java.util.Locale.English);
if(name == null) {
return;
}
if(!ghost.getFriendsList().contains(name)) {
new ChatBroadcastIntent(player, new ProsePackage("@cmnty:friend_not_found", "TT", name)).broadcast();
return;
}
new ChatAvatarRequestIntent(player, name, RequestType.FRIEND_REMOVE_TARGET).broadcast();
};