Add command to retrieve Lagoon account information in LagoonAddons
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { system, world } from "@minecraft/server";
|
import { CommandPermissionLevel, Player, system, world } from "@minecraft/server";
|
||||||
import utils from "utils";
|
import utils from "utils";
|
||||||
import { websocket } from "@minecraft/server-net";
|
import { websocket } from "@minecraft/server-net";
|
||||||
import { InitPlayer } from "entities/player";
|
import { InitPlayer } from "entities/player";
|
||||||
@@ -7,6 +7,19 @@ class LagoonAddons {
|
|||||||
constructor() {
|
constructor() {
|
||||||
this.timer = 0;
|
this.timer = 0;
|
||||||
world.afterEvents.worldLoad.subscribe(() => system.run(() => this.initEarlyExecution()));
|
world.afterEvents.worldLoad.subscribe(() => system.run(() => this.initEarlyExecution()));
|
||||||
|
system.beforeEvents.startup.subscribe((e) => {
|
||||||
|
e.customCommandRegistry.registerCommand({
|
||||||
|
name: 'lagoon',
|
||||||
|
description: 'Provides information for your Lagoon account.',
|
||||||
|
permissionLevel: CommandPermissionLevel.Any,
|
||||||
|
cheatsRequired: false
|
||||||
|
}, (origin) => {
|
||||||
|
const sender = origin.sourceEntity;
|
||||||
|
if (sender instanceof Player) {
|
||||||
|
sender.sendMessage(utils.prefix + '§aVotre lagoon code : ' + sender.lagoonCode + '\n§r§oMerci de ne pas divulguer ce code, il vous est propre !');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
async connect() {
|
async connect() {
|
||||||
this.ws = await websocket.connect('wss://lagoon.under-scape.com/ws/rooms/' + roomCode + '/plugins/proximity');
|
this.ws = await websocket.connect('wss://lagoon.under-scape.com/ws/rooms/' + roomCode + '/plugins/proximity');
|
||||||
|
|||||||
15
src/main.ts
15
src/main.ts
@@ -1,4 +1,4 @@
|
|||||||
import { system, world } from "@minecraft/server";
|
import { CommandPermissionLevel, Player, system, world } from "@minecraft/server";
|
||||||
import utils from "utils";
|
import utils from "utils";
|
||||||
import { websocket, WebSocketClient } from "@minecraft/server-net";
|
import { websocket, WebSocketClient } from "@minecraft/server-net";
|
||||||
import { InitPlayer } from "entities/player";
|
import { InitPlayer } from "entities/player";
|
||||||
@@ -11,6 +11,19 @@ class LagoonAddons {
|
|||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
world.afterEvents.worldLoad.subscribe(() => system.run(() => this.initEarlyExecution()));
|
world.afterEvents.worldLoad.subscribe(() => system.run(() => this.initEarlyExecution()));
|
||||||
|
system.beforeEvents.startup.subscribe((e) => {
|
||||||
|
e.customCommandRegistry.registerCommand({
|
||||||
|
name: 'lagoon',
|
||||||
|
description: 'Provides information for your Lagoon account.',
|
||||||
|
permissionLevel: CommandPermissionLevel.Any,
|
||||||
|
cheatsRequired: false
|
||||||
|
}, (origin) => {
|
||||||
|
const sender = origin.sourceEntity;
|
||||||
|
if (sender instanceof Player) {
|
||||||
|
sender.sendMessage(utils.prefix+'§aVotre lagoon code : '+sender.lagoonCode+'\n§r§oMerci de ne pas divulguer ce code, il vous est propre !');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async connect() {
|
async connect() {
|
||||||
|
|||||||
Reference in New Issue
Block a user