diff --git a/PALAMOD_CDC.md b/PALAMOD_CDC.md index d6921e9..32eb5d3 100644 --- a/PALAMOD_CDC.md +++ b/PALAMOD_CDC.md @@ -538,6 +538,9 @@ avant M4 (TODO:crafts-machines). wiki + invisibilite 15 s wiki via MobEffectInstance, APIs verifiees javap) + /tpdeny. Bug corrige avant build : tp vers la cible (TpaTask), pas vers soi-meme. VERIFIE : build SUCCESSFUL, boot Done, 0 erreur. UNVERIFIED en jeu (2 joueurs requis). +- M-msg LIVRE 2026-10-19 ~02:55 : /msg + /r (wiki commandes, suivi + dernier expediteur par destinataire, double sens). VERIFIE : build SUCCESSFUL, boot Done, + 0 erreur. UNVERIFIED en jeu (2 joueurs requis). - Client/mod : boucle visuelle OPERATIONNELLE 2026-10-19 (Xvfb :99 + runClient SDL x11 + captures Java Robot + pilotage xdotool + vision_analyze) : menu, Select World, monde New World (creatif, cheats), /give, pose de bloc, inventaire, F3+T. Screens : scratch vis*.png. diff --git a/mods/pala/src/main/java/fr/surviepote/pala/PalaCommands.java b/mods/pala/src/main/java/fr/surviepote/pala/PalaCommands.java index 247badd..8894b42 100644 --- a/mods/pala/src/main/java/fr/surviepote/pala/PalaCommands.java +++ b/mods/pala/src/main/java/fr/surviepote/pala/PalaCommands.java @@ -38,6 +38,8 @@ public final class PalaCommands { private static final java.util.Map TPA_REQUESTS = new java.util.HashMap<>(); // TP differees vers un joueur (acceptees) : teleporte -> (cible, tick d'execution). private static final java.util.Map TPA_QUEUE = new java.util.HashMap<>(); + // M-msg (wiki commandes) : dernier expediteur par destinataire (pour /r). + private static final java.util.Map LAST_MSG = new java.util.HashMap<>(); private record TpaRequest(java.util.UUID from, long expireTick) { } @@ -96,6 +98,21 @@ public final class PalaCommands { .executes(command -> tpRespond(command.getSource(), true))); dispatcher.register(Commands.literal("tpdeny") .executes(command -> tpRespond(command.getSource(), false))); + dispatcher.register(Commands.literal("msg") + .then(Commands.argument("cible", EntityArgument.player()) + .then(Commands.argument("texte", + com.mojang.brigadier.arguments.StringArgumentType + .greedyString()) + .executes(command -> msg(command.getSource(), + EntityArgument.getPlayer(command, "cible"), + com.mojang.brigadier.arguments.StringArgumentType + .getString(command, "texte")))))); + dispatcher.register(Commands.literal("r") + .then(Commands.argument("texte", + com.mojang.brigadier.arguments.StringArgumentType.greedyString()) + .executes(command -> reply(command.getSource(), + com.mojang.brigadier.arguments.StringArgumentType + .getString(command, "texte"))))); net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents.END_SERVER_TICK .register(PalaCommands::tickSpawnQueue); net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents.END_SERVER_TICK @@ -279,6 +296,41 @@ public final class PalaCommands { } } + // /msg + /r : messages prives (wiki commandes). /r repond au + // dernier expediteur (suivi par destinataire). + private static int msg(CommandSourceStack source, ServerPlayer cible, String texte) { + try { + ServerPlayer player = source.getPlayerOrException(); + sendPrivate(player, cible, texte); + return Command.SINGLE_SUCCESS; + } catch (com.mojang.brigadier.exceptions.CommandSyntaxException e) { + return 0; + } + } + + private static int reply(CommandSourceStack source, String texte) { + try { + ServerPlayer player = source.getPlayerOrException(); + java.util.UUID last = LAST_MSG.get(player.getUUID()); + ServerPlayer cible = last == null ? null : source.getServer().getPlayerList().getPlayer(last); + if (cible == null) { + source.sendFailure(Component.literal("§cPersonne a qui repondre.")); + return 0; + } + sendPrivate(player, cible, texte); + return Command.SINGLE_SUCCESS; + } catch (com.mojang.brigadier.exceptions.CommandSyntaxException e) { + return 0; + } + } + + private static void sendPrivate(ServerPlayer from, ServerPlayer to, String texte) { + LAST_MSG.put(to.getUUID(), from.getUUID()); + LAST_MSG.put(from.getUUID(), to.getUUID()); + from.sendSystemMessage(Component.literal("§d[Moi -> " + to.getScoreboardName() + "] §f" + texte)); + to.sendSystemMessage(Component.literal("§d[" + from.getScoreboardName() + " -> Moi] §f" + texte)); + } + private static void tickSpawnQueue(MinecraftServer server) { if (SPAWN_QUEUE.isEmpty()) { return; diff --git a/server/mods/pala-0.2.1.jar b/server/mods/pala-0.2.1.jar index 3859f5e..8e1521d 100644 Binary files a/server/mods/pala-0.2.1.jar and b/server/mods/pala-0.2.1.jar differ