kenshinshideandseek/src/main/java/net/tylermurphy/hideAndSeek/configuration/LocalizationString.java

49 lines
1.2 KiB
Java
Raw Normal View History

2021-10-23 00:03:15 +00:00
package net.tylermurphy.hideAndSeek.configuration;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
public class LocalizationString {
String message;
public LocalizationString(String message) {
this.message = message;
}
public LocalizationString addPlayer(Entity player) {
this.message = message.replaceFirst("\\{PLAYER\\}", player.getName());
return this;
}
public LocalizationString addPlayer(CommandSender player) {
this.message = message.replaceFirst("\\{PLAYER\\}", player.getName());
return this;
}
public LocalizationString addPlayer(String player) {
this.message = message.replaceFirst("\\{PLAYER\\}", player);
return this;
}
public LocalizationString addAmount(Integer value) {
this.message = message.replaceFirst("\\{AMOUNT\\}", value.toString());
return this;
}
public LocalizationString addAmount(String value) {
this.message = message.replaceFirst("\\{AMOUNT\\}", value.toString());
return this;
}
public LocalizationString addAmount(Float value) {
this.message = message.replaceFirst("\\{AMOUNT\\}", value.toString());
return this;
}
public String toString() {
return message;
}
}