added custom error message when translation not found

added message to mmocore attribute condition
This commit is contained in:
Indyuce 2019-08-31 16:28:54 +02:00
parent 5731b80c52
commit 378af5245d
2 changed files with 3 additions and 2 deletions

View File

@ -26,7 +26,7 @@ public class Required_Attribute extends DoubleStat implements Conditional {
MMOCoreRPGPlayer mmocore = (MMOCoreRPGPlayer) player;
if (mmocore.getData().getAttributes().getAttribute(attribute) < item.getStat(this)) {
if (message) {
new AddonMessage("not-enough-attribute").format(ChatColor.RED).send(player.getPlayer(), "cant-use-item");
new AddonMessage("not-enough-attribute").format(ChatColor.RED, "#attribute#", attribute.getName()).send(player.getPlayer(), "cant-use-item");
player.getPlayer().playSound(player.getPlayer().getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1.5f);
}
return false;

View File

@ -213,7 +213,8 @@ public class ConfigManager {
}
public String getMessage(String path) {
return ChatColor.translateAlternateColorCodes('&', messages.getConfig().getString(path));
String found = messages.getConfig().getString(path);
return ChatColor.translateAlternateColorCodes('&', found == null ? "<MessageNotFound:" + path + ">" : found);
}
public String getAbilityName(Ability ability) {