diff --git a/PALAMOD_CDC.md b/PALAMOD_CDC.md index ae01d30..a593afe 100644 --- a/PALAMOD_CDC.md +++ b/PALAMOD_CDC.md @@ -736,6 +736,10 @@ avant M4 (TODO:crafts-machines). 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-tp-zones LIVRE 2026-10-19 ~07:40 : /minage + /farmland (zones config "dim:x:y:z", + miningZone/farmlandZone persistee VERIFIEES, message si non configure). ECART : + positions = config admin (UNVERIFIED), bonus grades payants SKIP (boutique externe). + 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 718afd2..5ae4dfc 100644 --- a/mods/pala/src/main/java/fr/surviepote/pala/PalaCommands.java +++ b/mods/pala/src/main/java/fr/surviepote/pala/PalaCommands.java @@ -92,6 +92,10 @@ public final class PalaCommands { .executes(command -> craft(command.getSource()))); dispatcher.register(Commands.literal("spawn") .executes(command -> spawn(command.getSource()))); + dispatcher.register(Commands.literal("minage") + .executes(command -> minage(command.getSource()))); + dispatcher.register(Commands.literal("farmland") + .executes(command -> farmland(command.getSource()))); dispatcher.register(Commands.literal("tpa") .then(Commands.argument("cible", EntityArgument.player()) .executes(command -> tpa(command.getSource(), @@ -1080,6 +1084,61 @@ public final class PalaCommands { } } + // M-tp-zones (wiki grades) : /minage + /farmland vers zones configurees. + private static int minage(CommandSourceStack source) { + return zoneTeleport(source, + fr.surviepote.pala.core.PalaConfig.get().miningZone, "Minage"); + } + + private static int farmland(CommandSourceStack source) { + return zoneTeleport(source, + fr.surviepote.pala.core.PalaConfig.get().farmlandZone, "Farmland"); + } + + private static int zoneTeleport(CommandSourceStack source, String zone, String label) { + try { + ServerPlayer player = source.getPlayerOrException(); + if (zone == null || zone.isEmpty()) { + source.sendFailure(Component.literal( + "§cZone " + label + " non configuree (admin : config pala.json).")); + return 0; + } + String[] parts = zone.split(":"); + if (parts.length != 4) { + source.sendFailure(Component.literal("§cZone " + label + " corrompue.")); + 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("§cZone " + label + " corrompue.")); + 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/PalaConfig.java b/mods/pala/src/main/java/fr/surviepote/pala/core/PalaConfig.java index 10e16d3..b6eb895 100644 --- a/mods/pala/src/main/java/fr/surviepote/pala/core/PalaConfig.java +++ b/mods/pala/src/main/java/fr/surviepote/pala/core/PalaConfig.java @@ -91,6 +91,11 @@ public final class PalaConfig { // M-market-2 (wiki §3.8) : expiration des annonces en jours (defaut 7). public int marketExpiryDays = 7; + // M-tp-zones (wiki grades : /minage + /farmland) : zones designees "dimension:x:y:z" + // (vide = non configure, l'admin les definit). Positions UNVERIFIED par nature. + public String miningZone = ""; + public String farmlandZone = ""; + // M-rtp (wiki commandes) : cooldown minutes entre deux /rtp (wiki : 15). public int rtpCooldownMinutes = 15; // Rayon max du /rtp autour du spawn (blocs). UNVERIFIED (wiki : "aleatoire", sans borne). @@ -246,7 +251,8 @@ public final class PalaConfig { "furnaceSmelts", "furnaceFuels", "serverName", "wikiUrl", "discordUrl", "shopUrl", "afkKickMinutes", "rtpCooldownMinutes", "rtpRadius", - "factionMaxClaims", "marketExpiryDays"); + "factionMaxClaims", "marketExpiryDays", + "miningZone", "farmlandZone"); boolean complete = true; try (Reader keysReader = Files.newBufferedReader(path)) { com.google.gson.JsonObject obj = diff --git a/server/mods/pala-0.2.1.jar b/server/mods/pala-0.2.1.jar index caeccb7..4f4e79a 100644 Binary files a/server/mods/pala-0.2.1.jar and b/server/mods/pala-0.2.1.jar differ