From 305d3429c8f802f5398f82f1f57023fb738cd5b3 Mon Sep 17 00:00:00 2001 From: tkrmagid Date: Fri, 5 Jun 2026 17:48:21 +0900 Subject: [PATCH] v0.4.36: suppress command/preload chat broadcast Command-block and player usage no longer spams chat: - Command feedback (videoPlace/videoDelete/videoMute) now uses sendSuccess(..., false) so only the executor sees it; command blocks write to their own output + server log instead of broadcasting to ops. - Removed client-side [videopreload]/[videocache] notifyChat spam in VideoCache; download status remains in the client log via LOG. Co-Authored-By: Claude Opus 4 --- gradle.properties | 2 +- .../client/playback/VideoCache.java | 30 +------------------ .../command/VideoDeleteCommand.java | 2 +- .../videoplayer/command/VideoMuteCommand.java | 2 +- .../command/VideoPlaceCommand.java | 2 +- 5 files changed, 5 insertions(+), 33 deletions(-) diff --git a/gradle.properties b/gradle.properties index 8184e84..73e85e5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ org.gradle.configuration-cache=false # Mod mod_id=video_player -mod_version=0.4.35 +mod_version=0.4.36 maven_group=com.ejclaw.videoplayer archives_base_name=video_player diff --git a/src/main/java/com/ejclaw/videoplayer/client/playback/VideoCache.java b/src/main/java/com/ejclaw/videoplayer/client/playback/VideoCache.java index 2f0640b..97ba5c0 100644 --- a/src/main/java/com/ejclaw/videoplayer/client/playback/VideoCache.java +++ b/src/main/java/com/ejclaw/videoplayer/client/playback/VideoCache.java @@ -3,9 +3,7 @@ package com.ejclaw.videoplayer.client.playback; import com.ejclaw.videoplayer.VideoPlayerMod; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; -import net.minecraft.network.chat.Component; import java.io.InputStream; import java.io.OutputStream; @@ -138,7 +136,6 @@ public final class VideoCache { boolean gone = Files.deleteIfExists(p); VideoPlayerMod.LOG.info("[{}] purge: {} -> deleted={} ({})", VideoPlayerMod.MOD_ID, url, gone, p.getFileName()); - if (gone) notifyChat("[videocache] 캐시 삭제: " + url, ChatFormatting.YELLOW); } catch (Throwable t) { VideoPlayerMod.LOG.warn("[{}] purge failed for {}: {}", VideoPlayerMod.MOD_ID, url, t.toString()); @@ -202,7 +199,6 @@ public final class VideoCache { } VideoPlayerMod.LOG.info("[{}] clearAll: deleted={} failed={}", VideoPlayerMod.MOD_ID, deleted, failed); - notifyChat("[videocache] 전체 캐시 삭제: " + deleted + "개 파일", ChatFormatting.YELLOW); } /** Kick off a background download. No-op if already cached or in flight. */ @@ -215,15 +211,13 @@ public final class VideoCache { // a stale key would silently block a re-preload. if (lookup(url) != null) { VideoPlayerMod.LOG.info("[{}] preload: already cached {}", VideoPlayerMod.MOD_ID, url); - notifyChat("[videopreload] 이미 캐시됨: " + url, ChatFormatting.GRAY); return; } if (!IN_FLIGHT.add(url)) { VideoPlayerMod.LOG.info("[{}] preload: already downloading {}", VideoPlayerMod.MOD_ID, url); - notifyChat("[videopreload] 이미 다운로드 중: " + url, ChatFormatting.GRAY); return; } - notifyChat("[videopreload] 다운로드 대기열 추가: " + url, ChatFormatting.YELLOW); + VideoPlayerMod.LOG.info("[{}] preload: queued {}", VideoPlayerMod.MOD_ID, url); // Capture the current epoch at submit time. The download thread checks against // CACHE_EPOCH later — any mismatch means clearAll() ran in between and this // download must abort without publishing. @@ -370,7 +364,6 @@ public final class VideoCache { } VideoPlayerMod.LOG.info("[{}] preload: indexed existing cache {} -> {}", VideoPlayerMod.MOD_ID, url, finalPath.getFileName()); - notifyChat("[videopreload] 기존 캐시 사용: " + url, ChatFormatting.GREEN); return; } @@ -385,8 +378,6 @@ public final class VideoCache { VideoPlayerMod.LOG.warn( "[{}] preload: total-cache cap reached ({}/{} MB); aborting {}", VideoPlayerMod.MOD_ID, usedMb, capMb, url); - notifyChat("[videopreload] 실패 (전체 캐시 " + capMb + "MB 초과 / 현재 " - + usedMb + "MB): " + url, ChatFormatting.RED); return; } @@ -400,7 +391,6 @@ public final class VideoCache { if (code >= 400) { VideoPlayerMod.LOG.warn("[{}] preload: HTTP {} for {}", VideoPlayerMod.MOD_ID, code, url); - notifyChat("[videopreload] 실패 (HTTP " + code + "): " + url, ChatFormatting.RED); return; } } @@ -427,8 +417,6 @@ public final class VideoCache { VideoPlayerMod.MOD_ID, url, capMb); // Same close-before-delete dance for Windows. cancelled = true; - notifyChat("[videopreload] 실패 (단일 영상 " + capMb + "MB 초과): " + url, - ChatFormatting.RED); break; } if (existingCacheBytes + total > MAX_CACHE_BYTES) { @@ -438,8 +426,6 @@ public final class VideoCache { "[{}] preload: total-cache cap exceeded ({}>{} MB); aborting {}", VideoPlayerMod.MOD_ID, usedMb, capMb, url); cancelled = true; - notifyChat("[videopreload] 실패 (전체 캐시 " + capMb + "MB 초과): " + url, - ChatFormatting.RED); break; } out.write(buf, 0, n); @@ -475,13 +461,9 @@ public final class VideoCache { } VideoPlayerMod.LOG.info("[{}] preload: cached {} ({} bytes) -> {}", VideoPlayerMod.MOD_ID, url, total, finalPath.getFileName()); - long mb = Math.max(1, total / (1024 * 1024)); - notifyChat("[videopreload] 완료 (" + mb + " MB): " + url, ChatFormatting.GREEN); } catch (Throwable t) { VideoPlayerMod.LOG.warn("[{}] preload failed for {}: {}", VideoPlayerMod.MOD_ID, url, t.toString()); - notifyChat("[videopreload] 실패 (" + t.getClass().getSimpleName() + "): " + url, - ChatFormatting.RED); // Best-effort cleanup of any leftover .part on the error path. if (partPath != null) { try { Files.deleteIfExists(partPath); } catch (Throwable ignored) {} @@ -494,16 +476,6 @@ public final class VideoCache { } } - /** Post a status line to the local player's chat. No-op if there's no client/player yet. */ - private static void notifyChat(String text, ChatFormatting color) { - Minecraft mc = Minecraft.getInstance(); - if (mc == null) return; - mc.execute(() -> { - if (mc.player == null) return; - mc.player.sendSystemMessage(Component.literal(text).withStyle(color)); - }); - } - /** * Sum of regular-file sizes under {@code dir}, skipping {@code excludePart} (the .part file * for the in-flight download — we account for that via the running {@code total} counter). diff --git a/src/main/java/com/ejclaw/videoplayer/command/VideoDeleteCommand.java b/src/main/java/com/ejclaw/videoplayer/command/VideoDeleteCommand.java index 9370fbf..33a28cd 100644 --- a/src/main/java/com/ejclaw/videoplayer/command/VideoDeleteCommand.java +++ b/src/main/java/com/ejclaw/videoplayer/command/VideoDeleteCommand.java @@ -38,7 +38,7 @@ public final class VideoDeleteCommand { return 0; } level.setBlock(pos, Blocks.AIR.defaultBlockState(), Block.UPDATE_ALL); - src.sendSuccess(() -> Component.literal("anchor deleted at " + pos.toShortString()), true); + src.sendSuccess(() -> Component.literal("anchor deleted at " + pos.toShortString()), false); return 1; } } diff --git a/src/main/java/com/ejclaw/videoplayer/command/VideoMuteCommand.java b/src/main/java/com/ejclaw/videoplayer/command/VideoMuteCommand.java index bc87d02..9e5c109 100644 --- a/src/main/java/com/ejclaw/videoplayer/command/VideoMuteCommand.java +++ b/src/main/java/com/ejclaw/videoplayer/command/VideoMuteCommand.java @@ -54,7 +54,7 @@ public final class VideoMuteCommand { ServerPlayNetworking.send(p, new SyncAnchorPayload(pos, be.toNbt())); } final boolean mFinal = muted; - src.sendSuccess(() -> Component.literal("anchor " + (mFinal ? "muted" : "unmuted")), true); + src.sendSuccess(() -> Component.literal("anchor " + (mFinal ? "muted" : "unmuted")), false); return 1; } } diff --git a/src/main/java/com/ejclaw/videoplayer/command/VideoPlaceCommand.java b/src/main/java/com/ejclaw/videoplayer/command/VideoPlaceCommand.java index 173981f..3479c04 100644 --- a/src/main/java/com/ejclaw/videoplayer/command/VideoPlaceCommand.java +++ b/src/main/java/com/ejclaw/videoplayer/command/VideoPlaceCommand.java @@ -128,7 +128,7 @@ public final class VideoPlaceCommand { ServerPlayNetworking.send(p, new SyncAnchorPayload(pos, nbt)); } final BlockPos fp = pos; - src.sendSuccess(() -> Component.literal("anchor placed at " + fp.toShortString()), true); + src.sendSuccess(() -> Component.literal("anchor placed at " + fp.toShortString()), false); return 1; }