Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60c3b58a33 | ||
|
|
7216d0b09f | ||
|
|
97eeea8d48 | ||
|
|
82061ee6a3 |
@@ -47,6 +47,21 @@ public interface FastItemStack {
|
||||
*/
|
||||
List<String> getLore();
|
||||
|
||||
|
||||
/**
|
||||
* Set the rework penalty.
|
||||
*
|
||||
* @param cost The rework penalty to set.
|
||||
*/
|
||||
void setRepairCost(int cost);
|
||||
|
||||
/**
|
||||
* Get the rework penalty.
|
||||
*.
|
||||
* @return The rework penalty found on the item.
|
||||
*/
|
||||
int getRepairCost();
|
||||
|
||||
/**
|
||||
* Get the Bukkit ItemStack again.
|
||||
*
|
||||
|
||||
@@ -47,6 +47,15 @@ public class StringUtils {
|
||||
.add(Pattern.compile("<#" + "([A-Fa-f0-9]{6})" + ">"))
|
||||
.build();
|
||||
|
||||
/**
|
||||
* Legacy serializer.
|
||||
*/
|
||||
private static final LegacyComponentSerializer LEGACY_COMPONENT_SERIALIZER = LegacyComponentSerializer.builder()
|
||||
.character('\u00a7')
|
||||
.useUnusualXRepeatedCharacterHexFormat()
|
||||
.hexColors()
|
||||
.build();
|
||||
|
||||
/**
|
||||
* Format a list of strings - converts Placeholders and Color codes.
|
||||
*
|
||||
@@ -246,7 +255,7 @@ public class StringUtils {
|
||||
public String legacyToJson(@NotNull final String legacy) {
|
||||
return GsonComponentSerializer.gson().serialize(
|
||||
Component.empty().decoration(TextDecoration.ITALIC, false).append(
|
||||
LegacyComponentSerializer.legacySection().deserialize(legacy)
|
||||
LEGACY_COMPONENT_SERIALIZER.deserialize(legacy)
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -258,7 +267,7 @@ public class StringUtils {
|
||||
* @return The legacy string.
|
||||
*/
|
||||
public String jsonToLegacy(@NotNull final String json) {
|
||||
return LegacyComponentSerializer.legacySection().serialize(
|
||||
return LEGACY_COMPONENT_SERIALIZER.serialize(
|
||||
GsonComponentSerializer.gson().deserialize(json)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -207,7 +207,8 @@ open class EcoYamlConfigWrapper<T : ConfigurationSection> : Config {
|
||||
return if (cache.containsKey("$path\$FMT")) {
|
||||
cache["$path\$FMT"] as List<String>
|
||||
} else {
|
||||
cache["$path\$FMT"] = StringUtils.formatList(if (has(path)) ArrayList(handle.getStringList(path)) else ArrayList<String>())
|
||||
val list = if (has(path)) handle.getStringList(path) else ArrayList()
|
||||
cache["$path\$FMT"] = StringUtils.formatList(list);
|
||||
getStrings(path, true)
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -96,6 +96,14 @@ class NMSFastItemStack(itemStack: org.bukkit.inventory.ItemStack) : EcoFastItemS
|
||||
}
|
||||
}
|
||||
|
||||
override fun getRepairCost(): Int {
|
||||
return handle.repairCost;
|
||||
}
|
||||
|
||||
override fun setRepairCost(cost: Int) {
|
||||
handle.repairCost = cost;
|
||||
}
|
||||
|
||||
private fun apply() {
|
||||
if (bukkit !is CraftItemStack) {
|
||||
bukkit.itemMeta = CraftItemStack.asCraftMirror(handle).itemMeta
|
||||
|
||||
@@ -115,6 +115,14 @@ class NMSFastItemStack(itemStack: org.bukkit.inventory.ItemStack) : EcoFastItemS
|
||||
}
|
||||
}
|
||||
|
||||
override fun getRepairCost(): Int {
|
||||
return handle.baseRepairCost;
|
||||
}
|
||||
|
||||
override fun setRepairCost(cost: Int) {
|
||||
handle.setRepairCost(cost);
|
||||
}
|
||||
|
||||
private fun apply() {
|
||||
if (bukkit !is CraftItemStack) {
|
||||
bukkit.itemMeta = CraftItemStack.asCraftMirror(handle).itemMeta
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
version = 6.3.1
|
||||
version = 6.3.3
|
||||
plugin-name = eco
|
||||
Reference in New Issue
Block a user