Localization changes
This commit is contained in:
@@ -5,6 +5,7 @@ import com.willfp.eco.core.PluginDependent;
|
||||
import com.willfp.eco.core.command.CommandBase;
|
||||
import com.willfp.eco.core.command.CommandHandler;
|
||||
import com.willfp.eco.core.command.TabCompleteHandler;
|
||||
import com.willfp.eco.util.StringUtils;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -168,7 +169,7 @@ abstract class HandledCommand extends PluginDependent<EcoPlugin> implements Comm
|
||||
@NotNull final CommandBase command,
|
||||
@NotNull final EcoPlugin plugin) {
|
||||
if (command.isPlayersOnly() && !(sender instanceof Player)) {
|
||||
sender.sendMessage(plugin.getLangYml().getMessage("not-player"));
|
||||
sender.sendMessage(StringUtils.getLocalizedString(plugin.getNamespacedKeyFactory().create("not-player")));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package com.willfp.eco.core.recipe.parts;
|
||||
|
||||
import com.willfp.eco.core.Eco;
|
||||
import com.willfp.eco.core.items.TestableItem;
|
||||
import com.willfp.eco.util.NamespacedKeyUtils;
|
||||
import com.willfp.eco.util.StringUtils;
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@@ -58,7 +59,7 @@ public class TestableStack implements TestableItem {
|
||||
List<String> lore = meta.hasLore() ? meta.getLore() : new ArrayList<>();
|
||||
assert lore != null;
|
||||
lore.add("");
|
||||
String add = Eco.getHandler().getEcoPlugin().getLangYml().getString("multiple-in-craft");
|
||||
String add = StringUtils.getLocalizedString(NamespacedKeyUtils.createEcoKey("multiple-in-craft"));
|
||||
add = add.replace("%amount%", String.valueOf(amount));
|
||||
lore.add(add);
|
||||
meta.setLore(lore);
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.willfp.eco.util;
|
||||
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@UtilityClass
|
||||
public class NamespacedKeyUtils {
|
||||
/**
|
||||
* Create a NamespacedKey for eco.
|
||||
*
|
||||
* @param string The string.
|
||||
* @return The key.
|
||||
*/
|
||||
public NamespacedKey createEcoKey(@NotNull final String string) {
|
||||
return Objects.requireNonNull(NamespacedKey.fromString("eco:" + string));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user