add color support for message triggers

This commit is contained in:
Blackdigits 2020-01-15 22:40:21 +07:00
parent b19ee4dc2f
commit 2db9606083

View File

@ -1,5 +1,6 @@
package net.Indyuce.mmocore.api.quest.trigger; package net.Indyuce.mmocore.api.quest.trigger;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.MMOCore;
@ -7,7 +8,7 @@ import net.Indyuce.mmocore.api.load.MMOLineConfig;
import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.PlayerData;
public class MessageTrigger extends Trigger { public class MessageTrigger extends Trigger {
private final String message; private String message;
public MessageTrigger(MMOLineConfig config) { public MessageTrigger(MMOLineConfig config) {
super(config); super(config);
@ -22,6 +23,7 @@ public class MessageTrigger extends Trigger {
} }
private String format(Player player) { private String format(Player player) {
message = ChatColor.translateAlternateColorCodes('&', message);
return MMOCore.plugin.placeholderParser.parse(player, message.replace("%player%", player.getName())); return MMOCore.plugin.placeholderParser.parse(player, message.replace("%player%", player.getName()));
} }
} }