You've already forked Arcturus-Morningstar-Extended
mirror of
https://github.com/duckietm/Arcturus-Morningstar-Extended.git
synced 2026-06-19 15:06:19 +00:00
fix(housekeeping): emit localizable error keys instead of bare slugs
Every HK action handler returned bare error slugs (\"invalid_input\", \"user_offline\", \"no_active_ban\", \"target_unkickable\", \"ban_failed\", \"user_not_found\") in HousekeepingActionResultComposer.message. The client's `localizeOrPassthrough` only treats a value as a translation key when it contains a dot, so those bare slugs were rendered raw in the status banner and the toast — ugly and untranslatable. Re-prefix all error messages with `housekeeping.error.` so the EN + IT dictionaries can resolve them. Success path is unchanged (server sends empty string, client falls back to `housekeeping.action.success`). Companion dictionary entries land on the client side.
This commit is contained in:
+2
-2
@@ -37,7 +37,7 @@ public class HousekeepingBanUserEvent extends MessageHandler {
|
|||||||
int hours = this.packet.readInt();
|
int hours = this.packet.readInt();
|
||||||
|
|
||||||
if (userId <= 0 || hours <= 0) {
|
if (userId <= 0 || hours <= 0) {
|
||||||
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "invalid_input"));
|
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "housekeeping.error.invalid_input"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ public class HousekeepingBanUserEvent extends MessageHandler {
|
|||||||
.ban(userId, this.client.getHabbo(), reason != null ? reason : "", duration, ModToolBanType.ACCOUNT, 0);
|
.ban(userId, this.client.getHabbo(), reason != null ? reason : "", duration, ModToolBanType.ACCOUNT, 0);
|
||||||
|
|
||||||
if (bans == null || bans.isEmpty()) {
|
if (bans == null || bans.isEmpty()) {
|
||||||
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "ban_failed"));
|
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "housekeeping.error.ban_failed"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -29,14 +29,14 @@ public class HousekeepingForceDisconnectUserEvent extends MessageHandler {
|
|||||||
String reason = this.packet.readString();
|
String reason = this.packet.readString();
|
||||||
|
|
||||||
if (userId <= 0) {
|
if (userId <= 0) {
|
||||||
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "invalid_input"));
|
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "housekeeping.error.invalid_input"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Habbo target = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId);
|
Habbo target = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId);
|
||||||
|
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "user_offline"));
|
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "housekeeping.error.user_offline"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -31,19 +31,19 @@ public class HousekeepingKickUserEvent extends MessageHandler {
|
|||||||
String reason = this.packet.readString();
|
String reason = this.packet.readString();
|
||||||
|
|
||||||
if (userId <= 0) {
|
if (userId <= 0) {
|
||||||
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "invalid_input"));
|
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "housekeeping.error.invalid_input"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Habbo target = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId);
|
Habbo target = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId);
|
||||||
|
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "user_offline"));
|
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "housekeeping.error.user_offline"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target.hasPermission(Permission.ACC_UNKICKABLE)) {
|
if (target.hasPermission(Permission.ACC_UNKICKABLE)) {
|
||||||
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "target_unkickable"));
|
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "housekeeping.error.target_unkickable"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -33,14 +33,14 @@ public class HousekeepingMuteUserEvent extends MessageHandler {
|
|||||||
int minutes = this.packet.readInt();
|
int minutes = this.packet.readInt();
|
||||||
|
|
||||||
if (userId <= 0 || minutes <= 0) {
|
if (userId <= 0 || minutes <= 0) {
|
||||||
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "invalid_input"));
|
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "housekeeping.error.invalid_input"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Habbo target = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId);
|
Habbo target = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId);
|
||||||
|
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "user_offline"));
|
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "housekeeping.error.user_offline"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -23,14 +23,14 @@ public class HousekeepingUnbanUserEvent extends MessageHandler {
|
|||||||
int userId = this.packet.readInt();
|
int userId = this.packet.readInt();
|
||||||
|
|
||||||
if (userId <= 0) {
|
if (userId <= 0) {
|
||||||
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "invalid_input"));
|
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "housekeeping.error.invalid_input"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
HabboInfo info = Emulator.getGameEnvironment().getHabboManager().getHabboInfo(userId);
|
HabboInfo info = Emulator.getGameEnvironment().getHabboManager().getHabboInfo(userId);
|
||||||
|
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "user_not_found"));
|
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "housekeeping.error.user_not_found"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,6 +39,6 @@ public class HousekeepingUnbanUserEvent extends MessageHandler {
|
|||||||
// on a never-banned user is a benign no-op that returns false.
|
// on a never-banned user is a benign no-op that returns false.
|
||||||
boolean cleared = Emulator.getGameEnvironment().getModToolManager().unban(info.getUsername());
|
boolean cleared = Emulator.getGameEnvironment().getModToolManager().unban(info.getUsername());
|
||||||
|
|
||||||
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, cleared, cleared ? userId : 0, cleared ? "" : "no_active_ban"));
|
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, cleared, cleared ? userId : 0, cleared ? "" : "housekeeping.error.no_active_ban"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user