TF-Marriage/src/main/java/com/lenis0012/bukkit/marriage2/config/Message.java

39 lines
1.1 KiB
Java
Raw Normal View History

2014-11-13 16:45:41 +00:00
package com.lenis0012.bukkit.marriage2.config;
2014-11-12 21:27:22 +00:00
import com.lenis0012.bukkit.marriage2.Marriage;
import com.lenis0012.bukkit.marriage2.misc.BConfig;
public enum Message {
PLAYER_NOT_FOUND("&cNo player named %s was found!"),
2014-11-13 09:54:23 +00:00
TARGET_ALREADY_MARRIED("&cPlayers %s is already married to someone!"),
ALREADY_MARRIED("&cYou are already married to someone!"),
MARRIED("&a&lPlayer %s and %s are now officially married!"),
2014-12-14 02:36:33 +00:00
MARRIAGE_REQUESTED("&aPlayer %s has requested you to marry with them, use &e/marry %s &ato accept it."),
NOT_MARRIED("&cYou are currently not married with someone!"),
DIVORCED("&aPlayer %s and %s have divorced!");
2014-11-12 21:27:22 +00:00
private final String defaultMessage;
private String message;
private Message(String def) {
this.defaultMessage = def;
}
private void reload(BConfig config) {
this.message = config.getOrSet(toString().toLowerCase(), defaultMessage);
}
@Override
public String toString() {
return message;
}
public static void reloadAll(Marriage marriage) {
BConfig config = marriage.getBukkitConfig("messages.yml");
for(Message message : Message.values()) {
message.reload(config);
}
config.save();
}
}