Finished Soft Touch

This commit is contained in:
Auxilor 2021-08-09 01:07:00 +01:00
parent 6da7ff1e55
commit 5e04e4e55d
2 changed files with 10 additions and 8 deletions

View File

@ -34,6 +34,7 @@ public class SoftTouch extends EcoEnchant {
return EnchantmentUtils.chancePlaceholder(this, level);
}
@SuppressWarnings("checkstyle:OperatorWrap")
@Override
public void onBlockBreak(@NotNull final Player player,
@NotNull final Block block,
@ -60,12 +61,13 @@ public class SoftTouch extends EcoEnchant {
meta.getPersistentDataContainer().set(this.getPlugin().getNamespacedKeyFactory().create("softtouch"), PersistentDataType.STRING, type.name());
String entityName = displayNicely(type);
meta.setDisplayName(
this.getConfig().getString(EcoEnchants.CONFIG_LOCATION + "spawner-name")
.replace("%type%", entityName)
);
List<String> lore = this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "spawner-lore");
String name = this.getConfig().getString(EcoEnchants.CONFIG_LOCATION + "name");
name = name.replace("%type%", entityName);
name = name.replace("[", "").replace("]", "");
meta.setDisplayName(name);
List<String> lore = this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "lore");
lore.replaceAll(s -> s.replace("%type%", entityName));
meta.setLore(lore);
@ -111,7 +113,7 @@ public class SoftTouch extends EcoEnchant {
}
private String displayNicely(@NotNull final EntityType type) {
String name = type.name();
String name = type.name().toLowerCase();
name = name.replace("_", "");
name = StringUtils.capitalize(name);
return name;

View File

@ -23,8 +23,8 @@ general-config:
config:
chance-per-level: 10
spawner-name:
name:
- "&a%type%&f Spawner"
spawner-lore:
lore:
- "&a%type%&f Spawner"
- "&fCan be placed anywhere in the world"