pala M-faction-1c: /f desc + /f help
This commit is contained in:
@@ -610,6 +610,8 @@ avant M4 (TODO:crafts-machines).
|
|||||||
pouvait pas partir). Lecon : compter les parentheses d'un chainage brigadier au python
|
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.
|
(le patch fuzzy fusionne les lignes). VERIFIE : build SUCCESSFUL, boot Done, 0 erreur.
|
||||||
UNVERIFIED en jeu.
|
UNVERIFIED en jeu.
|
||||||
|
- M-faction-1c LIVRE 2026-10-19 ~04:20 : /f desc (chef, 140 car., sans speciaux — wiki) +
|
||||||
|
/f help. 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 +
|
- 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,
|
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
|
lave exclue : seau non rendu) + craft (1 findium + 4 furnaces + 4 briques, positions
|
||||||
|
|||||||
@@ -180,7 +180,16 @@ public final class PalaCommands {
|
|||||||
.then(Commands.literal("transfer")
|
.then(Commands.literal("transfer")
|
||||||
.then(Commands.argument("cible", EntityArgument.player())
|
.then(Commands.argument("cible", EntityArgument.player())
|
||||||
.executes(command -> fTransfer(command.getSource(),
|
.executes(command -> fTransfer(command.getSource(),
|
||||||
EntityArgument.getPlayer(command, "cible"))))));
|
EntityArgument.getPlayer(command, "cible")))))
|
||||||
|
|
||||||
|
.then(Commands.literal("desc")
|
||||||
|
.then(Commands.argument("texte",
|
||||||
|
com.mojang.brigadier.arguments.StringArgumentType.greedyString())
|
||||||
|
.executes(command -> fDesc(command.getSource(),
|
||||||
|
com.mojang.brigadier.arguments.StringArgumentType
|
||||||
|
.getString(command, "texte")))))
|
||||||
|
.then(Commands.literal("help")
|
||||||
|
.executes(command -> fHelp(command.getSource()))));
|
||||||
net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents.END_SERVER_TICK
|
net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents.END_SERVER_TICK
|
||||||
.register(PalaCommands::tickSpawnQueue);
|
.register(PalaCommands::tickSpawnQueue);
|
||||||
net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents.END_SERVER_TICK
|
net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents.END_SERVER_TICK
|
||||||
@@ -554,6 +563,37 @@ public final class PalaCommands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// M-faction-1c : description (chef, 140 caracteres max, sans format) + aide.
|
||||||
|
private static int fDesc(CommandSourceStack source, String texte) {
|
||||||
|
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 decrire."));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (texte.length() > 140 || !texte.matches("[A-Za-z0-9 _.,!?'()-]+")) {
|
||||||
|
source.sendFailure(Component.literal("§c140 caracteres max, sans caracteres speciaux."));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
faction.description = texte;
|
||||||
|
fr.surviepote.pala.core.PalaFactions.get().markDirty();
|
||||||
|
source.sendSuccess(() -> Component.literal(
|
||||||
|
"§6[Faction] §7Description : " + texte), false);
|
||||||
|
return Command.SINGLE_SUCCESS;
|
||||||
|
} catch (com.mojang.brigadier.exceptions.CommandSyntaxException e) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int fHelp(CommandSourceStack source) {
|
||||||
|
source.sendSuccess(() -> Component.literal("§6[Faction] §7/f create|info|invite|join|"
|
||||||
|
+ "leave|disband|kick|transfer|desc|help"), false);
|
||||||
|
return Command.SINGLE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
private static int fDisband(CommandSourceStack source) {
|
private static int fDisband(CommandSourceStack source) {
|
||||||
try {
|
try {
|
||||||
ServerPlayer player = source.getPlayerOrException();
|
ServerPlayer player = source.getPlayerOrException();
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user