Add Some Fixes and Improvements

This commit is contained in:
2024-12-22 21:57:54 +01:00
parent 1ea6bd61f8
commit aaa808f90f
14 changed files with 242 additions and 58 deletions
@@ -71,6 +71,13 @@ public class Message {
pattern = fromRB(resourceBundle, "PREFIX") + " ";
pattern += fromRB(resourceBundle, message);
for (int i = 0; i < params.length; i++) {
if (params[i] instanceof SubMessage) {
SubMessage smsg = (SubMessage) params[i];
params[i] = parse(smsg.getMessage(), sender, smsg.getParams());
}
}
return new MessageFormat(pattern, locale).format(params);
}
@@ -0,0 +1,30 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2024 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.message;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class SubMessage {
private final String message;
private final Object[] params = new Object[0];
}