Skip to content

Commit

Permalink
Fix wrong mob type name node retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreeam-qwq committed Dec 15, 2024
1 parent 77d90dc commit d2c963c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -777,9 +777,9 @@ public static Component entityDeathPlaceholders(Component msg, Player player, En
final boolean hasDistance = msg.contains(Component.text("%distance%"));

msg = msg.replaceText(Util.replace("%entity%", Messages.getInstance().getConfig().getString("Mobs."
+ entity.getType().toString().toLowerCase())))
+ EntityUtil.getConfigNodeByEntity(entity))))
.replaceText(Util.replace("%entity_display%", entity.getCustomName() == null ? Messages.getInstance().getConfig().getString("Mobs."
+ entity.getType().toString().toLowerCase()) : entity.getCustomName()))
+ EntityUtil.getConfigNodeByEntity(entity)) : entity.getCustomName()))
.replaceText(Util.replace("%killer%", player.getName()))
.replaceText(Util.replace("%killer_display%", player.getDisplayName()))
.replaceText(Util.replace("%world%", entity.getLocation().getWorld().getName()))
Expand Down Expand Up @@ -829,9 +829,9 @@ public static String entityDeathPlaceholders(String msg, Player player, Entity e
final boolean hasDistance = msg.contains("%distance%");

msg = msg.replaceAll("%entity%", Messages.getInstance().getConfig().getString("Mobs."
+ entity.getType().toString().toLowerCase()))
+ EntityUtil.getConfigNodeByEntity(entity)))
.replaceAll("%entity_display%", entity.getCustomName() == null ? Messages.getInstance().getConfig().getString("Mobs."
+ entity.getType().toString().toLowerCase()) : entity.getCustomName())
+ EntityUtil.getConfigNodeByEntity(entity)) : entity.getCustomName())
.replaceAll("%killer%", isSayanVanished ? getVanishedName() : player.getName())
.replaceAll("%killer_display%", isSayanVanished ? getVanishedName() : player.getDisplayName())
.replaceAll("%world%", entity.getLocation().getWorld().getName())
Expand Down Expand Up @@ -908,18 +908,18 @@ public static Component playerDeathPlaceholders(Component msg, PlayerManager pm,
String[] chars = Settings.getInstance().getConfig().getString(Config.RENAME_MOBS_IF_CONTAINS.getPath()).split("(?!^)");
for (String ch : chars) {
if (mobName.contains(ch)) {
mobName = Messages.getInstance().getConfig().getString("Mobs." + mob.getType().toString().toLowerCase());
mobName = Messages.getInstance().getConfig().getString("Mobs." + EntityUtil.getConfigNodeByEntity(mob));
break;
}
}
}

if (!(mob instanceof Player) && Settings.getInstance().getConfig().getBoolean(Config.DISABLE_NAMED_MOBS.getPath())) {
mobName = Messages.getInstance().getConfig().getString("Mobs." + mob.getType().toString().toLowerCase());
mobName = Messages.getInstance().getConfig().getString("Mobs." + EntityUtil.getConfigNodeByEntity(mob));
}

msg = msg.replaceText(Util.replace("%killer%", mobName))
.replaceText(Util.replace("%killer_type%", Messages.getInstance().getConfig().getString("Mobs." + mob.getType().toString().toLowerCase())));
.replaceText(Util.replace("%killer_type%", Messages.getInstance().getConfig().getString("Mobs." + EntityUtil.getConfigNodeByEntity(mob))));

