create-yeow 0.2.8 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-yeow",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "Scaffold a Yeow plugin project",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,5 +1,5 @@
1
1
  import * as esbuild from 'esbuild';
2
- import { readFileSync, mkdirSync, existsSync, statSync } from 'fs';
2
+ import { readFileSync, mkdirSync, existsSync, statSync, readdirSync } from 'fs';
3
3
  import { resolve } from 'path';
4
4
  import { fileURLToPath } from 'url';
5
5
  import AdmZip from 'adm-zip';
@@ -33,6 +33,18 @@ esbuild.build({
33
33
  zip.addFile('.yeow/main.js', readFileSync(resolve(outDir, 'main.js')));
34
34
  zip.addFile('yeow.json', Buffer.from(JSON.stringify(cfg)));
35
35
 
36
+ // Include assets/ directory
37
+ const assetsDir = resolve(root, 'assets');
38
+ if (existsSync(assetsDir)) {
39
+ for (const f of readdirSync(assetsDir, { recursive: true })) {
40
+ const fp = resolve(assetsDir, f);
41
+ if (statSync(fp).isFile()) {
42
+ zip.addFile('assets/' + f, readFileSync(fp));
43
+ }
44
+ }
45
+ console.log(' ✓ Assets included');
46
+ }
47
+
36
48
  const outJar = resolve(root, 'dist', `${name}-${version}.jar`);
37
49
  zip.writeZip(outJar);
38
50
  console.log(` ✓ Packaged ${outJar}\n`);
File without changes
@@ -7,7 +7,7 @@
7
7
  "dev": "node .yeow/dev-server.js"
8
8
  },
9
9
  "dependencies": {
10
- "yeow-api": "^0.2.5"
10
+ "yeow-api": "^0.2.8"
11
11
  },
12
12
  "devDependencies": {
13
13
  "esbuild": "^0.25.0",
@@ -1,12 +1,13 @@
1
- import { Player, registerCommand, eventOn, broadcast, call } from 'yeow-api';
1
+ import { Player, registerCommand, broadcast, eventOn, onInit, onLoad } from 'yeow-api';
2
+ import type { PlayerJoinEvent, BlockBreakEvent } from 'yeow-api';
2
3
 
3
- function onInit() {
4
+ onInit(() => {
4
5
  console.log('[init] Plugin loaded');
5
- }
6
+ });
6
7
 
7
- function onLoad() {
8
+ onLoad(() => {
8
9
  console.log('[load] Ready');
9
- }
10
+ });
10
11
 
11
12
  registerCommand('hello', {
12
13
  description: 'Say hello',
@@ -21,19 +22,11 @@ registerCommand('ping', {
21
22
  },
22
23
  });
23
24
 
24
- registerCommand('time', {
25
- description: 'Show world time',
26
- executor: (p) => {
27
- const t = call('world.getTime', { world: 'world' });
28
- p.sender.sendMessage(`<aqua>Time: ${t}</aqua>`);
29
- },
30
- });
31
-
32
- eventOn('playerJoin', (e) => {
33
- console.log(`Player joined: ${e.player}`);
25
+ eventOn('playerJoin', (e: PlayerJoinEvent) => {
26
+ console.log(`Player joined: ${e.player.name}`);
34
27
  broadcast(e.joinMessage);
35
28
  });
36
29
 
37
- eventOn('blockBreak', (e) => {
30
+ eventOn('blockBreak', (e: BlockBreakEvent) => {
38
31
  if (e.block === 'minecraft:bedrock') e.cancelled = true;
39
32
  });