From 856efc01b74cbda273e2c54b3a1558dd7b8f892b Mon Sep 17 00:00:00 2001 From: XiaoMoMi <972454774@qq.com> Date: Mon, 29 Apr 2024 14:37:39 +0800 Subject: [PATCH] [Small tweaks] Moved packages --- .../customcrops/api/manager/ItemManager.java | 65 +++++++++++-------- .../{ => custom}/AbstractCustomListener.java | 3 +- .../item/{ => custom}/CustomProvider.java | 2 +- .../oraxenlegacy/LegacyOraxenListener.java | 2 +- .../oraxenlegacy/LegacyOraxenProvider.java | 2 +- .../mechanic/item/ItemManagerImpl.java | 3 +- .../custom/crucible/CrucibleListener.java | 2 +- .../custom/crucible/CrucibleProvider.java | 2 +- .../custom/itemsadder/ItemsAdderListener.java | 2 +- .../custom/itemsadder/ItemsAdderProvider.java | 2 +- .../item/custom/oraxen/OraxenListener.java | 2 +- .../item/custom/oraxen/OraxenProvider.java | 2 +- settings.gradle | 2 +- 13 files changed, 53 insertions(+), 38 deletions(-) rename api/src/main/java/net/momirealms/customcrops/api/mechanic/item/{ => custom}/AbstractCustomListener.java (99%) rename api/src/main/java/net/momirealms/customcrops/api/mechanic/item/{ => custom}/CustomProvider.java (98%) diff --git a/api/src/main/java/net/momirealms/customcrops/api/manager/ItemManager.java b/api/src/main/java/net/momirealms/customcrops/api/manager/ItemManager.java index 9ba33b6..4056afe 100644 --- a/api/src/main/java/net/momirealms/customcrops/api/manager/ItemManager.java +++ b/api/src/main/java/net/momirealms/customcrops/api/manager/ItemManager.java @@ -328,6 +328,29 @@ public interface ItemManager extends Reloadable { @Nullable Crop.Stage getCropStageByStageID(String id); + /** + * Update a pot's block state + * + * @param location location + * @param pot pot config + * @param hasWater has water or not + * @param fertilizer fertilizer + */ + void updatePotState(Location location, Pot pot, boolean hasWater, Fertilizer fertilizer); + + /** + * Get the pots that can be watered with a watering can + * + * @param baseLocation the clicked pot's location + * @param width width of the working range + * @param length length of the working range + * @param yaw player's yaw + * @param potID pot's ID + * @return the pots that can be watered + */ + @NotNull + Collection getPotInRange(Location baseLocation, int width, int length, float yaw, String potID); + void handlePlayerInteractBlock( Player player, Block clickedBlock, @@ -369,32 +392,22 @@ public interface ItemManager extends Reloadable { Cancellable event ); - void handlePlayerPlaceBlock(Player player, Block block, String blockID, Cancellable event); + void handlePlayerPlaceBlock( + Player player, + Block block, + String blockID, + Cancellable event + ); - void handleEntityTramplingBlock(Entity entity, Block block, Cancellable event); + void handleEntityTramplingBlock( + Entity entity, + Block block, + Cancellable event + ); - void handleExplosion(Entity entity, List blocks, Cancellable event); - - /** - * Update a pot's block state - * - * @param location location - * @param pot pot config - * @param hasWater has water or not - * @param fertilizer fertilizer - */ - void updatePotState(Location location, Pot pot, boolean hasWater, Fertilizer fertilizer); - - /** - * Get the pots that can be watered with a watering can - * - * @param baseLocation the clicked pot's location - * @param width width of the working range - * @param length length of the working range - * @param yaw player's yaw - * @param potID pot's ID - * @return the pots that can be watered - */ - @NotNull - Collection getPotInRange(Location baseLocation, int width, int length, float yaw, String potID); + void handleExplosion( + Entity entity, + List blocks, + Cancellable event + ); } diff --git a/api/src/main/java/net/momirealms/customcrops/api/mechanic/item/AbstractCustomListener.java b/api/src/main/java/net/momirealms/customcrops/api/mechanic/item/custom/AbstractCustomListener.java similarity index 99% rename from api/src/main/java/net/momirealms/customcrops/api/mechanic/item/AbstractCustomListener.java rename to api/src/main/java/net/momirealms/customcrops/api/mechanic/item/custom/AbstractCustomListener.java index f748704..fdb531b 100644 --- a/api/src/main/java/net/momirealms/customcrops/api/mechanic/item/AbstractCustomListener.java +++ b/api/src/main/java/net/momirealms/customcrops/api/mechanic/item/custom/AbstractCustomListener.java @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -package net.momirealms.customcrops.api.mechanic.item; +package net.momirealms.customcrops.api.mechanic.item.custom; import net.momirealms.customcrops.api.CustomCropsPlugin; import net.momirealms.customcrops.api.event.BoneMealDispenseEvent; @@ -23,6 +23,7 @@ import net.momirealms.customcrops.api.manager.ConfigManager; import net.momirealms.customcrops.api.manager.ItemManager; import net.momirealms.customcrops.api.manager.VersionManager; import net.momirealms.customcrops.api.manager.WorldManager; +import net.momirealms.customcrops.api.mechanic.item.*; import net.momirealms.customcrops.api.mechanic.requirement.State; import net.momirealms.customcrops.api.mechanic.world.SimpleLocation; import net.momirealms.customcrops.api.mechanic.world.level.WorldCrop; diff --git a/api/src/main/java/net/momirealms/customcrops/api/mechanic/item/CustomProvider.java b/api/src/main/java/net/momirealms/customcrops/api/mechanic/item/custom/CustomProvider.java similarity index 98% rename from api/src/main/java/net/momirealms/customcrops/api/mechanic/item/CustomProvider.java rename to api/src/main/java/net/momirealms/customcrops/api/mechanic/item/custom/CustomProvider.java index 20f99b2..95f258b 100644 --- a/api/src/main/java/net/momirealms/customcrops/api/mechanic/item/CustomProvider.java +++ b/api/src/main/java/net/momirealms/customcrops/api/mechanic/item/custom/CustomProvider.java @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -package net.momirealms.customcrops.api.mechanic.item; +package net.momirealms.customcrops.api.mechanic.item.custom; import net.momirealms.customcrops.api.manager.VersionManager; import net.momirealms.customcrops.api.mechanic.misc.CRotation; diff --git a/oraxen-legacy/src/main/java/net/momirealms/customcrops/mechanic/item/custom/oraxenlegacy/LegacyOraxenListener.java b/oraxen-legacy/src/main/java/net/momirealms/customcrops/mechanic/item/custom/oraxenlegacy/LegacyOraxenListener.java index 58a0270..f9343a4 100644 --- a/oraxen-legacy/src/main/java/net/momirealms/customcrops/mechanic/item/custom/oraxenlegacy/LegacyOraxenListener.java +++ b/oraxen-legacy/src/main/java/net/momirealms/customcrops/mechanic/item/custom/oraxenlegacy/LegacyOraxenListener.java @@ -25,7 +25,7 @@ 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 net.momirealms.customcrops.api.manager.ItemManager; -import net.momirealms.customcrops.api.mechanic.item.AbstractCustomListener; +import net.momirealms.customcrops.api.mechanic.item.custom.AbstractCustomListener; import net.momirealms.customcrops.api.util.LocationUtils; import org.bukkit.event.EventHandler; diff --git a/oraxen-legacy/src/main/java/net/momirealms/customcrops/mechanic/item/custom/oraxenlegacy/LegacyOraxenProvider.java b/oraxen-legacy/src/main/java/net/momirealms/customcrops/mechanic/item/custom/oraxenlegacy/LegacyOraxenProvider.java index 8d3be1a..b66c20d 100644 --- a/oraxen-legacy/src/main/java/net/momirealms/customcrops/mechanic/item/custom/oraxenlegacy/LegacyOraxenProvider.java +++ b/oraxen-legacy/src/main/java/net/momirealms/customcrops/mechanic/item/custom/oraxenlegacy/LegacyOraxenProvider.java @@ -23,7 +23,7 @@ import io.th0rgal.oraxen.api.OraxenItems; import io.th0rgal.oraxen.items.ItemBuilder; import io.th0rgal.oraxen.mechanics.Mechanic; import io.th0rgal.oraxen.mechanics.provided.gameplay.furniture.FurnitureMechanic; -import net.momirealms.customcrops.api.mechanic.item.CustomProvider; +import net.momirealms.customcrops.api.mechanic.item.custom.CustomProvider; import net.momirealms.customcrops.api.util.LogUtils; import org.bukkit.Location; import org.bukkit.Material; diff --git a/plugin/src/main/java/net/momirealms/customcrops/mechanic/item/ItemManagerImpl.java b/plugin/src/main/java/net/momirealms/customcrops/mechanic/item/ItemManagerImpl.java index 0b47bb8..e6b72de 100644 --- a/plugin/src/main/java/net/momirealms/customcrops/mechanic/item/ItemManagerImpl.java +++ b/plugin/src/main/java/net/momirealms/customcrops/mechanic/item/ItemManagerImpl.java @@ -29,6 +29,7 @@ import net.momirealms.customcrops.api.mechanic.action.ActionTrigger; import net.momirealms.customcrops.api.mechanic.condition.Conditions; import net.momirealms.customcrops.api.mechanic.condition.DeathConditions; import net.momirealms.customcrops.api.mechanic.item.*; +import net.momirealms.customcrops.api.mechanic.item.custom.CustomProvider; import net.momirealms.customcrops.api.mechanic.item.water.PassiveFillMethod; import net.momirealms.customcrops.api.mechanic.item.water.PositiveFillMethod; import net.momirealms.customcrops.api.mechanic.misc.CRotation; @@ -40,7 +41,7 @@ import net.momirealms.customcrops.api.mechanic.world.SimpleLocation; import net.momirealms.customcrops.api.mechanic.world.level.*; import net.momirealms.customcrops.api.util.LocationUtils; import net.momirealms.customcrops.api.util.LogUtils; -import net.momirealms.customcrops.api.mechanic.item.AbstractCustomListener; +import net.momirealms.customcrops.api.mechanic.item.custom.AbstractCustomListener; import net.momirealms.customcrops.mechanic.item.custom.crucible.CrucibleListener; import net.momirealms.customcrops.mechanic.item.custom.crucible.CrucibleProvider; import net.momirealms.customcrops.mechanic.item.custom.itemsadder.ItemsAdderListener; diff --git a/plugin/src/main/java/net/momirealms/customcrops/mechanic/item/custom/crucible/CrucibleListener.java b/plugin/src/main/java/net/momirealms/customcrops/mechanic/item/custom/crucible/CrucibleListener.java index bba6daa..9ffe1c4 100644 --- a/plugin/src/main/java/net/momirealms/customcrops/mechanic/item/custom/crucible/CrucibleListener.java +++ b/plugin/src/main/java/net/momirealms/customcrops/mechanic/item/custom/crucible/CrucibleListener.java @@ -19,7 +19,7 @@ package net.momirealms.customcrops.mechanic.item.custom.crucible; import io.lumine.mythiccrucible.events.MythicFurniturePlaceEvent; import net.momirealms.customcrops.mechanic.item.ItemManagerImpl; -import net.momirealms.customcrops.api.mechanic.item.AbstractCustomListener; +import net.momirealms.customcrops.api.mechanic.item.custom.AbstractCustomListener; import org.bukkit.event.EventHandler; public class CrucibleListener extends AbstractCustomListener { diff --git a/plugin/src/main/java/net/momirealms/customcrops/mechanic/item/custom/crucible/CrucibleProvider.java b/plugin/src/main/java/net/momirealms/customcrops/mechanic/item/custom/crucible/CrucibleProvider.java index 523b012..b2af7f8 100644 --- a/plugin/src/main/java/net/momirealms/customcrops/mechanic/item/custom/crucible/CrucibleProvider.java +++ b/plugin/src/main/java/net/momirealms/customcrops/mechanic/item/custom/crucible/CrucibleProvider.java @@ -27,7 +27,7 @@ import io.lumine.mythiccrucible.items.blocks.CustomBlockManager; import io.lumine.mythiccrucible.items.furniture.Furniture; import io.lumine.mythiccrucible.items.furniture.FurnitureManager; import net.momirealms.customcrops.api.util.LogUtils; -import net.momirealms.customcrops.api.mechanic.item.CustomProvider; +import net.momirealms.customcrops.api.mechanic.item.custom.CustomProvider; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; diff --git a/plugin/src/main/java/net/momirealms/customcrops/mechanic/item/custom/itemsadder/ItemsAdderListener.java b/plugin/src/main/java/net/momirealms/customcrops/mechanic/item/custom/itemsadder/ItemsAdderListener.java index 6963149..6d45093 100644 --- a/plugin/src/main/java/net/momirealms/customcrops/mechanic/item/custom/itemsadder/ItemsAdderListener.java +++ b/plugin/src/main/java/net/momirealms/customcrops/mechanic/item/custom/itemsadder/ItemsAdderListener.java @@ -20,7 +20,7 @@ package net.momirealms.customcrops.mechanic.item.custom.itemsadder; import dev.lone.itemsadder.api.CustomFurniture; import dev.lone.itemsadder.api.Events.*; import net.momirealms.customcrops.mechanic.item.ItemManagerImpl; -import net.momirealms.customcrops.api.mechanic.item.AbstractCustomListener; +import net.momirealms.customcrops.api.mechanic.item.custom.AbstractCustomListener; import org.bukkit.entity.Entity; import org.bukkit.event.EventHandler; diff --git a/plugin/src/main/java/net/momirealms/customcrops/mechanic/item/custom/itemsadder/ItemsAdderProvider.java b/plugin/src/main/java/net/momirealms/customcrops/mechanic/item/custom/itemsadder/ItemsAdderProvider.java index 96cfdd0..4e558c6 100644 --- a/plugin/src/main/java/net/momirealms/customcrops/mechanic/item/custom/itemsadder/ItemsAdderProvider.java +++ b/plugin/src/main/java/net/momirealms/customcrops/mechanic/item/custom/itemsadder/ItemsAdderProvider.java @@ -21,7 +21,7 @@ import dev.lone.itemsadder.api.CustomBlock; import dev.lone.itemsadder.api.CustomFurniture; import dev.lone.itemsadder.api.CustomStack; import net.momirealms.customcrops.api.util.LogUtils; -import net.momirealms.customcrops.api.mechanic.item.CustomProvider; +import net.momirealms.customcrops.api.mechanic.item.custom.CustomProvider; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; diff --git a/plugin/src/main/java/net/momirealms/customcrops/mechanic/item/custom/oraxen/OraxenListener.java b/plugin/src/main/java/net/momirealms/customcrops/mechanic/item/custom/oraxen/OraxenListener.java index 225f5bf..52a62bf 100644 --- a/plugin/src/main/java/net/momirealms/customcrops/mechanic/item/custom/oraxen/OraxenListener.java +++ b/plugin/src/main/java/net/momirealms/customcrops/mechanic/item/custom/oraxen/OraxenListener.java @@ -26,7 +26,7 @@ import io.th0rgal.oraxen.api.events.furniture.OraxenFurnitureInteractEvent; import io.th0rgal.oraxen.api.events.furniture.OraxenFurniturePlaceEvent; import net.momirealms.customcrops.api.util.LocationUtils; import net.momirealms.customcrops.mechanic.item.ItemManagerImpl; -import net.momirealms.customcrops.api.mechanic.item.AbstractCustomListener; +import net.momirealms.customcrops.api.mechanic.item.custom.AbstractCustomListener; import org.bukkit.event.EventHandler; public class OraxenListener extends AbstractCustomListener { diff --git a/plugin/src/main/java/net/momirealms/customcrops/mechanic/item/custom/oraxen/OraxenProvider.java b/plugin/src/main/java/net/momirealms/customcrops/mechanic/item/custom/oraxen/OraxenProvider.java index bf2a37a..1ca1597 100644 --- a/plugin/src/main/java/net/momirealms/customcrops/mechanic/item/custom/oraxen/OraxenProvider.java +++ b/plugin/src/main/java/net/momirealms/customcrops/mechanic/item/custom/oraxen/OraxenProvider.java @@ -24,7 +24,7 @@ import io.th0rgal.oraxen.items.ItemBuilder; import io.th0rgal.oraxen.mechanics.Mechanic; import io.th0rgal.oraxen.mechanics.provided.gameplay.furniture.FurnitureMechanic; import net.momirealms.customcrops.api.util.LogUtils; -import net.momirealms.customcrops.api.mechanic.item.CustomProvider; +import net.momirealms.customcrops.api.mechanic.item.custom.CustomProvider; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Rotation; diff --git a/settings.gradle b/settings.gradle index 0319b10..a643408 100644 --- a/settings.gradle +++ b/settings.gradle @@ -2,5 +2,5 @@ rootProject.name = 'CustomCrops' include(":plugin") include(":api") include(":legacy-api") -include 'oraxen-legacy' +include("oraxen-legacy")