mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-23 17:09:21 +00:00
3.3.1.2
This commit is contained in:
@@ -19,7 +19,7 @@ package net.momirealms.customcrops.api;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class CustomCropsPlugin extends JavaPlugin {
|
||||
public abstract class CustomCropsPlugin extends JavaPlugin {
|
||||
|
||||
protected CustomCropsAPI customCropsAPI;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ plugins {
|
||||
allprojects {
|
||||
|
||||
project.group = "net.momirealms"
|
||||
project.version = "3.3.1.1-hotfix2"
|
||||
project.version = "3.3.1.2"
|
||||
|
||||
apply<JavaPlugin>()
|
||||
apply(plugin = "java")
|
||||
|
||||
@@ -6,9 +6,9 @@ dependencies {
|
||||
compileOnly("commons-io:commons-io:2.11.0")
|
||||
compileOnly("com.google.code.gson:gson:2.10.1")
|
||||
compileOnly("com.github.LoneDev6:api-itemsadder:3.4.1e")
|
||||
compileOnly("com.github.oraxen:oraxen:1.157.2")
|
||||
compileOnly("com.github.oraxen:oraxen:1.158.0")
|
||||
compileOnly("io.lumine:Mythic-Dist:5.2.1")
|
||||
compileOnly("io.lumine:MythicLib-dist:1.5.2-SNAPSHOT")
|
||||
compileOnly("io.lumine:MythicLib-dist:1.6-SNAPSHOT")
|
||||
compileOnly("com.willfp:eco:6.65.1")
|
||||
compileOnly("com.willfp:EcoJobs:3.13.0")
|
||||
compileOnly("net.objecthunter:exp4j:0.4.8")
|
||||
@@ -21,6 +21,7 @@ dependencies {
|
||||
compileOnly("com.github.MilkBowl:VaultAPI:1.7")
|
||||
compileOnly("com.comphenix.protocol:ProtocolLib:5.0.0")
|
||||
compileOnly("pl.betoncraft:betonquest:1.12.10")
|
||||
compileOnly("net.Indyuce:MMOCore-API:1.12-SNAPSHOT")
|
||||
|
||||
implementation(project(":api"))
|
||||
implementation("net.kyori:adventure-api:4.14.0")
|
||||
|
||||
Binary file not shown.
@@ -21,6 +21,7 @@ import net.kyori.adventure.sound.Sound;
|
||||
import net.momirealms.customcrops.api.object.ItemMode;
|
||||
import net.momirealms.customcrops.api.object.fill.PassiveFillMethod;
|
||||
import net.momirealms.customcrops.api.object.hologram.WaterAmountHologram;
|
||||
import net.momirealms.customcrops.api.object.requirement.Requirement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -37,10 +38,24 @@ public class SprinklerConfig {
|
||||
private final PassiveFillMethod[] passiveFillMethods;
|
||||
private final WaterAmountHologram waterAmountHologram;
|
||||
private final SprinklerAnimation sprinklerAnimation;
|
||||
private final Requirement[] requirements;
|
||||
private final int water;
|
||||
|
||||
public SprinklerConfig(String key, int storage, int range, int water, @Nullable String[] potWhitelist, @Nullable Sound sound, @NotNull ItemMode itemMode, @NotNull String threeD, @Nullable String twoD,
|
||||
@NotNull PassiveFillMethod[] passiveFillMethods, @Nullable WaterAmountHologram waterAmountHologram, SprinklerAnimation sprinklerAnimation) {
|
||||
public SprinklerConfig(
|
||||
String key,
|
||||
int storage,
|
||||
int range,
|
||||
int water,
|
||||
@Nullable String[] potWhitelist,
|
||||
@Nullable Sound sound,
|
||||
@NotNull ItemMode itemMode,
|
||||
@NotNull String threeD,
|
||||
@Nullable String twoD,
|
||||
@NotNull PassiveFillMethod[] passiveFillMethods,
|
||||
@Nullable WaterAmountHologram waterAmountHologram,
|
||||
SprinklerAnimation sprinklerAnimation,
|
||||
@Nullable Requirement[] requirements
|
||||
) {
|
||||
this.key = key;
|
||||
this.storage = storage;
|
||||
this.range = range;
|
||||
@@ -53,6 +68,7 @@ public class SprinklerConfig {
|
||||
this.passiveFillMethods = passiveFillMethods;
|
||||
this.sprinklerAnimation = sprinklerAnimation;
|
||||
this.waterAmountHologram = waterAmountHologram;
|
||||
this.requirements = requirements;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
@@ -110,4 +126,9 @@ public class SprinklerConfig {
|
||||
public int getWaterFillAbility() {
|
||||
return water;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Requirement[] getRequirements() {
|
||||
return requirements;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +129,8 @@ public class SprinklerManager extends Function implements Listener {
|
||||
sprinklerSec.getString("animation.item"),
|
||||
sprinklerSec.getDouble("animation.vertical-offset"),
|
||||
ItemMode.valueOf(sprinklerSec.getString("animation.type", "ARMOR_STAND").toUpperCase(Locale.ENGLISH))
|
||||
) : null
|
||||
) : null,
|
||||
ConfigUtils.getRequirementsWithMsg(sprinklerSec.getConfigurationSection("requirements"))
|
||||
);
|
||||
this.itemToKey.put(threeD, key);
|
||||
if (twoD != null) this.itemToKey.put(twoD, key);
|
||||
|
||||
@@ -21,7 +21,10 @@ import net.kyori.adventure.sound.Sound;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
import net.momirealms.customcrops.api.object.fill.PositiveFillMethod;
|
||||
import net.momirealms.customcrops.api.object.requirement.CurrentState;
|
||||
import net.momirealms.customcrops.api.object.requirement.Requirement;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -48,6 +51,7 @@ public class WateringCanConfig {
|
||||
private final String bar_right;
|
||||
private final PositiveFillMethod[] positiveFillMethods;
|
||||
private final HashMap<Integer, Integer> appearanceMap;
|
||||
private final Requirement[] requirements;
|
||||
|
||||
public WateringCanConfig(
|
||||
int width,
|
||||
@@ -66,7 +70,8 @@ public class WateringCanConfig {
|
||||
@Nullable Sound sound,
|
||||
@Nullable Particle particle,
|
||||
@NotNull PositiveFillMethod[] positiveFillMethods,
|
||||
@NotNull HashMap<Integer, Integer> appearanceMap
|
||||
@NotNull HashMap<Integer, Integer> appearanceMap,
|
||||
@Nullable Requirement[] requirements
|
||||
) {
|
||||
this.width = width;
|
||||
this.length = length;
|
||||
@@ -85,6 +90,7 @@ public class WateringCanConfig {
|
||||
this.particle = particle;
|
||||
this.positiveFillMethods = positiveFillMethods;
|
||||
this.appearanceMap = appearanceMap;
|
||||
this.requirements = requirements;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
@@ -158,4 +164,8 @@ public class WateringCanConfig {
|
||||
public int getModelDataByWater(int water) {
|
||||
return Optional.ofNullable(appearanceMap.get(water)).orElse(0);
|
||||
}
|
||||
|
||||
public Requirement[] getRequirements() {
|
||||
return requirements;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,8 @@ public class WateringCanManager extends Function {
|
||||
sound,
|
||||
canSec.contains("particle") ? Particle.valueOf(canSec.getString("particle", "WATER_SPLASH").toUpperCase(Locale.ENGLISH)) : null,
|
||||
methods,
|
||||
appearanceMap
|
||||
appearanceMap,
|
||||
ConfigUtils.getRequirementsWithMsg(canSec.getConfigurationSection("requirements"))
|
||||
);
|
||||
wateringCanConfigMap.put(canSec.getString("item"), wateringCanConfig);
|
||||
}
|
||||
|
||||
@@ -416,7 +416,6 @@ public class PlatformManager extends Function {
|
||||
PassiveFillMethod[] passiveFillMethods = sprinklerConfig.getPassiveFillMethods();
|
||||
for (PassiveFillMethod passiveFillMethod : passiveFillMethods) {
|
||||
if (passiveFillMethod.isRightItem(item_in_hand_id)) {
|
||||
|
||||
SprinklerFillEvent sprinklerFillEvent = new SprinklerFillEvent(player, sprinklerConfig.getKey(), item_in_hand, passiveFillMethod.getAmount(), location);
|
||||
Bukkit.getPluginManager().callEvent(sprinklerFillEvent);
|
||||
if (sprinklerFillEvent.isCancelled()) {
|
||||
@@ -432,6 +431,16 @@ public class PlatformManager extends Function {
|
||||
|
||||
WateringCanConfig wateringCanConfig = plugin.getWateringCanManager().getConfigByItemID(item_in_hand_id);
|
||||
if (wateringCanConfig != null) {
|
||||
|
||||
if (wateringCanConfig.getRequirements() != null) {
|
||||
CurrentState currentState = new CurrentState(location, player);
|
||||
for (Requirement requirement : wateringCanConfig.getRequirements()) {
|
||||
if (!requirement.isConditionMet(currentState)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String[] sprinkler_whitelist = wateringCanConfig.getSprinklerWhitelist();
|
||||
if (sprinkler_whitelist != null) {
|
||||
inner: {
|
||||
@@ -511,6 +520,15 @@ public class PlatformManager extends Function {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sprinklerConfig.getRequirements() != null) {
|
||||
CurrentState currentState = new CurrentState(location, player);
|
||||
for (Requirement requirement : sprinklerConfig.getRequirements()) {
|
||||
if (!requirement.isConditionMet(currentState)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (blockFace != BlockFace.UP || REPLACEABLE.contains(location.getBlock().getType())) {
|
||||
return true;
|
||||
}
|
||||
@@ -604,6 +622,16 @@ public class PlatformManager extends Function {
|
||||
|
||||
WateringCanConfig wateringCanConfig = plugin.getWateringCanManager().getConfigByItemID(item_in_hand_id);
|
||||
if (wateringCanConfig != null) {
|
||||
|
||||
if (wateringCanConfig.getRequirements() != null) {
|
||||
CurrentState currentState = new CurrentState(location, player);
|
||||
for (Requirement requirement : wateringCanConfig.getRequirements()) {
|
||||
if (!requirement.isConditionMet(currentState)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String[] pot_whitelist = wateringCanConfig.getPotWhitelist();
|
||||
if (pot_whitelist != null) {
|
||||
inner: {
|
||||
@@ -1083,11 +1111,6 @@ public class PlatformManager extends Function {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (location != null) {
|
||||
if (!ProtectionLib.canPlace(player, location)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
int current = plugin.getWateringCanManager().getCurrentWater(item_in_hand);
|
||||
if (current >= wateringCanConfig.getStorage()) return true;
|
||||
@@ -1096,6 +1119,19 @@ public class PlatformManager extends Function {
|
||||
|
||||
outer: {
|
||||
if (id != null && location != null) {
|
||||
if (!ProtectionLib.canPlace(player, location)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (wateringCanConfig.getRequirements() != null) {
|
||||
CurrentState currentState = new CurrentState(location, player);
|
||||
for (Requirement requirement : wateringCanConfig.getRequirements()) {
|
||||
if (!requirement.isConditionMet(currentState)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (PositiveFillMethod positiveFillMethod : wateringCanConfig.getPositiveFillMethods()) {
|
||||
if (positiveFillMethod.getId().equals(id)) {
|
||||
add = positiveFillMethod.getAmount();
|
||||
@@ -1117,14 +1153,26 @@ public class PlatformManager extends Function {
|
||||
int index = 0;
|
||||
for (String blockId : blockIds) {
|
||||
if (positiveFillMethod.getId().equals(blockId)) {
|
||||
|
||||
Block block = lineOfSight.get(index);
|
||||
if (!ProtectionLib.canPlace(player, block.getLocation()))
|
||||
return true;
|
||||
if (wateringCanConfig.getRequirements() != null) {
|
||||
CurrentState currentState = new CurrentState(block.getLocation(), player);
|
||||
for (Requirement requirement : wateringCanConfig.getRequirements()) {
|
||||
if (!requirement.isConditionMet(currentState)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
add = positiveFillMethod.getAmount();
|
||||
if (positiveFillMethod.getSound() != null) {
|
||||
|
||||
if (positiveFillMethod.getSound() != null)
|
||||
AdventureUtils.playerSound(player, positiveFillMethod.getSound());
|
||||
}
|
||||
if (positiveFillMethod.getParticle() != null) {
|
||||
Block block = lineOfSight.get(index);
|
||||
|
||||
if (positiveFillMethod.getParticle() != null)
|
||||
block.getWorld().spawnParticle(positiveFillMethod.getParticle(), block.getLocation().add(0.5,1.1, 0.5),5,0.1,0.1,0.1);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
index++;
|
||||
|
||||
@@ -17,7 +17,13 @@
|
||||
|
||||
package net.momirealms.customcrops.customplugin.oraxen;
|
||||
|
||||
import io.th0rgal.oraxen.api.events.*;
|
||||
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.api.events.noteblock.OraxenNoteBlockBreakEvent;
|
||||
import io.th0rgal.oraxen.api.events.noteblock.OraxenNoteBlockPlaceEvent;
|
||||
import io.th0rgal.oraxen.api.events.stringblock.OraxenStringBlockBreakEvent;
|
||||
import io.th0rgal.oraxen.api.events.stringblock.OraxenStringBlockPlaceEvent;
|
||||
import io.th0rgal.oraxen.mechanics.provided.gameplay.furniture.FurnitureMechanic;
|
||||
import io.th0rgal.oraxen.mechanics.provided.gameplay.noteblock.NoteBlockMechanic;
|
||||
import io.th0rgal.oraxen.mechanics.provided.gameplay.stringblock.StringBlockMechanic;
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
package net.momirealms.customcrops.integration.skill;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.MMOCoreAPI;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.experience.EXPSource;
|
||||
import net.Indyuce.mmocore.experience.Profession;
|
||||
import net.Indyuce.mmocore.manager.data.PlayerDataManager;
|
||||
@@ -27,22 +29,20 @@ import org.bukkit.entity.Player;
|
||||
public class MMOCoreImpl implements SkillInterface {
|
||||
|
||||
private final Profession profession;
|
||||
private final PlayerDataManager playerDataManager;
|
||||
|
||||
public MMOCoreImpl(String name) {
|
||||
profession = MMOCore.plugin.professionManager.get(name);
|
||||
playerDataManager = MMOCore.plugin.dataProvider.getDataManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addXp(Player player, double amount) {
|
||||
if (profession != null) {
|
||||
profession.giveExperience(playerDataManager.get(player), amount, null ,EXPSource.OTHER);
|
||||
profession.giveExperience(PlayerData.get(player.getUniqueId()), amount, null ,EXPSource.OTHER);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLevel(Player player) {
|
||||
return playerDataManager.get(player).getLevel();
|
||||
return PlayerData.get(player.getUniqueId()).getCollectionSkills().getLevel(profession);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user