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:
@@ -12,6 +12,7 @@ import com.tiedup.remake.v2.bondage.CollarHelper;
|
||||
import com.tiedup.remake.util.teleport.Position;
|
||||
import com.tiedup.remake.util.teleport.TeleportHelper;
|
||||
import com.tiedup.remake.v2.BodyRegionV2;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
@@ -152,9 +153,7 @@ public class CollarCommand {
|
||||
ItemStack collar = getPlayerCollar(target);
|
||||
if (collar.isEmpty()) {
|
||||
source.sendFailure(
|
||||
Component.literal(
|
||||
target.getName().getString() + " does not have a collar"
|
||||
)
|
||||
Component.translatable("command.tiedup.collar_cmd.no_collar", target.getName().getString())
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
@@ -164,18 +163,16 @@ public class CollarCommand {
|
||||
CollarHelper.addOwner(collar, executor);
|
||||
source.sendSuccess(
|
||||
() ->
|
||||
Component.literal(
|
||||
"§aClaimed " +
|
||||
target.getName().getString() +
|
||||
"'s collar"
|
||||
),
|
||||
Component.translatable(
|
||||
"command.tiedup.collar_cmd.claimed", target.getName().getString()
|
||||
).withStyle(ChatFormatting.GREEN),
|
||||
true
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
source.sendFailure(Component.literal("Failed to claim collar"));
|
||||
source.sendFailure(Component.translatable("command.tiedup.collar_cmd.claim_failed"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -187,9 +184,7 @@ public class CollarCommand {
|
||||
ItemStack collar = getPlayerCollar(target);
|
||||
if (collar.isEmpty()) {
|
||||
source.sendFailure(
|
||||
Component.literal(
|
||||
target.getName().getString() + " does not have a collar"
|
||||
)
|
||||
Component.translatable("command.tiedup.collar_cmd.no_collar", target.getName().getString())
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
@@ -199,18 +194,16 @@ public class CollarCommand {
|
||||
CollarHelper.removeOwner(collar, executor.getUUID());
|
||||
source.sendSuccess(
|
||||
() ->
|
||||
Component.literal(
|
||||
"§aRemoved your ownership from " +
|
||||
target.getName().getString() +
|
||||
"'s collar"
|
||||
),
|
||||
Component.translatable(
|
||||
"command.tiedup.collar_cmd.unclaimed", target.getName().getString()
|
||||
).withStyle(ChatFormatting.GREEN),
|
||||
true
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
source.sendFailure(Component.literal("Failed to unclaim collar"));
|
||||
source.sendFailure(Component.translatable("command.tiedup.collar_cmd.unclaim_failed"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -223,9 +216,7 @@ public class CollarCommand {
|
||||
ItemStack collar = getPlayerCollar(target);
|
||||
if (collar.isEmpty()) {
|
||||
source.sendFailure(
|
||||
Component.literal(
|
||||
target.getName().getString() + " does not have a collar"
|
||||
)
|
||||
Component.translatable("command.tiedup.collar_cmd.no_collar", target.getName().getString())
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
@@ -234,9 +225,9 @@ public class CollarCommand {
|
||||
CollarHelper.setNickname(collar, name);
|
||||
source.sendSuccess(
|
||||
() ->
|
||||
Component.literal(
|
||||
"§aSet collar nickname to '" + name + "'"
|
||||
),
|
||||
Component.translatable(
|
||||
"command.tiedup.collar_cmd.renamed", name
|
||||
).withStyle(ChatFormatting.GREEN),
|
||||
true
|
||||
);
|
||||
return 1;
|
||||
@@ -254,9 +245,7 @@ public class CollarCommand {
|
||||
ItemStack collar = getPlayerCollar(target);
|
||||
if (collar.isEmpty()) {
|
||||
source.sendFailure(
|
||||
Component.literal(
|
||||
target.getName().getString() + " does not have a collar"
|
||||
)
|
||||
Component.translatable("command.tiedup.collar_cmd.no_collar", target.getName().getString())
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
@@ -265,13 +254,11 @@ public class CollarCommand {
|
||||
CollarHelper.addOwner(collar, owner);
|
||||
source.sendSuccess(
|
||||
() ->
|
||||
Component.literal(
|
||||
"§aAdded " +
|
||||
owner.getName().getString() +
|
||||
" as owner of " +
|
||||
target.getName().getString() +
|
||||
"'s collar"
|
||||
),
|
||||
Component.translatable(
|
||||
"command.tiedup.collar_cmd.owner_added",
|
||||
owner.getName().getString(),
|
||||
target.getName().getString()
|
||||
).withStyle(ChatFormatting.GREEN),
|
||||
true
|
||||
);
|
||||
return 1;
|
||||
@@ -289,9 +276,7 @@ public class CollarCommand {
|
||||
ItemStack collar = getPlayerCollar(target);
|
||||
if (collar.isEmpty()) {
|
||||
source.sendFailure(
|
||||
Component.literal(
|
||||
target.getName().getString() + " does not have a collar"
|
||||
)
|
||||
Component.translatable("command.tiedup.collar_cmd.no_collar", target.getName().getString())
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
@@ -300,13 +285,11 @@ public class CollarCommand {
|
||||
CollarHelper.removeOwner(collar, owner.getUUID());
|
||||
source.sendSuccess(
|
||||
() ->
|
||||
Component.literal(
|
||||
"§aRemoved " +
|
||||
owner.getName().getString() +
|
||||
" as owner of " +
|
||||
target.getName().getString() +
|
||||
"'s collar"
|
||||
),
|
||||
Component.translatable(
|
||||
"command.tiedup.collar_cmd.owner_removed",
|
||||
owner.getName().getString(),
|
||||
target.getName().getString()
|
||||
).withStyle(ChatFormatting.GREEN),
|
||||
true
|
||||
);
|
||||
return 1;
|
||||
@@ -329,9 +312,7 @@ public class CollarCommand {
|
||||
ItemStack collar = getPlayerCollar(target);
|
||||
if (collar.isEmpty()) {
|
||||
source.sendFailure(
|
||||
Component.literal(
|
||||
target.getName().getString() + " does not have a collar"
|
||||
)
|
||||
Component.translatable("command.tiedup.collar_cmd.no_collar", target.getName().getString())
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
@@ -343,7 +324,7 @@ public class CollarCommand {
|
||||
|
||||
if (cell == null) {
|
||||
source.sendFailure(
|
||||
Component.literal("Cell '" + cellName + "' not found")
|
||||
Component.translatable("command.tiedup.collar_cmd.cell_not_found", cellName)
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
@@ -352,13 +333,11 @@ public class CollarCommand {
|
||||
CollarHelper.setCellId(collar, cell.getId());
|
||||
source.sendSuccess(
|
||||
() ->
|
||||
Component.literal(
|
||||
"§aAssigned cell '" +
|
||||
cellName +
|
||||
"' to " +
|
||||
target.getName().getString() +
|
||||
"'s collar"
|
||||
),
|
||||
Component.translatable(
|
||||
"command.tiedup.collar_cmd.cell_assigned",
|
||||
cellName,
|
||||
target.getName().getString()
|
||||
).withStyle(ChatFormatting.GREEN),
|
||||
true
|
||||
);
|
||||
return 1;
|
||||
@@ -381,9 +360,7 @@ public class CollarCommand {
|
||||
ItemStack collar = getPlayerCollar(target);
|
||||
if (collar.isEmpty()) {
|
||||
source.sendFailure(
|
||||
Component.literal(
|
||||
target.getName().getString() + " does not have a collar"
|
||||
)
|
||||
Component.translatable("command.tiedup.collar_cmd.no_collar", target.getName().getString())
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
@@ -391,7 +368,7 @@ public class CollarCommand {
|
||||
if (CollarHelper.isCollar(collar)) {
|
||||
if (!CollarHelper.hasCellAssigned(collar)) {
|
||||
source.sendFailure(
|
||||
Component.literal("No cell assigned to collar")
|
||||
Component.translatable("command.tiedup.collar_cmd.no_cell_assigned")
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
@@ -403,7 +380,7 @@ public class CollarCommand {
|
||||
|
||||
if (cell == null) {
|
||||
source.sendFailure(
|
||||
Component.literal("Assigned cell no longer exists")
|
||||
Component.translatable("command.tiedup.collar_cmd.cell_deleted")
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
@@ -420,12 +397,11 @@ public class CollarCommand {
|
||||
|
||||
source.sendSuccess(
|
||||
() ->
|
||||
Component.literal(
|
||||
"§aTeleported " +
|
||||
target.getName().getString() +
|
||||
" to cell at " +
|
||||
cell.getCorePos().toShortString()
|
||||
),
|
||||
Component.translatable(
|
||||
"command.tiedup.collar_cmd.teleported",
|
||||
target.getName().getString(),
|
||||
cell.getCorePos().toShortString()
|
||||
).withStyle(ChatFormatting.GREEN),
|
||||
true
|
||||
);
|
||||
return 1;
|
||||
@@ -442,9 +418,7 @@ public class CollarCommand {
|
||||
ItemStack collar = getPlayerCollar(target);
|
||||
if (collar.isEmpty()) {
|
||||
source.sendFailure(
|
||||
Component.literal(
|
||||
target.getName().getString() + " does not have a collar"
|
||||
)
|
||||
Component.translatable("command.tiedup.collar_cmd.no_collar", target.getName().getString())
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
@@ -452,28 +426,23 @@ public class CollarCommand {
|
||||
if (CollarHelper.isCollar(collar)) {
|
||||
source.sendSuccess(
|
||||
() ->
|
||||
Component.literal(
|
||||
"§6=== Collar Info for " +
|
||||
target.getName().getString() +
|
||||
" ==="
|
||||
),
|
||||
Component.translatable(
|
||||
"command.tiedup.collar_cmd.info_header",
|
||||
target.getName().getString()
|
||||
).withStyle(ChatFormatting.GOLD),
|
||||
false
|
||||
);
|
||||
|
||||
String nickname = CollarHelper.getNickname(collar);
|
||||
String nicknameDisplay = (nickname == null || nickname.isEmpty()) ? "None" : nickname;
|
||||
source.sendSuccess(
|
||||
() ->
|
||||
Component.literal(
|
||||
"§7Nickname: §f" +
|
||||
(nickname == null || nickname.isEmpty() ? "None" : nickname)
|
||||
),
|
||||
Component.translatable("command.tiedup.collar_cmd.info_nickname", nicknameDisplay).withStyle(ChatFormatting.GRAY),
|
||||
false
|
||||
);
|
||||
source.sendSuccess(
|
||||
() ->
|
||||
Component.literal(
|
||||
"§7Has Owner: §f" + CollarHelper.hasOwner(collar)
|
||||
),
|
||||
Component.translatable("command.tiedup.collar_cmd.info_has_owner", String.valueOf(CollarHelper.hasOwner(collar))).withStyle(ChatFormatting.GRAY),
|
||||
false
|
||||
);
|
||||
// Cell assignment
|
||||
@@ -489,23 +458,22 @@ public class CollarCommand {
|
||||
: cellId.toString().substring(0, 8) + "...";
|
||||
source.sendSuccess(
|
||||
() ->
|
||||
Component.literal(
|
||||
"§7Assigned Cell: §a" +
|
||||
cellDisplay +
|
||||
" §7@ " +
|
||||
cell.getCorePos().toShortString()
|
||||
),
|
||||
Component.translatable(
|
||||
"command.tiedup.collar_cmd.info_cell",
|
||||
cellDisplay,
|
||||
cell.getCorePos().toShortString()
|
||||
).withStyle(ChatFormatting.GRAY),
|
||||
false
|
||||
);
|
||||
} else {
|
||||
source.sendSuccess(
|
||||
() -> Component.literal("§7Assigned Cell: §c(deleted)"),
|
||||
() -> Component.translatable("command.tiedup.collar_cmd.info_cell_deleted").withStyle(ChatFormatting.RED),
|
||||
false
|
||||
);
|
||||
}
|
||||
} else {
|
||||
source.sendSuccess(
|
||||
() -> Component.literal("§7Assigned Cell: §fNone"),
|
||||
() -> Component.translatable("command.tiedup.collar_cmd.info_cell_none").withStyle(ChatFormatting.GRAY),
|
||||
false
|
||||
);
|
||||
}
|
||||
@@ -514,9 +482,9 @@ public class CollarCommand {
|
||||
&& lockable.isLocked(collar);
|
||||
source.sendSuccess(
|
||||
() ->
|
||||
Component.literal(
|
||||
"§7Locked: §f" + locked
|
||||
),
|
||||
Component.translatable(
|
||||
"command.tiedup.collar_cmd.info_locked", String.valueOf(locked)
|
||||
).withStyle(ChatFormatting.GRAY),
|
||||
false
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user