2020-07-29 17:31:54 +00:00
|
|
|
package xyz.etztech.minealert;
|
2020-07-21 03:17:08 +00:00
|
|
|
|
|
|
|
|
2020-07-28 02:06:33 +00:00
|
|
|
import org.apache.commons.lang.WordUtils;
|
|
|
|
import org.bukkit.Material;
|
2020-07-21 03:17:08 +00:00
|
|
|
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),
|
2020-07-29 17:31:54 +00:00
|
|
|
PLUGIN_RELOADED("MineAlert reloaded.", Color.INFO),
|
2020-08-02 02:01:51 +00:00
|
|
|
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);
|
2020-07-21 03:17:08 +00:00
|
|
|
|
|
|
|
private final String message;
|
2020-07-29 19:34:28 +00:00
|
|
|
private final Color color;
|
2020-07-21 03:17:08 +00:00
|
|
|
|
2020-07-29 19:34:28 +00:00
|
|
|
Lang(String message, Color color) {
|
2020-07-21 03:17:08 +00:00
|
|
|
this.message = message;
|
|
|
|
this.color = color;
|
|
|
|
}
|
|
|
|
|
2020-08-02 02:01:51 +00:00
|
|
|
public String getMessage(Object ...args) {
|
|
|
|
return String.format(this.message, args);
|
2020-07-29 04:30:41 +00:00
|
|
|
}
|
|
|
|
|
2020-07-29 19:34:28 +00:00
|
|
|
public Color getColor() {
|
2020-07-29 04:30:41 +00:00
|
|
|
return this.color;
|
|
|
|
}
|
|
|
|
|
2020-07-29 19:34:28 +00:00
|
|
|
public void sms(CommandSender sender, Object ...args) {
|
|
|
|
this.color.sms(sender, String.format(this.message, args));
|
2020-07-21 03:17:08 +00:00
|
|
|
}
|
2020-07-28 02:06:33 +00:00
|
|
|
|
|
|
|
public static String getMaterialName(Material material) {
|
2020-07-29 16:41:44 +00:00
|
|
|
String name = getMaterialKey(material);
|
2020-07-28 02:06:33 +00:00
|
|
|
name = name.replaceAll("_", " ");
|
2020-07-29 16:41:44 +00:00
|
|
|
name = WordUtils.capitalize(name);
|
2020-07-28 02:06:33 +00:00
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static String getMaterialKey(Material material) {
|
|
|
|
return material.name().toLowerCase();
|
|
|
|
}
|
2020-07-21 03:17:08 +00:00
|
|
|
}
|