if (mob instanceof Player) {
Player p = (Player) mob;
Expand Down Expand Up @@ -977,18 +977,18 @@ public static String playerDeathPlaceholders(String msg, PlayerManager pm, Entit
String[] chars = Settings.getInstance().getConfig().getString(Config.RENAME_MOBS_IF_CONTAINS.getPath()).split("(?!^)");
for (String ch : chars) {
if (mobName.contains(ch)) {
mobName = Messages.getInstance().getConfig().getString("Mobs." + mob.getType().toString().toLowerCase());
mobName = Messages.getInstance().getConfig().getString("Mobs." + EntityUtil.getConfigNodeByEntity(mob));
break;
}
}
}

if (!(mob instanceof Player) && Settings.getInstance().getConfig().getBoolean(Config.DISABLE_NAMED_MOBS.getPath())) {
mobName = Messages.getInstance().getConfig().getString("Mobs." + mob.getType().toString().toLowerCase());
mobName = Messages.getInstance().getConfig().getString("Mobs." + EntityUtil.getConfigNodeByEntity(mob));
}

msg = msg.replaceAll("%killer%", mobName)
.replaceAll("%killer_type%", Messages.getInstance().getConfig().getString("Mobs." + mob.getType().toString().toLowerCase()));
.replaceAll("%killer_type%", Messages.getInstance().getConfig().getString("Mobs." + EntityUtil.getConfigNodeByEntity(mob)));

if (mob instanceof Player) {
Player p = (Player) mob;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -776,9 +776,9 @@ public static Component entityDeathPlaceholders(Component msg, Player player, En
final boolean hasDistance = msg.contains(Component.text("%distance%"));

msg = msg.replaceText(Util.replace("%entity%", Messages.getInstance().getConfig().getString("Mobs."
+ entity.getType().toString().toLowerCase())))
+ EntityUtil.getConfigNodeByEntity(entity))))
.replaceText(Util.replace("%entity_display%", entity.getCustomName() == null ? Messages.getInstance().getConfig().getString("Mobs."
+ entity.getType().toString().toLowerCase()) : entity.getCustomName()))
+ EntityUtil.getConfigNodeByEntity(entity)) : entity.getCustomName()))
.replaceText(Util.replace("%killer%", player.getName()))
.replaceText(Util.replace("%killer_display%", player.getDisplayName()))
.replaceText(Util.replace("%world%", entity.getLocation().getWorld().getName()))
Expand Down Expand Up @@ -828,9 +828,9 @@ public static String entityDeathPlaceholders(String msg, Player player, Entity e
final boolean hasDistance = msg.contains("%distance%");

msg = msg.replaceAll("%entity%", Messages.getInstance().getConfig().getString("Mobs."
+ entity.getType().toString().toLowerCase()))
+ EntityUtil.getConfigNodeByEntity(entity)))
.replaceAll("%entity_display%", entity.getCustomName() == null ? Messages.getInstance().getConfig().getString("Mobs."
+ entity.getType().toString().toLowerCase()) : entity.getCustomName())
+ EntityUtil.getConfigNodeByEntity(entity)) : entity.getCustomName())
.replaceAll("%killer%", isSayanVanished ? getVanishedName() : player.getName())
.replaceAll("%killer_display%", isSayanVanished ? getVanishedName() : player.getDisplayName())
.replaceAll("%world%", entity.getLocation().getWorld().getName())
Expand Down Expand Up @@ -907,18 +907,18 @@ public static Component playerDeathPlaceholders(Component msg, PlayerManager pm,
String[] chars = Settings.getInstance().getConfig().getString(Config.RENAME_MOBS_IF_CONTAINS.getPath()).split("(?!^)");
for (String ch : chars) {
if (mobName.contains(ch)) {
mobName = Messages.getInstance().getConfig().getString("Mobs." + mob.getType().toString().toLowerCase());
mobName = Messages.getInstance().getConfig().getString("Mobs." + EntityUtil.getConfigNodeByEntity(mob));
break;
}
}
}

if (!(mob instanceof Player) && Settings.getInstance().getConfig().getBoolean(Config.DISABLE_NAMED_MOBS.getPath())) {
mobName = Messages.getInstance().getConfig().getString("Mobs." + mob.getType().toString().toLowerCase());
mobName = Messages.getInstance().getConfig().getString("Mobs." + EntityUtil.getConfigNodeByEntity(mob));
}

msg = msg.replaceText(Util.replace("%killer%", mobName))
.replaceText(Util.replace("%killer_type%", Messages.getInstance().getConfig().getString("Mobs." + mob.getType().toString().toLowerCase())));
.replaceText(Util.replace("%killer_type%", Messages.getInstance().getConfig().getString("Mobs." + EntityUtil.getConfigNodeByEntity(mob))));

if (mob instanceof Player) {
Player p = (Player) mob;
Expand Down Expand Up @@ -976,18 +976,18 @@ public static String playerDeathPlaceholders(String msg, PlayerManager pm, Entit
String[] chars = Settings.getInstance().getConfig().getString(Config.RENAME_MOBS_IF_CONTAINS.getPath()).split("(?!^)");
for (String ch : chars) {
if (mobName.contains(ch)) {
mobName = Messages.getInstance().getConfig().getString("Mobs." + mob.getType().toString().toLowerCase());
mobName = Messages.getInstance().getConfig().getString("Mobs." + EntityUtil.getConfigNodeByEntity(mob));
break;
}
}
}

if (!(mob instanceof Player) && Settings.getInstance().getConfig().getBoolean(Config.DISABLE_NAMED_MOBS.getPath())) {
mobName = Messages.getInstance().getConfig().getString("Mobs." + mob.getType().toString().toLowerCase());
mobName = Messages.getInstance().getConfig().getString("Mobs." + EntityUtil.getConfigNodeByEntity(mob));
}

msg = msg.replaceAll("%killer%", mobName)
.replaceAll("%killer_type%", Messages.getInstance().getConfig().getString("Mobs." + mob.getType().toString().toLowerCase()));
.replaceAll("%killer_type%", Messages.getInstance().getConfig().getString("Mobs." + EntityUtil.getConfigNodeByEntity(mob)));

if (mob instanceof Player) {
Player p = (Player) mob;
Expand Down

0 comments on commit d2c963c

Please sign in to comment.