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

51 lines
1.4 KiB
Java

package xyz.etztech.minealert;
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("MineAlert reloaded.", Color.INFO),
WEBHOOK_FAILED("Could not send webhook.", Color.ERROR),
ORE_ALERT("%s has found %d %s veins.", Color.DEFAULT),
IGNITE_ALERT("%s started a fire.", Color.DEFAULT),
TNT_ALERT("%s placed TnT.", Color.DEFAULT),
LAVA_ALERT("%s poured lava.", Color.DEFAULT);
private final String message;
private final Color color;
Lang(String message, Color color) {
this.message = message;
this.color = color;
}
public String getMessage(Object ...args) {
return String.format(this.message, args);
}
public Color getColor() {
return this.color;
}
public void sms(CommandSender sender, Object ...args) {
this.color.sms(sender, String.format(this.message, args));
}
public static String getMaterialName(Material material) {
String name = getMaterialKey(material);
name = name.replaceAll("_", " ");
name = WordUtils.capitalize(name);
return name;
}
public static String getMaterialKey(Material material) {
return material.name().toLowerCase();
}
}