feat(C-01): i18n main commands — 148 translatable keys

Phase 3: Migrate Component.literal() in all remaining command files.
- NPCCommand (34), CellCommand (33), SocialCommand (16), CollarCommand (25),
  KeyCommand (18), BountyCommand (6), KidnapSetCommand (2), CaptivityDebugCommand (7),
  InventorySubCommand (3), TestAnimSubCommand (2), MasterTestSubCommand (7), DebtSubCommand (8)
- Strip all section sign color codes, use .withStyle(ChatFormatting)
- 148 new keys in en_us.json (command.tiedup.*)
- Debug/dynamic strings intentionally kept as literal
This commit is contained in:
NotEvil
2026-04-15 13:54:26 +02:00
parent 70965c2dda
commit fa5cfb913c
14 changed files with 478 additions and 445 deletions

View File

@@ -7,6 +7,7 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.tiedup.remake.commands.CommandHelper;
import com.tiedup.remake.prison.PrisonerManager;
import com.tiedup.remake.prison.RansomRecord;
import net.minecraft.ChatFormatting;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.commands.arguments.EntityArgument;
@@ -77,9 +78,8 @@ public class DebtSubCommand {
.getSource()
.sendSuccess(
() ->
Component.literal(
target.getName().getString() +
" has no debt record."
Component.translatable(
"command.tiedup.debt.no_record", target.getName().getString()
),
false
);
@@ -94,16 +94,11 @@ public class DebtSubCommand {
.getSource()
.sendSuccess(
() ->
Component.literal(
target.getName().getString() +
" \u2014 Debt: " +
total +
" | Paid: " +
paid +
" | Remaining: " +
remaining +
" emeralds"
),
Component.translatable(
"command.tiedup.debt.show",
target.getName().getString(),
total, paid, remaining
).withStyle(ChatFormatting.YELLOW),
false
);
return 1;
@@ -121,9 +116,7 @@ public class DebtSubCommand {
context
.getSource()
.sendFailure(
Component.literal(
target.getName().getString() + " has no debt record."
)
Component.translatable("command.tiedup.debt.no_record", target.getName().getString())
);
return 0;
}
@@ -133,13 +126,10 @@ public class DebtSubCommand {
.getSource()
.sendSuccess(
() ->
Component.literal(
"Set " +
target.getName().getString() +
"'s total debt to " +
amount +
" emeralds."
),
Component.translatable(
"command.tiedup.debt.set",
target.getName().getString(), amount
).withStyle(ChatFormatting.GREEN),
true
);
return 1;
@@ -157,9 +147,7 @@ public class DebtSubCommand {
context
.getSource()
.sendFailure(
Component.literal(
target.getName().getString() + " has no debt record."
)
Component.translatable("command.tiedup.debt.no_record", target.getName().getString())
);
return 0;
}
@@ -169,14 +157,10 @@ public class DebtSubCommand {
.getSource()
.sendSuccess(
() ->
Component.literal(
"Added " +
amount +
" emeralds to " +
target.getName().getString() +
"'s debt. Remaining: " +
ransom.getRemainingDebt()
),
Component.translatable(
"command.tiedup.debt.added",
amount, target.getName().getString(), ransom.getRemainingDebt()
).withStyle(ChatFormatting.GREEN),
true
);
return 1;
@@ -194,9 +178,7 @@ public class DebtSubCommand {
context
.getSource()
.sendFailure(
Component.literal(
target.getName().getString() + " has no debt record."
)
Component.translatable("command.tiedup.debt.no_record", target.getName().getString())
);
return 0;
}
@@ -207,15 +189,10 @@ public class DebtSubCommand {
.getSource()
.sendSuccess(
() ->
Component.literal(
"Removed " +
amount +
" emeralds from " +
target.getName().getString() +
"'s debt. Remaining: " +
ransom.getRemainingDebt() +
(paid ? " (PAID OFF!)" : "")
),
Component.translatable(
paid ? "command.tiedup.debt.removed_paid" : "command.tiedup.debt.removed",
amount, target.getName().getString(), ransom.getRemainingDebt()
).withStyle(ChatFormatting.GREEN),
true
);
return 1;

View File

@@ -6,6 +6,7 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.tiedup.remake.cells.ConfiscatedInventoryRegistry;
import com.tiedup.remake.commands.CommandHelper;
import com.tiedup.remake.core.SystemMessageManager;
import net.minecraft.ChatFormatting;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.commands.arguments.EntityArgument;
@@ -56,9 +57,8 @@ public class InventorySubCommand {
context
.getSource()
.sendFailure(
Component.literal(
targetPlayer.getName().getString() +
" has no confiscated inventory to restore"
Component.translatable(
"command.tiedup.inventory.no_confiscated", targetPlayer.getName().getString()
)
);
return 0;
@@ -71,10 +71,9 @@ public class InventorySubCommand {
.getSource()
.sendSuccess(
() ->
Component.literal(
"\u00a7aRestored confiscated inventory to " +
targetPlayer.getName().getString()
),
Component.translatable(
"command.tiedup.inventory.restored", targetPlayer.getName().getString()
).withStyle(ChatFormatting.GREEN),
true
);
SystemMessageManager.sendToPlayer(
@@ -88,9 +87,8 @@ public class InventorySubCommand {
context
.getSource()
.sendFailure(
Component.literal(
"Failed to restore inventory for " +
targetPlayer.getName().getString()
Component.translatable(
"command.tiedup.inventory.restore_failed", targetPlayer.getName().getString()
)
);
return 0;

View File

@@ -77,7 +77,7 @@ public class MasterTestSubCommand {
context
.getSource()
.sendFailure(
Component.literal("Failed to create Master entity")
Component.translatable("command.tiedup.master.spawn_failed")
);
return 0;
}
@@ -108,10 +108,8 @@ public class MasterTestSubCommand {
.getSource()
.sendSuccess(
() ->
Component.literal(
"Spawned Master '" +
finalName +
"' \u2014 you are now their pet."
Component.translatable(
"command.tiedup.master.spawned", finalName
),
true
);
@@ -133,7 +131,7 @@ public class MasterTestSubCommand {
context
.getSource()
.sendFailure(
Component.literal("No Master NPC found within 20 blocks")
Component.translatable("command.tiedup.master.no_master_nearby")
);
return 0;
}
@@ -157,8 +155,8 @@ public class MasterTestSubCommand {
.getSource()
.sendSuccess(
() ->
Component.literal(
"Forced " + finalName + " into HUMAN_CHAIR state"
Component.translatable(
"command.tiedup.master.forced_state", finalName, "HUMAN_CHAIR"
),
true
);
@@ -183,7 +181,7 @@ public class MasterTestSubCommand {
context
.getSource()
.sendFailure(
Component.literal("Unknown MasterState: " + taskName)
Component.translatable("command.tiedup.master.unknown_state", taskName)
);
return 0;
}
@@ -193,7 +191,7 @@ public class MasterTestSubCommand {
context
.getSource()
.sendFailure(
Component.literal("No Master NPC found within 20 blocks")
Component.translatable("command.tiedup.master.no_master_nearby")
);
return 0;
}
@@ -217,12 +215,8 @@ public class MasterTestSubCommand {
.getSource()
.sendSuccess(
() ->
Component.literal(
"Forced " +
finalName +
" into " +
targetState.name() +
" state"
Component.translatable(
"command.tiedup.master.forced_state", finalName, targetState.name()
),
true
);

View File

@@ -87,8 +87,8 @@ public class TestAnimSubCommand {
.getSource()
.sendSuccess(
() ->
Component.literal(
"Playing animation '" + anim + "' on " + name
Component.translatable(
"command.tiedup.testanim.playing", anim, name
),
false
);
@@ -116,7 +116,7 @@ public class TestAnimSubCommand {
context
.getSource()
.sendSuccess(
() -> Component.literal("Stopped animation on " + name),
() -> Component.translatable("command.tiedup.testanim.stopped", name),
false
);
return 1;