MineAlert/src/main/java/xyz/etztech/orealert/Lang.java

49 lines
1.3 KiB
Java
Raw Normal View History

package xyz.etztech.orealert;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.TextComponent;
import org.apache.commons.lang.WordUtils;
import org.bukkit.Material;
import org.bukkit.command.CommandSender;
public enum Lang {
NO_PERMISSION("You don't have permission to do that.", Color.ERROR),
UNKNOWN_COMMAND("This command wasn't recognized.", Color.ERROR),
PLUGIN_RELOADED("Plugin reloaded.", Color.INFO),
ALERT("%s has found %d %s veins.", null);
private final String message;
private final ChatColor color;
Lang(String message, ChatColor color) {
this.message = message;
this.color = color;
}
public String getMessage() {
return this.message;
}
public ChatColor getColor() {
return this.color;
}
public void sms(CommandSender sender) {
TextComponent text = new TextComponent(this.message);
text.setColor(this.color);
sender.spigot().sendMessage(text);
}
public static String getMaterialName(Material material) {
String name = material.name();
name = name.replaceAll("_", " ");
name = WordUtils.capitalize(name.toLowerCase());
return name;
}
public static String getMaterialKey(Material material) {
return material.name().toLowerCase();
}
}