mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2025-12-19 15:09:24 +00:00
fix some bugs
This commit is contained in:
@@ -77,6 +77,10 @@ public class BukkitPlaceholderManager implements PlaceholderManager {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public boolean hasPapi() {
|
||||
return hasPapi;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean registerCustomPlaceholder(String placeholder, String original) {
|
||||
if (this.customPlaceholderMap.containsKey(placeholder)) return false;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
package net.momirealms.customfishing.api.mechanic.misc.value;
|
||||
|
||||
import net.momirealms.customfishing.api.mechanic.context.Context;
|
||||
import net.momirealms.customfishing.api.mechanic.misc.placeholder.BukkitPlaceholderManager;
|
||||
import net.momirealms.customfishing.api.mechanic.misc.placeholder.PlaceholderAPIUtils;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
@@ -51,13 +52,17 @@ public interface TextValue<T> {
|
||||
*/
|
||||
default String render(Context<T> context, boolean parseRawPlaceholders) {
|
||||
if (!(context.holder() instanceof OfflinePlayer player)) {
|
||||
if (!parseRawPlaceholders) {
|
||||
return render(context);
|
||||
} else {
|
||||
if (BukkitPlaceholderManager.getInstance().hasPapi() && parseRawPlaceholders) {
|
||||
return PlaceholderAPIUtils.parse(null, render(context));
|
||||
} else {
|
||||
return render(context);
|
||||
}
|
||||
} else {
|
||||
return PlaceholderAPIUtils.parse(player, render(context));
|
||||
if (BukkitPlaceholderManager.getInstance().hasPapi() && parseRawPlaceholders) {
|
||||
return PlaceholderAPIUtils.parse(player, render(context));
|
||||
} else {
|
||||
return render(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -110,6 +110,10 @@ public class VersionHelper {
|
||||
return version >= 21.39;
|
||||
}
|
||||
|
||||
public static boolean isVersionNewerThan1_21_5() {
|
||||
return version >= 21.49;
|
||||
}
|
||||
|
||||
public static boolean isFolia() {
|
||||
return folia;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import net.momirealms.customfishing.api.BukkitCustomFishingPlugin;
|
||||
import net.momirealms.customfishing.api.mechanic.context.Context;
|
||||
import net.momirealms.customfishing.api.mechanic.context.ContextKeys;
|
||||
import net.momirealms.customfishing.api.mechanic.market.MarketGUIHolder;
|
||||
import net.momirealms.customfishing.api.mechanic.misc.placeholder.PlaceholderAPIUtils;
|
||||
import net.momirealms.customfishing.api.storage.data.EarningData;
|
||||
import net.momirealms.customfishing.api.storage.user.UserData;
|
||||
import net.momirealms.customfishing.api.util.PlayerUtils;
|
||||
|
||||
@@ -17,14 +17,17 @@
|
||||
|
||||
package net.momirealms.customfishing.bukkit.util;
|
||||
|
||||
import com.saicone.rtag.RtagItem;
|
||||
import com.saicone.rtag.item.ItemTagStream;
|
||||
import dev.dejvokep.boostedyaml.block.implementation.Section;
|
||||
import net.momirealms.customfishing.api.mechanic.context.Context;
|
||||
import net.momirealms.customfishing.api.mechanic.item.ItemEditor;
|
||||
import net.momirealms.customfishing.api.mechanic.item.tag.TagMap;
|
||||
import net.momirealms.customfishing.api.mechanic.item.tag.TagValueType;
|
||||
import net.momirealms.customfishing.api.mechanic.misc.value.MathValue;
|
||||
import net.momirealms.customfishing.api.mechanic.misc.value.TextValue;
|
||||
import net.momirealms.customfishing.common.helper.GsonHelper;
|
||||
import net.momirealms.customfishing.common.helper.VersionHelper;
|
||||
import net.momirealms.customfishing.common.util.ArrayUtils;
|
||||
import net.momirealms.customfishing.common.util.Pair;
|
||||
import org.bukkit.Material;
|
||||
@@ -110,6 +113,13 @@ public class ItemStackUtils {
|
||||
public static void sectionToComponentEditor(Section section, List<ItemEditor> itemEditors) {
|
||||
for (Map.Entry<String, Object> entry : section.getStringRouteMappedValues(false).entrySet()) {
|
||||
String component = entry.getKey();
|
||||
if (VersionHelper.isVersionNewerThan1_21_5() && component.equals("minecraft:hide_tooltip")) {
|
||||
itemEditors.add((item, context) -> {
|
||||
item.setComponent("minecraft:tooltip_display", Map.of("hide_tooltip", true));
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
||||
Object value = entry.getValue();
|
||||
if (value instanceof Section inner) {
|
||||
Map<String, Object> innerMap = new HashMap<>();
|
||||
|
||||
Reference in New Issue
Block a user