Skip to content

Commit

Permalink
add check displaynames (GrimAnticheat#1669)
Browse files Browse the repository at this point in the history
* add check displaynames

* oops
  • Loading branch information
ManInMyVan authored Nov 1, 2024
1 parent e829c25 commit b65f42a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/main/java/ac/grim/grimac/checks/Check.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class Check implements AbstractCheck, ConfigReloadObserver {
private String checkName;
private String configName;
private String alternativeName;
private String displayName;
private String description;

private boolean experimental;
Expand Down Expand Up @@ -53,6 +54,7 @@ public Check(final GrimPlayer player) {
this.alternativeName = checkData.alternativeName();
this.experimental = checkData.experimental();
this.description = checkData.description();
this.displayName = this.checkName;
}
//
reload();
Expand Down Expand Up @@ -112,6 +114,8 @@ public final void reward() {
public void reload(ConfigManager configuration) {
decay = configuration.getDoubleElse(configName + ".decay", decay);
setbackVL = configuration.getDoubleElse(configName + ".setbackvl", setbackVL);
displayName = configuration.getStringElse(configName + ".displayname", checkName);

if (setbackVL == -1) setbackVL = Double.MAX_VALUE;
updateExempted();
onReload(configuration);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/ac/grim/grimac/manager/PunishmentManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private String replaceAlertPlaceholders(String original, PunishGroup group, Chec
original = MessageUtil.format(original
.replace("[alert]", alertString)
.replace("[proxy]", alertString)
.replace("%check_name%", check.getCheckName())
.replace("%check_name%", check.getDisplayName())
.replace("%experimental%", check.isExperimental() ? experimentalSymbol : "")
.replace("%vl%", vl)
.replace("%verbose%", verbose)
Expand Down Expand Up @@ -149,7 +149,7 @@ public boolean handleAlert(GrimPlayer player, String verbose, Check check) {

if (command.command.equals("[webhook]")) {
String vl = group.violations.values().stream().filter((e) -> e == check).count() + "";
GrimAPI.INSTANCE.getDiscordManager().sendAlert(player, verbose, check.getCheckName(), vl);
GrimAPI.INSTANCE.getDiscordManager().sendAlert(player, verbose, check.getDisplayName(), vl);
} else if (command.command.equals("[proxy]")) {
ProxyAlertMessenger.sendPluginMessage(replaceAlertPlaceholders(command.getCommand(), group, check, proxyAlertString, verbose));
} else {
Expand Down

0 comments on commit b65f42a

Please sign in to comment.