refactor(command): clean GSD comments and translate user-facing messages to English
This commit is contained in:
@@ -10,30 +10,16 @@ import com.mythlane.gravityflip.GravityFlipPlugin;
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* {@code /gravityflip delete <name>} — supprime la région nommée et persiste.
|
||||
*
|
||||
* <p>Étend {@link CommandBase} pour permettre l'usage depuis la console serveur
|
||||
* (opération admin, pas besoin d'un joueur caller).
|
||||
*
|
||||
* <p>Flow :
|
||||
* <ol>
|
||||
* <li>{@code registry.remove(name)} — renvoie {@code false} si nom inconnu → message
|
||||
* d'erreur clair et retour précoce (pas de save inutile).</li>
|
||||
* <li>{@code configHolder.save().join()} force la durabilité. Même pattern que
|
||||
* {@code GravityFlipDefineSubCommand} : sur échec disque, on reporte truthfully
|
||||
* ("en mémoire OK, persistance échouée") plutôt que silent rollback.</li>
|
||||
* </ol>
|
||||
*/
|
||||
/** Deletes a Gravity Flip region and persists the change. */
|
||||
public final class GravityFlipDeleteSubCommand extends CommandBase {
|
||||
|
||||
private final GravityFlipPlugin plugin;
|
||||
|
||||
private final RequiredArg<String> nameArg =
|
||||
this.withRequiredArg("name", "Nom de la région à supprimer", ArgTypes.STRING);
|
||||
this.withRequiredArg("name", "Name of the region to delete", ArgTypes.STRING);
|
||||
|
||||
public GravityFlipDeleteSubCommand(GravityFlipPlugin plugin) {
|
||||
super("delete", "Supprime une région Gravity Flip");
|
||||
super("delete", "Delete a Gravity Flip region");
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@@ -41,7 +27,7 @@ public final class GravityFlipDeleteSubCommand extends CommandBase {
|
||||
protected void executeSync(@Nonnull CommandContext ctx) {
|
||||
String name = nameArg.get(ctx);
|
||||
if (!plugin.regions().remove(name)) {
|
||||
ctx.sendMessage(Message.raw("[gravityflip] Région '" + name + "' introuvable."));
|
||||
ctx.sendMessage(Message.raw("[gravityflip] Region '" + name + "' not found."));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
@@ -50,9 +36,9 @@ public final class GravityFlipDeleteSubCommand extends CommandBase {
|
||||
plugin.getLogger().at(Level.WARNING).withCause(th)
|
||||
.log("[delete] save failed for region '" + name + "'");
|
||||
ctx.sendMessage(Message.raw(
|
||||
"[gravityflip] Suppression en mémoire OK, persistance échouée — voir logs."));
|
||||
"[gravityflip] Deleted in memory, but persistence failed — see logs."));
|
||||
return;
|
||||
}
|
||||
ctx.sendMessage(Message.raw("[gravityflip] Région '" + name + "' supprimée."));
|
||||
ctx.sendMessage(Message.raw("[gravityflip] Region '" + name + "' deleted."));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user