9
0
mirror of https://github.com/Xiao-MoMi/Custom-Fishing.git synced 2025-12-28 03:19:12 +00:00

placeholders suppliers

This commit is contained in:
XiaoMoMi
2024-07-11 00:29:56 +08:00
parent 0ea172336c
commit 519d4c0f95
8 changed files with 31 additions and 11 deletions

View File

@@ -361,7 +361,8 @@ public class BukkitActionManager implements ActionManager<Player> {
return context -> {
if (Math.random() > chance) return;
final Player player = context.getHolder();
player.getLocation().getWorld().spawn(player.getLocation().clone().add(0,0.5,0), ExperienceOrb.class, e -> e.setExperience((int) value.evaluate(context)));
ExperienceOrb entity = player.getLocation().getWorld().spawn(player.getLocation().clone().add(0,0.5,0), ExperienceOrb.class);
entity.setExperience((int) value.evaluate(context));
};
});
registerAction("exp", (args, chance) -> {

View File

@@ -24,7 +24,6 @@ import net.momirealms.customfishing.api.mechanic.context.Context;
import net.momirealms.customfishing.api.mechanic.context.ContextKeys;
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.fishing.FishingGears;
import net.momirealms.customfishing.bukkit.command.BukkitCommandFeature;
import net.momirealms.customfishing.common.command.CustomFishingCommandManager;
@@ -39,14 +38,12 @@ import org.incendo.cloud.CommandManager;
import org.incendo.cloud.context.CommandContext;
import org.incendo.cloud.context.CommandInput;
import org.incendo.cloud.parser.standard.StringParser;
import org.incendo.cloud.parser.standard.UUIDParser;
import org.incendo.cloud.suggestion.Suggestion;
import org.incendo.cloud.suggestion.SuggestionProvider;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Stream;

View File

@@ -839,6 +839,11 @@ public class BukkitConfigManager extends ConfigManager {
Action<Player>[] actions = plugin.getActionManager().parseActions(section);
return builder -> builder.action(ActionTrigger.INTERACT, actions);
}, "events", "interact");
this.registerEventParser(object -> {
Section section = (Section) object;
Action<Player>[] actions = plugin.getActionManager().parseActions(section);
return builder -> builder.action(ActionTrigger.REEL, actions);
}, "events", "reel");
this.registerEventParser(object -> {
Section section = (Section) object;
Action<Player>[] actions = plugin.getActionManager().parseActions(section);

View File

@@ -37,6 +37,7 @@ import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;
public class BukkitEventManager implements EventManager, Listener {
@@ -84,7 +85,13 @@ public class BukkitEventManager implements EventManager, Listener {
Context<Player> context = Context.player(event.getPlayer());
Block clicked = event.getClickedBlock();
context.arg(ContextKeys.OTHER_LOCATION, clicked == null ? event.getPlayer().getLocation() : clicked.getLocation());
trigger(context, id, MechanicType.UTIL, ActionTrigger.INTERACT);
List<MechanicType> mechanics = MechanicType.getTypeByID(id);
if (mechanics != null) {
for (MechanicType type : mechanics) {
if (type == MechanicType.ROD) continue;
trigger(context, id, type, ActionTrigger.INTERACT);
}
}
}
@EventHandler (ignoreCancelled = true)

View File

@@ -184,6 +184,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
this.registerPluginLevelRequirement();
this.registerItemInHandRequirement();
this.registerImpossibleRequirement();
this.registerPotionEffectRequirement();
}
private void registerImpossibleRequirement() {

View File

@@ -417,7 +417,6 @@ other-settings:
'{date}': '%server_time_yyyy-MM-dd-HH:mm:ss%'
# Requires player expansion
'{yaw}': '%player_yaw%'
'{random}': '%customfishing_random%'
# CustomFishing supports using items/blocks from other plugins
# If items share the same id, they would inherit the effects
# Check the wiki for examples