fix(plugins) basic private server variable
This commit is contained in:
@@ -3,6 +3,10 @@ export default class BasePlugin {
|
||||
constructor() {
|
||||
}
|
||||
|
||||
_getServer() {
|
||||
return this.#wetsock;
|
||||
}
|
||||
|
||||
initialize(wetsock) {
|
||||
this.#wetsock = wetsock;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ class EntityPlugin extends BasePlugin {
|
||||
|
||||
broadcast(clientId, message) {
|
||||
// Broadcast the message to all connected clients
|
||||
for (const [id, client] of this.#wetsock.clients) {
|
||||
for (const [id, client] of this._getServer().clients) {
|
||||
if (id !== clientId) {
|
||||
client.send(JSON.stringify(message));
|
||||
}
|
||||
@@ -57,7 +57,7 @@ class EntityPlugin extends BasePlugin {
|
||||
|
||||
send(clientId, message) {
|
||||
// Send the message to a specific client
|
||||
const client = this.#wetsock.clients.get(clientId);
|
||||
const client = this._getServer().clients.get(clientId);
|
||||
if (client) {
|
||||
client.send(JSON.stringify(message));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user