Added a game.user.isFirstGM property
This commit is contained in:
@@ -676,7 +676,7 @@ export class RollnKeepDialog extends FormApplication {
|
||||
|
||||
// Delete old chat message related to this series
|
||||
if (game.settings.get("l5r5e", "rnk-deleteOldMessage")) {
|
||||
if (game.user.isGM) {
|
||||
if (game.user.isFirstGM) {
|
||||
const message = game.messages.get(msgOldId);
|
||||
if (message) {
|
||||
message.delete();
|
||||
|
||||
@@ -16,6 +16,13 @@ export default class HooksL5r5e {
|
||||
* Do anything once the system is ready
|
||||
*/
|
||||
static async ready() {
|
||||
// If multiple GM connected, tag the 1st alive, useful for some traitements
|
||||
Object.defineProperty(game.user, "isFirstGM", {
|
||||
get: function () {
|
||||
return game.user.isGM && game.user.id === game.users.find((u) => u.active && u.isGM)?.id;
|
||||
},
|
||||
});
|
||||
|
||||
// Migration stuff
|
||||
if (game.l5r5e.migrations.needUpdate(game.l5r5e.migrations.NEEDED_VERSION)) {
|
||||
game.l5r5e.migrations.migrateWorld({ force: false });
|
||||
|
||||
@@ -24,7 +24,7 @@ export class MigrationL5r5e {
|
||||
* @return {Promise<void>} A Promise which resolves once the migration is completed
|
||||
*/
|
||||
static async migrateWorld(options = { force: false }) {
|
||||
if (!game.user.isGM) {
|
||||
if (!game.user.isFirstGM) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,9 +44,9 @@ export class SocketHandlerL5r5e {
|
||||
});
|
||||
}
|
||||
_onDeleteChatMessage(data) {
|
||||
// Only delete the message if the user is a GM (otherwise it have no real effect)
|
||||
// Only delete the message if the user is a GM (otherwise it has no real effect)
|
||||
// Currently only used in RnK
|
||||
if (!game.user.isGM || !game.settings.get("l5r5e", "rnk-deleteOldMessage")) {
|
||||
if (!game.user.isFirstGM || !game.settings.get("l5r5e", "rnk-deleteOldMessage")) {
|
||||
return;
|
||||
}
|
||||
const message = game.messages.get(data.messageId);
|
||||
|
||||
Reference in New Issue
Block a user