OriginXMPP

所属分类:WEB开发
开发工具:Java
文件大小:50KB
下载次数:0
上传日期:2019-04-19 04:48:11
上 传 者sh-1993
说明:  一个与OriginsXMPP服务交互的库,与玩家聊天,发送接受好友请求等!
(A library for interacting with Origins XMPP service, chat with players, send accept friend requests and more!)

文件列表:
LICENSE (1062, 2019-04-19)
build.gradle (517, 2019-04-19)
out (0, 2019-04-19)
out\production (0, 2019-04-19)
out\production\classes (0, 2019-04-19)
out\production\classes\META-INF (0, 2019-04-19)
out\production\classes\META-INF\me.vrekt.Origin.main.kotlin_module (16, 2019-04-19)
out\production\classes\me (0, 2019-04-19)
out\production\classes\me\vrekt (0, 2019-04-19)
out\production\classes\me\vrekt\origin (0, 2019-04-19)
out\production\classes\me\vrekt\origin\DefaultOrigin.class (6226, 2019-04-19)
out\production\classes\me\vrekt\origin\Origin.class (1308, 2019-04-19)
out\production\classes\me\vrekt\origin\chat (0, 2019-04-19)
out\production\classes\me\vrekt\origin\chat\ChatService.class (469, 2019-04-19)
out\production\classes\me\vrekt\origin\chat\implementation (0, 2019-04-19)
out\production\classes\me\vrekt\origin\chat\implementation\ChatListener.class (486, 2019-04-19)
out\production\classes\me\vrekt\origin\chat\implementation\DefaultChatService$MessageListener.class (3133, 2019-04-19)
out\production\classes\me\vrekt\origin\chat\implementation\DefaultChatService.class (3702, 2019-04-19)
out\production\classes\me\vrekt\origin\chat\implementation\IncomingMessageListener.class (250, 2019-04-19)
out\production\classes\me\vrekt\origin\chat\implementation\message (0, 2019-04-19)
out\production\classes\me\vrekt\origin\chat\implementation\message\Message.class (1701, 2019-04-19)
out\production\classes\me\vrekt\origin\exception (0, 2019-04-19)
out\production\classes\me\vrekt\origin\exception\OriginException.class (460, 2019-04-19)
out\production\classes\me\vrekt\origin\friend (0, 2019-04-19)
out\production\classes\me\vrekt\origin\friend\DefaultFriendService$PacketListener.class (2912, 2019-04-19)
out\production\classes\me\vrekt\origin\friend\DefaultFriendService.class (4113, 2019-04-19)
out\production\classes\me\vrekt\origin\friend\FriendService.class (433, 2019-04-19)
out\production\classes\me\vrekt\origin\friend\implementation (0, 2019-04-19)
out\production\classes\me\vrekt\origin\friend\implementation\FriendListener.class (493, 2019-04-19)
src (0, 2019-04-19)
src\main (0, 2019-04-19)
src\main\java (0, 2019-04-19)
src\main\java\me (0, 2019-04-19)
src\main\java\me\vrekt (0, 2019-04-19)
src\main\java\me\vrekt\origin (0, 2019-04-19)
src\main\java\me\vrekt\origin\DefaultOrigin.java (11769, 2019-04-19)
src\main\java\me\vrekt\origin\Origin.java (4330, 2019-04-19)
src\main\java\me\vrekt\origin\chat (0, 2019-04-19)
... ...

# Origin A library for interacting with Origins XMPP service, chat with players, send/accept friend requests and more! # Features - Support for game presences, have custom text as your status! - Support for chatting with players. - Support for friends, listen for friend requests, send them, or accept one! - Basic Lobby support, receive invites, get lobby information. - Everything else `Nadir` supports. # Credits Origin uses `Nadir` made by [RobertoGraham](https://github.com/RobertoGraham/nadir), go check it out! # WIP This project is still a work in progress, expect more things to be soon! # Initializing and connecting You can either intialize an `Origin` instance with a username and password, or with an already built instance of `Nadir`. ```java final var origin = Origin.newOrigin(username, password); origin.connect(); ``` ```java final var origin = Origin.newOrigin(nadir); origin.connect(); ``` # Send/reply to messages ```java origin.chat().addChatListener(message -> { System.out.println("Message: " + message.getMessage()); message.reply("abc"); }); ``` # Listeners for when somebody is typing ```java origin.chat().addChatListener(new ChatListener() { @Override public void onMessageReceived(Message message) { System.err.println(message.getMessage()); } @Override public void onTyping(EntityBareJid from) { System.err.println("typing"); } }); ``` # Send a friend request ```java try { origin.getNadir().accounts().findAllBySearchTerms("vrektwastaken") .flatMap((final var list) -> list.stream() .findFirst()).ifPresent(account -> origin.friend().sendFriendRequest(account.userId())); } catch (final IOException exception) { exception.printStackTrace(); } ``` # Accept one ```java origin.friend().acceptFriendRequest(1008999560409L); ``` # Friend listeners ```java origin.friend().addFriendListener(new FriendListener() { @Override public void onFriendRequestAccepted(Long userId) { System.out.println("Accepted!"); } }); ``` # Presence ``` origin.presence().setGameTextPresence(new GameTextPresence("Your text here", "Your text here")); ``` # Listeners ``` origin.onConnect(() -> { // start code }); origin.onReconnect(() -> { // stop code temporarily }); ``` # Lobbies ``` final var lobby = origin.lobby().getLobby(1008999560409L); origin.lobby().addLobbyListener(new LobbyListener() { @Override public void onInvitation(String joinLink, String inviteId, Long userId) { final var lobby = origin.lobby().getLobby(userId); } }); ```

近期下载者

相关文件


收藏者