Skip to content

Commit

Permalink
add isPublic and room info command
Browse files Browse the repository at this point in the history
  • Loading branch information
onlypuppy7 committed Nov 20, 2024
1 parent d4f818f commit 34b81b9
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 2 deletions.
2 changes: 1 addition & 1 deletion plugins_default/LegacyShellCore/items/Stamps.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var items = {
"category_name": "Stamps",
"exclusive_for_class": null,
"item_data": {},
"is_available": true
"is_available": false
}]
};

Expand Down
50 changes: 49 additions & 1 deletion src/shell/permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,13 +321,37 @@ export class PermissionsConstructor {
category: "room",
description: "View current game options.",
example: "(no input needed)",
permissionLevel: [this.ranksEnum.Moderator, this.ranksEnum.Guest, true],
permissionLevel: [this.ranksEnum.Guest, this.ranksEnum.Guest, false],
inputType: ["bool"],
executeClient: ({ player, opts, mentions }) => {},
executeServer: ({ player, opts, mentions }) => {
player.client.commandFeedback(JSON.stringify(this.room.gameOptions));
},
});
this.newCommand({
identifier: "roominfo",
name: "info",
category: "room",
description: "View current room's info.",
example: "(no input needed)",
permissionLevel: [this.ranksEnum.Guest, this.ranksEnum.Guest, false],
inputType: ["bool"],
executeClient: ({ player, opts, mentions }) => {},
executeServer: ({ player, opts, mentions }) => {
player.client.commandFeedback(JSON.stringify({
ready: true,
playerLimit: this.room.playerLimit,
playerCount: this.room.details.count,

joinType: this.room.joinType,
gameType: this.room.gameType,
mapId: this.mapId,
gameId: this.room.gameId,
gameKey: this.room.gameKey,
locked: this.room.locked,
}).replaceAll(',"',', "'));
},
});
this.newCommand({
identifier: "lock",
name: "lock",
Expand All @@ -349,6 +373,30 @@ export class PermissionsConstructor {
this.room.updateRoomDetails();
},
});
this.newCommand({
identifier: "isPublic",
name: "isPublic",
category: "room",
description: "Change this room's visibility.",
example: "true",
usage: "true: public, false: private",
permissionLevel: [this.ranksEnum.Moderator, this.ranksEnum.Moderator, false],
inputType: ["bool"],
executeClient: ({ player, opts, mentions }) => {},
executeServer: ({ player, opts, mentions }) => {
if (this.room.locked && opts) {
player.client.commandFeedback(`Room locked: can't make public.`);
} else {
this.room.joinType = opts ? Comm.Code.joinPublicGame : Comm.Code.createPrivateGame;
if (opts) {
player.client.commandFeedback(`Room moved to public pool.`);
} else {
player.client.commandFeedback(`Room made private/invite only.`);
};
this.room.updateRoomDetails();
};
},
});

//rounds
this.newCommand({
Expand Down

0 comments on commit 34b81b9

Please sign in to comment.