pala M-tp-zones: /minage + /farmland (zones config)

This commit is contained in:
Anaïs Saraiva
2026-10-19 07:42:49 +02:00
parent 89ea9fe43a
commit 44c172021c
4 changed files with 70 additions and 1 deletions
+4
View File
@@ -736,6 +736,10 @@ avant M4 (TODO:crafts-machines).
script (jamais a l'oeil) ; le compteur cumule est biaise par les apostrophes script (jamais a l'oeil) ; le compteur cumule est biaise par les apostrophes
(strip quotes apres comments) ; javac = arbitre final. VERIFIE : build SUCCESSFUL, (strip quotes apres comments) ; javac = arbitre final. VERIFIE : build SUCCESSFUL,
boot Done, 0 erreur. UNVERIFIED en jeu. 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 + - 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
@@ -92,6 +92,10 @@ public final class PalaCommands {
.executes(command -> craft(command.getSource()))); .executes(command -> craft(command.getSource())));
dispatcher.register(Commands.literal("spawn") dispatcher.register(Commands.literal("spawn")
.executes(command -> spawn(command.getSource()))); .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") dispatcher.register(Commands.literal("tpa")
.then(Commands.argument("cible", EntityArgument.player()) .then(Commands.argument("cible", EntityArgument.player())
.executes(command -> tpa(command.getSource(), .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) { private static int fDisband(CommandSourceStack source) {
try { try {
ServerPlayer player = source.getPlayerOrException(); ServerPlayer player = source.getPlayerOrException();
@@ -91,6 +91,11 @@ public final class PalaConfig {
// M-market-2 (wiki §3.8) : expiration des annonces en jours (defaut 7). // M-market-2 (wiki §3.8) : expiration des annonces en jours (defaut 7).
public int marketExpiryDays = 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). // M-rtp (wiki commandes) : cooldown minutes entre deux /rtp (wiki : 15).
public int rtpCooldownMinutes = 15; public int rtpCooldownMinutes = 15;
// Rayon max du /rtp autour du spawn (blocs). UNVERIFIED (wiki : "aleatoire", sans borne). // Rayon max du /rtp autour du spawn (blocs). UNVERIFIED (wiki : "aleatoire", sans borne).
@@ -246,7 +251,8 @@ public final class PalaConfig {
"furnaceSmelts", "furnaceFuels", "furnaceSmelts", "furnaceFuels",
"serverName", "wikiUrl", "discordUrl", "shopUrl", "serverName", "wikiUrl", "discordUrl", "shopUrl",
"afkKickMinutes", "rtpCooldownMinutes", "rtpRadius", "afkKickMinutes", "rtpCooldownMinutes", "rtpRadius",
"factionMaxClaims", "marketExpiryDays"); "factionMaxClaims", "marketExpiryDays",
"miningZone", "farmlandZone");
boolean complete = true; boolean complete = true;
try (Reader keysReader = Files.newBufferedReader(path)) { try (Reader keysReader = Files.newBufferedReader(path)) {
com.google.gson.JsonObject obj = com.google.gson.JsonObject obj =
Binary file not shown.