create-yeow 0.3.0 → 0.3.5

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.3.0",
3
+ "version": "0.3.5",
4
4
  "description": "Scaffold a Yeow plugin project",
5
5
  "type": "module",
6
6
  "bin": {
@@ -35,7 +35,7 @@ const HEADLESS = process.argv.includes('--eula') || process.argv.includes('--tim
35
35
  || process.argv.includes('--wait') || process.argv.includes('--outfile') || KEEP;
36
36
 
37
37
  const cfg = JSON.parse(readFileSync(resolve(ROOT, 'yeow.config.json'), 'utf-8'));
38
- const RUNTIME = resolve(ROOT, '.yeow', 'assets', 'yeow-runtime-0.1.0.jar');
38
+ const RUNTIME = resolve(ROOT, '.yeow', 'assets', 'yeow-runtime-0.2.0.jar');
39
39
 
40
40
  // Dev server config (optional, from yeow.config.json)
41
41
  const devCfg = cfg.dev || {};
@@ -434,7 +434,10 @@ async function printFormattedError(err) {
434
434
  }
435
435
 
436
436
  function startServer() {
437
- const jvmArgs = ['-Xmx4G', '-Xms4G', '-Dfile.encoding=UTF-8', '-Dstdout.encoding=UTF-8', '-Dyeow.dev=true', '-Dyeow.ws.port=' + WS_PORT];
437
+ // 注意:不设 -Dstdout.encoding=UTF-8——主路径 stdout 直接继承控制台(stdio: inherit),
438
+ // 强制 UTF-8 会在 GBK 控制台(中文 Windows)产生中文乱码;不设时 JVM 自动匹配控制台编码。
439
+ // headless 路径(管道 + readline 解码)才需要 UTF-8 强制。
440
+ const jvmArgs = ['-Xmx4G', '-Xms4G', '-Dfile.encoding=UTF-8', '-Dyeow.dev=true', '-Dyeow.ws.port=' + WS_PORT];
438
441
  info(`\nStarting Paper ${PAPER_VERSION} server...`);
439
442
  proc = spawn('java', [...jvmArgs, '-jar', resolve(SERVER, PAPER_JAR), '--nogui'], { cwd: SERVER, stdio: ['pipe', 'inherit', 'inherit'] });
440
443
  proc.on('exit', code => { warn(`Server exited (${code})`); if (wss) wss.close(); process.exit(0); });
@@ -11,8 +11,8 @@ onLoad(() => {
11
11
  eventOn('playerDeath', async (e) => {
12
12
  const loc = e.player.location;
13
13
  if (!loc) return;
14
- const data = JSON.stringify({ x: loc.x, y: loc.y, z: loc.z, world: loc.world || e.player.world });
15
- pdcSet(e.player.uuid, 'back.deathLocation', data);
14
+ // PDC 自动 JSON 序列化:直接存取对象(无需手写 JSON.stringify/parse)
15
+ pdcSet(e.player.uuid, 'back.deathLocation', { x: loc.x, y: loc.y, z: loc.z, world: loc.world || e.player.world });
16
16
  await e.player.sendMessage(
17
17
  '<red>You died!</red> <gray>Use</gray> <click:run_command:/back><aqua><u>/back</u></aqua></click> <gray>to return</gray>',
18
18
  );
@@ -24,10 +24,9 @@ onLoad(() => {
24
24
  executor: async (p) => {
25
25
  if (p.sender === 'CONSOLE') return;
26
26
  const player = p.sender; // 已确认非 CONSOLE → Player
27
- const raw = await pdcGet(player.uuid, 'back.deathLocation');
28
- if (!raw) return player.sendMessage('<red>No death location recorded</red>');
27
+ const loc = await pdcGet(player.uuid, 'back.deathLocation');
28
+ if (!loc) return player.sendMessage('<red>No death location recorded</red>');
29
29
 
30
- const loc = JSON.parse(raw);
31
30
  await player.teleport(new Location(loc.x, loc.y, loc.z, 0, 0, loc.world));
32
31
  await player.sendMessage('<green>Teleported to death location</green>');
33
32
  },
@@ -12,8 +12,8 @@ onLoad(() => {
12
12
  eventOn('playerDeath', async (e: PlayerDeathEvent) => {
13
13
  const loc = e.player.location;
14
14
  if (!loc) return;
15
- const data = JSON.stringify({ x: loc.x, y: loc.y, z: loc.z, world: loc.world || e.player.world });
16
- pdcSet(e.player.uuid, 'back.deathLocation', data);
15
+ // PDC 自动 JSON 序列化:直接存取对象(无需手写 JSON.stringify/parse)
16
+ pdcSet(e.player.uuid, 'back.deathLocation', { x: loc.x, y: loc.y, z: loc.z, world: loc.world || e.player.world });
17
17
  await e.player.sendMessage(
18
18
  '<red>You died!</red> <gray>Use</gray> <click:run_command:/back><aqua><u>/back</u></aqua></click> <gray>to return</gray>',
19
19
  );
@@ -25,10 +25,9 @@ onLoad(() => {
25
25
  executor: async (p) => {
26
26
  if (p.sender === 'CONSOLE') return;
27
27
  const player = p.sender; // 已确认非 CONSOLE → Player
28
- const raw = await pdcGet(player.uuid, 'back.deathLocation');
29
- if (!raw) return player.sendMessage('<red>No death location recorded</red>');
28
+ const loc = await pdcGet<{ x: number; y: number; z: number; world: string }>(player.uuid, 'back.deathLocation');
29
+ if (!loc) return player.sendMessage('<red>No death location recorded</red>');
30
30
 
31
- const loc = JSON.parse(raw);
32
31
  await player.teleport(new Location(loc.x, loc.y, loc.z, 0, 0, loc.world));
33
32
  await player.sendMessage('<green>Teleported to death location</green>');
34
33
  },