mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2025-12-19 15:09:24 +00:00
checkpoint - 20
This commit is contained in:
@@ -9,6 +9,7 @@ import dev.dejvokep.boostedyaml.settings.updater.UpdaterSettings;
|
|||||||
import net.momirealms.customfishing.api.BukkitCustomFishingPlugin;
|
import net.momirealms.customfishing.api.BukkitCustomFishingPlugin;
|
||||||
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.EffectModifier;
|
import net.momirealms.customfishing.api.mechanic.effect.EffectModifier;
|
||||||
import net.momirealms.customfishing.api.mechanic.effect.LootBaseEffect;
|
import net.momirealms.customfishing.api.mechanic.effect.LootBaseEffect;
|
||||||
import net.momirealms.customfishing.api.mechanic.entity.EntityConfig;
|
import net.momirealms.customfishing.api.mechanic.entity.EntityConfig;
|
||||||
@@ -22,6 +23,7 @@ import net.momirealms.customfishing.common.config.node.Node;
|
|||||||
import net.momirealms.customfishing.common.item.Item;
|
import net.momirealms.customfishing.common.item.Item;
|
||||||
import net.momirealms.customfishing.common.plugin.feature.Reloadable;
|
import net.momirealms.customfishing.common.plugin.feature.Reloadable;
|
||||||
import net.momirealms.customfishing.common.util.Pair;
|
import net.momirealms.customfishing.common.util.Pair;
|
||||||
|
import net.momirealms.customfishing.common.util.TriConsumer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@@ -71,7 +73,7 @@ public abstract class ConfigManager implements ConfigLoader, Reloadable {
|
|||||||
protected EventPriority eventPriority;
|
protected EventPriority eventPriority;
|
||||||
protected Requirement<Player>[] mechanicRequirements;
|
protected Requirement<Player>[] mechanicRequirements;
|
||||||
protected boolean enableBag;
|
protected boolean enableBag;
|
||||||
|
protected List<TriConsumer<Effect, Context<Player>, Integer>> globalEffects;
|
||||||
|
|
||||||
protected ConfigManager(BukkitCustomFishingPlugin plugin) {
|
protected ConfigManager(BukkitCustomFishingPlugin plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
@@ -186,6 +188,10 @@ public abstract class ConfigManager implements ConfigLoader, Reloadable {
|
|||||||
return instance.mechanicRequirements;
|
return instance.mechanicRequirements;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<TriConsumer<Effect, Context<Player>, Integer>> globalEffects() {
|
||||||
|
return instance.globalEffects;
|
||||||
|
}
|
||||||
|
|
||||||
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));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,7 +101,16 @@ public class ConfigType {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
private static final ConfigType[] values = new ConfigType[] {ITEM, ENTITY, BLOCK, HOOK, ROD, BAIT, UTIL, TOTEM};
|
public static final ConfigType ENCHANT = of(
|
||||||
|
"enchant",
|
||||||
|
(id, section, functions) -> {
|
||||||
|
EnchantConfigParser config = new EnchantConfigParser(id, section, functions);
|
||||||
|
BukkitCustomFishingPlugin.getInstance().getEffectManager().registerEffectModifier(config.getEffectModifier(), MechanicType.ENCHANT);
|
||||||
|
BukkitCustomFishingPlugin.getInstance().getEventManager().registerEventCarrier(config.getEventCarrier());
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
private static final ConfigType[] values = new ConfigType[] {ITEM, ENTITY, BLOCK, HOOK, ROD, BAIT, UTIL, TOTEM, ENCHANT};
|
||||||
|
|
||||||
public static ConfigType[] values() {
|
public static ConfigType[] values() {
|
||||||
return values;
|
return values;
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
package net.momirealms.customfishing.api.mechanic.config;
|
||||||
|
|
||||||
|
import dev.dejvokep.boostedyaml.block.implementation.Section;
|
||||||
|
import net.momirealms.customfishing.api.mechanic.config.function.ConfigParserFunction;
|
||||||
|
import net.momirealms.customfishing.api.mechanic.config.function.EffectModifierParserFunction;
|
||||||
|
import net.momirealms.customfishing.api.mechanic.config.function.EventParserFunction;
|
||||||
|
import net.momirealms.customfishing.api.mechanic.config.function.TotemParserFunction;
|
||||||
|
import net.momirealms.customfishing.api.mechanic.effect.EffectModifier;
|
||||||
|
import net.momirealms.customfishing.api.mechanic.event.EventCarrier;
|
||||||
|
import net.momirealms.customfishing.api.mechanic.item.MechanicType;
|
||||||
|
import net.momirealms.customfishing.api.mechanic.totem.TotemConfig;
|
||||||
|
import net.momirealms.customfishing.common.config.node.Node;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
public class EnchantConfigParser {
|
||||||
|
|
||||||
|
private final String id;
|
||||||
|
private final List<Consumer<EventCarrier.Builder>> eventBuilderConsumers = new ArrayList<>();
|
||||||
|
private final List<Consumer<EffectModifier.Builder>> effectBuilderConsumers = new ArrayList<>();
|
||||||
|
|
||||||
|
public EnchantConfigParser(String id, Section section, Map<String, Node<ConfigParserFunction>> functionMap) {
|
||||||
|
this.id = id;
|
||||||
|
analyze(section, functionMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void analyze(Section section, Map<String, Node<ConfigParserFunction>> functionMap) {
|
||||||
|
Map<String, Object> dataMap = section.getStringRouteMappedValues(false);
|
||||||
|
for (Map.Entry<String, Object> entry : dataMap.entrySet()) {
|
||||||
|
String key = entry.getKey();
|
||||||
|
Node<ConfigParserFunction> node = functionMap.get(key);
|
||||||
|
if (node == null) continue;
|
||||||
|
ConfigParserFunction function = node.nodeValue();
|
||||||
|
if (function != null) {
|
||||||
|
switch (function.type()) {
|
||||||
|
case EVENT -> {
|
||||||
|
EventParserFunction eventParserFunction = (EventParserFunction) function;
|
||||||
|
Consumer<EventCarrier.Builder> consumer = eventParserFunction.accept(entry.getValue());
|
||||||
|
eventBuilderConsumers.add(consumer);
|
||||||
|
}
|
||||||
|
case EFFECT_MODIFIER -> {
|
||||||
|
EffectModifierParserFunction effectModifierParserFunction = (EffectModifierParserFunction) function;
|
||||||
|
Consumer<EffectModifier.Builder> consumer = effectModifierParserFunction.accept(entry.getValue());
|
||||||
|
effectBuilderConsumers.add(consumer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (entry.getValue() instanceof Section innerSection) {
|
||||||
|
analyze(innerSection, node.getChildTree());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public EventCarrier getEventCarrier() {
|
||||||
|
EventCarrier.Builder builder = EventCarrier.builder()
|
||||||
|
.id(id)
|
||||||
|
.type(MechanicType.TOTEM);
|
||||||
|
for (Consumer<EventCarrier.Builder> consumer : eventBuilderConsumers) {
|
||||||
|
consumer.accept(builder);
|
||||||
|
}
|
||||||
|
return builder.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public EffectModifier getEffectModifier() {
|
||||||
|
EffectModifier.Builder builder = EffectModifier.builder()
|
||||||
|
.id(id)
|
||||||
|
.type(MechanicType.TOTEM);
|
||||||
|
for (Consumer<EffectModifier.Builder> consumer : effectBuilderConsumers) {
|
||||||
|
consumer.accept(builder);
|
||||||
|
}
|
||||||
|
return builder.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,7 +25,6 @@ public class TotemConfigParser {
|
|||||||
|
|
||||||
public TotemConfigParser(String id, Section section, Map<String, Node<ConfigParserFunction>> functionMap) {
|
public TotemConfigParser(String id, Section section, Map<String, Node<ConfigParserFunction>> functionMap) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
if (!section.contains("tag")) section.set("tag", true);
|
|
||||||
analyze(section, functionMap);
|
analyze(section, functionMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -204,8 +204,8 @@ public class EffectImpl implements Effect {
|
|||||||
this.difficultyAdder += another.difficultyAdder();
|
this.difficultyAdder += another.difficultyAdder();
|
||||||
this.gameTimeMultiplier += (another.gameTimeMultiplier() - 1);
|
this.gameTimeMultiplier += (another.gameTimeMultiplier() - 1);
|
||||||
this.gameTimeAdder += another.gameTimeAdder();
|
this.gameTimeAdder += another.gameTimeAdder();
|
||||||
this.waitTimeAdder += (another.waitTimeAdder() -1);
|
|
||||||
this.waitTimeMultiplier += (another.waitTimeMultiplier() -1);
|
this.waitTimeMultiplier += (another.waitTimeMultiplier() -1);
|
||||||
|
this.waitTimeAdder += (another.waitTimeAdder());
|
||||||
this.multipleLootChance += another.multipleLootChance();
|
this.multipleLootChance += another.multipleLootChance();
|
||||||
this.weightOperations.addAll(another.weightOperations());
|
this.weightOperations.addAll(another.weightOperations());
|
||||||
this.weightOperationsIgnored.addAll(another.weightOperationsIgnored());
|
this.weightOperationsIgnored.addAll(another.weightOperationsIgnored());
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ 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.EffectModifier;
|
import net.momirealms.customfishing.api.mechanic.effect.EffectModifier;
|
||||||
import net.momirealms.customfishing.api.mechanic.item.MechanicType;
|
import net.momirealms.customfishing.api.mechanic.item.MechanicType;
|
||||||
import net.momirealms.customfishing.api.mechanic.requirement.Requirement;
|
|
||||||
import net.momirealms.customfishing.api.mechanic.requirement.RequirementManager;
|
import net.momirealms.customfishing.api.mechanic.requirement.RequirementManager;
|
||||||
import net.momirealms.customfishing.api.storage.user.UserData;
|
import net.momirealms.customfishing.api.storage.user.UserData;
|
||||||
|
import net.momirealms.customfishing.common.util.Pair;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
@@ -102,6 +102,13 @@ public class FishingGears {
|
|||||||
context.arg(ContextKeys.ROD, rodID);
|
context.arg(ContextKeys.ROD, rodID);
|
||||||
BukkitCustomFishingPlugin.getInstance().getEffectManager().getEffectModifier(rodID, MechanicType.ROD).ifPresent(fishingGears.modifiers::add);
|
BukkitCustomFishingPlugin.getInstance().getEffectManager().getEffectModifier(rodID, MechanicType.ROD).ifPresent(fishingGears.modifiers::add);
|
||||||
|
|
||||||
|
// set enchantments
|
||||||
|
List<Pair<String, Short>> enchants = BukkitCustomFishingPlugin.getInstance().getIntegrationManager().getEnchantments(rodOnMainHand ? mainHandItem : offHandItem);
|
||||||
|
for (Pair<String, Short> enchantment : enchants) {
|
||||||
|
String effectID = enchantment.left() + ":" + enchantment.right();
|
||||||
|
BukkitCustomFishingPlugin.getInstance().getEffectManager().getEffectModifier(effectID, MechanicType.ENCHANT).ifPresent(fishingGears.modifiers::add);
|
||||||
|
}
|
||||||
|
|
||||||
// set bait if it is
|
// set bait if it is
|
||||||
boolean hasBait = false;
|
boolean hasBait = false;
|
||||||
String anotherItemID = BukkitCustomFishingPlugin.getInstance().getItemManager().getItemID(rodOnMainHand ? offHandItem : mainHandItem);
|
String anotherItemID = BukkitCustomFishingPlugin.getInstance().getItemManager().getItemID(rodOnMainHand ? offHandItem : mainHandItem);
|
||||||
@@ -158,6 +165,14 @@ public class FishingGears {
|
|||||||
for (String id : totemIDs) {
|
for (String id : totemIDs) {
|
||||||
BukkitCustomFishingPlugin.getInstance().getEffectManager().getEffectModifier(id, MechanicType.TOTEM).ifPresent(fishingGears.modifiers::add);
|
BukkitCustomFishingPlugin.getInstance().getEffectManager().getEffectModifier(id, MechanicType.TOTEM).ifPresent(fishingGears.modifiers::add);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add global effects
|
||||||
|
fishingGears.modifiers.add(
|
||||||
|
EffectModifier.builder()
|
||||||
|
.id("__GLOBAL__")
|
||||||
|
.modifiers(ConfigManager.globalEffects())
|
||||||
|
.build()
|
||||||
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,39 @@
|
|||||||
package net.momirealms.customfishing.api.mechanic.fishing.hook;
|
package net.momirealms.customfishing.api.mechanic.fishing.hook;
|
||||||
|
|
||||||
|
import io.papermc.paper.block.fluid.FluidData;
|
||||||
|
import net.momirealms.customfishing.api.BukkitCustomFishingPlugin;
|
||||||
|
import net.momirealms.customfishing.api.mechanic.config.ConfigManager;
|
||||||
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;
|
||||||
import net.momirealms.customfishing.api.mechanic.effect.EffectProperties;
|
import net.momirealms.customfishing.api.mechanic.effect.EffectProperties;
|
||||||
|
import net.momirealms.customfishing.common.plugin.scheduler.SchedulerTask;
|
||||||
|
import net.momirealms.customfishing.common.util.RandomUtils;
|
||||||
|
import org.bukkit.*;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.entity.ArmorStand;
|
||||||
import org.bukkit.entity.FishHook;
|
import org.bukkit.entity.FishHook;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.persistence.PersistentDataType;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
public class LavaFishingMechanic implements HookMechanic {
|
public class LavaFishingMechanic implements HookMechanic {
|
||||||
|
|
||||||
private final FishHook hook;
|
private final FishHook hook;
|
||||||
private final Effect gearsEffect;
|
private final Effect gearsEffect;
|
||||||
private final Context<Player> context;
|
private final Context<Player> context;
|
||||||
|
private ArmorStand tempEntity;
|
||||||
|
private SchedulerTask task;
|
||||||
|
private int timeUntilLured;
|
||||||
|
private int timeUntilHooked;
|
||||||
|
private int nibble;
|
||||||
|
private boolean hooked;
|
||||||
|
private float fishAngle;
|
||||||
|
private int currentState;
|
||||||
|
private int jumpTimer;
|
||||||
|
|
||||||
public LavaFishingMechanic(FishHook hook, Effect gearsEffect, Context<Player> context) {
|
public LavaFishingMechanic(FishHook hook, Effect gearsEffect, Context<Player> context) {
|
||||||
this.hook = hook;
|
this.hook = hook;
|
||||||
@@ -24,12 +46,17 @@ public class LavaFishingMechanic implements HookMechanic {
|
|||||||
if (!(boolean) gearsEffect.properties().getOrDefault(EffectProperties.LAVA_FISHING, false)) {
|
if (!(boolean) gearsEffect.properties().getOrDefault(EffectProperties.LAVA_FISHING, false)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
float lavaHeight = 0F;
|
||||||
|
FluidData fluidData = this.hook.getWorld().getFluidData(this.hook.getLocation());
|
||||||
|
if (fluidData.getFluidType() == Fluid.LAVA || fluidData.getFluidType() == Fluid.FLOWING_LAVA) {
|
||||||
|
lavaHeight = (float) (fluidData.getLevel() * 0.125);
|
||||||
|
}
|
||||||
|
return lavaHeight > 0 && this.hook.getY() % 1 <= lavaHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldStop() {
|
public boolean shouldStop() {
|
||||||
return false;
|
return hook.isOnGround() || (hook.getLocation().getBlock().getType() != Material.LAVA && hook.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() != Material.LAVA);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -39,16 +66,123 @@ public class LavaFishingMechanic implements HookMechanic {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start(Effect finalEffect) {
|
public void start(Effect finalEffect) {
|
||||||
|
this.setWaitTime(finalEffect);
|
||||||
|
this.task = BukkitCustomFishingPlugin.getInstance().getScheduler().sync().runRepeating(() -> {
|
||||||
|
float lavaHeight = 0F;
|
||||||
|
FluidData fluidData = this.hook.getWorld().getFluidData(this.hook.getLocation());
|
||||||
|
if (fluidData.getFluidType() == Fluid.LAVA || fluidData.getFluidType() == Fluid.FLOWING_LAVA) {
|
||||||
|
lavaHeight = (float) (fluidData.getLevel() * 0.125);
|
||||||
|
}
|
||||||
|
if (this.nibble > 0) {
|
||||||
|
--this.nibble;
|
||||||
|
if (this.hook.getY() % 1 <= lavaHeight) {
|
||||||
|
this.jumpTimer++;
|
||||||
|
if (this.jumpTimer >= 4) {
|
||||||
|
this.jumpTimer = 0;
|
||||||
|
Vector previousVector = this.hook.getVelocity();
|
||||||
|
this.hook.setVelocity(new Vector(0,0.24,0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.nibble <= 0) {
|
||||||
|
this.timeUntilLured = 0;
|
||||||
|
this.timeUntilHooked = 0;
|
||||||
|
this.hooked = false;
|
||||||
|
this.jumpTimer = 0;
|
||||||
|
this.currentState = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (this.hook.getY() % 1 <= lavaHeight) {
|
||||||
|
Vector previousVector = this.hook.getVelocity();
|
||||||
|
this.hook.setVelocity(new Vector(previousVector.getX() * 0.6, Math.min(0.1, Math.max(-0.1, previousVector.getY() + 0.1)), previousVector.getZ() * 0.6));
|
||||||
|
this.currentState = 1;
|
||||||
|
} else {
|
||||||
|
if (currentState == 1) {
|
||||||
|
this.currentState = 0;
|
||||||
|
// set temp entity
|
||||||
|
this.tempEntity = this.hook.getWorld().spawn(this.hook.getLocation().clone().subtract(0,1,0), ArmorStand.class);
|
||||||
|
this.setTempEntityProperties(this.tempEntity);
|
||||||
|
this.hook.setHookedEntity(this.tempEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
float f;
|
||||||
|
float f1;
|
||||||
|
float f2;
|
||||||
|
double d0;
|
||||||
|
double d1;
|
||||||
|
double d2;
|
||||||
|
if (this.timeUntilHooked > 0) {
|
||||||
|
this.timeUntilHooked -= 1;
|
||||||
|
if (this.timeUntilHooked > 0) {
|
||||||
|
this.fishAngle += (float) RandomUtils.triangle(0.0D, 9.188D);
|
||||||
|
f = this.fishAngle * 0.017453292F;
|
||||||
|
f1 = (float) Math.sin(f);
|
||||||
|
f2 = (float) Math.cos(f);
|
||||||
|
d0 = hook.getX() + (double) (f1 * (float) this.timeUntilHooked * 0.1F);
|
||||||
|
d1 = hook.getY();
|
||||||
|
d2 = hook.getZ() + (double) (f2 * (float) this.timeUntilHooked * 0.1F);
|
||||||
|
if (RandomUtils.generateRandomFloat(0,1) < 0.15F) {
|
||||||
|
hook.getWorld().spawnParticle(Particle.FLAME, d0, d1 - 0.10000000149011612D, d2, 1, f1, 0.1D, f2, 0.0D);
|
||||||
|
}
|
||||||
|
float f3 = f1 * 0.04F;
|
||||||
|
float f4 = f2 * 0.04F;
|
||||||
|
hook.getWorld().spawnParticle(Particle.FLAME, d0, d1, d2, 0, f4, 0.01D, -f3, 1.0D);
|
||||||
|
} else {
|
||||||
|
double d3 = hook.getY() + 0.5D;
|
||||||
|
hook.getWorld().spawnParticle(Particle.FLAME, hook.getX(), d3, hook.getZ(), (int) (1.0F + 0.3 * 20.0F), 0.3, 0.0D, 0.3, 0.20000000298023224D);
|
||||||
|
this.nibble = RandomUtils.generateRandomInt(20, 40);
|
||||||
|
this.hooked = true;
|
||||||
|
hook.getWorld().playSound(hook.getLocation(), Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 0.25F, 1.0F + (RandomUtils.generateRandomFloat(0,1)-RandomUtils.generateRandomFloat(0,1)) * 0.4F);
|
||||||
|
if (this.tempEntity != null && this.tempEntity.isValid()) {
|
||||||
|
this.tempEntity.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (timeUntilLured > 0) {
|
||||||
|
timeUntilLured--;
|
||||||
|
if (this.timeUntilLured <= 0) {
|
||||||
|
this.fishAngle = RandomUtils.generateRandomFloat(0F, 360F);
|
||||||
|
this.timeUntilHooked = RandomUtils.generateRandomInt(20, 80);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setWaitTime(finalEffect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 1, 1, hook.getLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isHooked() {
|
public boolean isHooked() {
|
||||||
return false;
|
return hooked;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
|
if (this.tempEntity != null && this.tempEntity.isValid()) {
|
||||||
|
this.tempEntity.remove();
|
||||||
|
}
|
||||||
|
if (this.task != null) {
|
||||||
|
this.task.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setWaitTime(Effect effect) {
|
||||||
|
int before = ThreadLocalRandom.current().nextInt(ConfigManager.lavaMaxTime() - ConfigManager.lavaMinTime() + 1) + ConfigManager.lavaMinTime();
|
||||||
|
int after = Math.max(1, (int) (before * effect.waitTimeMultiplier() + effect.waitTimeAdder()));
|
||||||
|
BukkitCustomFishingPlugin.getInstance().debug("Wait time: " + before + " -> " + after + " ticks");
|
||||||
|
this.timeUntilLured = after;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setTempEntityProperties(ArmorStand entity) {
|
||||||
|
entity.setInvisible(true);
|
||||||
|
entity.setCollidable(false);
|
||||||
|
entity.setInvulnerable(true);
|
||||||
|
entity.setVisible(false);
|
||||||
|
entity.setCustomNameVisible(false);
|
||||||
|
entity.setSmall(true);
|
||||||
|
entity.setGravity(false);
|
||||||
|
entity.getPersistentDataContainer().set(
|
||||||
|
Objects.requireNonNull(NamespacedKey.fromString("temp-entity", BukkitCustomFishingPlugin.getInstance().getBoostrap())),
|
||||||
|
PersistentDataType.STRING,
|
||||||
|
"lava"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,16 +5,15 @@ import net.momirealms.customfishing.api.mechanic.config.ConfigManager;
|
|||||||
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;
|
||||||
import net.momirealms.customfishing.api.mechanic.effect.EffectModifier;
|
|
||||||
import net.momirealms.customfishing.api.mechanic.effect.EffectProperties;
|
import net.momirealms.customfishing.api.mechanic.effect.EffectProperties;
|
||||||
import net.momirealms.customfishing.common.plugin.scheduler.SchedulerTask;
|
import net.momirealms.customfishing.common.plugin.scheduler.SchedulerTask;
|
||||||
import net.momirealms.customfishing.common.util.RandomUtils;
|
import net.momirealms.customfishing.common.util.RandomUtils;
|
||||||
import org.bukkit.NamespacedKey;
|
import org.bukkit.NamespacedKey;
|
||||||
import org.bukkit.Particle;
|
import org.bukkit.Particle;
|
||||||
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.ArmorStand;
|
import org.bukkit.entity.ArmorStand;
|
||||||
import org.bukkit.entity.FishHook;
|
import org.bukkit.entity.FishHook;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.player.PlayerFishEvent;
|
|
||||||
import org.bukkit.persistence.PersistentDataType;
|
import org.bukkit.persistence.PersistentDataType;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -113,6 +112,7 @@ public class VoidFishingMechanic implements HookMechanic {
|
|||||||
hook.getWorld().spawnParticle(Particle.END_ROD, hook.getX(), d3, hook.getZ(), (int) (1.0F + 0.3 * 20.0F), 0.3, 0.0D, 0.3, 0.20000000298023224D);
|
hook.getWorld().spawnParticle(Particle.END_ROD, hook.getX(), d3, hook.getZ(), (int) (1.0F + 0.3 * 20.0F), 0.3, 0.0D, 0.3, 0.20000000298023224D);
|
||||||
this.nibble = RandomUtils.generateRandomInt(20, 40);
|
this.nibble = RandomUtils.generateRandomInt(20, 40);
|
||||||
this.hooked = true;
|
this.hooked = true;
|
||||||
|
hook.getWorld().playSound(hook.getLocation(), Sound.ITEM_TRIDENT_THUNDER, 0.25F, 1.0F + (RandomUtils.generateRandomFloat(0,1)-RandomUtils.generateRandomFloat(0,1)) * 0.4F);
|
||||||
}
|
}
|
||||||
} else if (timeUntilLured > 0) {
|
} else if (timeUntilLured > 0) {
|
||||||
timeUntilLured--;
|
timeUntilLured--;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ public class MechanicType {
|
|||||||
public static final MechanicType BAIT = of("bait");
|
public static final MechanicType BAIT = of("bait");
|
||||||
public static final MechanicType HOOK = of("hook");
|
public static final MechanicType HOOK = of("hook");
|
||||||
public static final MechanicType TOTEM = of("totem");
|
public static final MechanicType TOTEM = of("totem");
|
||||||
|
public static final MechanicType ENCHANT = of("enchant");
|
||||||
|
|
||||||
private final String type;
|
private final String type;
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
config=${config_version}
|
||||||
asm=${asm_version}
|
asm=${asm_version}
|
||||||
asm-commons=${asm_commons_version}
|
asm-commons=${asm_commons_version}
|
||||||
jar-relocator=${jar_relocator_version}
|
jar-relocator=${jar_relocator_version}
|
||||||
|
|||||||
@@ -2,6 +2,11 @@ package net.momirealms.customfishing.bukkit.config;
|
|||||||
|
|
||||||
import dev.dejvokep.boostedyaml.YamlDocument;
|
import dev.dejvokep.boostedyaml.YamlDocument;
|
||||||
import dev.dejvokep.boostedyaml.block.implementation.Section;
|
import dev.dejvokep.boostedyaml.block.implementation.Section;
|
||||||
|
import dev.dejvokep.boostedyaml.dvs.versioning.BasicVersioning;
|
||||||
|
import dev.dejvokep.boostedyaml.settings.dumper.DumperSettings;
|
||||||
|
import dev.dejvokep.boostedyaml.settings.general.GeneralSettings;
|
||||||
|
import dev.dejvokep.boostedyaml.settings.loader.LoaderSettings;
|
||||||
|
import dev.dejvokep.boostedyaml.settings.updater.UpdaterSettings;
|
||||||
import net.momirealms.customfishing.api.BukkitCustomFishingPlugin;
|
import net.momirealms.customfishing.api.BukkitCustomFishingPlugin;
|
||||||
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;
|
||||||
@@ -26,6 +31,7 @@ import net.momirealms.customfishing.api.mechanic.totem.block.property.TotemBlock
|
|||||||
import net.momirealms.customfishing.api.mechanic.totem.block.type.TypeCondition;
|
import net.momirealms.customfishing.api.mechanic.totem.block.type.TypeCondition;
|
||||||
import net.momirealms.customfishing.bukkit.totem.particle.DustParticleSetting;
|
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.common.dependency.DependencyProperties;
|
||||||
import net.momirealms.customfishing.common.helper.AdventureHelper;
|
import net.momirealms.customfishing.common.helper.AdventureHelper;
|
||||||
import net.momirealms.customfishing.common.util.ListUtils;
|
import net.momirealms.customfishing.common.util.ListUtils;
|
||||||
import net.momirealms.customfishing.common.util.Pair;
|
import net.momirealms.customfishing.common.util.Pair;
|
||||||
@@ -40,6 +46,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.BiFunction;
|
import java.util.function.BiFunction;
|
||||||
|
|
||||||
@@ -65,7 +72,34 @@ public class BukkitConfigManager extends ConfigManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load() {
|
public void load() {
|
||||||
MAIN_CONFIG = loadConfig("config.yml");
|
String configVersion = DependencyProperties.getDependencyVersion("config");
|
||||||
|
try {
|
||||||
|
MAIN_CONFIG = YamlDocument.create(
|
||||||
|
resolveConfig("config.yml").toFile(),
|
||||||
|
plugin.getResourceStream("config.yml"),
|
||||||
|
GeneralSettings.builder()
|
||||||
|
.setRouteSeparator('.')
|
||||||
|
.setUseDefaults(false)
|
||||||
|
.build(),
|
||||||
|
LoaderSettings
|
||||||
|
.builder()
|
||||||
|
.setAutoUpdate(true)
|
||||||
|
.build(),
|
||||||
|
DumperSettings.DEFAULT,
|
||||||
|
UpdaterSettings
|
||||||
|
.builder()
|
||||||
|
.setVersioning(new BasicVersioning("config-version"))
|
||||||
|
.addIgnoredRoute(configVersion, "mechanics.mechanic-requirements", '.')
|
||||||
|
.addIgnoredRoute(configVersion, "mechanics.global-events", '.')
|
||||||
|
.addIgnoredRoute(configVersion, "mechanics.global-effects", '.')
|
||||||
|
.addIgnoredRoute(configVersion, "mechanics.fishing-bag.collect-actions", '.')
|
||||||
|
.addIgnoredRoute(configVersion, "mechanics.fishing-bag.full-actions", '.')
|
||||||
|
.addIgnoredRoute(configVersion, "other-settings.placeholder-register", '.')
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
this.loadSettings();
|
this.loadSettings();
|
||||||
this.loadConfigs();
|
this.loadConfigs();
|
||||||
}
|
}
|
||||||
@@ -122,6 +156,15 @@ public class BukkitConfigManager extends ConfigManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
globalEffects = new ArrayList<>();
|
||||||
|
Section globalEffectSection = config.getSection("mechanics.global-effects");
|
||||||
|
if (globalEffectSection != null)
|
||||||
|
for (Map.Entry<String, Object> entry : globalEffectSection.getStringRouteMappedValues(false).entrySet()) {
|
||||||
|
if (entry.getValue() instanceof Section innerSection) {
|
||||||
|
globalEffects.add(parseEffect(innerSection));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadConfigs() {
|
private void loadConfigs() {
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import net.momirealms.customfishing.api.mechanic.context.Context;
|
|||||||
import net.momirealms.customfishing.api.mechanic.fishing.CustomFishingHook;
|
import net.momirealms.customfishing.api.mechanic.fishing.CustomFishingHook;
|
||||||
import net.momirealms.customfishing.api.mechanic.fishing.FishingGears;
|
import net.momirealms.customfishing.api.mechanic.fishing.FishingGears;
|
||||||
import net.momirealms.customfishing.api.mechanic.fishing.FishingManager;
|
import net.momirealms.customfishing.api.mechanic.fishing.FishingManager;
|
||||||
import net.momirealms.customfishing.api.mechanic.fishing.hook.VanillaMechanic;
|
|
||||||
import net.momirealms.customfishing.api.mechanic.requirement.RequirementManager;
|
import net.momirealms.customfishing.api.mechanic.requirement.RequirementManager;
|
||||||
import net.momirealms.customfishing.bukkit.util.EventUtils;
|
import net.momirealms.customfishing.bukkit.util.EventUtils;
|
||||||
import net.momirealms.customfishing.common.helper.VersionHelper;
|
import net.momirealms.customfishing.common.helper.VersionHelper;
|
||||||
|
|||||||
@@ -24,8 +24,10 @@ import net.momirealms.customfishing.bukkit.entity.BukkitEntityManager;
|
|||||||
import net.momirealms.customfishing.bukkit.integration.block.ItemsAdderBlockProvider;
|
import net.momirealms.customfishing.bukkit.integration.block.ItemsAdderBlockProvider;
|
||||||
import net.momirealms.customfishing.bukkit.integration.block.OraxenBlockProvider;
|
import net.momirealms.customfishing.bukkit.integration.block.OraxenBlockProvider;
|
||||||
import net.momirealms.customfishing.bukkit.integration.enchant.AdvancedEnchantmentsProvider;
|
import net.momirealms.customfishing.bukkit.integration.enchant.AdvancedEnchantmentsProvider;
|
||||||
|
import net.momirealms.customfishing.bukkit.integration.enchant.VanillaEnchantmentsProvider;
|
||||||
import net.momirealms.customfishing.bukkit.integration.entity.ItemsAdderEntityProvider;
|
import net.momirealms.customfishing.bukkit.integration.entity.ItemsAdderEntityProvider;
|
||||||
import net.momirealms.customfishing.bukkit.integration.entity.MythicEntityProvider;
|
import net.momirealms.customfishing.bukkit.integration.entity.MythicEntityProvider;
|
||||||
|
import net.momirealms.customfishing.bukkit.integration.entity.VanillaEntityProvider;
|
||||||
import net.momirealms.customfishing.bukkit.integration.item.*;
|
import net.momirealms.customfishing.bukkit.integration.item.*;
|
||||||
import net.momirealms.customfishing.bukkit.integration.level.*;
|
import net.momirealms.customfishing.bukkit.integration.level.*;
|
||||||
import net.momirealms.customfishing.bukkit.integration.quest.BattlePassQuest;
|
import net.momirealms.customfishing.bukkit.integration.quest.BattlePassQuest;
|
||||||
@@ -67,6 +69,7 @@ public class BukkitIntegrationManager implements IntegrationManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load() {
|
public void load() {
|
||||||
|
registerEnchantmentProvider(new VanillaEnchantmentsProvider());
|
||||||
if (isHooked("ItemsAdder")) {
|
if (isHooked("ItemsAdder")) {
|
||||||
registerItemProvider(new ItemsAdderItemProvider());
|
registerItemProvider(new ItemsAdderItemProvider());
|
||||||
registerBlockProvider(new ItemsAdderBlockProvider());
|
registerBlockProvider(new ItemsAdderBlockProvider());
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
@@ -171,7 +170,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
|
|
||||||
private void registerCompetitionRequirement() {
|
private void registerCompetitionRequirement() {
|
||||||
registerRequirement("competition", (args, actions, advanced) -> {
|
registerRequirement("competition", (args, actions, advanced) -> {
|
||||||
if (args instanceof ConfigurationSection section) {
|
if (args instanceof Section section) {
|
||||||
boolean onCompetition = section.getBoolean("ongoing", true);
|
boolean onCompetition = section.getBoolean("ongoing", true);
|
||||||
List<String> ids = ListUtils.toList(section.get("id"));
|
List<String> ids = ListUtils.toList(section.get("id"));
|
||||||
return context -> {
|
return context -> {
|
||||||
@@ -863,7 +862,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
|
|
||||||
private void registerPAPIRequirement() {
|
private void registerPAPIRequirement() {
|
||||||
registerRequirement("<", (args, actions, advanced) -> {
|
registerRequirement("<", (args, actions, advanced) -> {
|
||||||
if (args instanceof ConfigurationSection section) {
|
if (args instanceof Section section) {
|
||||||
MathValue<Player> v1 = MathValue.auto(section.get("value1"));
|
MathValue<Player> v1 = MathValue.auto(section.get("value1"));
|
||||||
MathValue<Player> v2 = MathValue.auto(section.get("value2"));
|
MathValue<Player> v2 = MathValue.auto(section.get("value2"));
|
||||||
return context -> {
|
return context -> {
|
||||||
@@ -877,7 +876,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement("<=", (args, actions, advanced) -> {
|
registerRequirement("<=", (args, actions, advanced) -> {
|
||||||
if (args instanceof ConfigurationSection section) {
|
if (args instanceof Section section) {
|
||||||
MathValue<Player> v1 = MathValue.auto(section.get("value1"));
|
MathValue<Player> v1 = MathValue.auto(section.get("value1"));
|
||||||
MathValue<Player> v2 = MathValue.auto(section.get("value2"));
|
MathValue<Player> v2 = MathValue.auto(section.get("value2"));
|
||||||
return context -> {
|
return context -> {
|
||||||
@@ -891,7 +890,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement("!=", (args, actions, advanced) -> {
|
registerRequirement("!=", (args, actions, advanced) -> {
|
||||||
if (args instanceof ConfigurationSection section) {
|
if (args instanceof Section section) {
|
||||||
MathValue<Player> v1 = MathValue.auto(section.get("value1"));
|
MathValue<Player> v1 = MathValue.auto(section.get("value1"));
|
||||||
MathValue<Player> v2 = MathValue.auto(section.get("value2"));
|
MathValue<Player> v2 = MathValue.auto(section.get("value2"));
|
||||||
return context -> {
|
return context -> {
|
||||||
@@ -905,7 +904,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement("==", (args, actions, advanced) -> {
|
registerRequirement("==", (args, actions, advanced) -> {
|
||||||
if (args instanceof ConfigurationSection section) {
|
if (args instanceof Section section) {
|
||||||
MathValue<Player> v1 = MathValue.auto(section.get("value1"));
|
MathValue<Player> v1 = MathValue.auto(section.get("value1"));
|
||||||
MathValue<Player> v2 = MathValue.auto(section.get("value2"));
|
MathValue<Player> v2 = MathValue.auto(section.get("value2"));
|
||||||
return context -> {
|
return context -> {
|
||||||
@@ -919,7 +918,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement(">=", (args, actions, advanced) -> {
|
registerRequirement(">=", (args, actions, advanced) -> {
|
||||||
if (args instanceof ConfigurationSection section) {
|
if (args instanceof Section section) {
|
||||||
MathValue<Player> v1 = MathValue.auto(section.get("value1"));
|
MathValue<Player> v1 = MathValue.auto(section.get("value1"));
|
||||||
MathValue<Player> v2 = MathValue.auto(section.get("value2"));
|
MathValue<Player> v2 = MathValue.auto(section.get("value2"));
|
||||||
return context -> {
|
return context -> {
|
||||||
@@ -933,7 +932,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement(">", (args, actions, advanced) -> {
|
registerRequirement(">", (args, actions, advanced) -> {
|
||||||
if (args instanceof ConfigurationSection section) {
|
if (args instanceof Section section) {
|
||||||
MathValue<Player> v1 = MathValue.auto(section.get("value1"));
|
MathValue<Player> v1 = MathValue.auto(section.get("value1"));
|
||||||
MathValue<Player> v2 = MathValue.auto(section.get("value2"));
|
MathValue<Player> v2 = MathValue.auto(section.get("value2"));
|
||||||
return context -> {
|
return context -> {
|
||||||
@@ -947,7 +946,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement("regex", (args, actions, advanced) -> {
|
registerRequirement("regex", (args, actions, advanced) -> {
|
||||||
if (args instanceof ConfigurationSection section) {
|
if (args instanceof Section section) {
|
||||||
TextValue<Player> v1 = TextValue.auto(section.getString("papi", ""));
|
TextValue<Player> v1 = TextValue.auto(section.getString("papi", ""));
|
||||||
String v2 = section.getString("regex", "");
|
String v2 = section.getString("regex", "");
|
||||||
return context -> {
|
return context -> {
|
||||||
@@ -961,7 +960,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement("startsWith", (args, actions, advanced) -> {
|
registerRequirement("startsWith", (args, actions, advanced) -> {
|
||||||
if (args instanceof ConfigurationSection section) {
|
if (args instanceof Section section) {
|
||||||
TextValue<Player> v1 = TextValue.auto(section.getString("value1", ""));
|
TextValue<Player> v1 = TextValue.auto(section.getString("value1", ""));
|
||||||
TextValue<Player> v2 = TextValue.auto(section.getString("value2", ""));
|
TextValue<Player> v2 = TextValue.auto(section.getString("value2", ""));
|
||||||
return context -> {
|
return context -> {
|
||||||
@@ -975,7 +974,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement("!startsWith", (args, actions, advanced) -> {
|
registerRequirement("!startsWith", (args, actions, advanced) -> {
|
||||||
if (args instanceof ConfigurationSection section) {
|
if (args instanceof Section section) {
|
||||||
TextValue<Player> v1 = TextValue.auto(section.getString("value1", ""));
|
TextValue<Player> v1 = TextValue.auto(section.getString("value1", ""));
|
||||||
TextValue<Player> v2 = TextValue.auto(section.getString("value2", ""));
|
TextValue<Player> v2 = TextValue.auto(section.getString("value2", ""));
|
||||||
return context -> {
|
return context -> {
|
||||||
@@ -989,7 +988,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement("endsWith", (args, actions, advanced) -> {
|
registerRequirement("endsWith", (args, actions, advanced) -> {
|
||||||
if (args instanceof ConfigurationSection section) {
|
if (args instanceof Section section) {
|
||||||
TextValue<Player> v1 = TextValue.auto(section.getString("value1", ""));
|
TextValue<Player> v1 = TextValue.auto(section.getString("value1", ""));
|
||||||
TextValue<Player> v2 = TextValue.auto(section.getString("value2", ""));
|
TextValue<Player> v2 = TextValue.auto(section.getString("value2", ""));
|
||||||
return context -> {
|
return context -> {
|
||||||
@@ -1003,7 +1002,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement("!endsWith", (args, actions, advanced) -> {
|
registerRequirement("!endsWith", (args, actions, advanced) -> {
|
||||||
if (args instanceof ConfigurationSection section) {
|
if (args instanceof Section section) {
|
||||||
TextValue<Player> v1 = TextValue.auto(section.getString("value1", ""));
|
TextValue<Player> v1 = TextValue.auto(section.getString("value1", ""));
|
||||||
TextValue<Player> v2 = TextValue.auto(section.getString("value2", ""));
|
TextValue<Player> v2 = TextValue.auto(section.getString("value2", ""));
|
||||||
return context -> {
|
return context -> {
|
||||||
@@ -1017,7 +1016,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement("contains", (args, actions, advanced) -> {
|
registerRequirement("contains", (args, actions, advanced) -> {
|
||||||
if (args instanceof ConfigurationSection section) {
|
if (args instanceof Section section) {
|
||||||
TextValue<Player> v1 = TextValue.auto(section.getString("value1", ""));
|
TextValue<Player> v1 = TextValue.auto(section.getString("value1", ""));
|
||||||
TextValue<Player> v2 = TextValue.auto(section.getString("value2", ""));
|
TextValue<Player> v2 = TextValue.auto(section.getString("value2", ""));
|
||||||
return context -> {
|
return context -> {
|
||||||
@@ -1031,7 +1030,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement("!contains", (args, actions, advanced) -> {
|
registerRequirement("!contains", (args, actions, advanced) -> {
|
||||||
if (args instanceof ConfigurationSection section) {
|
if (args instanceof Section section) {
|
||||||
TextValue<Player> v1 = TextValue.auto(section.getString("value1", ""));
|
TextValue<Player> v1 = TextValue.auto(section.getString("value1", ""));
|
||||||
TextValue<Player> v2 = TextValue.auto(section.getString("value2", ""));
|
TextValue<Player> v2 = TextValue.auto(section.getString("value2", ""));
|
||||||
return context -> {
|
return context -> {
|
||||||
@@ -1045,7 +1044,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement("in-list", (args, actions, advanced) -> {
|
registerRequirement("in-list", (args, actions, advanced) -> {
|
||||||
if (args instanceof ConfigurationSection section) {
|
if (args instanceof Section section) {
|
||||||
TextValue<Player> papi = TextValue.auto(section.getString("papi", ""));
|
TextValue<Player> papi = TextValue.auto(section.getString("papi", ""));
|
||||||
List<String> values = ListUtils.toList(section.get("values"));
|
List<String> values = ListUtils.toList(section.get("values"));
|
||||||
return context -> {
|
return context -> {
|
||||||
@@ -1059,7 +1058,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement("!in-list", (args, actions, advanced) -> {
|
registerRequirement("!in-list", (args, actions, advanced) -> {
|
||||||
if (args instanceof ConfigurationSection section) {
|
if (args instanceof Section section) {
|
||||||
TextValue<Player> papi = TextValue.auto(section.getString("papi", ""));
|
TextValue<Player> papi = TextValue.auto(section.getString("papi", ""));
|
||||||
List<String> values = ListUtils.toList(section.get("values"));
|
List<String> values = ListUtils.toList(section.get("values"));
|
||||||
return context -> {
|
return context -> {
|
||||||
@@ -1073,7 +1072,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement("equals", (args, actions, advanced) -> {
|
registerRequirement("equals", (args, actions, advanced) -> {
|
||||||
if (args instanceof ConfigurationSection section) {
|
if (args instanceof Section section) {
|
||||||
TextValue<Player> v1 = TextValue.auto(section.getString("value1", ""));
|
TextValue<Player> v1 = TextValue.auto(section.getString("value1", ""));
|
||||||
TextValue<Player> v2 = TextValue.auto(section.getString("value2", ""));
|
TextValue<Player> v2 = TextValue.auto(section.getString("value2", ""));
|
||||||
return context -> {
|
return context -> {
|
||||||
@@ -1087,7 +1086,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement("!equals", (args, actions, advanced) -> {
|
registerRequirement("!equals", (args, actions, advanced) -> {
|
||||||
if (args instanceof ConfigurationSection section) {
|
if (args instanceof Section section) {
|
||||||
TextValue<Player> v1 = TextValue.auto(section.getString("value1", ""));
|
TextValue<Player> v1 = TextValue.auto(section.getString("value1", ""));
|
||||||
TextValue<Player> v2 = TextValue.auto(section.getString("value2", ""));
|
TextValue<Player> v2 = TextValue.auto(section.getString("value2", ""));
|
||||||
return context -> {
|
return context -> {
|
||||||
|
|||||||
@@ -30,21 +30,42 @@ minecraft:luck_of_the_sea:3:
|
|||||||
value:
|
value:
|
||||||
- silver_star:+6
|
- silver_star:+6
|
||||||
- golden_star:+3
|
- golden_star:+3
|
||||||
#minecraft:lure:1:
|
minecraft:lure:1:
|
||||||
# requirements: {}
|
requirements: {}
|
||||||
# effects:
|
effects:
|
||||||
# effect_1:
|
effect_1:
|
||||||
# type: wait-time
|
type: conditional
|
||||||
# value: -50
|
conditions:
|
||||||
#minecraft:lure:2:
|
"||":
|
||||||
# requirements: {}
|
in-lava: true
|
||||||
# effects:
|
in-void: true
|
||||||
# effect_1:
|
effects:
|
||||||
# type: wait-time
|
effect_1:
|
||||||
# value: -100
|
type: wait-time
|
||||||
#minecraft:lure:3:
|
value: -80
|
||||||
# requirements: {}
|
minecraft:lure:2:
|
||||||
# effects:
|
requirements: {}
|
||||||
# effect_1:
|
effects:
|
||||||
# type: wait-time
|
effect_1:
|
||||||
# value: -150
|
type: conditional
|
||||||
|
conditions:
|
||||||
|
"||":
|
||||||
|
in-lava: true
|
||||||
|
in-void: true
|
||||||
|
effects:
|
||||||
|
effect_1:
|
||||||
|
type: wait-time
|
||||||
|
value: -160
|
||||||
|
minecraft:lure:3:
|
||||||
|
requirements: {}
|
||||||
|
effects:
|
||||||
|
effect_1:
|
||||||
|
type: conditional
|
||||||
|
conditions:
|
||||||
|
"||":
|
||||||
|
in-lava: true
|
||||||
|
in-void: true
|
||||||
|
effects:
|
||||||
|
effect_1:
|
||||||
|
type: wait-time
|
||||||
|
value: -240
|
||||||
@@ -5,7 +5,7 @@ global-group:
|
|||||||
sub-groups:
|
sub-groups:
|
||||||
loots_in_water:
|
loots_in_water:
|
||||||
conditions:
|
conditions:
|
||||||
lava-fishing: false
|
in-water: true
|
||||||
environment:
|
environment:
|
||||||
- normal
|
- normal
|
||||||
'!rod':
|
'!rod':
|
||||||
@@ -126,7 +126,7 @@ global-group:
|
|||||||
- 'skeleton:+30'
|
- 'skeleton:+30'
|
||||||
loots_in_lava:
|
loots_in_lava:
|
||||||
conditions:
|
conditions:
|
||||||
lava-fishing: true
|
in-lava: true
|
||||||
list: []
|
list: []
|
||||||
sub-groups:
|
sub-groups:
|
||||||
world_loots:
|
world_loots:
|
||||||
|
|||||||
Reference in New Issue
Block a user