66 lines
2.0 KiB
Java
Executable File
66 lines
2.0 KiB
Java
Executable File
package com.alttd.afkdectector;
|
|
|
|
import org.bukkit.ChatColor;
|
|
import org.bukkit.configuration.file.YamlConfiguration;
|
|
|
|
/**
|
|
* An enum for requesting strings from the language file.
|
|
*/
|
|
public enum Lang {
|
|
TITLE("title-name", "&4[&fAFKDetector&4]:"),
|
|
COOLDOWN("cooldown-message", "You need to wait %timeleft% seconds before using this command."),
|
|
INVALID_PLAYER("invalid-args", "&cInvalid args!usage: -p:playername"),
|
|
INVALID_REASON("invalid-reason" , "&cInvalid args! usage: -r:reason"),
|
|
NOT_ONLINE("player-notonline", "&cInvalid args! player not online"),
|
|
PLAYER_ONLY("player-only", "Teri have you ever seen an afk console?"),
|
|
NO_PERMS("no-permissions", "&cYou don''t have permission for that!"),
|
|
AFK_LIST("afk-list", "There are %afkplayers% afk."),
|
|
AFK_PREFIX("afk-prefix", "[AFK]"),
|
|
AFKCHECKTITLE("afkcheck-title", "AFK CHECK"),
|
|
AFKCHECKSUBTITLE("afkcheck-subtitle", "Please respond to the dm from staff!"),
|
|
AFKCHECKCMESSAGE("afkcheck-message", "Hey, since you're near a farm and not moving. I'm making sure you aren't afk. Please respond to me if you're not AFK.");
|
|
|
|
|
|
private String path;
|
|
private String def;
|
|
private static YamlConfiguration LANG;
|
|
|
|
/**
|
|
* Lang enum constructor.
|
|
* @param path The string path.
|
|
* @param start The default string.
|
|
*/
|
|
Lang(String path, String start) {
|
|
this.path = path;
|
|
this.def = start;
|
|
}
|
|
|
|
/**
|
|
* Set the {@code YamlConfiguration} to use.
|
|
* @param config The config to set.
|
|
*/
|
|
public static void setFile(YamlConfiguration config) {
|
|
LANG = config;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return ChatColor.translateAlternateColorCodes('&', LANG.getString(this.path, def));
|
|
}
|
|
|
|
/**
|
|
* Get the default value of the path.
|
|
* @return The default value of the path.
|
|
*/
|
|
public String getDefault() {
|
|
return this.def;
|
|
}
|
|
|
|
/**
|
|
* Get the path to the string.
|
|
* @return The path to the string.
|
|
*/
|
|
public String getPath() {
|
|
return this.path;
|
|
}
|
|
} |