diff --git a/PALAMOD_CDC.md b/PALAMOD_CDC.md index f333d84..ed66768 100644 --- a/PALAMOD_CDC.md +++ b/PALAMOD_CDC.md @@ -620,6 +620,10 @@ avant M4 (TODO:crafts-machines). (trou detecte a la relecture) + /f list + /fc (chat faction, membres connectes). Lecon : chirurgie brigadier par indices de lignes + parencheck.py avant build. VERIFIE : build SUCCESSFUL, boot Done, 0 erreur. UNVERIFIED en jeu. +- M-faction-2c LIVRE 2026-10-19 ~04:50 : /f sethome (chef) + /f home (membres, multi-dim). + ECART : sans grades (GUI, M-faction-3), regle simplifiee chef/membres. Lecon : la ligne + /f list finissait par 4 parentheses (register inclus) — assert endswith trompeur. + VERIFIE : build SUCCESSFUL, boot Done, 0 erreur. UNVERIFIED en jeu. - M-palaforge LIVRE 2026-10-19 ~03:55 : bloc + BE partagee (3e mode) + gate mineur 14 + table fonte wiki §3.2 (31 items, ratio floor usure) + fuels bois (+buche/planches/baton, lave exclue : seau non rendu) + craft (1 findium + 4 furnaces + 4 briques, positions 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 40ed7f1..fb53c6f 100644 --- a/mods/pala/src/main/java/fr/surviepote/pala/PalaCommands.java +++ b/mods/pala/src/main/java/fr/surviepote/pala/PalaCommands.java @@ -197,7 +197,11 @@ public final class PalaCommands { .then(Commands.literal("unclaimall") .executes(command -> fUnclaim(command.getSource(), true))) .then(Commands.literal("list") - .executes(command -> fList(command.getSource())))); + .executes(command -> fList(command.getSource()))) + .then(Commands.literal("sethome") + .executes(command -> fSetHome(command.getSource()))) + .then(Commands.literal("home") + .executes(command -> fHome(command.getSource())))); dispatcher.register(Commands.literal("fc") .then(Commands.argument("texte", com.mojang.brigadier.arguments.StringArgumentType.greedyString()) @@ -727,6 +731,80 @@ public final class PalaCommands { } } + // M-faction-2c : home faction (chef pose, membres utilisent). Sans systeme de grades + // (GUI, M-faction-3) : regle simplifiee, ECART documente. + private static int fSetHome(CommandSourceStack source) { + try { + ServerPlayer player = source.getPlayerOrException(); + fr.surviepote.pala.core.PalaFactions fa = + fr.surviepote.pala.core.PalaFactions.get(); + fr.surviepote.pala.core.PalaFactions.Faction faction = + fa.byMember(player.getUUID().toString()); + if (faction == null || !faction.owner.equals(player.getUUID().toString())) { + source.sendFailure(Component.literal("§cSeul le chef peut definir le home.")); + return 0; + } + net.minecraft.core.BlockPos pos = player.blockPosition(); + faction.home = player.level().dimension().identifier().toString() + ":" + + pos.getX() + ":" + pos.getY() + ":" + pos.getZ(); + fa.markDirty(); + source.sendSuccess(() -> Component.literal("§6[Faction] §7Home defini."), false); + return Command.SINGLE_SUCCESS; + } catch (com.mojang.brigadier.exceptions.CommandSyntaxException e) { + return 0; + } + } + + private static int fHome(CommandSourceStack source) { + try { + ServerPlayer player = source.getPlayerOrException(); + fr.surviepote.pala.core.PalaFactions.Faction faction = + fr.surviepote.pala.core.PalaFactions.get() + .byMember(player.getUUID().toString()); + if (faction == null) { + source.sendFailure(Component.literal("§cVous n'etes dans aucune faction.")); + return 0; + } + if (faction.home == null || faction.home.isEmpty()) { + source.sendFailure(Component.literal("§cAucun home defini (/f sethome).")); + return 0; + } + String[] parts = faction.home.split(":"); + if (parts.length != 4) { + source.sendFailure(Component.literal("§cHome corrompu.")); + return 0; + } + net.minecraft.server.MinecraftServer server = source.getServer(); + net.minecraft.server.level.ServerLevel target = null; + for (net.minecraft.server.level.ServerLevel level : server.getAllLevels()) { + if (level.dimension().identifier().toString().equals(parts[0])) { + target = level; + break; + } + } + if (target == null) { + source.sendFailure(Component.literal("§cDimension inconnue.")); + return 0; + } + int x; + int y; + int z; + try { + x = Integer.parseInt(parts[1]); + y = Integer.parseInt(parts[2]); + z = Integer.parseInt(parts[3]); + } catch (NumberFormatException e) { + source.sendFailure(Component.literal("§cHome corrompu.")); + return 0; + } + teleportPlayer(player, target, + new net.minecraft.core.BlockPos(x, y, z)); + return Command.SINGLE_SUCCESS; + } catch (com.mojang.brigadier.exceptions.CommandSyntaxException e) { + return 0; + } + } + private static int fDisband(CommandSourceStack source) { try { ServerPlayer player = source.getPlayerOrException(); diff --git a/mods/pala/src/main/java/fr/surviepote/pala/core/PalaFactions.java b/mods/pala/src/main/java/fr/surviepote/pala/core/PalaFactions.java index 65ebab4..1d35505 100644 --- a/mods/pala/src/main/java/fr/surviepote/pala/core/PalaFactions.java +++ b/mods/pala/src/main/java/fr/surviepote/pala/core/PalaFactions.java @@ -32,6 +32,8 @@ public final class PalaFactions { public List invites = new ArrayList<>(); // M-faction-2 : chunks revendiques ("dimension:x:z"). public List claims = new ArrayList<>(); + // M-faction-2c : home ("dimension:x:y:z", vide = non defini). + public String home = ""; } private final Map factions = new HashMap<>(); diff --git a/server/mods/pala-0.2.1.jar b/server/mods/pala-0.2.1.jar index 7339cb7..7375b30 100644 Binary files a/server/mods/pala-0.2.1.jar and b/server/mods/pala-0.2.1.jar differ