Skip to content

Commit

Permalink
Fixed config issue with kill messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Devlrxxh committed Jul 15, 2024
1 parent ceaf74d commit 1bb24b0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public void setspawn(Player player) {
@Subcommand("reload")
public void reload(Player player) {
plugin.getConfigManager().load();
plugin.getCosmeticManager().load();
player.sendMessage(CC.color("&aSuccessfully reloaded configs!"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public ItemStack getButtonItem(Player player) {
.replace("<selected>", selected ? CosmeticsLocale.SELECTED_DISPLAY_NAME.getString() : ""))
.lore(ItemUtils.getLore(lore,
new Replacement("<description>", killMessagePackage.getDescription()),
new Replacement("<messages>", killMessagePackage.getMessages())))
new Replacement("<messages>", ItemUtils.getLore(killMessagePackage.getMessages(), new Replacement("<player>", player.getName()), new Replacement("<killer>", player.getName())))))
.clearFlags()
.build();
}
Expand Down
6 changes: 3 additions & 3 deletions Plugin/src/main/java/dev/lrxh/neptune/utils/ItemUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ public List<String> getLore(List<String> lore, Replacement... replacements) {
for (Replacement replacement : replacements) {
if (replacement.getReplacement() instanceof String) {
line = line.replaceAll(replacement.getPlaceholder(), (String) replacement.getReplacement());
}else if (replacement.getReplacement() instanceof List<?>) {
if(line.contains(replacement.getPlaceholder())) {
} else if (replacement.getReplacement() instanceof List<?>) {
if (line.contains(replacement.getPlaceholder())) {
List<String> replacementList = (List<String>) replacement.getReplacement();
for (String replacementLine : replacementList) {
newLore.add(line.replaceAll(replacement.getPlaceholder(), replacementLine));
Expand All @@ -132,7 +132,7 @@ public List<String> getLore(List<String> lore, Replacement... replacements) {
line = line.replaceAll(replacement.getPlaceholder(), String.valueOf(replacement.getReplacement()));
}
}
if(!skip) newLore.add(line);
if (!skip) newLore.add(line);
}
return newLore;
}
Expand Down

0 comments on commit 1bb24b0

Please sign in to comment.