mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-19 15:09:25 +00:00
3.6.28
This commit is contained in:
@@ -21,7 +21,6 @@ import net.momirealms.customcrops.api.BukkitCustomCropsPlugin;
|
||||
import net.momirealms.customcrops.api.action.Action;
|
||||
import net.momirealms.customcrops.api.context.Context;
|
||||
import net.momirealms.customcrops.api.misc.value.MathValue;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public abstract class AbstractBuiltInAction<T> implements Action<T> {
|
||||
|
||||
|
||||
@@ -33,6 +33,9 @@ import static java.util.Objects.requireNonNull;
|
||||
public class ActionSpawnEntity<T> extends AbstractBuiltInAction<T> {
|
||||
|
||||
private final String id;
|
||||
private MathValue<T> x;
|
||||
private MathValue<T> y;
|
||||
private MathValue<T> z;
|
||||
private final Map<String, Object> properties;
|
||||
|
||||
public ActionSpawnEntity(
|
||||
@@ -42,6 +45,9 @@ public class ActionSpawnEntity<T> extends AbstractBuiltInAction<T> {
|
||||
) {
|
||||
super(plugin, chance);
|
||||
this.id = section.getString("id");
|
||||
this.x = MathValue.auto(section.get("x", 0));
|
||||
this.y = MathValue.auto(section.get("y", 0));
|
||||
this.z = MathValue.auto(section.get("z", 0));
|
||||
Section proeprtySection = section.getSection("properties");
|
||||
this.properties = proeprtySection == null ? new HashMap<>() : proeprtySection.getStringRouteMappedValues(false);
|
||||
}
|
||||
@@ -49,6 +55,7 @@ public class ActionSpawnEntity<T> extends AbstractBuiltInAction<T> {
|
||||
@Override
|
||||
protected void triggerAction(Context<T> context) {
|
||||
Location location = requireNonNull(context.arg(ContextKeys.LOCATION));
|
||||
location = location.clone().add(this.x.evaluate(context), this.y.evaluate(context), this.z.evaluate(context));
|
||||
String finalID;
|
||||
EntityProvider provider;
|
||||
if (id.contains(":")) {
|
||||
|
||||
@@ -20,7 +20,6 @@ package net.momirealms.customcrops.api.core.world;
|
||||
import com.flowpowered.nbt.CompoundMap;
|
||||
import com.flowpowered.nbt.CompoundTag;
|
||||
import com.flowpowered.nbt.Tag;
|
||||
import com.flowpowered.nbt.stream.NBTInputStream;
|
||||
import net.momirealms.customcrops.api.core.SynchronizedCompoundMap;
|
||||
import net.momirealms.customcrops.api.core.block.CustomCropsBlock;
|
||||
import net.momirealms.customcrops.api.util.TagUtils;
|
||||
|
||||
@@ -26,7 +26,6 @@ import io.th0rgal.oraxen.api.events.custom_block.stringblock.OraxenStringBlockPl
|
||||
import io.th0rgal.oraxen.api.events.furniture.OraxenFurnitureBreakEvent;
|
||||
import io.th0rgal.oraxen.api.events.furniture.OraxenFurnitureInteractEvent;
|
||||
import io.th0rgal.oraxen.api.events.furniture.OraxenFurniturePlaceEvent;
|
||||
import io.th0rgal.oraxen.font.Glyph;
|
||||
import net.momirealms.customcrops.api.core.AbstractCustomEventListener;
|
||||
import net.momirealms.customcrops.api.core.AbstractItemManager;
|
||||
import org.bukkit.Material;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Project settings
|
||||
# Rule: [major update].[feature update].[bug fix]
|
||||
project_version=3.6.27.1
|
||||
project_version=3.6.28
|
||||
config_version=42
|
||||
project_group=net.momirealms
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ public class PlayerRequirementManager extends AbstractRequirementManager<Player>
|
||||
this.registerPotionEffectRequirement();
|
||||
this.registerSneakRequirement();
|
||||
this.registerGameModeRequirement();
|
||||
this.registerHandRequirement();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -345,4 +346,21 @@ public class PlayerRequirementManager extends AbstractRequirementManager<Player>
|
||||
};
|
||||
}, "gamemode");
|
||||
}
|
||||
|
||||
private void registerHandRequirement() {
|
||||
registerRequirement((args, actions, advanced) -> {
|
||||
String hand = ((String) args).toLowerCase(Locale.ENGLISH);
|
||||
return context -> {
|
||||
if (context.holder() == null) return true;
|
||||
EquipmentSlot slot = context.arg(ContextKeys.SLOT);
|
||||
if (slot != null) {
|
||||
if (slot.name().toLowerCase(Locale.ENGLISH).equals(hand)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (advanced) ActionManager.trigger(context, actions);
|
||||
return false;
|
||||
};
|
||||
}, "hand");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user