diff --git a/PALAMOD_CDC.md b/PALAMOD_CDC.md index 6ab7a24..7751e19 100644 --- a/PALAMOD_CDC.md +++ b/PALAMOD_CDC.md @@ -606,6 +606,10 @@ avant M4 (TODO:crafts-machines). invite / join / leave / disband. Lecon : Inventory.items prive en 26.3 -> getItem(i). Grades/claims/elo : M-faction-2. VERIFIE : build SUCCESSFUL, boot Done, 0 erreur. UNVERIFIED en jeu (2 joueurs). +- M-faction-1b LIVRE 2026-10-19 ~04:15 : /f kick + /f transfer (trou bouche : le chef ne + pouvait pas partir). Lecon : compter les parentheses d'un chainage brigadier au python + (le patch fuzzy fusionne les lignes). 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 83e8f1f..abb44b8 100644 --- a/mods/pala/src/main/java/fr/surviepote/pala/PalaCommands.java +++ b/mods/pala/src/main/java/fr/surviepote/pala/PalaCommands.java @@ -172,7 +172,15 @@ public final class PalaCommands { .then(Commands.literal("leave") .executes(command -> fLeave(command.getSource()))) .then(Commands.literal("disband") - .executes(command -> fDisband(command.getSource())))); + .executes(command -> fDisband(command.getSource()))) + .then(Commands.literal("kick") + .then(Commands.argument("cible", EntityArgument.player()) + .executes(command -> fKick(command.getSource(), + EntityArgument.getPlayer(command, "cible"))))) + .then(Commands.literal("transfer") + .then(Commands.argument("cible", EntityArgument.player()) + .executes(command -> fTransfer(command.getSource(), + EntityArgument.getPlayer(command, "cible")))))); 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 @@ -490,6 +498,62 @@ public final class PalaCommands { } } + // M-faction-1b : kick (chef, pas sur soi-meme) + transfer (passation chef, debloque /f leave). + private static int fKick(CommandSourceStack source, ServerPlayer cible) { + 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 || !faction.owner.equals(player.getUUID().toString())) { + source.sendFailure(Component.literal("§cSeul le chef peut exclure.")); + return 0; + } + if (cible.getUUID().equals(player.getUUID())) { + source.sendFailure(Component.literal("§cVous ne pouvez pas vous exclure.")); + return 0; + } + if (!faction.members.remove(cible.getUUID().toString())) { + source.sendFailure(Component.literal("§cCe joueur n'est pas dans votre faction.")); + return 0; + } + fr.surviepote.pala.core.PalaFactions.get().markDirty(); + cible.sendSystemMessage(Component.literal( + "§6[Faction] §7Vous avez ete exclu de " + faction.name + ".")); + source.sendSuccess(() -> Component.literal("§6[Faction] §7" + + cible.getScoreboardName() + " exclu de " + faction.name + "."), false); + return Command.SINGLE_SUCCESS; + } catch (com.mojang.brigadier.exceptions.CommandSyntaxException e) { + return 0; + } + } + + private static int fTransfer(CommandSourceStack source, ServerPlayer cible) { + 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 || !faction.owner.equals(player.getUUID().toString())) { + source.sendFailure(Component.literal("§cSeul le chef peut transferer.")); + return 0; + } + if (!faction.members.contains(cible.getUUID().toString())) { + source.sendFailure(Component.literal("§cCe joueur n'est pas dans votre faction.")); + return 0; + } + faction.owner = cible.getUUID().toString(); + fr.surviepote.pala.core.PalaFactions.get().markDirty(); + source.getServer().getPlayerList().broadcastSystemMessage( + Component.literal("§6[Faction] §e" + cible.getScoreboardName() + + " §7est le nouveau chef de §e" + faction.name + " §7!"), + false); + 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/server/mods/pala-0.2.1.jar b/server/mods/pala-0.2.1.jar index dfb6350..34fa107 100644 Binary files a/server/mods/pala-0.2.1.jar and b/server/mods/pala-0.2.1.jar differ