mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-21 07:59:16 +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.action.Action;
|
||||||
import net.momirealms.customcrops.api.context.Context;
|
import net.momirealms.customcrops.api.context.Context;
|
||||||
import net.momirealms.customcrops.api.misc.value.MathValue;
|
import net.momirealms.customcrops.api.misc.value.MathValue;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public abstract class AbstractBuiltInAction<T> implements Action<T> {
|
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> {
|
public class ActionSpawnEntity<T> extends AbstractBuiltInAction<T> {
|
||||||
|
|
||||||
private final String id;
|
private final String id;
|
||||||
|
private MathValue<T> x;
|
||||||
|
private MathValue<T> y;
|
||||||
|
private MathValue<T> z;
|
||||||
private final Map<String, Object> properties;
|
private final Map<String, Object> properties;
|
||||||
|
|
||||||
public ActionSpawnEntity(
|
public ActionSpawnEntity(
|
||||||
@@ -42,6 +45,9 @@ public class ActionSpawnEntity<T> extends AbstractBuiltInAction<T> {
|
|||||||
) {
|
) {
|
||||||
super(plugin, chance);
|
super(plugin, chance);
|
||||||
this.id = section.getString("id");
|
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");
|
Section proeprtySection = section.getSection("properties");
|
||||||
this.properties = proeprtySection == null ? new HashMap<>() : proeprtySection.getStringRouteMappedValues(false);
|
this.properties = proeprtySection == null ? new HashMap<>() : proeprtySection.getStringRouteMappedValues(false);
|
||||||
}
|
}
|
||||||
@@ -49,6 +55,7 @@ public class ActionSpawnEntity<T> extends AbstractBuiltInAction<T> {
|
|||||||
@Override
|
@Override
|
||||||
protected void triggerAction(Context<T> context) {
|
protected void triggerAction(Context<T> context) {
|
||||||
Location location = requireNonNull(context.arg(ContextKeys.LOCATION));
|
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;
|
String finalID;
|
||||||
EntityProvider provider;
|
EntityProvider provider;
|
||||||
if (id.contains(":")) {
|
if (id.contains(":")) {
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ package net.momirealms.customcrops.api.core.world;
|
|||||||
import com.flowpowered.nbt.CompoundMap;
|
import com.flowpowered.nbt.CompoundMap;
|
||||||
import com.flowpowered.nbt.CompoundTag;
|
import com.flowpowered.nbt.CompoundTag;
|
||||||
import com.flowpowered.nbt.Tag;
|
import com.flowpowered.nbt.Tag;
|
||||||
import com.flowpowered.nbt.stream.NBTInputStream;
|
|
||||||
import net.momirealms.customcrops.api.core.SynchronizedCompoundMap;
|
import net.momirealms.customcrops.api.core.SynchronizedCompoundMap;
|
||||||
import net.momirealms.customcrops.api.core.block.CustomCropsBlock;
|
import net.momirealms.customcrops.api.core.block.CustomCropsBlock;
|
||||||
import net.momirealms.customcrops.api.util.TagUtils;
|
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.OraxenFurnitureBreakEvent;
|
||||||
import io.th0rgal.oraxen.api.events.furniture.OraxenFurnitureInteractEvent;
|
import io.th0rgal.oraxen.api.events.furniture.OraxenFurnitureInteractEvent;
|
||||||
import io.th0rgal.oraxen.api.events.furniture.OraxenFurniturePlaceEvent;
|
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.AbstractCustomEventListener;
|
||||||
import net.momirealms.customcrops.api.core.AbstractItemManager;
|
import net.momirealms.customcrops.api.core.AbstractItemManager;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Project settings
|
# Project settings
|
||||||
# Rule: [major update].[feature update].[bug fix]
|
# Rule: [major update].[feature update].[bug fix]
|
||||||
project_version=3.6.27.1
|
project_version=3.6.28
|
||||||
config_version=42
|
config_version=42
|
||||||
project_group=net.momirealms
|
project_group=net.momirealms
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ public class PlayerRequirementManager extends AbstractRequirementManager<Player>
|
|||||||
this.registerPotionEffectRequirement();
|
this.registerPotionEffectRequirement();
|
||||||
this.registerSneakRequirement();
|
this.registerSneakRequirement();
|
||||||
this.registerGameModeRequirement();
|
this.registerGameModeRequirement();
|
||||||
|
this.registerHandRequirement();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -345,4 +346,21 @@ public class PlayerRequirementManager extends AbstractRequirementManager<Player>
|
|||||||
};
|
};
|
||||||
}, "gamemode");
|
}, "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