mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2025-12-19 15:09:24 +00:00
refactor config parsers
This commit is contained in:
@@ -17,6 +17,9 @@
|
|||||||
|
|
||||||
package net.momirealms.customfishing.api.mechanic.block;
|
package net.momirealms.customfishing.api.mechanic.block;
|
||||||
|
|
||||||
|
import net.momirealms.customfishing.api.mechanic.misc.value.MathValue;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,6 +41,20 @@ public interface BlockConfig {
|
|||||||
*/
|
*/
|
||||||
String blockID();
|
String blockID();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the horizontal vector value for the block.
|
||||||
|
*
|
||||||
|
* @return the horizontal vector value as a double
|
||||||
|
*/
|
||||||
|
MathValue<Player> horizontalVector();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the vertical vector value for the block.
|
||||||
|
*
|
||||||
|
* @return the vertical vector value as a double
|
||||||
|
*/
|
||||||
|
MathValue<Player> verticalVector();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the list of data modifiers applied to the block.
|
* Gets the list of data modifiers applied to the block.
|
||||||
*
|
*
|
||||||
@@ -81,6 +98,22 @@ public interface BlockConfig {
|
|||||||
*/
|
*/
|
||||||
Builder blockID(String blockID);
|
Builder blockID(String blockID);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the vertical vector value for the BlockConfig being built.
|
||||||
|
*
|
||||||
|
* @param value the vertical vector value as a double
|
||||||
|
* @return the current Builder instance
|
||||||
|
*/
|
||||||
|
Builder verticalVector(MathValue<Player> value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the horizontal vector value for the BlockConfig being built.
|
||||||
|
*
|
||||||
|
* @param value the horizontal vector value as a double
|
||||||
|
* @return the current Builder instance
|
||||||
|
*/
|
||||||
|
Builder horizontalVector(MathValue<Player> value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the list of data modifiers for the configuration.
|
* Sets the list of data modifiers for the configuration.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -17,20 +17,29 @@
|
|||||||
|
|
||||||
package net.momirealms.customfishing.api.mechanic.block;
|
package net.momirealms.customfishing.api.mechanic.block;
|
||||||
|
|
||||||
|
import net.momirealms.customfishing.api.mechanic.misc.value.MathValue;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static java.util.Objects.requireNonNull;
|
||||||
|
|
||||||
public class BlockConfigImpl implements BlockConfig {
|
public class BlockConfigImpl implements BlockConfig {
|
||||||
|
|
||||||
private final String blockID;
|
private final String blockID;
|
||||||
|
private final MathValue<Player> horizontalVector;
|
||||||
|
private final MathValue<Player> verticalVector;
|
||||||
private final List<BlockDataModifier> dataModifierList;
|
private final List<BlockDataModifier> dataModifierList;
|
||||||
private final List<BlockStateModifier> stateModifierList;
|
private final List<BlockStateModifier> stateModifierList;
|
||||||
private final String id;
|
private final String id;
|
||||||
|
|
||||||
public BlockConfigImpl(String id, String blockID, List<BlockDataModifier> dataModifierList, List<BlockStateModifier> stateModifierList) {
|
public BlockConfigImpl(String id, String blockID, MathValue<Player> horizontalVector, MathValue<Player> verticalVector, List<BlockDataModifier> dataModifierList, List<BlockStateModifier> stateModifierList) {
|
||||||
this.blockID = blockID;
|
this.blockID = blockID;
|
||||||
this.dataModifierList = dataModifierList;
|
this.dataModifierList = dataModifierList;
|
||||||
this.stateModifierList = stateModifierList;
|
this.stateModifierList = stateModifierList;
|
||||||
|
this.horizontalVector = horizontalVector;
|
||||||
|
this.verticalVector = verticalVector;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,6 +53,16 @@ public class BlockConfigImpl implements BlockConfig {
|
|||||||
return blockID;
|
return blockID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MathValue<Player> horizontalVector() {
|
||||||
|
return horizontalVector;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MathValue<Player> verticalVector() {
|
||||||
|
return verticalVector;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BlockDataModifier> dataModifier() {
|
public List<BlockDataModifier> dataModifier() {
|
||||||
return dataModifierList;
|
return dataModifierList;
|
||||||
@@ -58,6 +77,8 @@ public class BlockConfigImpl implements BlockConfig {
|
|||||||
private String blockID;
|
private String blockID;
|
||||||
private final List<BlockDataModifier> dataModifierList = new ArrayList<>();
|
private final List<BlockDataModifier> dataModifierList = new ArrayList<>();
|
||||||
private final List<BlockStateModifier> stateModifierList = new ArrayList<>();
|
private final List<BlockStateModifier> stateModifierList = new ArrayList<>();
|
||||||
|
private MathValue<Player> horizontalVector;
|
||||||
|
private MathValue<Player> verticalVector;
|
||||||
private String id;
|
private String id;
|
||||||
@Override
|
@Override
|
||||||
public Builder id(String id) {
|
public Builder id(String id) {
|
||||||
@@ -70,6 +91,16 @@ public class BlockConfigImpl implements BlockConfig {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
public Builder verticalVector(MathValue<Player> value) {
|
||||||
|
this.verticalVector = value;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Builder horizontalVector(MathValue<Player> value) {
|
||||||
|
this.horizontalVector = value;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
public Builder dataModifierList(List<BlockDataModifier> dataModifierList) {
|
public Builder dataModifierList(List<BlockDataModifier> dataModifierList) {
|
||||||
this.dataModifierList.addAll(dataModifierList);
|
this.dataModifierList.addAll(dataModifierList);
|
||||||
return this;
|
return this;
|
||||||
@@ -81,7 +112,7 @@ public class BlockConfigImpl implements BlockConfig {
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public BlockConfig build() {
|
public BlockConfig build() {
|
||||||
return new BlockConfigImpl(id, blockID, dataModifierList, stateModifierList);
|
return new BlockConfigImpl(id, requireNonNull(blockID, "Block id should not be null"), horizontalVector, verticalVector, dataModifierList, stateModifierList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,12 +23,31 @@ import org.bukkit.block.Block;
|
|||||||
import org.bukkit.entity.FallingBlock;
|
import org.bukkit.entity.FallingBlock;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for managing custom block loots.
|
* Interface for managing custom block loots.
|
||||||
*/
|
*/
|
||||||
public interface BlockManager extends Reloadable {
|
public interface BlockManager extends Reloadable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the {@link BlockDataModifierFactory} by ID
|
||||||
|
*
|
||||||
|
* @param id the id of the factory
|
||||||
|
* @return the factory instance
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
BlockDataModifierFactory getBlockDataModifierFactory(@NotNull String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the {@link BlockStateModifierFactory} by ID
|
||||||
|
*
|
||||||
|
* @param id the id of the factory
|
||||||
|
* @return the factory instance
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
BlockStateModifierFactory getBlockStateModifierFactory(@NotNull String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a block loot.
|
* Registers a block loot.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import dev.dejvokep.boostedyaml.settings.loader.LoaderSettings;
|
|||||||
import dev.dejvokep.boostedyaml.settings.updater.UpdaterSettings;
|
import dev.dejvokep.boostedyaml.settings.updater.UpdaterSettings;
|
||||||
import dev.dejvokep.boostedyaml.utils.format.NodeRole;
|
import dev.dejvokep.boostedyaml.utils.format.NodeRole;
|
||||||
import net.momirealms.customfishing.api.BukkitCustomFishingPlugin;
|
import net.momirealms.customfishing.api.BukkitCustomFishingPlugin;
|
||||||
|
import net.momirealms.customfishing.api.mechanic.block.BlockConfig;
|
||||||
import net.momirealms.customfishing.api.mechanic.config.function.*;
|
import net.momirealms.customfishing.api.mechanic.config.function.*;
|
||||||
import net.momirealms.customfishing.api.mechanic.context.Context;
|
import net.momirealms.customfishing.api.mechanic.context.Context;
|
||||||
import net.momirealms.customfishing.api.mechanic.effect.Effect;
|
import net.momirealms.customfishing.api.mechanic.effect.Effect;
|
||||||
@@ -66,7 +67,15 @@ public abstract class ConfigManager implements ConfigLoader, Reloadable {
|
|||||||
|
|
||||||
private static ConfigManager instance;
|
private static ConfigManager instance;
|
||||||
protected final BukkitCustomFishingPlugin plugin;
|
protected final BukkitCustomFishingPlugin plugin;
|
||||||
protected final HashMap<String, Node<ConfigParserFunction>> formatFunctions = new HashMap<>();
|
protected final HashMap<String, Node<ConfigParserFunction>> entityFormatFunctions = new HashMap<>();
|
||||||
|
protected final HashMap<String, Node<ConfigParserFunction>> blockFormatFunctions = new HashMap<>();
|
||||||
|
protected final HashMap<String, Node<ConfigParserFunction>> totemFormatFunctions = new HashMap<>();
|
||||||
|
protected final HashMap<String, Node<ConfigParserFunction>> hookFormatFunctions = new HashMap<>();
|
||||||
|
protected final HashMap<String, Node<ConfigParserFunction>> eventFormatFunctions = new HashMap<>();
|
||||||
|
protected final HashMap<String, Node<ConfigParserFunction>> baseEffectFormatFunctions = new HashMap<>();
|
||||||
|
protected final HashMap<String, Node<ConfigParserFunction>> effectModifierFormatFunctions = new HashMap<>();
|
||||||
|
protected final HashMap<String, Node<ConfigParserFunction>> itemFormatFunctions = new HashMap<>();
|
||||||
|
protected final HashMap<String, Node<ConfigParserFunction>> lootFormatFunctions = new HashMap<>();
|
||||||
protected int placeholderLimit;
|
protected int placeholderLimit;
|
||||||
protected boolean redisRanking;
|
protected boolean redisRanking;
|
||||||
protected String serverGroup;
|
protected String serverGroup;
|
||||||
@@ -234,39 +243,42 @@ public abstract class ConfigManager implements ConfigLoader, Reloadable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void registerHookParser(Function<Object, Consumer<HookConfig.Builder>> function, String... nodes) {
|
public void registerHookParser(Function<Object, Consumer<HookConfig.Builder>> function, String... nodes) {
|
||||||
registerNodeFunction(nodes, new HookParserFunction(function));
|
registerNodeFunction(nodes, new HookParserFunction(function), hookFormatFunctions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerTotemParser(Function<Object, Consumer<TotemConfig.Builder>> function, String... nodes) {
|
public void registerTotemParser(Function<Object, Consumer<TotemConfig.Builder>> function, String... nodes) {
|
||||||
registerNodeFunction(nodes, new TotemParserFunction(function));
|
registerNodeFunction(nodes, new TotemParserFunction(function), totemFormatFunctions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerLootParser(Function<Object, Consumer<Loot.Builder>> function, String... nodes) {
|
public void registerLootParser(Function<Object, Consumer<Loot.Builder>> function, String... nodes) {
|
||||||
registerNodeFunction(nodes, new LootParserFunction(function));
|
registerNodeFunction(nodes, new LootParserFunction(function), lootFormatFunctions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerItemParser(Function<Object, BiConsumer<Item<ItemStack>, Context<Player>>> function, int priority, String... nodes) {
|
public void registerItemParser(Function<Object, BiConsumer<Item<ItemStack>, Context<Player>>> function, int priority, String... nodes) {
|
||||||
registerNodeFunction(nodes, new ItemParserFunction(priority, function));
|
registerNodeFunction(nodes, new ItemParserFunction(priority, function), itemFormatFunctions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerEffectModifierParser(Function<Object, Consumer<EffectModifier.Builder>> function, String... nodes) {
|
public void registerEffectModifierParser(Function<Object, Consumer<EffectModifier.Builder>> function, String... nodes) {
|
||||||
registerNodeFunction(nodes, new EffectModifierParserFunction(function));
|
registerNodeFunction(nodes, new EffectModifierParserFunction(function), effectModifierFormatFunctions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerEntityParser(Function<Object, Consumer<EntityConfig.Builder>> function, String... nodes) {
|
public void registerEntityParser(Function<Object, Consumer<EntityConfig.Builder>> function, String... nodes) {
|
||||||
registerNodeFunction(nodes, new EntityParserFunction(function));
|
registerNodeFunction(nodes, new EntityParserFunction(function), entityFormatFunctions);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerBlockParser(Function<Object, Consumer<BlockConfig.Builder>> function, String... nodes) {
|
||||||
|
registerNodeFunction(nodes, new BlockParserFunction(function), blockFormatFunctions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerEventParser(Function<Object, Consumer<EventCarrier.Builder>> function, String... nodes) {
|
public void registerEventParser(Function<Object, Consumer<EventCarrier.Builder>> function, String... nodes) {
|
||||||
registerNodeFunction(nodes, new EventParserFunction(function));
|
registerNodeFunction(nodes, new EventParserFunction(function), eventFormatFunctions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerBaseEffectParser(Function<Object, Consumer<LootBaseEffect.Builder>> function, String... nodes) {
|
public void registerBaseEffectParser(Function<Object, Consumer<LootBaseEffect.Builder>> function, String... nodes) {
|
||||||
registerNodeFunction(nodes, new BaseEffectParserFunction(function));
|
registerNodeFunction(nodes, new BaseEffectParserFunction(function), baseEffectFormatFunctions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unregisterNodeFunction(String... nodes) {
|
public void unregisterNodeFunction(Map<String, Node<ConfigParserFunction>> functionMap, String... nodes) {
|
||||||
Map<String, Node<ConfigParserFunction>> functionMap = formatFunctions;
|
|
||||||
for (int i = 0; i < nodes.length; i++) {
|
for (int i = 0; i < nodes.length; i++) {
|
||||||
if (functionMap.containsKey(nodes[i])) {
|
if (functionMap.containsKey(nodes[i])) {
|
||||||
Node<ConfigParserFunction> functionNode = functionMap.get(nodes[i]);
|
Node<ConfigParserFunction> functionNode = functionMap.get(nodes[i]);
|
||||||
@@ -285,8 +297,7 @@ public abstract class ConfigManager implements ConfigLoader, Reloadable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerNodeFunction(String[] nodes, ConfigParserFunction configParserFunction) {
|
public void registerNodeFunction(String[] nodes, ConfigParserFunction configParserFunction, Map<String, Node<ConfigParserFunction>> functionMap) {
|
||||||
Map<String, Node<ConfigParserFunction>> functionMap = formatFunctions;
|
|
||||||
for (int i = 0; i < nodes.length; i++) {
|
for (int i = 0; i < nodes.length; i++) {
|
||||||
if (functionMap.containsKey(nodes[i])) {
|
if (functionMap.containsKey(nodes[i])) {
|
||||||
Node<ConfigParserFunction> functionNode = functionMap.get(nodes[i]);
|
Node<ConfigParserFunction> functionNode = functionMap.get(nodes[i]);
|
||||||
@@ -389,11 +400,48 @@ public abstract class ConfigManager implements ConfigLoader, Reloadable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Node<ConfigParserFunction>> getFormatFunctions() {
|
public HashMap<String, Node<ConfigParserFunction>> getBlockFormatFunctions() {
|
||||||
return formatFunctions;
|
return blockFormatFunctions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashMap<String, Node<ConfigParserFunction>> getEntityFormatFunctions() {
|
||||||
|
return entityFormatFunctions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashMap<String, Node<ConfigParserFunction>> getTotemFormatFunctions() {
|
||||||
|
return totemFormatFunctions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashMap<String, Node<ConfigParserFunction>> getHookFormatFunctions() {
|
||||||
|
return hookFormatFunctions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashMap<String, Node<ConfigParserFunction>> getEventFormatFunctions() {
|
||||||
|
return eventFormatFunctions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashMap<String, Node<ConfigParserFunction>> getBaseEffectFormatFunctions() {
|
||||||
|
return baseEffectFormatFunctions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashMap<String, Node<ConfigParserFunction>> getEffectModifierFormatFunctions() {
|
||||||
|
return effectModifierFormatFunctions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashMap<String, Node<ConfigParserFunction>> getItemFormatFunctions() {
|
||||||
|
return itemFormatFunctions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashMap<String, Node<ConfigParserFunction>> getLootFormatFunctions() {
|
||||||
|
return lootFormatFunctions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract List<Pair<String, BiFunction<Context<Player>, Double, Double>>> parseWeightOperation(List<String> ops);
|
public abstract List<Pair<String, BiFunction<Context<Player>, Double, Double>>> parseWeightOperation(List<String> ops);
|
||||||
|
|
||||||
public abstract List<Pair<String, BiFunction<Context<Player>, Double, Double>>> parseGroupWeightOperation(List<String> gops);
|
public abstract List<Pair<String, BiFunction<Context<Player>, Double, Double>>> parseGroupWeightOperation(List<String> gops);
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public Map<String, Node<ConfigParserFunction>> getDefaultFormatFunctions() {
|
||||||
|
return getItemFormatFunctions();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,9 @@ import net.momirealms.customfishing.api.mechanic.config.function.ConfigParserFun
|
|||||||
import net.momirealms.customfishing.common.config.node.Node;
|
import net.momirealms.customfishing.common.config.node.Node;
|
||||||
import net.momirealms.customfishing.common.util.TriConsumer;
|
import net.momirealms.customfishing.common.util.TriConsumer;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration types for various mechanics.
|
* Configuration types for various mechanics.
|
||||||
@@ -33,6 +35,13 @@ public class ConfigType {
|
|||||||
|
|
||||||
public static final ConfigType ITEM = of(
|
public static final ConfigType ITEM = of(
|
||||||
"item",
|
"item",
|
||||||
|
() -> {
|
||||||
|
HashMap<String, Node<ConfigParserFunction>> parsers = new HashMap<>();
|
||||||
|
parsers.putAll(BukkitCustomFishingPlugin.getInstance().getConfigManager().getLootFormatFunctions());
|
||||||
|
parsers.putAll(BukkitCustomFishingPlugin.getInstance().getConfigManager().getItemFormatFunctions());
|
||||||
|
parsers.putAll(BukkitCustomFishingPlugin.getInstance().getConfigManager().getEventFormatFunctions());
|
||||||
|
return parsers;
|
||||||
|
},
|
||||||
(id, section, functions) -> {
|
(id, section, functions) -> {
|
||||||
MechanicType.register(id, MechanicType.LOOT);
|
MechanicType.register(id, MechanicType.LOOT);
|
||||||
ItemConfigParser config = new ItemConfigParser(id, section, functions);
|
ItemConfigParser config = new ItemConfigParser(id, section, functions);
|
||||||
@@ -44,6 +53,13 @@ public class ConfigType {
|
|||||||
|
|
||||||
public static final ConfigType ENTITY = of(
|
public static final ConfigType ENTITY = of(
|
||||||
"entity",
|
"entity",
|
||||||
|
() -> {
|
||||||
|
HashMap<String, Node<ConfigParserFunction>> parsers = new HashMap<>();
|
||||||
|
parsers.putAll(BukkitCustomFishingPlugin.getInstance().getConfigManager().getLootFormatFunctions());
|
||||||
|
parsers.putAll(BukkitCustomFishingPlugin.getInstance().getConfigManager().getEntityFormatFunctions());
|
||||||
|
parsers.putAll(BukkitCustomFishingPlugin.getInstance().getConfigManager().getEventFormatFunctions());
|
||||||
|
return parsers;
|
||||||
|
},
|
||||||
(id, section, functions) -> {
|
(id, section, functions) -> {
|
||||||
MechanicType.register(id, MechanicType.LOOT);
|
MechanicType.register(id, MechanicType.LOOT);
|
||||||
EntityConfigParser config = new EntityConfigParser(id, section, functions);
|
EntityConfigParser config = new EntityConfigParser(id, section, functions);
|
||||||
@@ -55,6 +71,13 @@ public class ConfigType {
|
|||||||
|
|
||||||
public static final ConfigType BLOCK = of(
|
public static final ConfigType BLOCK = of(
|
||||||
"block",
|
"block",
|
||||||
|
() -> {
|
||||||
|
HashMap<String, Node<ConfigParserFunction>> parsers = new HashMap<>();
|
||||||
|
parsers.putAll(BukkitCustomFishingPlugin.getInstance().getConfigManager().getLootFormatFunctions());
|
||||||
|
parsers.putAll(BukkitCustomFishingPlugin.getInstance().getConfigManager().getBlockFormatFunctions());
|
||||||
|
parsers.putAll(BukkitCustomFishingPlugin.getInstance().getConfigManager().getEventFormatFunctions());
|
||||||
|
return parsers;
|
||||||
|
},
|
||||||
(id, section, functions) -> {
|
(id, section, functions) -> {
|
||||||
MechanicType.register(id, MechanicType.LOOT);
|
MechanicType.register(id, MechanicType.LOOT);
|
||||||
BlockConfigParser config = new BlockConfigParser(id, section, functions);
|
BlockConfigParser config = new BlockConfigParser(id, section, functions);
|
||||||
@@ -66,6 +89,13 @@ public class ConfigType {
|
|||||||
|
|
||||||
public static final ConfigType ROD = of(
|
public static final ConfigType ROD = of(
|
||||||
"rod",
|
"rod",
|
||||||
|
() -> {
|
||||||
|
HashMap<String, Node<ConfigParserFunction>> parsers = new HashMap<>();
|
||||||
|
parsers.putAll(BukkitCustomFishingPlugin.getInstance().getConfigManager().getItemFormatFunctions());
|
||||||
|
parsers.putAll(BukkitCustomFishingPlugin.getInstance().getConfigManager().getEffectModifierFormatFunctions());
|
||||||
|
parsers.putAll(BukkitCustomFishingPlugin.getInstance().getConfigManager().getEventFormatFunctions());
|
||||||
|
return parsers;
|
||||||
|
},
|
||||||
(id, section, functions) -> {
|
(id, section, functions) -> {
|
||||||
MechanicType.register(id, MechanicType.ROD);
|
MechanicType.register(id, MechanicType.ROD);
|
||||||
RodConfigParser config = new RodConfigParser(id, section, functions);
|
RodConfigParser config = new RodConfigParser(id, section, functions);
|
||||||
@@ -78,6 +108,13 @@ public class ConfigType {
|
|||||||
|
|
||||||
public static final ConfigType BAIT = of(
|
public static final ConfigType BAIT = of(
|
||||||
"bait",
|
"bait",
|
||||||
|
() -> {
|
||||||
|
HashMap<String, Node<ConfigParserFunction>> parsers = new HashMap<>();
|
||||||
|
parsers.putAll(BukkitCustomFishingPlugin.getInstance().getConfigManager().getItemFormatFunctions());
|
||||||
|
parsers.putAll(BukkitCustomFishingPlugin.getInstance().getConfigManager().getEffectModifierFormatFunctions());
|
||||||
|
parsers.putAll(BukkitCustomFishingPlugin.getInstance().getConfigManager().getEventFormatFunctions());
|
||||||
|
return parsers;
|
||||||
|
},
|
||||||
(id, section, functions) -> {
|
(id, section, functions) -> {
|
||||||
MechanicType.register(id, MechanicType.BAIT);
|
MechanicType.register(id, MechanicType.BAIT);
|
||||||
BaitConfigParser config = new BaitConfigParser(id, section, functions);
|
BaitConfigParser config = new BaitConfigParser(id, section, functions);
|
||||||
@@ -90,6 +127,14 @@ public class ConfigType {
|
|||||||
|
|
||||||
public static final ConfigType HOOK = of(
|
public static final ConfigType HOOK = of(
|
||||||
"hook",
|
"hook",
|
||||||
|
() -> {
|
||||||
|
HashMap<String, Node<ConfigParserFunction>> parsers = new HashMap<>();
|
||||||
|
parsers.putAll(BukkitCustomFishingPlugin.getInstance().getConfigManager().getItemFormatFunctions());
|
||||||
|
parsers.putAll(BukkitCustomFishingPlugin.getInstance().getConfigManager().getEffectModifierFormatFunctions());
|
||||||
|
parsers.putAll(BukkitCustomFishingPlugin.getInstance().getConfigManager().getEventFormatFunctions());
|
||||||
|
parsers.putAll(BukkitCustomFishingPlugin.getInstance().getConfigManager().getHookFormatFunctions());
|
||||||
|
return parsers;
|
||||||
|
},
|
||||||
(id, section, functions) -> {
|
(id, section, functions) -> {
|
||||||
MechanicType.register(id, MechanicType.HOOK);
|
MechanicType.register(id, MechanicType.HOOK);
|
||||||
HookConfigParser config = new HookConfigParser(id, section, functions);
|
HookConfigParser config = new HookConfigParser(id, section, functions);
|
||||||
@@ -103,6 +148,13 @@ public class ConfigType {
|
|||||||
|
|
||||||
public static final ConfigType UTIL = of(
|
public static final ConfigType UTIL = of(
|
||||||
"util",
|
"util",
|
||||||
|
() -> {
|
||||||
|
HashMap<String, Node<ConfigParserFunction>> parsers = new HashMap<>();
|
||||||
|
parsers.putAll(BukkitCustomFishingPlugin.getInstance().getConfigManager().getItemFormatFunctions());
|
||||||
|
parsers.putAll(BukkitCustomFishingPlugin.getInstance().getConfigManager().getEffectModifierFormatFunctions());
|
||||||
|
parsers.putAll(BukkitCustomFishingPlugin.getInstance().getConfigManager().getEventFormatFunctions());
|
||||||
|
return parsers;
|
||||||
|
},
|
||||||
(id, section, functions) -> {
|
(id, section, functions) -> {
|
||||||
MechanicType.register(id, MechanicType.UTIL);
|
MechanicType.register(id, MechanicType.UTIL);
|
||||||
UtilConfigParser config = new UtilConfigParser(id, section, functions);
|
UtilConfigParser config = new UtilConfigParser(id, section, functions);
|
||||||
@@ -115,6 +167,13 @@ public class ConfigType {
|
|||||||
|
|
||||||
public static final ConfigType TOTEM = of(
|
public static final ConfigType TOTEM = of(
|
||||||
"totem",
|
"totem",
|
||||||
|
() -> {
|
||||||
|
HashMap<String, Node<ConfigParserFunction>> parsers = new HashMap<>();
|
||||||
|
parsers.putAll(BukkitCustomFishingPlugin.getInstance().getConfigManager().getTotemFormatFunctions());
|
||||||
|
parsers.putAll(BukkitCustomFishingPlugin.getInstance().getConfigManager().getEffectModifierFormatFunctions());
|
||||||
|
parsers.putAll(BukkitCustomFishingPlugin.getInstance().getConfigManager().getEventFormatFunctions());
|
||||||
|
return parsers;
|
||||||
|
},
|
||||||
(id, section, functions) -> {
|
(id, section, functions) -> {
|
||||||
TotemConfigParser config = new TotemConfigParser(id, section, functions);
|
TotemConfigParser config = new TotemConfigParser(id, section, functions);
|
||||||
BukkitCustomFishingPlugin.getInstance().getEffectManager().registerEffectModifier(config.getEffectModifier(), MechanicType.TOTEM);
|
BukkitCustomFishingPlugin.getInstance().getEffectManager().registerEffectModifier(config.getEffectModifier(), MechanicType.TOTEM);
|
||||||
@@ -125,6 +184,12 @@ public class ConfigType {
|
|||||||
|
|
||||||
public static final ConfigType ENCHANT = of(
|
public static final ConfigType ENCHANT = of(
|
||||||
"enchant",
|
"enchant",
|
||||||
|
() -> {
|
||||||
|
HashMap<String, Node<ConfigParserFunction>> parsers = new HashMap<>();
|
||||||
|
parsers.putAll(BukkitCustomFishingPlugin.getInstance().getConfigManager().getEventFormatFunctions());
|
||||||
|
parsers.putAll(BukkitCustomFishingPlugin.getInstance().getConfigManager().getEffectModifierFormatFunctions());
|
||||||
|
return parsers;
|
||||||
|
},
|
||||||
(id, section, functions) -> {
|
(id, section, functions) -> {
|
||||||
EnchantConfigParser config = new EnchantConfigParser(id, section, functions);
|
EnchantConfigParser config = new EnchantConfigParser(id, section, functions);
|
||||||
BukkitCustomFishingPlugin.getInstance().getEffectManager().registerEffectModifier(config.getEffectModifier(), MechanicType.ENCHANT);
|
BukkitCustomFishingPlugin.getInstance().getEffectManager().registerEffectModifier(config.getEffectModifier(), MechanicType.ENCHANT);
|
||||||
@@ -134,6 +199,7 @@ public class ConfigType {
|
|||||||
|
|
||||||
public static final ConfigType MINI_GAME = of(
|
public static final ConfigType MINI_GAME = of(
|
||||||
"minigame",
|
"minigame",
|
||||||
|
HashMap::new,
|
||||||
(id, section, functions) -> {
|
(id, section, functions) -> {
|
||||||
MiniGameConfigParser config = new MiniGameConfigParser(id, section);
|
MiniGameConfigParser config = new MiniGameConfigParser(id, section);
|
||||||
BukkitCustomFishingPlugin.getInstance().getGameManager().registerGame(config.getGame());
|
BukkitCustomFishingPlugin.getInstance().getGameManager().registerGame(config.getGame());
|
||||||
@@ -153,6 +219,7 @@ public class ConfigType {
|
|||||||
|
|
||||||
private final String path;
|
private final String path;
|
||||||
private TriConsumer<String, Section, Map<String, Node<ConfigParserFunction>>> argumentConsumer;
|
private TriConsumer<String, Section, Map<String, Node<ConfigParserFunction>>> argumentConsumer;
|
||||||
|
private Supplier<Map<String, Node<ConfigParserFunction>>> parserSupplier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new ConfigType with the specified path and argument consumer.
|
* Creates a new ConfigType with the specified path and argument consumer.
|
||||||
@@ -160,9 +227,10 @@ public class ConfigType {
|
|||||||
* @param path the configuration path.
|
* @param path the configuration path.
|
||||||
* @param argumentConsumer the argument consumer.
|
* @param argumentConsumer the argument consumer.
|
||||||
*/
|
*/
|
||||||
public ConfigType(String path, TriConsumer<String, Section, Map<String, Node<ConfigParserFunction>>> argumentConsumer) {
|
public ConfigType(String path, Supplier<Map<String, Node<ConfigParserFunction>>> parserSupplier, TriConsumer<String, Section, Map<String, Node<ConfigParserFunction>>> argumentConsumer) {
|
||||||
this.path = path;
|
this.path = path;
|
||||||
this.argumentConsumer = argumentConsumer;
|
this.argumentConsumer = argumentConsumer;
|
||||||
|
this.parserSupplier = parserSupplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -181,8 +249,8 @@ public class ConfigType {
|
|||||||
* @param argumentConsumer the argument consumer.
|
* @param argumentConsumer the argument consumer.
|
||||||
* @return A new ConfigType instance.
|
* @return A new ConfigType instance.
|
||||||
*/
|
*/
|
||||||
public static ConfigType of(String path, TriConsumer<String, Section, Map<String, Node<ConfigParserFunction>>> argumentConsumer) {
|
public static ConfigType of(String path, Supplier<Map<String, Node<ConfigParserFunction>>> parserSupplier, TriConsumer<String, Section, Map<String, Node<ConfigParserFunction>>> argumentConsumer) {
|
||||||
return new ConfigType(path, argumentConsumer);
|
return new ConfigType(path, parserSupplier, argumentConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -204,4 +272,13 @@ public class ConfigType {
|
|||||||
public String path() {
|
public String path() {
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the config parsers
|
||||||
|
*
|
||||||
|
* @return config parsers
|
||||||
|
*/
|
||||||
|
public Map<String, Node<ConfigParserFunction>> parser() {
|
||||||
|
return parserSupplier.get();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ public final class PlayerContextImpl implements Context<Player> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <C> PlayerContextImpl arg(ContextKeys<C> key, C value) {
|
public <C> PlayerContextImpl arg(ContextKeys<C> key, C value) {
|
||||||
|
if (key == null || value == null) return this;
|
||||||
this.args.put(key, value);
|
this.args.put(key, value);
|
||||||
this.placeholderMap.put("{" + key.key() + "}", value.toString());
|
this.placeholderMap.put("{" + key.key() + "}", value.toString());
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ dependencies {
|
|||||||
compileOnly(files("libs/BattlePass-4.0.6-api.jar"))
|
compileOnly(files("libs/BattlePass-4.0.6-api.jar"))
|
||||||
compileOnly(files("libs/ClueScrolls-4.8.7-api.jar"))
|
compileOnly(files("libs/ClueScrolls-4.8.7-api.jar"))
|
||||||
compileOnly(files("libs/notquests-5.17.1.jar"))
|
compileOnly(files("libs/notquests-5.17.1.jar"))
|
||||||
compileOnly("org.betonquest:betonquest:2.0.1")
|
compileOnly("org.betonquest:betonquest:2.1.2")
|
||||||
// item
|
// item
|
||||||
compileOnly(files("libs/zaphkiel-2.0.24.jar"))
|
compileOnly(files("libs/zaphkiel-2.0.24.jar"))
|
||||||
compileOnly("com.github.LoneDev6:API-ItemsAdder:3.6.1")
|
compileOnly("com.github.LoneDev6:API-ItemsAdder:3.6.1")
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.persistence.PersistentDataType;
|
import org.bukkit.persistence.PersistentDataType;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
@@ -88,6 +89,18 @@ public class BukkitBlockManager implements BlockManager, Listener {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public BlockDataModifierFactory getBlockDataModifierFactory(@NotNull String id) {
|
||||||
|
return dataFactories.get(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public BlockStateModifierFactory getBlockStateModifierFactory(@NotNull String id) {
|
||||||
|
return stateFactories.get(id);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load() {
|
public void load() {
|
||||||
Bukkit.getPluginManager().registerEvents(this, plugin.getBoostrap());
|
Bukkit.getPluginManager().registerEvents(this, plugin.getBoostrap());
|
||||||
@@ -235,8 +248,12 @@ public class BukkitBlockManager implements BlockManager, Listener {
|
|||||||
PersistentDataType.STRING,
|
PersistentDataType.STRING,
|
||||||
id + ";" + context.getHolder().getName()
|
id + ";" + context.getHolder().getName()
|
||||||
);
|
);
|
||||||
Vector vector = playerLocation.subtract(hookLocation).toVector().multiply(1.2 - 1);
|
double d0 = playerLocation.getX() - hookLocation.getX();
|
||||||
vector = vector.setY((vector.getY() + 0.2) * 1.2);
|
double d1 = playerLocation.getY() - hookLocation.getY();
|
||||||
|
double d2 = playerLocation.getZ() - hookLocation.getZ();
|
||||||
|
double d3 = config.horizontalVector().evaluate(context);
|
||||||
|
double d4 = config.verticalVector().evaluate(context);
|
||||||
|
Vector vector = new Vector(d0 * 0.1D * d3, d1 * 0.1D + Math.sqrt(Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2)) * 0.08D * d4, d2 * 0.1D * d3);
|
||||||
fallingBlock.setVelocity(vector);
|
fallingBlock.setVelocity(vector);
|
||||||
return fallingBlock;
|
return fallingBlock;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,8 +32,13 @@ import net.momirealms.customfishing.api.BukkitCustomFishingPlugin;
|
|||||||
import net.momirealms.customfishing.api.mechanic.MechanicType;
|
import net.momirealms.customfishing.api.mechanic.MechanicType;
|
||||||
import net.momirealms.customfishing.api.mechanic.action.Action;
|
import net.momirealms.customfishing.api.mechanic.action.Action;
|
||||||
import net.momirealms.customfishing.api.mechanic.action.ActionTrigger;
|
import net.momirealms.customfishing.api.mechanic.action.ActionTrigger;
|
||||||
|
import net.momirealms.customfishing.api.mechanic.block.BlockDataModifier;
|
||||||
|
import net.momirealms.customfishing.api.mechanic.block.BlockDataModifierFactory;
|
||||||
|
import net.momirealms.customfishing.api.mechanic.block.BlockStateModifier;
|
||||||
|
import net.momirealms.customfishing.api.mechanic.block.BlockStateModifierFactory;
|
||||||
import net.momirealms.customfishing.api.mechanic.config.ConfigManager;
|
import net.momirealms.customfishing.api.mechanic.config.ConfigManager;
|
||||||
import net.momirealms.customfishing.api.mechanic.config.ConfigType;
|
import net.momirealms.customfishing.api.mechanic.config.ConfigType;
|
||||||
|
import net.momirealms.customfishing.api.mechanic.config.function.ConfigParserFunction;
|
||||||
import net.momirealms.customfishing.api.mechanic.context.Context;
|
import net.momirealms.customfishing.api.mechanic.context.Context;
|
||||||
import net.momirealms.customfishing.api.mechanic.context.ContextKeys;
|
import net.momirealms.customfishing.api.mechanic.context.ContextKeys;
|
||||||
import net.momirealms.customfishing.api.mechanic.effect.Effect;
|
import net.momirealms.customfishing.api.mechanic.effect.Effect;
|
||||||
@@ -60,6 +65,7 @@ import net.momirealms.customfishing.bukkit.totem.particle.DustParticleSetting;
|
|||||||
import net.momirealms.customfishing.bukkit.totem.particle.ParticleSetting;
|
import net.momirealms.customfishing.bukkit.totem.particle.ParticleSetting;
|
||||||
import net.momirealms.customfishing.bukkit.util.ItemStackUtils;
|
import net.momirealms.customfishing.bukkit.util.ItemStackUtils;
|
||||||
import net.momirealms.customfishing.bukkit.util.ParticleUtils;
|
import net.momirealms.customfishing.bukkit.util.ParticleUtils;
|
||||||
|
import net.momirealms.customfishing.common.config.node.Node;
|
||||||
import net.momirealms.customfishing.common.dependency.DependencyProperties;
|
import net.momirealms.customfishing.common.dependency.DependencyProperties;
|
||||||
import net.momirealms.customfishing.common.helper.AdventureHelper;
|
import net.momirealms.customfishing.common.helper.AdventureHelper;
|
||||||
import net.momirealms.customfishing.common.helper.VersionHelper;
|
import net.momirealms.customfishing.common.helper.VersionHelper;
|
||||||
@@ -102,6 +108,7 @@ public class BukkitConfigManager extends ConfigManager {
|
|||||||
this.registerBuiltInEffectModifierParser();
|
this.registerBuiltInEffectModifierParser();
|
||||||
this.registerBuiltInTotemParser();
|
this.registerBuiltInTotemParser();
|
||||||
this.registerBuiltInHookParser();
|
this.registerBuiltInHookParser();
|
||||||
|
this.registerBuiltInBlockParser();
|
||||||
dustParticle = VersionHelper.isVersionNewerThan1_20_5() ? Particle.valueOf("DUST") : Particle.valueOf("REDSTONE");
|
dustParticle = VersionHelper.isVersionNewerThan1_20_5() ? Particle.valueOf("DUST") : Particle.valueOf("REDSTONE");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,6 +269,7 @@ public class BukkitConfigManager extends ConfigManager {
|
|||||||
if (!typeFolder.mkdirs()) return;
|
if (!typeFolder.mkdirs()) return;
|
||||||
plugin.getBoostrap().saveResource("contents" + File.separator + type.path() + File.separator + "default.yml", false);
|
plugin.getBoostrap().saveResource("contents" + File.separator + type.path() + File.separator + "default.yml", false);
|
||||||
}
|
}
|
||||||
|
Map<String, Node<ConfigParserFunction>> nodes = type.parser();
|
||||||
fileDeque.push(typeFolder);
|
fileDeque.push(typeFolder);
|
||||||
while (!fileDeque.isEmpty()) {
|
while (!fileDeque.isEmpty()) {
|
||||||
File file = fileDeque.pop();
|
File file = fileDeque.pop();
|
||||||
@@ -274,7 +282,7 @@ public class BukkitConfigManager extends ConfigManager {
|
|||||||
YamlDocument document = plugin.getConfigManager().loadData(subFile);
|
YamlDocument document = plugin.getConfigManager().loadData(subFile);
|
||||||
for (Map.Entry<String, Object> entry : document.getStringRouteMappedValues(false).entrySet()) {
|
for (Map.Entry<String, Object> entry : document.getStringRouteMappedValues(false).entrySet()) {
|
||||||
if (entry.getValue() instanceof Section section) {
|
if (entry.getValue() instanceof Section section) {
|
||||||
type.parse(entry.getKey(), section, formatFunctions);
|
type.parse(entry.getKey(), section, nodes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -783,6 +791,41 @@ public class BukkitConfigManager extends ConfigManager {
|
|||||||
}, "base-effects", "wait-time-multiplier");
|
}, "base-effects", "wait-time-multiplier");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void registerBuiltInBlockParser() {
|
||||||
|
this.registerBlockParser(object -> {
|
||||||
|
String block = (String) object;
|
||||||
|
return builder -> builder.blockID(block);
|
||||||
|
}, "block");
|
||||||
|
this.registerBlockParser(object -> {
|
||||||
|
Section section = (Section) object;
|
||||||
|
List<BlockDataModifier> dataModifiers = new ArrayList<>();
|
||||||
|
List<BlockStateModifier> stateModifiers = new ArrayList<>();
|
||||||
|
for (Map.Entry<String, Object> innerEntry : section.getStringRouteMappedValues(false).entrySet()) {
|
||||||
|
BlockDataModifierFactory dataModifierFactory = plugin.getBlockManager().getBlockDataModifierFactory(innerEntry.getKey());
|
||||||
|
if (dataModifierFactory != null) {
|
||||||
|
dataModifiers.add(dataModifierFactory.process(innerEntry.getValue()));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
BlockStateModifierFactory stateModifierFactory = plugin.getBlockManager().getBlockStateModifierFactory(innerEntry.getKey());
|
||||||
|
if (stateModifierFactory != null) {
|
||||||
|
stateModifiers.add(stateModifierFactory.process(innerEntry.getValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return builder -> {
|
||||||
|
builder.dataModifierList(dataModifiers);
|
||||||
|
builder.stateModifierList(stateModifiers);
|
||||||
|
};
|
||||||
|
}, "properties");
|
||||||
|
this.registerBlockParser(object -> {
|
||||||
|
MathValue<Player> mathValue = MathValue.auto(object);
|
||||||
|
return builder -> builder.horizontalVector(mathValue);
|
||||||
|
}, "velocity", "horizontal");
|
||||||
|
this.registerBlockParser(object -> {
|
||||||
|
MathValue<Player> mathValue = MathValue.auto(object);
|
||||||
|
return builder -> builder.verticalVector(mathValue);
|
||||||
|
}, "velocity", "vertical");
|
||||||
|
}
|
||||||
|
|
||||||
private void registerBuiltInEntityParser() {
|
private void registerBuiltInEntityParser() {
|
||||||
this.registerEntityParser(object -> {
|
this.registerEntityParser(object -> {
|
||||||
String entity = (String) object;
|
String entity = (String) object;
|
||||||
|
|||||||
@@ -146,9 +146,9 @@ public class BukkitMarketManager implements MarketManager, Listener {
|
|||||||
this.sellAllSlot = sellAllSection.getString("symbol", "S").charAt(0);
|
this.sellAllSlot = sellAllSection.getString("symbol", "S").charAt(0);
|
||||||
this.sellFishingBag = sellAllSection.getBoolean("fishingbag", true);
|
this.sellFishingBag = sellAllSection.getBoolean("fishingbag", true);
|
||||||
|
|
||||||
this.sellAllIconAllowItem = new SingleItemParser("allow", sellAllSection.getSection("allow-icon"), plugin.getConfigManager().getFormatFunctions()).getItem();
|
this.sellAllIconAllowItem = new SingleItemParser("allow", sellAllSection.getSection("allow-icon"), plugin.getConfigManager().getItemFormatFunctions()).getItem();
|
||||||
this.sellAllIconDenyItem = new SingleItemParser("deny", sellAllSection.getSection("deny-icon"), plugin.getConfigManager().getFormatFunctions()).getItem();
|
this.sellAllIconDenyItem = new SingleItemParser("deny", sellAllSection.getSection("deny-icon"), plugin.getConfigManager().getItemFormatFunctions()).getItem();
|
||||||
this.sellAllIconLimitItem = new SingleItemParser("limit", sellAllSection.getSection("limit-icon"), plugin.getConfigManager().getFormatFunctions()).getItem();
|
this.sellAllIconLimitItem = new SingleItemParser("limit", sellAllSection.getSection("limit-icon"), plugin.getConfigManager().getItemFormatFunctions()).getItem();
|
||||||
|
|
||||||
this.sellAllAllowActions = plugin.getActionManager().parseActions(sellAllSection.getSection("allow-icon.action"));
|
this.sellAllAllowActions = plugin.getActionManager().parseActions(sellAllSection.getSection("allow-icon.action"));
|
||||||
this.sellAllDenyActions = plugin.getActionManager().parseActions(sellAllSection.getSection("deny-icon.action"));
|
this.sellAllDenyActions = plugin.getActionManager().parseActions(sellAllSection.getSection("deny-icon.action"));
|
||||||
@@ -163,9 +163,9 @@ public class BukkitMarketManager implements MarketManager, Listener {
|
|||||||
if (sellSection != null) {
|
if (sellSection != null) {
|
||||||
this.sellSlot = sellSection.getString("symbol", "B").charAt(0);
|
this.sellSlot = sellSection.getString("symbol", "B").charAt(0);
|
||||||
|
|
||||||
this.sellIconAllowItem = new SingleItemParser("allow", sellSection.getSection("allow-icon"), plugin.getConfigManager().getFormatFunctions()).getItem();
|
this.sellIconAllowItem = new SingleItemParser("allow", sellSection.getSection("allow-icon"), plugin.getConfigManager().getItemFormatFunctions()).getItem();
|
||||||
this.sellIconDenyItem = new SingleItemParser("deny", sellSection.getSection("deny-icon"), plugin.getConfigManager().getFormatFunctions()).getItem();
|
this.sellIconDenyItem = new SingleItemParser("deny", sellSection.getSection("deny-icon"), plugin.getConfigManager().getItemFormatFunctions()).getItem();
|
||||||
this.sellIconLimitItem = new SingleItemParser("limit", sellSection.getSection("limit-icon"), plugin.getConfigManager().getFormatFunctions()).getItem();
|
this.sellIconLimitItem = new SingleItemParser("limit", sellSection.getSection("limit-icon"), plugin.getConfigManager().getItemFormatFunctions()).getItem();
|
||||||
|
|
||||||
this.sellAllowActions = plugin.getActionManager().parseActions(sellSection.getSection("allow-icon.action"));
|
this.sellAllowActions = plugin.getActionManager().parseActions(sellSection.getSection("allow-icon.action"));
|
||||||
this.sellDenyActions = plugin.getActionManager().parseActions(sellSection.getSection("deny-icon.action"));
|
this.sellDenyActions = plugin.getActionManager().parseActions(sellSection.getSection("deny-icon.action"));
|
||||||
@@ -188,7 +188,7 @@ public class BukkitMarketManager implements MarketManager, Listener {
|
|||||||
for (Map.Entry<String, Object> entry : decorativeSection.getStringRouteMappedValues(false).entrySet()) {
|
for (Map.Entry<String, Object> entry : decorativeSection.getStringRouteMappedValues(false).entrySet()) {
|
||||||
if (entry.getValue() instanceof Section innerSection) {
|
if (entry.getValue() instanceof Section innerSection) {
|
||||||
char symbol = Objects.requireNonNull(innerSection.getString("symbol")).charAt(0);
|
char symbol = Objects.requireNonNull(innerSection.getString("symbol")).charAt(0);
|
||||||
decorativeIcons.put(symbol, new SingleItemParser("gui", innerSection, plugin.getConfigManager().getFormatFunctions()).getItem());
|
decorativeIcons.put(symbol, new SingleItemParser("gui", innerSection, plugin.getConfigManager().getItemFormatFunctions()).getItem());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Project settings
|
# Project settings
|
||||||
# Rule: [major update].[feature update].[bug fix]
|
# Rule: [major update].[feature update].[bug fix]
|
||||||
project_version=2.2.4
|
project_version=2.2.5
|
||||||
config_version=34
|
config_version=34
|
||||||
project_group=net.momirealms
|
project_group=net.momirealms
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user