pala M-rtp: teleportation aleatoire safe + cooldown 15min (wiki)
This commit is contained in:
@@ -598,6 +598,9 @@ avant M4 (TODO:crafts-machines).
|
|||||||
wiki documentee), bonbon jaune = mineur (mapping partiel : restent bleu/rose). ECART :
|
wiki documentee), bonbon jaune = mineur (mapping partiel : restent bleu/rose). ECART :
|
||||||
"Particules" non identifie (non implemente). VERIFIE : build SUCCESSFUL, boot Done,
|
"Particules" non identifie (non implemente). VERIFIE : build SUCCESSFUL, boot Done,
|
||||||
0 erreur. UNVERIFIED en jeu.
|
0 erreur. UNVERIFIED en jeu.
|
||||||
|
- M-rtp LIVRE 2026-10-19 ~04:00 : /rtp (wiki commandes : aleatoire overworld, cooldown 15 min,
|
||||||
|
position safe via heightmap, 16 essais, refuse ocean). ECART : pas de limite "3/version".
|
||||||
|
VERIFIE : build SUCCESSFUL, boot Done, 0 erreur, 23 cles. 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
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ public final class PalaCommands {
|
|||||||
private static final java.util.Map<java.util.UUID, TpaTask> TPA_QUEUE = new java.util.HashMap<>();
|
private static final java.util.Map<java.util.UUID, TpaTask> TPA_QUEUE = new java.util.HashMap<>();
|
||||||
// M-msg (wiki commandes) : dernier expediteur par destinataire (pour /r).
|
// M-msg (wiki commandes) : dernier expediteur par destinataire (pour /r).
|
||||||
private static final java.util.Map<java.util.UUID, java.util.UUID> LAST_MSG = new java.util.HashMap<>();
|
private static final java.util.Map<java.util.UUID, java.util.UUID> LAST_MSG = new java.util.HashMap<>();
|
||||||
|
// M-rtp (wiki commandes) : dernier /rtp par joueur (tick). Cooldown 15 min (config).
|
||||||
|
private static final java.util.Map<java.util.UUID, Long> RTP_LAST = new java.util.HashMap<>();
|
||||||
|
|
||||||
private record TpaRequest(java.util.UUID from, long expireTick) {
|
private record TpaRequest(java.util.UUID from, long expireTick) {
|
||||||
}
|
}
|
||||||
@@ -141,6 +143,8 @@ public final class PalaCommands {
|
|||||||
.executes(command -> baltop(command.getSource())));
|
.executes(command -> baltop(command.getSource())));
|
||||||
dispatcher.register(Commands.literal("balance")
|
dispatcher.register(Commands.literal("balance")
|
||||||
.executes(command -> balance(command.getSource())));
|
.executes(command -> balance(command.getSource())));
|
||||||
|
dispatcher.register(Commands.literal("rtp")
|
||||||
|
.executes(command -> rtp(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
|
||||||
@@ -237,6 +241,54 @@ public final class PalaCommands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// M-rtp (wiki commandes) : teleportation aleatoire dans l'overworld, cooldown 15 min.
|
||||||
|
// ECART : pas de limite "3 utilisations par version" (notion de version/serveur faction
|
||||||
|
// sans objet ici) ; rayon borne en config (wiki sans borne).
|
||||||
|
private static int rtp(CommandSourceStack source) {
|
||||||
|
try {
|
||||||
|
ServerPlayer player = source.getPlayerOrException();
|
||||||
|
MinecraftServer server = source.getServer();
|
||||||
|
long cooldown = (long) PalaConfig.get().rtpCooldownMinutes * 60L * 20L;
|
||||||
|
Long last = RTP_LAST.get(player.getUUID());
|
||||||
|
long now = server.getTickCount();
|
||||||
|
if (last != null && now - last < cooldown) {
|
||||||
|
long wait = (cooldown - (now - last)) / 20L;
|
||||||
|
source.sendFailure(Component.literal("§cProchain /rtp dans " + wait + " s."));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
ServerLevel overworld = server.overworld();
|
||||||
|
BlockPos spawn = overworld.getRespawnData().pos();
|
||||||
|
int radius = Math.max(100, PalaConfig.get().rtpRadius);
|
||||||
|
java.util.Random random = new java.util.Random();
|
||||||
|
BlockPos target = null;
|
||||||
|
for (int i = 0; i < 16 && target == null; i++) {
|
||||||
|
int x = spawn.getX() + random.nextInt(radius * 2 + 1) - radius;
|
||||||
|
int z = spawn.getZ() + random.nextInt(radius * 2 + 1) - radius;
|
||||||
|
BlockPos ground = overworld.getHeightmapPos(
|
||||||
|
net.minecraft.world.level.levelgen.Heightmap.Types.MOTION_BLOCKING_NO_LEAVES,
|
||||||
|
new BlockPos(x, 0, z));
|
||||||
|
// Refuse l'ocean profond et les zones trop hautes/basses.
|
||||||
|
if (ground.getY() < overworld.getMinY() + 2 || ground.getY() > 200) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (overworld.getFluidState(ground).isSource()
|
||||||
|
|| overworld.getFluidState(ground.above()).isSource()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
target = ground.above();
|
||||||
|
}
|
||||||
|
if (target == null) {
|
||||||
|
source.sendFailure(Component.literal("§cAucun endroit sur (reessayez)."));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
RTP_LAST.put(player.getUUID(), now);
|
||||||
|
teleportPlayer(player, overworld, target.below());
|
||||||
|
return Command.SINGLE_SUCCESS;
|
||||||
|
} catch (com.mojang.brigadier.exceptions.CommandSyntaxException e) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// M1 : prospecte les minerais pala dans un cube de rayon N autour du joueur.
|
// M1 : prospecte les minerais pala dans un cube de rayon N autour du joueur.
|
||||||
// Affiche comptes par minerai + histogramme Y (8 bandes de 16) pour amethyste/titane.
|
// Affiche comptes par minerai + histogramme Y (8 bandes de 16) pour amethyste/titane.
|
||||||
// Test distribution worldgen (couches 6-10 + deep ocean). Rayon capé à 32 (65^3 lectures).
|
// Test distribution worldgen (couches 6-10 + deep ocean). Rayon capé à 32 (65^3 lectures).
|
||||||
|
|||||||
@@ -85,6 +85,11 @@ public final class PalaConfig {
|
|||||||
// M-afk (wiki reglement/grades) : kick apres N minutes sans activite (defaut 10).
|
// M-afk (wiki reglement/grades) : kick apres N minutes sans activite (defaut 10).
|
||||||
public int afkKickMinutes = 10;
|
public int afkKickMinutes = 10;
|
||||||
|
|
||||||
|
// 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).
|
||||||
|
public int rtpRadius = 3000;
|
||||||
|
|
||||||
// Cooldowns sticks PvP en secondes. UNVERIFIED (durees balance staff, M5).
|
// Cooldowns sticks PvP en secondes. UNVERIFIED (durees balance staff, M5).
|
||||||
public Map<String, Integer> stickCooldowns = new HashMap<>(Map.of(
|
public Map<String, Integer> stickCooldowns = new HashMap<>(Map.of(
|
||||||
"heal_stick", 60, "speed_stick", 30, "hyper_jump_stick", 30,
|
"heal_stick", 60, "speed_stick", 30, "hyper_jump_stick", 30,
|
||||||
@@ -229,7 +234,7 @@ public final class PalaConfig {
|
|||||||
"crusherResults", "crusherFuels", "crusherInfiniteFuels",
|
"crusherResults", "crusherFuels", "crusherInfiniteFuels",
|
||||||
"furnaceSmelts", "furnaceFuels",
|
"furnaceSmelts", "furnaceFuels",
|
||||||
"serverName", "wikiUrl", "discordUrl", "shopUrl",
|
"serverName", "wikiUrl", "discordUrl", "shopUrl",
|
||||||
"afkKickMinutes");
|
"afkKickMinutes", "rtpCooldownMinutes", "rtpRadius");
|
||||||
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.
Reference in New Issue
Block a user