Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added unenchant messages #9

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.thenextlvl.tweaks.command.item;

import lombok.RequiredArgsConstructor;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
import net.thenextlvl.tweaks.TweaksPlugin;
import net.thenextlvl.tweaks.command.api.CommandInfo;
Expand Down Expand Up @@ -54,7 +55,11 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
enchantments.add(enchantment);
}

enchantments.forEach(item::removeEnchantment);
enchantments.forEach(enchantment -> {
var message = item.removeEnchantment(enchantment) != 0 ? "enchantment.removed" : "enchantment.absent";
plugin.bundle().sendMessage(player, message, Placeholder.component("enchantment",
Component.translatable(enchantment.translationKey())));
});

return true;
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/tweaks.properties
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ item.invalid=<prefix> <dark_red><item><red> is not a valid item
enchantment.invalid=<prefix> <dark_red><enchantment><red> is not a valid enchantment
enchantment.not.applicable=<prefix> <red>This enchantment is not applicable on <dark_red><item>
enchantment.applied=<prefix> <white>Applied <green><enchantment><white> to your item
enchantment.removed=<prefix> <white>Removed <green><enchantment><white> from your item
enchantment.absent=<prefix> <red>Your item does not have <dark_red><enchantment>
gamemode.changed.self=<prefix> <white>You are now in <green><gamemode>
gamemode.changed.others=<prefix> <green><player> <white>is now in <green><gamemode>
speed.walk.changed.self=<prefix> <white>Your walk speed is now <green><speed>
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/tweaks_german.properties
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ inventory.full=<prefix> <red>Dein Inventar ist voll
item.received=<prefix> <white>Du hast <green><amount> x <item><white> erhalten
item.invalid=<prefix> <dark_red><item><red> ist kein gültiges Item
enchantment.invalid=<prefix> <dark_red><enchantment><red> ist keine gültige Verzauberung
enchantment.not.applicable=<prefix> <red>Dieses enchantment ist nicht auf <dark_red><item><red> anwendbar
enchantment.not.applicable=<prefix> <red>Diese Verzauberung ist nicht auf <dark_red><item><red> anwendbar
enchantment.applied=<prefix> <white>Dein Item wurde mit <green><enchantment><white> verzaubert
enchantment.removed=<prefix> <white>Die Verzauberung <green><enchantment><white> wurde von deinem Item entfernt
enchantment.absent=<prefix> <red>Dein Item ist nicht mit <dark_red><enchantment><red> verzaubert
gamemode.changed.self=<prefix> <white>Du bist jetzt im <green><gamemode>
gamemode.changed.others=<prefix> <green><player> <white>ist jetzt im <green><gamemode>
speed.walk.changed.self=<prefix> <white>Deine Laufgeschwindigkeit is jetzt <green><speed>
Expand Down
Loading