pala M-faction-4: /f map (carte ASCII claims 9x9)

This commit is contained in:
Anaïs Saraiva
2026-10-19 07:37:16 +02:00
parent ca01bd796c
commit 89ea9fe43a
3 changed files with 44 additions and 2 deletions
+5
View File
@@ -731,6 +731,11 @@ avant M4 (TODO:crafts-machines).
silencieuse). Menage : 3 DynamiteGunItem legacy supprimes (fireball non-wiki, silencieuse). Menage : 3 DynamiteGunItem legacy supprimes (fireball non-wiki,
conflit id "dynamite"). ECART : chiffres degats, portes/trappes+hardened TODO, conflit id "dynamite"). ECART : chiffres degats, portes/trappes+hardened TODO,
sans craft. VERIFIE : build SUCCESSFUL, boot Done, 0 erreur. UNVERIFIED en jeu. sans craft. VERIFIE : build SUCCESSFUL, boot Done, 0 erreur. UNVERIFIED en jeu.
- M-faction-4 LIVRE 2026-10-19 ~07:35 : /f map (carte ASCII 9x9 claims, permission
wiki "Voir les territoires", +help). Lecon : compter opens/closes PAR LIGNE au
script (jamais a l'oeil) ; le compteur cumule est biaise par les apostrophes
(strip quotes apres comments) ; javac = arbitre final. 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
@@ -235,7 +235,9 @@ public final class PalaCommands {
.then(Commands.literal("home") .then(Commands.literal("home")
.executes(command -> fHome(command.getSource()))) .executes(command -> fHome(command.getSource())))
.then(Commands.literal("top") .then(Commands.literal("top")
.executes(command -> fTop(command.getSource())))); .executes(command -> fTop(command.getSource())))
.then(Commands.literal("map")
.executes(command -> fMap(command.getSource()))));
dispatcher.register(Commands.literal("fc") dispatcher.register(Commands.literal("fc")
.then(Commands.argument("texte", .then(Commands.argument("texte",
com.mojang.brigadier.arguments.StringArgumentType.greedyString()) com.mojang.brigadier.arguments.StringArgumentType.greedyString())
@@ -647,7 +649,7 @@ public final class PalaCommands {
private static int fHelp(CommandSourceStack source) { private static int fHelp(CommandSourceStack source) {
source.sendSuccess(() -> Component.literal("§6[Faction] §7/f create|info|invite|join|" source.sendSuccess(() -> Component.literal("§6[Faction] §7/f create|info|invite|join|"
+ "leave|disband|kick|transfer|desc|help|claim|unclaim|list|sethome|home|" + "leave|disband|kick|transfer|desc|help|claim|unclaim|list|sethome|home|"
+ "promote|demote|top"), false); + "promote|demote|top|map"), false);
return Command.SINGLE_SUCCESS; return Command.SINGLE_SUCCESS;
} }
@@ -1043,6 +1045,41 @@ public final class PalaCommands {
} }
} }
// M-faction-4 (wiki grades, permission "Voir les territoires") : carte ASCII 9x9
// des claims autour du joueur (. = libre, initiale faction, vert = la sienne).
private static int fMap(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 mine =
fa.byMember(player.getUUID().toString());
String dim = player.level().dimension().identifier().toString();
int baseX = (player.blockPosition().getX() >> 4) - 4;
int baseZ = (player.blockPosition().getZ() >> 4) - 4;
StringBuilder out = new StringBuilder("§6[Carte]");
for (int dz = 0; dz < 9; dz++) {
out.append("\n§7");
for (int dx = 0; dx < 9; dx++) {
String key = dim + ":" + (baseX + dx) + ":" + (baseZ + dz);
fr.surviepote.pala.core.PalaFactions.Faction owner = fa.byClaim(key);
if (owner == null) {
out.append("§8.");
} else if (mine != null && owner.name.equals(mine.name)) {
out.append("§a").append(Character.toUpperCase(owner.name.charAt(0)));
} else {
out.append("§c").append(Character.toUpperCase(owner.name.charAt(0)));
}
}
}
out.append("\n§7. = libre, §ainitiale verte = vous§7, §crouge = autres");
source.sendSuccess(() -> Component.literal(out.toString()), false);
return Command.SINGLE_SUCCESS;
} catch (com.mojang.brigadier.exceptions.CommandSyntaxException e) {
return 0;
}
}
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.