Skip to content

Commit

Permalink
Merge pull request #1409 from ManInMyVan/config
Browse files Browse the repository at this point in the history
add %experimental%
  • Loading branch information
AoElite authored Mar 27, 2024
2 parents d6cefa7 + aa3ebfe commit 2fda5b4
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 20 deletions.
17 changes: 11 additions & 6 deletions src/main/java/ac/grim/grimac/manager/PunishmentManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
public class PunishmentManager {
GrimPlayer player;
List<PunishGroup> groups = new ArrayList<>();
String experimentalSymbol = "*";

public PunishmentManager(GrimPlayer player) {
this.player = player;
Expand All @@ -29,6 +30,7 @@ public PunishmentManager(GrimPlayer player) {
public void reload() {
DynamicConfig config = GrimAPI.INSTANCE.getConfigManager().getConfig();
List<String> punish = config.getStringListElse("Punishments", new ArrayList<>());
experimentalSymbol = config.getStringElse("experimental-symbol", "*");

try {
groups.clear();
Expand Down Expand Up @@ -93,12 +95,15 @@ private String replaceAlertPlaceholders(String original, PunishGroup group, Chec
// Streams are slow but this isn't a hot path... it's fine.
String vl = group.violations.values().stream().filter((e) -> e == check).count() + "";

original = original.replace("[alert]", alertString);
original = original.replace("[proxy]", alertString);
original = original.replace("%check_name%", check.getCheckName());
original = original.replace("%vl%", vl);
original = original.replace("%verbose%", verbose);
original = MessageUtil.format(original);
original = MessageUtil.format(original
.replace("[alert]", alertString)
.replace("[proxy]", alertString)
.replace("%check_name%", check.getCheckName())
.replace("%experimental%", check.isExperimental() ? experimentalSymbol : "")
.replace("%vl%", vl)
.replace("%verbose%", verbose)
);

original = GrimAPI.INSTANCE.getExternalAPI().replaceVariables(player, original, true);

return original;
Expand Down
6 changes: 4 additions & 2 deletions src/main/resources/messages/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ upload-log-upload-failure: "%prefix% &cBeim Hochladen dieses Protokolls ist etwa
# %prefix%
# %player%
# %check_name%
# %experimental%
# %vl% - Verstöße
# %verbose% - zusätzliche Informationen aus dem Check wie z.B. Offsets, nicht alle Checks fügen Informationen hinzu
alerts-format: "%prefix% &f%player% &bhat versagt &f%check_name% &f(x&c%vl%&f) &7%verbose%"
alerts-format-proxy: "%prefix% &f[&cproxy&f] &f%player% &bhat versagt &f%check_name% &f(x&c%vl%&f) &7%verbose%"
alerts-format: "%prefix% &f%player% &bhat versagt &f%check_name%%experimental% &f(x&c%vl%&f) &7%verbose%"
alerts-format-proxy: "%prefix% &f[&cproxy&f] &f%player% &bhat versagt &f%check_name%%experimental% &f(x&c%vl%&f) &7%verbose%"
experimental-symbol: "*"

profile:
- "&7======================"
Expand Down
6 changes: 4 additions & 2 deletions src/main/resources/messages/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ upload-log-upload-failure: "%prefix% &cSomething went wrong while uploading this
# %prefix%
# %player%
# %check_name%
# %experimental%
# %vl% - violations
# %verbose% - extra information from the check such as offsets, not all checks will add information
alerts-format: "%prefix% &f%player% &bfailed &f%check_name% &f(x&c%vl%&f) &7%verbose%"
alerts-format-proxy: "%prefix% &f[&cproxy&f] &f%player% &bfailed &f%check_name% &f(x&c%vl%&f) &7%verbose%"
alerts-format: "%prefix% &f%player% &bfailed &f%check_name%%experimental% &f(x&c%vl%&f) &7%verbose%"
alerts-format-proxy: "%prefix% &f[&cproxy&f] &f%player% &bfailed &f%check_name%%experimental% &f(x&c%vl%&f) &7%verbose%"
experimental-symbol: "*"

profile:
- "&7======================"
Expand Down
6 changes: 4 additions & 2 deletions src/main/resources/messages/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ upload-log-upload-failure: "%prefix% &cAlgo salio mal mientras subíamos ese reg
# %prefix%
# %player%
# %check_name%
# %experimental%
# %vl% - violaciones
# %verbose% - información extra de la comprobación como compensaciones. No todas añadirán informacion.
alerts-format: "%prefix% &f%player% &bfalló &f%check_name% &f(x&c%vl%&f) &7%verbose%"
alerts-format-proxy: "%prefix% &f[&cproxy&f] &f%player% &bfailed &f%check_name% &f(x&c%vl%&f) &7%verbose%"
alerts-format: "%prefix% &f%player% &bfalló &f%check_name%%experimental% &f(x&c%vl%&f) &7%verbose%"
alerts-format-proxy: "%prefix% &f[&cproxy&f] &f%player% &bfailed &f%check_name%%experimental% &f(x&c%vl%&f) &7%verbose%"
experimental-symbol: "*"

profile:
- "&7======================"
Expand Down
6 changes: 4 additions & 2 deletions src/main/resources/messages/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ upload-log-upload-failure: "%prefix% &cUne erreur est survenue lors du téléver
# %prefix%
# %player%
# %check_name%
# %experimental%
# %vl% - violations
# %verbose% - Informations supplémentaires sur les vérifivations comme les écarts, toutes les vérifications n'ajoutent pas d'information
alerts-format: "%prefix% &f%player% &ba échoué &f%check_name% &f(x&c%vl%&f) &7%verbose%"
alerts-format-proxy: "%prefix% &f[&cproxy&f] &f%player% &ba échoué &f%check_name% &f(x&c%vl%&f) &7%verbose%"
alerts-format: "%prefix% &f%player% &ba échoué &f%check_name%%experimental% &f(x&c%vl%&f) &7%verbose%"
alerts-format-proxy: "%prefix% &f[&cproxy&f] &f%player% &ba échoué &f%check_name%%experimental% &f(x&c%vl%&f) &7%verbose%"
experimental-symbol: "*"

profile:
- "&7======================"
Expand Down
6 changes: 4 additions & 2 deletions src/main/resources/messages/pt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ upload-log-upload-failure: "%prefix% &cAlgo deu errado ao enviar essa log, veja
# %prefix%
# %player%
# %check_name%
# %experimental%
# %vl% - violações
# %verbose% - Informação extra da verificação, como os desvios, nem todas as verifiações terão essa informação.
alerts-format: "%prefix% &f%player% &bfalhou em &f%check_name% &f(x&c%vl%&f) &7%verbose%"
alerts-format-proxy: "%prefix% &f[&cproxy&f] &f%player% &bfalhou em &f%check_name% &f(x&c%vl%&f) &7%verbose%"
alerts-format: "%prefix% &f%player% &bfalhou em &f%check_name%%experimental% &f(x&c%vl%&f) &7%verbose%"
alerts-format-proxy: "%prefix% &f[&cproxy&f] &f%player% &bfalhou em &f%check_name%%experimental% &f(x&c%vl%&f) &7%verbose%"
experimental-symbol: "*"

profile:
- "&7======================"
Expand Down
6 changes: 4 additions & 2 deletions src/main/resources/messages/ru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ upload-log-upload-failure: "%prefix% &cЧто-то пошло не так при
# %prefix%
# %player%
# %check_name%
# %experimental%
# %vl% - нарушения
# %verbose% - дополнительная информация от проверки, например, смещения, не все проверки добавляют информацию.
alerts-format: "%prefix% &f%player% &bпровалил &f%check_name% &f(x&c%vl%&f) &7%verbose%"
alerts-format-proxy: "%prefix% &f[&cproxy&f] &f%player% &bпровалил &f%check_name% &f(x&c%vl%&f) &7%verbose%"
alerts-format: "%prefix% &f%player% &bпровалил &f%check_name%%experimental% &f(x&c%vl%&f) &7%verbose%"
alerts-format-proxy: "%prefix% &f[&cproxy&f] &f%player% &bпровалил &f%check_name%%experimental% &f(x&c%vl%&f) &7%verbose%"
experimental-symbol: "*"

profile:
- "&7======================"
Expand Down
6 changes: 4 additions & 2 deletions src/main/resources/messages/zh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ upload-log-upload-failure: "%prefix% &c上载此日志时出错, 有关详细信
# %prefix% - 前缀
# %player% - 玩家
# %check_name% - 检查名字
# %experimental%
# %vl% - VL值
# %verbose% - 检查中的额外信息,例如偏移量,并非所有检查都会添加信息
alerts-format: "%prefix% &f%player% &b触发了 &f%check_name% &f(x&c%vl%&f) &7%verbose%"
alerts-format-proxy: "%prefix% &f[&cproxy&f] &f%player% &b触发了 &f%check_name% &f(x&c%vl%&f) &7%verbose%"
alerts-format: "%prefix% &f%player% &b触发了 &f%check_name%%experimental% &f(x&c%vl%&f) &7%verbose%"
alerts-format-proxy: "%prefix% &f[&cproxy&f] &f%player% &b触发了 &f%check_name%%experimental% &f(x&c%vl%&f) &7%verbose%"
experimental-symbol: "*"

profile:
- "&7======================"
Expand Down

0 comments on commit 2fda5b4

Please sign in to comment.