Skip to content

Commit

Permalink
Add version number to welcome message
Browse files Browse the repository at this point in the history
  • Loading branch information
ForestOfLight committed Jan 28, 2025
1 parent 9e7f672 commit 980e711
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 21 deletions.
File renamed without changes.
24 changes: 13 additions & 11 deletions Canopy [BP]/scripts/src/validWorld.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { world, system } from '@minecraft/server';
import ProbeManager from 'src/classes/ProbeManager';
import { Extensions } from '../lib/canopy/Canopy';
import { world, system } from "@minecraft/server";
import ProbeManager from "./classes/ProbeManager";
import { Extensions } from "../lib/canopy/Canopy";
import { PACK_VERSION } from "../constants";

const hasShownWelcome = {};

Expand Down Expand Up @@ -28,14 +29,15 @@ function onValidWorld(player) {
}

function displayWelcome(player) {
let graphic = '';
graphic += `§a + ----- +\n`;
graphic += `§a / / |\n`;
graphic += `§a+ ----- + |\n`;
graphic += `§a | | +\n`;
graphic += `§a | | /\n`;
graphic += `§a+ ----- +\n`;
player.sendMessage({ rawtext: [{ text: graphic }, { translate: 'generic.welcome.start' }] });
const graphic = [
'§a + ----- +\n',
'§a / / |\n',
'§a+ ----- + |\n',
'§a | | +\n',
'§a | | /\n',
'§a+ ----- +\n'
].join('');
player.sendMessage({ rawtext: [{ text: graphic }, { translate: 'generic.welcome.start', with: [PACK_VERSION] }] });
const extensions = Extensions.getVersionedNames();
if (extensions.length > 0)
player.sendMessage({ translate: 'generic.welcome.extensions', with: [extensions.join('§r§7, §a§o')] });
Expand Down
2 changes: 1 addition & 1 deletion Canopy [RP]/texts/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ entity.canopy:rideable.name=Canopy Rideable
action.hint.exit.canopy:rideable=Sneak to stand

## generic
generic.welcome.start=§7This server is running §l§aCanopy§r§7. Type ./help to get started.§r
generic.welcome.start=§7This server is running §l§aCanopy§r §a%s§7. Type ./help to get started.§r
generic.welcome.extensions=§7Loaded extensions: §a%s
generic.player.notfound=§cPlayer '%s' not found.
generic.target.notfound=§cTarget not found.
Expand Down
9 changes: 0 additions & 9 deletions __tests__/BP/scripts/config.test.js

This file was deleted.

11 changes: 11 additions & 0 deletions __tests__/BP/scripts/constants.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { describe, it, expect } from "vitest";
import { getCanopyVersion } from "../../utils";
import { PACK_VERSION } from "../../../Canopy [BP]/scripts/constants.js";

describe('Constants', () => {
describe('PACK_VERSION', () => {
it('should match the manifest version', () => {
expect(PACK_VERSION).toBe(getCanopyVersion());
});
});
});

0 comments on commit 980e711

Please sign in to comment.