Hotfix for: SD-3014

This commit is contained in:
Stefano Haagmans 2019-07-16 22:53:23 +02:00
parent 8ad2b5d31c
commit c44c7adca4
3 changed files with 11 additions and 6 deletions

2
.gitignore vendored
View File

@ -91,3 +91,5 @@ target/classes/en_US\.lang
target/classes/plugin\.yml
target/classes/vouchers\.yml
dependency-reduced-pom\.xml

View File

@ -19,6 +19,7 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot:1.13.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot:1.14" level="project" />
<orderEntry type="library" name="Maven: com.songoda:songodaupdater:1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.2" level="project" />

View File

@ -18,6 +18,7 @@ import org.bukkit.inventory.meta.ItemMeta;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import static com.songoda.epicvouchers.utils.Methods.format;
@ -141,16 +142,17 @@ public class Voucher {
}
public void give(CommandSender sender, List<Player> players, int amount) {
String giveMessage = instance.getLocale().getMessage("command.give.send")
.replaceAll("%player%", players.size() == 1 ? players.get(0).getName() : "everyone")
.replaceAll("%voucher%", Matcher.quoteReplacement(getName(true)))
.replaceAll("%amount%", String.valueOf(amount));
.replaceAll(Pattern.quote("%player%"), players.size() == 1 ? players.get(0).getName() : "everyone")
.replaceAll(Pattern.quote("%voucher%"), Matcher.quoteReplacement(getName(true)))
.replaceAll(Pattern.quote("%amount%"), String.valueOf(amount));
for (Player player : players) {
String receiveMessage = instance.getLocale().getMessage("command.give.receive")
.replaceAll("%voucher%", getName(true))
.replaceAll("%player%", player.getName())
.replaceAll("%amount%", String.valueOf(amount));
.replaceAll(Pattern.quote("%voucher%"), getName(true))
.replaceAll(Pattern.quote("%player%"), player.getName())
.replaceAll(Pattern.quote("%amount%"), String.valueOf(amount));
VoucherReceiveEvent event = new VoucherReceiveEvent(player, getName(true), toItemStack(amount), amount, sender);
Bukkit.getServer().getPluginManager().callEvent(event);