improve prestige customisation

add prestiges section of messages.yml
add prestige gui title
add first rank for prestiges
This commit is contained in:
okx-code
2018-09-06 21:30:21 +01:00
parent f78bc81d0f
commit 4c7c4ef7f5
10 changed files with 72 additions and 50 deletions
@@ -6,6 +6,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import sh.okx.rankup.prestige.Prestige;
import sh.okx.rankup.prestige.Prestiges;
import sh.okx.rankup.ranks.Rank;
import java.util.regex.Matcher;
@@ -19,7 +20,11 @@ public class MessageBuilder {
}
public static MessageBuilder of(ConfigurationSection config, Message message) {
return new MessageBuilder(ChatColor.translateAlternateColorCodes('&', config.getString(message.getName())));
return MessageBuilder.of(config, message.getName());
}
private static MessageBuilder of(ConfigurationSection config, String message) {
return new MessageBuilder(ChatColor.translateAlternateColorCodes('&', config.getString(message)));
}
public MessageBuilder replace(Variable variable, Object value) {
@@ -33,6 +38,14 @@ public class MessageBuilder {
return this;
}
public MessageBuilder replaceFirstPrestige(Rank rank, Prestiges prestiges, String with) {
if(prestiges.getFirst().equals(rank)) {
replace(Variable.OLD_RANK, with);
replace(Variable.OLD_RANK_NAME, with);
}
return this;
}
public MessageBuilder replaceRanks(CommandSender player, Rank rank) {
replace(Variable.PLAYER, player.getName());
replaceRanks(rank);