bedrock-portal 0.8.3 → 0.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -4
- package/dist/modules/inviteOnMessage.js +5 -1
- package/dist/modules/multipleAccounts.js +0 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -294,8 +294,8 @@ Emitted when a player is added as a friend. This event is only emitted when the
|
|
|
294
294
|
### portal.on('friendRemoved', (player) => void)
|
|
295
295
|
Emitted when a player is removed as a friend. This event is only emitted when the `autoFriendAdd` module is enabled.
|
|
296
296
|
|
|
297
|
-
### portal.on('
|
|
298
|
-
Emitted when a message is
|
|
297
|
+
### portal.on('messageReceived', (message) => void)
|
|
298
|
+
Emitted when a message is received from a player. This event is only emitted when the `inviteOnMessage` module is enabled.
|
|
299
299
|
|
|
300
300
|
### portal.on('memberCountUpdate', (memberCount) => void)
|
|
301
301
|
Emitted when the member count of the session is updated. This event is only emitted when the `updateMemberCount` module is enabled.
|
package/dist/index.d.ts
CHANGED
|
@@ -7,10 +7,11 @@ import Host from './classes/Host';
|
|
|
7
7
|
import Player from './classes/Player';
|
|
8
8
|
import Module from './classes/Module';
|
|
9
9
|
import { Joinability } from './common/constants';
|
|
10
|
-
import AutoFriendAdd from './modules/
|
|
10
|
+
import AutoFriendAdd from './modules/autoFriendAdd';
|
|
11
11
|
import InviteOnMessage from './modules/inviteOnMessage';
|
|
12
12
|
import RedirectFromRealm from './modules/redirectFromRealm';
|
|
13
13
|
import MultipleAccounts from './modules/multipleAccounts';
|
|
14
|
+
import AutoFriendAccept from './modules/autoFriendAccept';
|
|
14
15
|
import UpdateMemberCount from './modules/updateMemberCount';
|
|
15
16
|
type BedrockPortalOptions = {
|
|
16
17
|
/**
|
|
@@ -84,6 +85,7 @@ interface PortalEvents {
|
|
|
84
85
|
playerJoin: (player: Player) => void;
|
|
85
86
|
playerLeave: (player: Player) => void;
|
|
86
87
|
messageRecieved: (message: Message) => void;
|
|
88
|
+
messageReceived: (message: Message) => void;
|
|
87
89
|
friendRemoved: (player: Player) => void;
|
|
88
90
|
friendAdded: (player: Player) => void;
|
|
89
91
|
memberCountUpdate: (data: {
|
|
@@ -156,7 +158,7 @@ declare const Modules: {
|
|
|
156
158
|
InviteOnMessage: typeof InviteOnMessage;
|
|
157
159
|
RedirectFromRealm: typeof RedirectFromRealm;
|
|
158
160
|
MultipleAccounts: typeof MultipleAccounts;
|
|
159
|
-
AutoFriendAccept: typeof
|
|
161
|
+
AutoFriendAccept: typeof AutoFriendAccept;
|
|
160
162
|
UpdateMemberCount: typeof UpdateMemberCount;
|
|
161
163
|
};
|
|
162
164
|
export { Modules };
|
package/dist/index.js
CHANGED
|
@@ -13,11 +13,11 @@ const Module_1 = __importDefault(require("./classes/Module"));
|
|
|
13
13
|
exports.Module = Module_1.default;
|
|
14
14
|
const constants_1 = require("./common/constants");
|
|
15
15
|
const Event_1 = __importDefault(require("./handlers/Event"));
|
|
16
|
-
const
|
|
16
|
+
const autoFriendAdd_1 = __importDefault(require("./modules/autoFriendAdd"));
|
|
17
17
|
const inviteOnMessage_1 = __importDefault(require("./modules/inviteOnMessage"));
|
|
18
18
|
const redirectFromRealm_1 = __importDefault(require("./modules/redirectFromRealm"));
|
|
19
19
|
const multipleAccounts_1 = __importDefault(require("./modules/multipleAccounts"));
|
|
20
|
-
const
|
|
20
|
+
const autoFriendAccept_1 = __importDefault(require("./modules/autoFriendAccept"));
|
|
21
21
|
const updateMemberCount_1 = __importDefault(require("./modules/updateMemberCount"));
|
|
22
22
|
const start_game_1 = require("./common/start_game");
|
|
23
23
|
const util_1 = require("./common/util");
|
|
@@ -251,11 +251,11 @@ exports.BedrockPortal = BedrockPortal;
|
|
|
251
251
|
var constants_2 = require("./common/constants");
|
|
252
252
|
Object.defineProperty(exports, "Joinability", { enumerable: true, get: function () { return constants_2.Joinability; } });
|
|
253
253
|
const Modules = {
|
|
254
|
-
AutoFriendAdd:
|
|
254
|
+
AutoFriendAdd: autoFriendAdd_1.default,
|
|
255
255
|
InviteOnMessage: inviteOnMessage_1.default,
|
|
256
256
|
RedirectFromRealm: redirectFromRealm_1.default,
|
|
257
257
|
MultipleAccounts: multipleAccounts_1.default,
|
|
258
|
-
AutoFriendAccept:
|
|
258
|
+
AutoFriendAccept: autoFriendAccept_1.default,
|
|
259
259
|
UpdateMemberCount: updateMemberCount_1.default,
|
|
260
260
|
};
|
|
261
261
|
exports.Modules = Modules;
|
|
@@ -32,7 +32,11 @@ class IniteOnMessage extends Module_1.default {
|
|
|
32
32
|
if (newMessages.length === 0)
|
|
33
33
|
return;
|
|
34
34
|
for (const message of newMessages) {
|
|
35
|
-
portal.
|
|
35
|
+
if (portal.listenerCount('messageRecieved') > 0) {
|
|
36
|
+
console.warn('[Deprecation Warning]: The event \'messageRecieved\' is deprecated and will be removed in a future release. Please use \'messageReceived\' instead.');
|
|
37
|
+
portal.emit('messageRecieved', message.lastMessage);
|
|
38
|
+
}
|
|
39
|
+
portal.emit('messageReceived', message.lastMessage);
|
|
36
40
|
const senderXuid = message.lastMessage.sender;
|
|
37
41
|
if (senderXuid === '0')
|
|
38
42
|
continue;
|
|
@@ -25,7 +25,6 @@ class MultipleAccounts extends Module_1.default {
|
|
|
25
25
|
const peer = new Host_1.default(portal, account);
|
|
26
26
|
await peer.connect();
|
|
27
27
|
if (!peer.profile || !peer.connectionId) {
|
|
28
|
-
// @ts-expect-error - username isn't defined on Authflow
|
|
29
28
|
this.debug(`Failed to connect to ${account.username}`);
|
|
30
29
|
continue;
|
|
31
30
|
}
|
package/package.json
CHANGED