mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-24 17:39:26 +00:00
rearrange api structure
This commit is contained in:
@@ -25,8 +25,11 @@ import net.momirealms.customcrops.api.context.Context;
|
||||
import net.momirealms.customcrops.api.context.ContextKeys;
|
||||
import net.momirealms.customcrops.api.core.*;
|
||||
import net.momirealms.customcrops.api.core.block.*;
|
||||
import net.momirealms.customcrops.api.core.item.Fertilizer;
|
||||
import net.momirealms.customcrops.api.core.item.FertilizerConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.fertilizer.Fertilizer;
|
||||
import net.momirealms.customcrops.api.core.mechanic.fertilizer.FertilizerConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.pot.PotConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.CropConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.CropStageConfig;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsChunk;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsWorld;
|
||||
|
||||
@@ -22,6 +22,11 @@ import net.momirealms.customcrops.api.action.ActionManager;
|
||||
import net.momirealms.customcrops.api.context.Context;
|
||||
import net.momirealms.customcrops.api.context.ContextKeys;
|
||||
import net.momirealms.customcrops.api.core.block.*;
|
||||
import net.momirealms.customcrops.api.core.mechanic.pot.PotConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.BoneMeal;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.CropConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.CropStageConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.sprinkler.SprinklerConfig;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsWorld;
|
||||
import net.momirealms.customcrops.api.core.world.Pos3;
|
||||
@@ -312,7 +317,7 @@ public abstract class AbstractCustomEventListener implements Listener {
|
||||
if (point < cropConfig.maxPoints()) {
|
||||
for (BoneMeal boneMeal : cropConfig.boneMeals()) {
|
||||
if (boneMeal.isDispenserAllowed()) {
|
||||
if (EventUtils.fireAndCheckCancel(new BoneMealDispenseEvent(block, itemStack, location, boneMeal, state))) {
|
||||
if (EventUtils.fireAndCheckCancel(new BoneMealDispenseEvent(block, location, state, itemStack, boneMeal))) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -12,10 +12,15 @@ import dev.dejvokep.boostedyaml.settings.loader.LoaderSettings;
|
||||
import dev.dejvokep.boostedyaml.settings.updater.UpdaterSettings;
|
||||
import dev.dejvokep.boostedyaml.utils.format.NodeRole;
|
||||
import net.momirealms.customcrops.api.BukkitCustomCropsPlugin;
|
||||
import net.momirealms.customcrops.api.core.block.*;
|
||||
import net.momirealms.customcrops.api.core.item.FertilizerConfig;
|
||||
import net.momirealms.customcrops.api.core.item.FertilizerType;
|
||||
import net.momirealms.customcrops.api.core.item.WateringCanConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.fertilizer.FertilizerConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.fertilizer.FertilizerType;
|
||||
import net.momirealms.customcrops.api.core.mechanic.wateringcan.WateringCanConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.DeathCondition;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.GrowCondition;
|
||||
import net.momirealms.customcrops.api.core.mechanic.pot.PotConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.BoneMeal;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.CropConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.sprinkler.SprinklerConfig;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import net.momirealms.customcrops.api.misc.water.FillMethod;
|
||||
import net.momirealms.customcrops.api.misc.water.WateringMethod;
|
||||
|
||||
@@ -17,14 +17,14 @@
|
||||
|
||||
package net.momirealms.customcrops.api.core;
|
||||
|
||||
import net.momirealms.customcrops.api.core.block.CropConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.CropConfig;
|
||||
import net.momirealms.customcrops.api.core.block.CustomCropsBlock;
|
||||
import net.momirealms.customcrops.api.core.block.PotConfig;
|
||||
import net.momirealms.customcrops.api.core.block.SprinklerConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.pot.PotConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.sprinkler.SprinklerConfig;
|
||||
import net.momirealms.customcrops.api.core.item.CustomCropsItem;
|
||||
import net.momirealms.customcrops.api.core.item.FertilizerConfig;
|
||||
import net.momirealms.customcrops.api.core.item.FertilizerType;
|
||||
import net.momirealms.customcrops.api.core.item.WateringCanConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.fertilizer.FertilizerConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.fertilizer.FertilizerType;
|
||||
import net.momirealms.customcrops.api.core.mechanic.wateringcan.WateringCanConfig;
|
||||
import net.momirealms.customcrops.common.annotation.DoNotUse;
|
||||
import net.momirealms.customcrops.common.util.Key;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
@@ -19,7 +19,7 @@ package net.momirealms.customcrops.api.core;
|
||||
|
||||
import net.momirealms.customcrops.api.core.block.CustomCropsBlock;
|
||||
import net.momirealms.customcrops.api.core.item.CustomCropsItem;
|
||||
import net.momirealms.customcrops.api.core.item.FertilizerType;
|
||||
import net.momirealms.customcrops.api.core.mechanic.fertilizer.FertilizerType;
|
||||
import net.momirealms.customcrops.common.util.Key;
|
||||
|
||||
public interface RegistryAccess {
|
||||
|
||||
@@ -20,7 +20,7 @@ package net.momirealms.customcrops.api.core;
|
||||
import net.momirealms.customcrops.api.BukkitCustomCropsPlugin;
|
||||
import net.momirealms.customcrops.api.core.block.CustomCropsBlock;
|
||||
import net.momirealms.customcrops.api.core.item.CustomCropsItem;
|
||||
import net.momirealms.customcrops.api.core.item.FertilizerType;
|
||||
import net.momirealms.customcrops.api.core.mechanic.fertilizer.FertilizerType;
|
||||
import net.momirealms.customcrops.common.util.Key;
|
||||
|
||||
public class SimpleRegistryAccess implements RegistryAccess {
|
||||
|
||||
@@ -23,8 +23,10 @@ import net.momirealms.customcrops.api.action.ActionManager;
|
||||
import net.momirealms.customcrops.api.context.Context;
|
||||
import net.momirealms.customcrops.api.context.ContextKeys;
|
||||
import net.momirealms.customcrops.api.core.*;
|
||||
import net.momirealms.customcrops.api.core.item.Fertilizer;
|
||||
import net.momirealms.customcrops.api.core.item.FertilizerConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.fertilizer.Fertilizer;
|
||||
import net.momirealms.customcrops.api.core.mechanic.fertilizer.FertilizerConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.*;
|
||||
import net.momirealms.customcrops.api.core.mechanic.pot.PotConfig;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsWorld;
|
||||
import net.momirealms.customcrops.api.core.world.Pos3;
|
||||
|
||||
@@ -22,6 +22,7 @@ import net.momirealms.customcrops.api.context.Context;
|
||||
import net.momirealms.customcrops.api.context.ContextKeys;
|
||||
import net.momirealms.customcrops.api.core.BuiltInBlockMechanics;
|
||||
import net.momirealms.customcrops.api.core.Registries;
|
||||
import net.momirealms.customcrops.api.core.mechanic.pot.PotConfig;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsWorld;
|
||||
import net.momirealms.customcrops.api.core.world.Pos3;
|
||||
|
||||
@@ -23,8 +23,11 @@ import net.momirealms.customcrops.api.action.ActionManager;
|
||||
import net.momirealms.customcrops.api.context.Context;
|
||||
import net.momirealms.customcrops.api.context.ContextKeys;
|
||||
import net.momirealms.customcrops.api.core.*;
|
||||
import net.momirealms.customcrops.api.core.item.Fertilizer;
|
||||
import net.momirealms.customcrops.api.core.item.FertilizerConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.fertilizer.Fertilizer;
|
||||
import net.momirealms.customcrops.api.core.mechanic.fertilizer.FertilizerConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.pot.PotConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.CropConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.CropStageConfig;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsWorld;
|
||||
import net.momirealms.customcrops.api.core.world.Pos3;
|
||||
|
||||
@@ -24,6 +24,8 @@ import net.momirealms.customcrops.api.action.ActionManager;
|
||||
import net.momirealms.customcrops.api.context.Context;
|
||||
import net.momirealms.customcrops.api.context.ContextKeys;
|
||||
import net.momirealms.customcrops.api.core.*;
|
||||
import net.momirealms.customcrops.api.core.mechanic.pot.PotConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.sprinkler.SprinklerConfig;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsWorld;
|
||||
import net.momirealms.customcrops.api.core.world.Pos3;
|
||||
|
||||
@@ -26,9 +26,11 @@ import net.momirealms.customcrops.api.core.BuiltInItemMechanics;
|
||||
import net.momirealms.customcrops.api.core.InteractionResult;
|
||||
import net.momirealms.customcrops.api.core.Registries;
|
||||
import net.momirealms.customcrops.api.core.block.CropBlock;
|
||||
import net.momirealms.customcrops.api.core.block.CropConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.CropConfig;
|
||||
import net.momirealms.customcrops.api.core.block.PotBlock;
|
||||
import net.momirealms.customcrops.api.core.block.PotConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.pot.PotConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.fertilizer.Fertilizer;
|
||||
import net.momirealms.customcrops.api.core.mechanic.fertilizer.FertilizerConfig;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsWorld;
|
||||
import net.momirealms.customcrops.api.core.world.Pos3;
|
||||
|
||||
@@ -23,9 +23,9 @@ import net.momirealms.customcrops.api.context.Context;
|
||||
import net.momirealms.customcrops.api.context.ContextKeys;
|
||||
import net.momirealms.customcrops.api.core.*;
|
||||
import net.momirealms.customcrops.api.core.block.CropBlock;
|
||||
import net.momirealms.customcrops.api.core.block.CropConfig;
|
||||
import net.momirealms.customcrops.api.core.block.CropStageConfig;
|
||||
import net.momirealms.customcrops.api.core.block.PotConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.CropConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.CropStageConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.pot.PotConfig;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsWorld;
|
||||
import net.momirealms.customcrops.api.core.world.Pos3;
|
||||
|
||||
@@ -23,7 +23,7 @@ import net.momirealms.customcrops.api.context.Context;
|
||||
import net.momirealms.customcrops.api.context.ContextKeys;
|
||||
import net.momirealms.customcrops.api.core.*;
|
||||
import net.momirealms.customcrops.api.core.block.SprinklerBlock;
|
||||
import net.momirealms.customcrops.api.core.block.SprinklerConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.sprinkler.SprinklerConfig;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsWorld;
|
||||
import net.momirealms.customcrops.api.core.world.Pos3;
|
||||
|
||||
@@ -25,6 +25,10 @@ import net.momirealms.customcrops.api.context.Context;
|
||||
import net.momirealms.customcrops.api.context.ContextKeys;
|
||||
import net.momirealms.customcrops.api.core.*;
|
||||
import net.momirealms.customcrops.api.core.block.*;
|
||||
import net.momirealms.customcrops.api.core.mechanic.pot.PotConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.CropConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.sprinkler.SprinklerConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.wateringcan.WateringCanConfig;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsWorld;
|
||||
import net.momirealms.customcrops.api.core.world.Pos3;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.block;
|
||||
package net.momirealms.customcrops.api.core.mechanic.crop;
|
||||
|
||||
import net.momirealms.customcrops.api.action.Action;
|
||||
import net.momirealms.customcrops.api.action.ActionManager;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.block;
|
||||
package net.momirealms.customcrops.api.core.mechanic.crop;
|
||||
|
||||
import net.momirealms.customcrops.api.action.Action;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.block;
|
||||
package net.momirealms.customcrops.api.core.mechanic.crop;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.momirealms.customcrops.api.action.Action;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.block;
|
||||
package net.momirealms.customcrops.api.core.mechanic.crop;
|
||||
|
||||
import net.momirealms.customcrops.api.action.Action;
|
||||
import net.momirealms.customcrops.api.core.ExistenceForm;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.block;
|
||||
package net.momirealms.customcrops.api.core.mechanic.crop;
|
||||
|
||||
import net.momirealms.customcrops.api.action.Action;
|
||||
import net.momirealms.customcrops.api.core.ExistenceForm;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.block;
|
||||
package net.momirealms.customcrops.api.core.mechanic.crop;
|
||||
|
||||
import net.momirealms.customcrops.api.BukkitCustomCropsPlugin;
|
||||
import net.momirealms.customcrops.api.util.LocationUtils;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.block;
|
||||
package net.momirealms.customcrops.api.core.mechanic.crop;
|
||||
|
||||
import net.momirealms.customcrops.api.context.Context;
|
||||
import net.momirealms.customcrops.api.core.ExistenceForm;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.block;
|
||||
package net.momirealms.customcrops.api.core.mechanic.crop;
|
||||
|
||||
import net.momirealms.customcrops.api.context.Context;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.block;
|
||||
package net.momirealms.customcrops.api.core.mechanic.crop;
|
||||
|
||||
import net.momirealms.customcrops.api.core.ExistenceForm;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.item;
|
||||
package net.momirealms.customcrops.api.core.mechanic.fertilizer;
|
||||
|
||||
import net.momirealms.customcrops.api.action.Action;
|
||||
import net.momirealms.customcrops.api.requirement.Requirement;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.item;
|
||||
package net.momirealms.customcrops.api.core.mechanic.fertilizer;
|
||||
|
||||
import net.momirealms.customcrops.api.core.Registries;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.item;
|
||||
package net.momirealms.customcrops.api.core.mechanic.fertilizer;
|
||||
|
||||
import net.momirealms.customcrops.api.action.Action;
|
||||
import net.momirealms.customcrops.api.requirement.Requirement;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.item;
|
||||
package net.momirealms.customcrops.api.core.mechanic.fertilizer;
|
||||
|
||||
public class FertilizerImpl implements Fertilizer {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.item;
|
||||
package net.momirealms.customcrops.api.core.mechanic.fertilizer;
|
||||
|
||||
import dev.dejvokep.boostedyaml.block.implementation.Section;
|
||||
import net.momirealms.customcrops.api.BukkitCustomCropsPlugin;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.item;
|
||||
package net.momirealms.customcrops.api.core.mechanic.fertilizer;
|
||||
|
||||
import net.momirealms.customcrops.api.action.Action;
|
||||
import net.momirealms.customcrops.api.requirement.Requirement;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.item;
|
||||
package net.momirealms.customcrops.api.core.mechanic.fertilizer;
|
||||
|
||||
import net.momirealms.customcrops.api.action.Action;
|
||||
import net.momirealms.customcrops.api.requirement.Requirement;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.item;
|
||||
package net.momirealms.customcrops.api.core.mechanic.fertilizer;
|
||||
|
||||
import net.momirealms.customcrops.api.action.Action;
|
||||
import net.momirealms.customcrops.api.requirement.Requirement;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.item;
|
||||
package net.momirealms.customcrops.api.core.mechanic.fertilizer;
|
||||
|
||||
import net.momirealms.customcrops.api.action.Action;
|
||||
import net.momirealms.customcrops.api.requirement.Requirement;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.item;
|
||||
package net.momirealms.customcrops.api.core.mechanic.fertilizer;
|
||||
|
||||
import net.momirealms.customcrops.api.action.Action;
|
||||
import net.momirealms.customcrops.api.requirement.Requirement;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.item;
|
||||
package net.momirealms.customcrops.api.core.mechanic.fertilizer;
|
||||
|
||||
import net.momirealms.customcrops.api.action.Action;
|
||||
import net.momirealms.customcrops.api.requirement.Requirement;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.item;
|
||||
package net.momirealms.customcrops.api.core.mechanic.fertilizer;
|
||||
|
||||
import net.momirealms.customcrops.api.action.Action;
|
||||
import net.momirealms.customcrops.api.requirement.Requirement;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.item;
|
||||
package net.momirealms.customcrops.api.core.mechanic.fertilizer;
|
||||
|
||||
import net.momirealms.customcrops.api.action.Action;
|
||||
import net.momirealms.customcrops.api.requirement.Requirement;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.item;
|
||||
package net.momirealms.customcrops.api.core.mechanic.fertilizer;
|
||||
|
||||
import net.momirealms.customcrops.api.action.Action;
|
||||
import net.momirealms.customcrops.api.requirement.Requirement;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.item;
|
||||
package net.momirealms.customcrops.api.core.mechanic.fertilizer;
|
||||
|
||||
import net.momirealms.customcrops.api.action.Action;
|
||||
import net.momirealms.customcrops.api.requirement.Requirement;
|
||||
@@ -15,10 +15,10 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.block;
|
||||
package net.momirealms.customcrops.api.core.mechanic.pot;
|
||||
|
||||
import net.momirealms.customcrops.api.action.Action;
|
||||
import net.momirealms.customcrops.api.core.item.FertilizerType;
|
||||
import net.momirealms.customcrops.api.core.mechanic.fertilizer.FertilizerType;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import net.momirealms.customcrops.api.misc.water.WaterBar;
|
||||
import net.momirealms.customcrops.api.misc.water.WateringMethod;
|
||||
@@ -15,11 +15,11 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.block;
|
||||
package net.momirealms.customcrops.api.core.mechanic.pot;
|
||||
|
||||
import net.momirealms.customcrops.api.action.Action;
|
||||
import net.momirealms.customcrops.api.core.ExistenceForm;
|
||||
import net.momirealms.customcrops.api.core.item.FertilizerType;
|
||||
import net.momirealms.customcrops.api.core.mechanic.fertilizer.FertilizerType;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import net.momirealms.customcrops.api.misc.water.WaterBar;
|
||||
import net.momirealms.customcrops.api.misc.water.WateringMethod;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.block;
|
||||
package net.momirealms.customcrops.api.core.mechanic.sprinkler;
|
||||
|
||||
import net.momirealms.customcrops.api.action.Action;
|
||||
import net.momirealms.customcrops.api.core.ExistenceForm;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.block;
|
||||
package net.momirealms.customcrops.api.core.mechanic.sprinkler;
|
||||
|
||||
import net.momirealms.customcrops.api.action.Action;
|
||||
import net.momirealms.customcrops.api.core.ExistenceForm;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.item;
|
||||
package net.momirealms.customcrops.api.core.mechanic.wateringcan;
|
||||
|
||||
import net.momirealms.customcrops.api.action.Action;
|
||||
import net.momirealms.customcrops.api.misc.value.TextValue;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.core.item;
|
||||
package net.momirealms.customcrops.api.core.mechanic.wateringcan;
|
||||
|
||||
import net.momirealms.customcrops.api.action.Action;
|
||||
import net.momirealms.customcrops.api.misc.value.TextValue;
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
package net.momirealms.customcrops.api.event;
|
||||
|
||||
import net.momirealms.customcrops.api.core.block.BoneMeal;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.BoneMeal;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
@@ -28,7 +28,9 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* An event that triggered when the bone meal is dispensed
|
||||
* The BoneMealDispenseEvent class represents an event that is triggered when a dispenser
|
||||
* applies bone meal to a custom crop block in the CustomCrops plugin. This event allows
|
||||
* for handling the action of bone meal being dispensed and applied to crops.
|
||||
*/
|
||||
public class BoneMealDispenseEvent extends Event implements Cancellable {
|
||||
|
||||
@@ -40,12 +42,21 @@ public class BoneMealDispenseEvent extends Event implements Cancellable {
|
||||
private final ItemStack boneMealItem;
|
||||
private final Block dispenser;
|
||||
|
||||
/**
|
||||
* Constructor for the BoneMealDispenseEvent.
|
||||
*
|
||||
* @param dispenser The dispenser block that dispensed the bone meal.
|
||||
* @param location The location of the crop block affected by the bone meal.
|
||||
* @param blockState The state of the crop block before the bone meal is applied.
|
||||
* @param boneMealItem The ItemStack representing the bone meal item used.
|
||||
* @param boneMeal The BoneMeal configuration being used.
|
||||
*/
|
||||
public BoneMealDispenseEvent(
|
||||
@NotNull Block dispenser,
|
||||
@NotNull ItemStack boneMealItem,
|
||||
@NotNull Location location,
|
||||
@NotNull BoneMeal boneMeal,
|
||||
@NotNull CustomCropsBlockState blockState
|
||||
@NotNull CustomCropsBlockState blockState,
|
||||
@NotNull ItemStack boneMealItem,
|
||||
@NotNull BoneMeal boneMeal
|
||||
) {
|
||||
this.location = location;
|
||||
this.blockState = blockState;
|
||||
@@ -54,21 +65,41 @@ public class BoneMealDispenseEvent extends Event implements Cancellable {
|
||||
this.dispenser = dispenser;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the event is cancelled.
|
||||
*
|
||||
* @return true if the event is cancelled, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancelled state of the event.
|
||||
*
|
||||
* @param cancel true to cancel the event, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event.
|
||||
*
|
||||
* @return the static handler list.
|
||||
*/
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event instance.
|
||||
*
|
||||
* @return the handler list.
|
||||
*/
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
@@ -76,8 +107,9 @@ public class BoneMealDispenseEvent extends Event implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the crop location
|
||||
* @return location
|
||||
* Gets the location of the crop block affected by the bone meal.
|
||||
*
|
||||
* @return the location of the crop block.
|
||||
*/
|
||||
@NotNull
|
||||
public Location getLocation() {
|
||||
@@ -85,24 +117,29 @@ public class BoneMealDispenseEvent extends Event implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the item in player's hand
|
||||
* If there's nothing in hand, it would return AIR
|
||||
* @return item in hand
|
||||
* Gets the ItemStack representing the bone meal item used.
|
||||
*
|
||||
* @return the ItemStack of bone meal.
|
||||
*/
|
||||
@NotNull
|
||||
public ItemStack getBoneMealItem() {
|
||||
return boneMealItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the state of the crop block before the bone meal was applied.
|
||||
*
|
||||
* @return the block state of the crop.
|
||||
*/
|
||||
@NotNull
|
||||
public CustomCropsBlockState getBlockState() {
|
||||
return blockState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the bone meal's config
|
||||
* Gets the configuration of the bone meal being used.
|
||||
*
|
||||
* @return bone meal config
|
||||
* @return the BoneMeal configuration.
|
||||
*/
|
||||
@NotNull
|
||||
public BoneMeal getBoneMeal() {
|
||||
@@ -110,9 +147,9 @@ public class BoneMealDispenseEvent extends Event implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the dispenser block
|
||||
* Gets the dispenser block that dispensed the bone meal.
|
||||
*
|
||||
* @return dispenser block
|
||||
* @return the dispenser block.
|
||||
*/
|
||||
@NotNull
|
||||
public Block getDispenser() {
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
package net.momirealms.customcrops.api.event;
|
||||
|
||||
import net.momirealms.customcrops.api.core.block.BoneMeal;
|
||||
import net.momirealms.customcrops.api.core.block.CropConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.BoneMeal;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.CropConfig;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -30,7 +30,8 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* An event that triggered when a player interacts a crop with a bone meal
|
||||
* The BoneMealUseEvent class represents an event triggered when a player uses bone meal
|
||||
* on a custom crop block in the CustomCrops plugin.
|
||||
*/
|
||||
public class BoneMealUseEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
@@ -43,6 +44,17 @@ public class BoneMealUseEvent extends PlayerEvent implements Cancellable {
|
||||
private final EquipmentSlot equipmentSlot;
|
||||
private final CropConfig config;
|
||||
|
||||
/**
|
||||
* Constructor for the BoneMealUseEvent.
|
||||
*
|
||||
* @param player The player who used the bone meal.
|
||||
* @param itemInHand The ItemStack representing the item in the player's hand.
|
||||
* @param location The location of the crop block affected by the bone meal.
|
||||
* @param boneMeal The BoneMeal configuration being applied.
|
||||
* @param blockState The state of the crop block before the bone meal is applied.
|
||||
* @param equipmentSlot The equipment slot where the bone meal item is held.
|
||||
* @param config The crop configuration associated with the block being targeted.
|
||||
*/
|
||||
public BoneMealUseEvent(
|
||||
@NotNull Player player,
|
||||
@NotNull ItemStack itemInHand,
|
||||
@@ -61,21 +73,41 @@ public class BoneMealUseEvent extends PlayerEvent implements Cancellable {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the event is cancelled.
|
||||
*
|
||||
* @return true if the event is cancelled, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancelled state of the event.
|
||||
*
|
||||
* @param cancel true to cancel the event, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event.
|
||||
*
|
||||
* @return the static handler list.
|
||||
*/
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event instance.
|
||||
*
|
||||
* @return the handler list.
|
||||
*/
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
@@ -83,45 +115,60 @@ public class BoneMealUseEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the crop location
|
||||
* Gets the location of the crop block affected by the bone meal.
|
||||
*
|
||||
* @return location
|
||||
* @return the location of the crop block.
|
||||
*/
|
||||
@NotNull
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the crop configuration associated with the block being targeted.
|
||||
*
|
||||
* @return the crop configuration.
|
||||
*/
|
||||
@NotNull
|
||||
public CropConfig getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the item in player's hand
|
||||
* If there's nothing in hand, it would return AIR
|
||||
* Gets the ItemStack representing the item in the player's hand.
|
||||
* If there is nothing in hand, it would return AIR.
|
||||
*
|
||||
* @return item in hand
|
||||
* @return the ItemStack in hand.
|
||||
*/
|
||||
@NotNull
|
||||
public ItemStack getItemInHand() {
|
||||
return itemInHand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the state of the crop block before the bone meal was applied.
|
||||
*
|
||||
* @return the block state of the crop.
|
||||
*/
|
||||
@NotNull
|
||||
public CustomCropsBlockState getBlockState() {
|
||||
return blockState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the equipment slot where the bone meal item is held.
|
||||
*
|
||||
* @return the equipment slot.
|
||||
*/
|
||||
@NotNull
|
||||
public EquipmentSlot getEquipmentSlot() {
|
||||
return equipmentSlot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the bone meal config
|
||||
* Gets the configuration of the bone meal being used.
|
||||
*
|
||||
* @return bone meal config
|
||||
* @return the BoneMeal configuration.
|
||||
*/
|
||||
@NotNull
|
||||
public BoneMeal getBoneMeal() {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
package net.momirealms.customcrops.api.event;
|
||||
|
||||
import net.momirealms.customcrops.api.core.block.BreakReason;
|
||||
import net.momirealms.customcrops.api.core.block.CropConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.CropConfig;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
package net.momirealms.customcrops.api.event;
|
||||
|
||||
import net.momirealms.customcrops.api.core.block.CropConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.CropConfig;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -29,7 +29,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* An event that triggered when a player interacts a crop
|
||||
* An event that is triggered when a player interacts with a crop in the CustomCrops plugin.
|
||||
*/
|
||||
public class CropInteractEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
@@ -42,6 +42,17 @@ public class CropInteractEvent extends PlayerEvent implements Cancellable {
|
||||
private final CropConfig config;
|
||||
private final String stageItemID;
|
||||
|
||||
/**
|
||||
* Constructor for the CropInteractEvent.
|
||||
*
|
||||
* @param who The player who interacted with the crop.
|
||||
* @param itemInHand The ItemStack representing the item in the player's hand.
|
||||
* @param location The location of the crop block being interacted with.
|
||||
* @param blockState The state of the crop block before interaction.
|
||||
* @param hand The hand (main or offhand) used by the player.
|
||||
* @param config The crop configuration associated with the crop block.
|
||||
* @param stageItemID The ID representing the stage of the crop.
|
||||
*/
|
||||
public CropInteractEvent(
|
||||
@NotNull Player who,
|
||||
@NotNull ItemStack itemInHand,
|
||||
@@ -60,21 +71,41 @@ public class CropInteractEvent extends PlayerEvent implements Cancellable {
|
||||
this.stageItemID = stageItemID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the event is cancelled.
|
||||
*
|
||||
* @return true if the event is cancelled, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancelled state of the event.
|
||||
*
|
||||
* @param cancel true to cancel the event, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event.
|
||||
*
|
||||
* @return the static handler list.
|
||||
*/
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event instance.
|
||||
*
|
||||
* @return the handler list.
|
||||
*/
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
@@ -82,9 +113,9 @@ public class CropInteractEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the crop location
|
||||
* Gets the location of the crop block being interacted with.
|
||||
*
|
||||
* @return location
|
||||
* @return the location of the crop block.
|
||||
*/
|
||||
@NotNull
|
||||
public Location getLocation() {
|
||||
@@ -92,31 +123,51 @@ public class CropInteractEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the item in player's hand
|
||||
* If there's nothing in hand, it would return AIR
|
||||
* Gets the ItemStack representing the item in the player's hand.
|
||||
* If there is nothing in hand, it would return AIR.
|
||||
*
|
||||
* @return item in hand
|
||||
* @return the ItemStack in hand.
|
||||
*/
|
||||
@NotNull
|
||||
public ItemStack getItemInHand() {
|
||||
return itemInHand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the crop configuration associated with the crop block.
|
||||
*
|
||||
* @return the crop configuration.
|
||||
*/
|
||||
@NotNull
|
||||
public CropConfig getCropConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the state of the crop block before the interaction occurred.
|
||||
*
|
||||
* @return the block state of the crop.
|
||||
*/
|
||||
@NotNull
|
||||
public CustomCropsBlockState getBlockState() {
|
||||
return blockState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hand (main or offhand) used by the player to interact with the crop.
|
||||
*
|
||||
* @return the equipment slot representing the hand used.
|
||||
*/
|
||||
@NotNull
|
||||
public EquipmentSlot getHand() {
|
||||
return hand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ID representing the stage of the crop.
|
||||
*
|
||||
* @return the stage item ID.
|
||||
*/
|
||||
@NotNull
|
||||
public String getStageItemID() {
|
||||
return stageItemID;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
package net.momirealms.customcrops.api.event;
|
||||
|
||||
import net.momirealms.customcrops.api.core.block.CropConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.CropConfig;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -29,7 +29,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* An event that triggered when planting a crop
|
||||
* An event that is triggered when a player plants a crop in the CustomCrops plugin.
|
||||
*/
|
||||
public class CropPlantEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
@@ -42,6 +42,17 @@ public class CropPlantEvent extends PlayerEvent implements Cancellable {
|
||||
private final EquipmentSlot hand;
|
||||
private int point;
|
||||
|
||||
/**
|
||||
* Constructor for the CropPlantEvent.
|
||||
*
|
||||
* @param who The player who is planting the crop.
|
||||
* @param itemInHand The ItemStack representing the item in the player's hand used for planting.
|
||||
* @param hand The hand (main or offhand) used by the player for planting.
|
||||
* @param location The location where the crop is being planted.
|
||||
* @param config The crop configuration associated with the crop being planted.
|
||||
* @param blockState The state of the block where the crop is planted.
|
||||
* @param point The initial point value associated with planting the crop.
|
||||
*/
|
||||
public CropPlantEvent(
|
||||
@NotNull Player who,
|
||||
@NotNull ItemStack itemInHand,
|
||||
@@ -60,51 +71,81 @@ public class CropPlantEvent extends PlayerEvent implements Cancellable {
|
||||
this.blockState = blockState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the event is cancelled.
|
||||
*
|
||||
* @return true if the event is cancelled, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancelled state of the event.
|
||||
*
|
||||
* @param cancel true to cancel the event, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the seed item
|
||||
* Gets the ItemStack representing the seed item in the player's hand.
|
||||
*
|
||||
* @return seed item
|
||||
* @return the seed item.
|
||||
*/
|
||||
@NotNull
|
||||
public ItemStack getItemInHand() {
|
||||
return itemInHand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event.
|
||||
*
|
||||
* @return the static handler list.
|
||||
*/
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event instance.
|
||||
*
|
||||
* @return the handler list.
|
||||
*/
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the state of the block where the crop is planted.
|
||||
*
|
||||
* @return the block state of the crop.
|
||||
*/
|
||||
@NotNull
|
||||
public CustomCropsBlockState getBlockState() {
|
||||
return blockState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hand (main or offhand) used by the player to plant the crop.
|
||||
*
|
||||
* @return the equipment slot representing the hand used.
|
||||
*/
|
||||
@NotNull
|
||||
public EquipmentSlot getHand() {
|
||||
return hand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the crop's config
|
||||
* Gets the crop configuration associated with the crop being planted.
|
||||
*
|
||||
* @return crop
|
||||
* @return the crop configuration.
|
||||
*/
|
||||
@NotNull
|
||||
public CropConfig getCropConfig() {
|
||||
@@ -112,9 +153,9 @@ public class CropPlantEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the crop's location
|
||||
* Gets the location where the crop is being planted.
|
||||
*
|
||||
* @return location
|
||||
* @return the location of the crop.
|
||||
*/
|
||||
@NotNull
|
||||
public Location getLocation() {
|
||||
@@ -122,18 +163,19 @@ public class CropPlantEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the initial point
|
||||
* It would be 0 when planting
|
||||
* Gets the initial point value associated with planting the crop.
|
||||
* This value is typically 0 when the crop is first planted.
|
||||
*
|
||||
* @return point
|
||||
* @return the initial point.
|
||||
*/
|
||||
public int getPoint() {
|
||||
return point;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the initial point
|
||||
* @param point point
|
||||
* Sets the initial point value associated with planting the crop.
|
||||
*
|
||||
* @param point the new initial point value.
|
||||
*/
|
||||
public void setPoint(int point) {
|
||||
this.point = point;
|
||||
|
||||
@@ -22,25 +22,48 @@ import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* An event that is triggered when the CustomCrops plugin is reloaded.
|
||||
*/
|
||||
public class CustomCropsReloadEvent extends Event {
|
||||
|
||||
private static final HandlerList handlerList = new HandlerList();
|
||||
private final BukkitCustomCropsPlugin plugin;
|
||||
|
||||
/**
|
||||
* Constructor for the CustomCropsReloadEvent.
|
||||
*
|
||||
* @param plugin The instance of the CustomCrops plugin being reloaded.
|
||||
*/
|
||||
public CustomCropsReloadEvent(BukkitCustomCropsPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event.
|
||||
*
|
||||
* @return the static handler list.
|
||||
*/
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlerList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event instance.
|
||||
*
|
||||
* @return the handler list.
|
||||
*/
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the instance of the CustomCrops plugin that is being reloaded.
|
||||
*
|
||||
* @return the plugin instance.
|
||||
*/
|
||||
public BukkitCustomCropsPlugin getPluginInstance() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
package net.momirealms.customcrops.api.event;
|
||||
|
||||
import net.momirealms.customcrops.api.core.block.PotConfig;
|
||||
import net.momirealms.customcrops.api.core.item.Fertilizer;
|
||||
import net.momirealms.customcrops.api.core.mechanic.pot.PotConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.fertilizer.Fertilizer;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -30,7 +30,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* An event that triggered when player tries adding fertilizer to pot
|
||||
* An event that is triggered when a player tries to add fertilizer to a pot in the CustomCrops plugin.
|
||||
*/
|
||||
public class FertilizerUseEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
@@ -43,6 +43,17 @@ public class FertilizerUseEvent extends PlayerEvent implements Cancellable {
|
||||
private final EquipmentSlot hand;
|
||||
private final PotConfig config;
|
||||
|
||||
/**
|
||||
* Constructor for the FertilizerUseEvent.
|
||||
*
|
||||
* @param player The player who is attempting to add fertilizer.
|
||||
* @param itemInHand The ItemStack representing the fertilizer item in the player's hand.
|
||||
* @param fertilizer The Fertilizer configuration being applied.
|
||||
* @param location The location of the pot where the fertilizer is being added.
|
||||
* @param blockState The state of the block (pot) before the fertilizer is added.
|
||||
* @param hand The hand (main or offhand) used by the player to apply the fertilizer.
|
||||
* @param config The pot configuration associated with the pot being fertilized.
|
||||
*/
|
||||
public FertilizerUseEvent(
|
||||
@NotNull Player player,
|
||||
@NotNull ItemStack itemInHand,
|
||||
@@ -62,30 +73,50 @@ public class FertilizerUseEvent extends PlayerEvent implements Cancellable {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the event is cancelled.
|
||||
*
|
||||
* @return true if the event is cancelled, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancelled state of the event.
|
||||
*
|
||||
* @param cancel true to cancel the event, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
cancelled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event instance.
|
||||
*
|
||||
* @return the handler list.
|
||||
*/
|
||||
@Override
|
||||
public @NotNull HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event.
|
||||
*
|
||||
* @return the static handler list.
|
||||
*/
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fertilizer item in hand
|
||||
* Gets the ItemStack representing the fertilizer item in the player's hand.
|
||||
*
|
||||
* @return item in hand
|
||||
* @return the item in hand.
|
||||
*/
|
||||
@NotNull
|
||||
public ItemStack getItemInHand() {
|
||||
@@ -93,34 +124,49 @@ public class FertilizerUseEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the pot's location
|
||||
* Gets the location of the pot where the fertilizer is being added.
|
||||
*
|
||||
* @return location
|
||||
* @return the location of the pot.
|
||||
*/
|
||||
@NotNull
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the state of the block (pot) before the fertilizer is added.
|
||||
*
|
||||
* @return the block state of the pot.
|
||||
*/
|
||||
@NotNull
|
||||
public CustomCropsBlockState getBlockState() {
|
||||
return blockState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hand (main or offhand) used by the player to apply the fertilizer.
|
||||
*
|
||||
* @return the equipment slot representing the hand used.
|
||||
*/
|
||||
@NotNull
|
||||
public EquipmentSlot getHand() {
|
||||
return hand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the pot configuration associated with the pot being fertilized.
|
||||
*
|
||||
* @return the pot configuration.
|
||||
*/
|
||||
@NotNull
|
||||
public PotConfig getPotConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fertilizer's config
|
||||
* Gets the fertilizer being applied.
|
||||
*
|
||||
* @return fertilizer config
|
||||
* @return the fertilizer configuration.
|
||||
*/
|
||||
@NotNull
|
||||
public Fertilizer getFertilizer() {
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* An event that triggered when breaking greenhouse glass
|
||||
* An event that is triggered when a greenhouse glass block is broken in the CustomCrops plugin.
|
||||
*/
|
||||
public class GreenhouseGlassBreakEvent extends Event implements Cancellable {
|
||||
|
||||
@@ -42,6 +42,16 @@ public class GreenhouseGlassBreakEvent extends Event implements Cancellable {
|
||||
private final CustomCropsBlockState blockState;
|
||||
private final String glassItemID;
|
||||
|
||||
/**
|
||||
* Constructor for the GreenhouseGlassBreakEvent.
|
||||
*
|
||||
* @param entityBreaker The entity that caused the glass to break, if applicable (can be null).
|
||||
* @param blockBreaker The block that caused the glass to break, if applicable (can be null).
|
||||
* @param location The location of the greenhouse glass block being broken.
|
||||
* @param glassItemID The item ID representing the glass type being broken.
|
||||
* @param blockState The state of the greenhouse glass block before it was broken.
|
||||
* @param reason The reason why the glass was broken.
|
||||
*/
|
||||
public GreenhouseGlassBreakEvent(
|
||||
@Nullable Entity entityBreaker,
|
||||
@Nullable Block blockBreaker,
|
||||
@@ -58,21 +68,41 @@ public class GreenhouseGlassBreakEvent extends Event implements Cancellable {
|
||||
this.glassItemID = glassItemID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the event is cancelled.
|
||||
*
|
||||
* @return true if the event is cancelled, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancelled state of the event.
|
||||
*
|
||||
* @param cancel true to cancel the event, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event.
|
||||
*
|
||||
* @return the static handler list.
|
||||
*/
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event instance.
|
||||
*
|
||||
* @return the handler list.
|
||||
*/
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
@@ -80,35 +110,60 @@ public class GreenhouseGlassBreakEvent extends Event implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the glass location
|
||||
* Gets the location of the greenhouse glass block being broken.
|
||||
*
|
||||
* @return location
|
||||
* @return the location of the glass block.
|
||||
*/
|
||||
@NotNull
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entity responsible for breaking the glass, if applicable.
|
||||
*
|
||||
* @return the entity that caused the break, or null if not applicable.
|
||||
*/
|
||||
@Nullable
|
||||
public Entity getEntityBreaker() {
|
||||
return entityBreaker;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the block responsible for breaking the glass, if applicable.
|
||||
*
|
||||
* @return the block that caused the break, or null if not applicable.
|
||||
*/
|
||||
@Nullable
|
||||
public Block getBlockBreaker() {
|
||||
return blockBreaker;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the reason for the greenhouse glass breakage.
|
||||
*
|
||||
* @return the reason for the break.
|
||||
*/
|
||||
@NotNull
|
||||
public BreakReason getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the state of the greenhouse glass block before it was broken.
|
||||
*
|
||||
* @return the block state of the glass.
|
||||
*/
|
||||
@NotNull
|
||||
public CustomCropsBlockState getBlockState() {
|
||||
return blockState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item ID representing the glass type being broken.
|
||||
*
|
||||
* @return the glass item ID.
|
||||
*/
|
||||
public String getGlassItemID() {
|
||||
return glassItemID;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* An event that triggered when interacting a sprinkler
|
||||
* An event that is triggered when a player interacts with a greenhouse glass block in the CustomCrops plugin.
|
||||
*/
|
||||
public class GreenhouseGlassInteractEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
@@ -40,6 +40,16 @@ public class GreenhouseGlassInteractEvent extends PlayerEvent implements Cancell
|
||||
private final String glassItemID;
|
||||
private final EquipmentSlot hand;
|
||||
|
||||
/**
|
||||
* Constructor for the GreenhouseGlassInteractEvent.
|
||||
*
|
||||
* @param who The player who is interacting with the greenhouse glass.
|
||||
* @param itemInHand The ItemStack representing the item in the player's hand.
|
||||
* @param location The location of the greenhouse glass block being interacted with.
|
||||
* @param glassItemID The item ID representing the glass type being interacted with.
|
||||
* @param blockState The state of the greenhouse glass block at the time of interaction.
|
||||
* @param hand The hand (main or offhand) used by the player for the interaction.
|
||||
*/
|
||||
public GreenhouseGlassInteractEvent(
|
||||
@NotNull Player who,
|
||||
@NotNull ItemStack itemInHand,
|
||||
@@ -56,21 +66,41 @@ public class GreenhouseGlassInteractEvent extends PlayerEvent implements Cancell
|
||||
this.glassItemID = glassItemID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the event is cancelled.
|
||||
*
|
||||
* @return true if the event is cancelled, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancelled state of the event.
|
||||
*
|
||||
* @param cancel true to cancel the event, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event.
|
||||
*
|
||||
* @return the static handler list.
|
||||
*/
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event instance.
|
||||
*
|
||||
* @return the handler list.
|
||||
*/
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
@@ -78,34 +108,49 @@ public class GreenhouseGlassInteractEvent extends PlayerEvent implements Cancell
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the sprinkler location
|
||||
* Gets the location of the greenhouse glass block being interacted with.
|
||||
*
|
||||
* @return location
|
||||
* @return the location of the glass block.
|
||||
*/
|
||||
@NotNull
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the state of the greenhouse glass block at the time of interaction.
|
||||
*
|
||||
* @return the block state of the glass.
|
||||
*/
|
||||
@NotNull
|
||||
public CustomCropsBlockState getBlockState() {
|
||||
return blockState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hand (main or offhand) used by the player to interact with the glass.
|
||||
*
|
||||
* @return the equipment slot representing the hand used.
|
||||
*/
|
||||
@NotNull
|
||||
public EquipmentSlot getHand() {
|
||||
return hand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item ID representing the glass type being interacted with.
|
||||
*
|
||||
* @return the glass item ID.
|
||||
*/
|
||||
@NotNull
|
||||
public String getGlassItemID() {
|
||||
return glassItemID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the item in player's hand
|
||||
* Gets the ItemStack representing the item in the player's hand.
|
||||
*
|
||||
* @return item in hand
|
||||
* @return the item in hand.
|
||||
*/
|
||||
@NotNull
|
||||
public ItemStack getItemInHand() {
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.bukkit.event.player.PlayerEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* An event that triggered when placing greenhouse glass
|
||||
* An event that is triggered when a player places a greenhouse glass block in the CustomCrops plugin.
|
||||
*/
|
||||
public class GreenhouseGlassPlaceEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
@@ -36,6 +36,14 @@ public class GreenhouseGlassPlaceEvent extends PlayerEvent implements Cancellabl
|
||||
private final CustomCropsBlockState blockState;
|
||||
private final String glassItemID;
|
||||
|
||||
/**
|
||||
* Constructor for the GreenhouseGlassPlaceEvent.
|
||||
*
|
||||
* @param who The player who is placing the greenhouse glass block.
|
||||
* @param location The location where the greenhouse glass block is being placed.
|
||||
* @param glassItemID The item ID representing the glass type being placed.
|
||||
* @param blockState The state of the block where the greenhouse glass is placed.
|
||||
*/
|
||||
public GreenhouseGlassPlaceEvent(
|
||||
@NotNull Player who,
|
||||
@NotNull Location location,
|
||||
@@ -48,21 +56,41 @@ public class GreenhouseGlassPlaceEvent extends PlayerEvent implements Cancellabl
|
||||
this.blockState = blockState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the event is cancelled.
|
||||
*
|
||||
* @return true if the event is cancelled, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancelled state of the event.
|
||||
*
|
||||
* @param cancel true to cancel the event, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event.
|
||||
*
|
||||
* @return the static handler list.
|
||||
*/
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event instance.
|
||||
*
|
||||
* @return the handler list.
|
||||
*/
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
@@ -70,20 +98,30 @@ public class GreenhouseGlassPlaceEvent extends PlayerEvent implements Cancellabl
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the glass location
|
||||
* Gets the location where the greenhouse glass block is being placed.
|
||||
*
|
||||
* @return location
|
||||
* @return the location of the glass block.
|
||||
*/
|
||||
@NotNull
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the state of the block where the greenhouse glass is placed.
|
||||
*
|
||||
* @return the block state of the glass.
|
||||
*/
|
||||
@NotNull
|
||||
public CustomCropsBlockState getBlockState() {
|
||||
return blockState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item ID representing the glass type being placed.
|
||||
*
|
||||
* @return the glass item ID.
|
||||
*/
|
||||
@NotNull
|
||||
public String getGlassItemID() {
|
||||
return glassItemID;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
package net.momirealms.customcrops.api.event;
|
||||
|
||||
import net.momirealms.customcrops.api.core.block.BreakReason;
|
||||
import net.momirealms.customcrops.api.core.block.PotConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.pot.PotConfig;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
@@ -31,7 +31,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* An event that triggered when breaking a pot
|
||||
* An event that is triggered when a pot block is broken in the CustomCrops plugin.
|
||||
*/
|
||||
public class PotBreakEvent extends Event implements Cancellable {
|
||||
|
||||
@@ -44,6 +44,16 @@ public class PotBreakEvent extends Event implements Cancellable {
|
||||
private final Block blockBreaker;
|
||||
private final BreakReason reason;
|
||||
|
||||
/**
|
||||
* Constructor for the PotBreakEvent.
|
||||
*
|
||||
* @param entityBreaker The entity that caused the pot to break, if applicable (can be null).
|
||||
* @param blockBreaker The block that caused the pot to break, if applicable (can be null).
|
||||
* @param location The location of the pot block being broken.
|
||||
* @param config The configuration of the pot that is being broken.
|
||||
* @param blockState The state of the pot block before it was broken.
|
||||
* @param reason The reason why the pot was broken.
|
||||
*/
|
||||
public PotBreakEvent(
|
||||
@Nullable Entity entityBreaker,
|
||||
@Nullable Block blockBreaker,
|
||||
@@ -60,21 +70,41 @@ public class PotBreakEvent extends Event implements Cancellable {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the event is cancelled.
|
||||
*
|
||||
* @return true if the event is cancelled, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancelled state of the event.
|
||||
*
|
||||
* @param cancel true to cancel the event, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
cancelled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event.
|
||||
*
|
||||
* @return the static handler list.
|
||||
*/
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event instance.
|
||||
*
|
||||
* @return the handler list.
|
||||
*/
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
@@ -82,20 +112,30 @@ public class PotBreakEvent extends Event implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the pot location
|
||||
* Gets the location of the pot block being broken.
|
||||
*
|
||||
* @return location
|
||||
* @return the location of the pot block.
|
||||
*/
|
||||
@NotNull
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entity responsible for breaking the pot, if applicable.
|
||||
*
|
||||
* @return the entity that caused the break, or null if not applicable.
|
||||
*/
|
||||
@Nullable
|
||||
public Entity getEntityBreaker() {
|
||||
return entityBreaker;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the player responsible for breaking the pot, if the breaker is a player.
|
||||
*
|
||||
* @return the player that caused the break, or null if not applicable.
|
||||
*/
|
||||
@Nullable
|
||||
public Player getPlayer() {
|
||||
if (entityBreaker instanceof Player player) {
|
||||
@@ -104,21 +144,41 @@ public class PotBreakEvent extends Event implements Cancellable {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the reason for the pot breakage.
|
||||
*
|
||||
* @return the reason for the break.
|
||||
*/
|
||||
@NotNull
|
||||
public BreakReason getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the configuration of the pot that is being broken.
|
||||
*
|
||||
* @return the pot configuration.
|
||||
*/
|
||||
@NotNull
|
||||
public PotConfig getPotConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the state of the pot block before it was broken.
|
||||
*
|
||||
* @return the block state of the pot.
|
||||
*/
|
||||
@NotNull
|
||||
public CustomCropsBlockState getBlockState() {
|
||||
return blockState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the block responsible for breaking the pot, if applicable.
|
||||
*
|
||||
* @return the block that caused the break, or null if not applicable.
|
||||
*/
|
||||
@Nullable
|
||||
public Block getBlockBreaker() {
|
||||
return blockBreaker;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
package net.momirealms.customcrops.api.event;
|
||||
|
||||
import net.momirealms.customcrops.api.core.block.PotConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.pot.PotConfig;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import net.momirealms.customcrops.api.misc.water.WateringMethod;
|
||||
import org.bukkit.Location;
|
||||
@@ -30,7 +30,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* An event that triggered when a pot is watered by the fill-methods set in each pot's config
|
||||
* An event that is triggered when a pot is watered using the fill methods specified in each pot's configuration.
|
||||
*/
|
||||
public class PotFillEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
@@ -43,6 +43,17 @@ public class PotFillEvent extends PlayerEvent implements Cancellable {
|
||||
private final CustomCropsBlockState blockState;
|
||||
private final EquipmentSlot hand;
|
||||
|
||||
/**
|
||||
* Constructor for the PotFillEvent.
|
||||
*
|
||||
* @param player The player who is watering the pot.
|
||||
* @param itemInHand The ItemStack representing the item in the player's hand.
|
||||
* @param hand The hand (main or offhand) used by the player for watering.
|
||||
* @param location The location of the pot being watered.
|
||||
* @param wateringMethod The method used to water the pot.
|
||||
* @param blockState The state of the pot block before it is watered.
|
||||
* @param config The configuration of the pot being watered.
|
||||
*/
|
||||
public PotFillEvent(
|
||||
@NotNull Player player,
|
||||
@NotNull ItemStack itemInHand,
|
||||
@@ -61,21 +72,41 @@ public class PotFillEvent extends PlayerEvent implements Cancellable {
|
||||
this.hand = hand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the event is cancelled.
|
||||
*
|
||||
* @return true if the event is cancelled, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancelled state of the event.
|
||||
*
|
||||
* @param cancel true to cancel the event, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
cancelled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event.
|
||||
*
|
||||
* @return the static handler list.
|
||||
*/
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event instance.
|
||||
*
|
||||
* @return the handler list.
|
||||
*/
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
@@ -83,9 +114,9 @@ public class PotFillEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the pot location
|
||||
* Gets the location of the pot being watered.
|
||||
*
|
||||
* @return location
|
||||
* @return the location of the pot.
|
||||
*/
|
||||
@NotNull
|
||||
public Location getLocation() {
|
||||
@@ -93,30 +124,50 @@ public class PotFillEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the item in hand
|
||||
* Gets the ItemStack representing the item in the player's hand.
|
||||
*
|
||||
* @return item in hand
|
||||
* @return the item in hand.
|
||||
*/
|
||||
@NotNull
|
||||
public ItemStack getItemInHand() {
|
||||
return itemInHand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the configuration of the pot being watered.
|
||||
*
|
||||
* @return the pot configuration.
|
||||
*/
|
||||
@NotNull
|
||||
public PotConfig getPotConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the method used to water the pot.
|
||||
*
|
||||
* @return the watering method.
|
||||
*/
|
||||
@NotNull
|
||||
public WateringMethod getWateringMethod() {
|
||||
return wateringMethod;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the state of the pot block before it is watered.
|
||||
*
|
||||
* @return the block state of the pot.
|
||||
*/
|
||||
@NotNull
|
||||
public CustomCropsBlockState getBlockState() {
|
||||
return blockState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hand (main or offhand) used by the player to water the pot.
|
||||
*
|
||||
* @return the equipment slot representing the hand used.
|
||||
*/
|
||||
@NotNull
|
||||
public EquipmentSlot getHand() {
|
||||
return hand;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
package net.momirealms.customcrops.api.event;
|
||||
|
||||
import net.momirealms.customcrops.api.core.block.PotConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.pot.PotConfig;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -29,7 +29,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* This event is called when a player is interacting a pot
|
||||
* This event is called when a player interacts with a pot in the CustomCrops plugin.
|
||||
*/
|
||||
public class PotInteractEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
@@ -41,6 +41,16 @@ public class PotInteractEvent extends PlayerEvent implements Cancellable {
|
||||
private final PotConfig config;
|
||||
private final EquipmentSlot hand;
|
||||
|
||||
/**
|
||||
* Constructor for the PotInteractEvent.
|
||||
*
|
||||
* @param who The player who is interacting with the pot.
|
||||
* @param hand The hand (main or offhand) used by the player for the interaction.
|
||||
* @param itemInHand The ItemStack representing the item in the player's hand.
|
||||
* @param config The configuration of the pot being interacted with.
|
||||
* @param location The location of the pot block being interacted with.
|
||||
* @param blockState The state of the pot block at the time of interaction.
|
||||
*/
|
||||
public PotInteractEvent(
|
||||
@NotNull Player who,
|
||||
@NotNull EquipmentSlot hand,
|
||||
@@ -57,21 +67,41 @@ public class PotInteractEvent extends PlayerEvent implements Cancellable {
|
||||
this.hand = hand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the event is cancelled.
|
||||
*
|
||||
* @return true if the event is cancelled, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancelled state of the event.
|
||||
*
|
||||
* @param cancel true to cancel the event, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event.
|
||||
*
|
||||
* @return the static handler list.
|
||||
*/
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event instance.
|
||||
*
|
||||
* @return the handler list.
|
||||
*/
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
@@ -79,25 +109,30 @@ public class PotInteractEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the item in player's hand
|
||||
* If there's nothing in hand, it would return AIR
|
||||
* Gets the ItemStack representing the item in the player's hand.
|
||||
* If there is nothing in hand, it would return AIR.
|
||||
*
|
||||
* @return item in hand
|
||||
* @return the item in hand.
|
||||
*/
|
||||
@NotNull
|
||||
public ItemStack getItemInHand() {
|
||||
return itemInHand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hand (main or offhand) used by the player to interact with the pot.
|
||||
*
|
||||
* @return the equipment slot representing the hand used.
|
||||
*/
|
||||
@NotNull
|
||||
public EquipmentSlot getHand() {
|
||||
return hand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the pot location
|
||||
* Gets the location of the pot block being interacted with.
|
||||
*
|
||||
* @return pot location
|
||||
* @return the location of the pot.
|
||||
*/
|
||||
@NotNull
|
||||
public Location getLocation() {
|
||||
@@ -105,15 +140,20 @@ public class PotInteractEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the pot's data
|
||||
* Gets the state of the pot block at the time of interaction.
|
||||
*
|
||||
* @return pot key
|
||||
* @return the block state of the pot.
|
||||
*/
|
||||
@NotNull
|
||||
public CustomCropsBlockState getBlockState() {
|
||||
return blockState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the configuration of the pot being interacted with.
|
||||
*
|
||||
* @return the pot configuration.
|
||||
*/
|
||||
@NotNull
|
||||
public PotConfig getPotConfig() {
|
||||
return config;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
package net.momirealms.customcrops.api.event;
|
||||
|
||||
import net.momirealms.customcrops.api.core.block.PotConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.pot.PotConfig;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -29,7 +29,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* An event that triggered when placing a pot
|
||||
* An event that is triggered when a player places a pot in the CustomCrops plugin.
|
||||
*/
|
||||
public class PotPlaceEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
@@ -41,6 +41,16 @@ public class PotPlaceEvent extends PlayerEvent implements Cancellable {
|
||||
private final ItemStack itemInHand;
|
||||
private final EquipmentSlot hand;
|
||||
|
||||
/**
|
||||
* Constructor for the PotPlaceEvent.
|
||||
*
|
||||
* @param who The player who is placing the pot.
|
||||
* @param location The location where the pot is being placed.
|
||||
* @param config The configuration of the pot being placed.
|
||||
* @param state The state of the block where the pot is placed.
|
||||
* @param itemInHand The ItemStack representing the item in the player's hand.
|
||||
* @param hand The hand (main or offhand) used by the player for placing the pot.
|
||||
*/
|
||||
public PotPlaceEvent(
|
||||
@NotNull Player who,
|
||||
@NotNull Location location,
|
||||
@@ -57,21 +67,41 @@ public class PotPlaceEvent extends PlayerEvent implements Cancellable {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the event is cancelled.
|
||||
*
|
||||
* @return true if the event is cancelled, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancelled state of the event.
|
||||
*
|
||||
* @param cancel true to cancel the event, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event.
|
||||
*
|
||||
* @return the static handler list.
|
||||
*/
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event instance.
|
||||
*
|
||||
* @return the handler list.
|
||||
*/
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
@@ -79,30 +109,50 @@ public class PotPlaceEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the pot location
|
||||
* Gets the location where the pot is being placed.
|
||||
*
|
||||
* @return location
|
||||
* @return the location of the pot.
|
||||
*/
|
||||
@NotNull
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the state of the block where the pot is placed.
|
||||
*
|
||||
* @return the block state of the pot.
|
||||
*/
|
||||
@NotNull
|
||||
public CustomCropsBlockState getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ItemStack representing the item in the player's hand.
|
||||
*
|
||||
* @return the item in hand.
|
||||
*/
|
||||
@NotNull
|
||||
public ItemStack getItemInHand() {
|
||||
return itemInHand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hand (main or offhand) used by the player to place the pot.
|
||||
*
|
||||
* @return the equipment slot representing the hand used.
|
||||
*/
|
||||
@NotNull
|
||||
public EquipmentSlot getHand() {
|
||||
return hand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the configuration of the pot being placed.
|
||||
*
|
||||
* @return the pot configuration.
|
||||
*/
|
||||
@NotNull
|
||||
public PotConfig getPotConfig() {
|
||||
return config;
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* An event that triggered when breaking a scarecrow
|
||||
* An event that is triggered when a scarecrow is broken in the CustomCrops plugin.
|
||||
*/
|
||||
public class ScarecrowBreakEvent extends Event implements Cancellable {
|
||||
|
||||
@@ -42,6 +42,16 @@ public class ScarecrowBreakEvent extends Event implements Cancellable {
|
||||
private final CustomCropsBlockState blockState;
|
||||
private final String scarecrowItemID;
|
||||
|
||||
/**
|
||||
* Constructor for the ScarecrowBreakEvent.
|
||||
*
|
||||
* @param entityBreaker The entity that caused the scarecrow to break, if applicable (can be null).
|
||||
* @param blockBreaker The block that caused the scarecrow to break, if applicable (can be null).
|
||||
* @param location The location of the scarecrow being broken.
|
||||
* @param scarecrowItemID The item ID representing the scarecrow type being broken.
|
||||
* @param blockState The state of the scarecrow block before it was broken.
|
||||
* @param reason The reason why the scarecrow was broken.
|
||||
*/
|
||||
public ScarecrowBreakEvent(
|
||||
@Nullable Entity entityBreaker,
|
||||
@Nullable Block blockBreaker,
|
||||
@@ -58,21 +68,41 @@ public class ScarecrowBreakEvent extends Event implements Cancellable {
|
||||
this.scarecrowItemID = scarecrowItemID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the event is cancelled.
|
||||
*
|
||||
* @return true if the event is cancelled, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancelled state of the event.
|
||||
*
|
||||
* @param cancel true to cancel the event, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event.
|
||||
*
|
||||
* @return the static handler list.
|
||||
*/
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event instance.
|
||||
*
|
||||
* @return the handler list.
|
||||
*/
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
@@ -80,35 +110,60 @@ public class ScarecrowBreakEvent extends Event implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the scarecrow location
|
||||
* Gets the location of the scarecrow being broken.
|
||||
*
|
||||
* @return location
|
||||
* @return the location of the scarecrow.
|
||||
*/
|
||||
@NotNull
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entity responsible for breaking the scarecrow, if applicable.
|
||||
*
|
||||
* @return the entity that caused the break, or null if not applicable.
|
||||
*/
|
||||
@Nullable
|
||||
public Entity getEntityBreaker() {
|
||||
return entityBreaker;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the block responsible for breaking the scarecrow, if applicable.
|
||||
*
|
||||
* @return the block that caused the break, or null if not applicable.
|
||||
*/
|
||||
@Nullable
|
||||
public Block getBlockBreaker() {
|
||||
return blockBreaker;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the reason for the scarecrow breakage.
|
||||
*
|
||||
* @return the reason for the break.
|
||||
*/
|
||||
@NotNull
|
||||
public BreakReason getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the state of the scarecrow block before it was broken.
|
||||
*
|
||||
* @return the block state of the scarecrow.
|
||||
*/
|
||||
@NotNull
|
||||
public CustomCropsBlockState getBlockState() {
|
||||
return blockState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item ID representing the scarecrow type being broken.
|
||||
*
|
||||
* @return the scarecrow item ID.
|
||||
*/
|
||||
public String getScarecrowItemID() {
|
||||
return scarecrowItemID;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* An event that triggered when interacting a sprinkler
|
||||
* An event that is triggered when a player interacts with a scarecrow in the CustomCrops plugin.
|
||||
*/
|
||||
public class ScarecrowInteractEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
@@ -40,6 +40,16 @@ public class ScarecrowInteractEvent extends PlayerEvent implements Cancellable {
|
||||
private final String scarecrowItemID;
|
||||
private final EquipmentSlot hand;
|
||||
|
||||
/**
|
||||
* Constructor for the ScarecrowInteractEvent.
|
||||
*
|
||||
* @param who The player who is interacting with the scarecrow.
|
||||
* @param itemInHand The ItemStack representing the item in the player's hand.
|
||||
* @param location The location of the scarecrow block being interacted with.
|
||||
* @param scarecrowItemID The item ID representing the scarecrow type being interacted with.
|
||||
* @param blockState The state of the scarecrow block at the time of interaction.
|
||||
* @param hand The hand (main or offhand) used by the player for the interaction.
|
||||
*/
|
||||
public ScarecrowInteractEvent(
|
||||
@NotNull Player who,
|
||||
@NotNull ItemStack itemInHand,
|
||||
@@ -56,21 +66,41 @@ public class ScarecrowInteractEvent extends PlayerEvent implements Cancellable {
|
||||
this.scarecrowItemID = scarecrowItemID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the event is cancelled.
|
||||
*
|
||||
* @return true if the event is cancelled, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancelled state of the event.
|
||||
*
|
||||
* @param cancel true to cancel the event, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event.
|
||||
*
|
||||
* @return the static handler list.
|
||||
*/
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event instance.
|
||||
*
|
||||
* @return the handler list.
|
||||
*/
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
@@ -78,34 +108,49 @@ public class ScarecrowInteractEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the sprinkler location
|
||||
* Gets the location of the scarecrow block being interacted with.
|
||||
*
|
||||
* @return location
|
||||
* @return the location of the scarecrow.
|
||||
*/
|
||||
@NotNull
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the state of the scarecrow block at the time of interaction.
|
||||
*
|
||||
* @return the block state of the scarecrow.
|
||||
*/
|
||||
@NotNull
|
||||
public CustomCropsBlockState getBlockState() {
|
||||
return blockState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hand (main or offhand) used by the player to interact with the scarecrow.
|
||||
*
|
||||
* @return the equipment slot representing the hand used.
|
||||
*/
|
||||
@NotNull
|
||||
public EquipmentSlot getHand() {
|
||||
return hand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item ID representing the scarecrow type being interacted with.
|
||||
*
|
||||
* @return the scarecrow item ID.
|
||||
*/
|
||||
@NotNull
|
||||
public String getScarecrowItemID() {
|
||||
return scarecrowItemID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the item in player's hand
|
||||
* Gets the ItemStack representing the item in the player's hand.
|
||||
*
|
||||
* @return item in hand
|
||||
* @return the item in hand.
|
||||
*/
|
||||
@NotNull
|
||||
public ItemStack getItemInHand() {
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.bukkit.event.player.PlayerEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* An event that triggered when placing a scarecrow
|
||||
* An event that is triggered when a player places a scarecrow in the CustomCrops plugin.
|
||||
*/
|
||||
public class ScarecrowPlaceEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
@@ -36,6 +36,14 @@ public class ScarecrowPlaceEvent extends PlayerEvent implements Cancellable {
|
||||
private final String scarecrowItemID;
|
||||
private final CustomCropsBlockState blockState;
|
||||
|
||||
/**
|
||||
* Constructor for the ScarecrowPlaceEvent.
|
||||
*
|
||||
* @param who The player who is placing the scarecrow.
|
||||
* @param location The location where the scarecrow is being placed.
|
||||
* @param scarecrowItemID The item ID representing the scarecrow type being placed.
|
||||
* @param blockState The state of the block where the scarecrow is placed.
|
||||
*/
|
||||
public ScarecrowPlaceEvent(
|
||||
@NotNull Player who,
|
||||
@NotNull Location location,
|
||||
@@ -48,42 +56,72 @@ public class ScarecrowPlaceEvent extends PlayerEvent implements Cancellable {
|
||||
this.scarecrowItemID = scarecrowItemID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the event is cancelled.
|
||||
*
|
||||
* @return true if the event is cancelled, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancelled state of the event.
|
||||
*
|
||||
* @param cancel true to cancel the event, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event.
|
||||
*
|
||||
* @return the static handler list.
|
||||
*/
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event instance.
|
||||
*
|
||||
* @return the handler list.
|
||||
*/
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item ID representing the scarecrow type being placed.
|
||||
*
|
||||
* @return the scarecrow item ID.
|
||||
*/
|
||||
@NotNull
|
||||
public String getScarecrowItemID() {
|
||||
return scarecrowItemID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the scarecrow location
|
||||
* Gets the location where the scarecrow is being placed.
|
||||
*
|
||||
* @return location
|
||||
* @return the location of the scarecrow.
|
||||
*/
|
||||
@NotNull
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the state of the block where the scarecrow is placed.
|
||||
*
|
||||
* @return the block state of the scarecrow.
|
||||
*/
|
||||
@NotNull
|
||||
public CustomCropsBlockState getBlockState() {
|
||||
return blockState;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
package net.momirealms.customcrops.api.event;
|
||||
|
||||
import net.momirealms.customcrops.api.core.block.BreakReason;
|
||||
import net.momirealms.customcrops.api.core.block.SprinklerConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.sprinkler.SprinklerConfig;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
@@ -30,7 +30,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* An event that triggered when breaking a sprinkler
|
||||
* An event that is triggered when a sprinkler is broken in the CustomCrops plugin.
|
||||
*/
|
||||
public class SprinklerBreakEvent extends Event implements Cancellable {
|
||||
|
||||
@@ -43,6 +43,16 @@ public class SprinklerBreakEvent extends Event implements Cancellable {
|
||||
private final Block blockBreaker;
|
||||
private final BreakReason reason;
|
||||
|
||||
/**
|
||||
* Constructor for the SprinklerBreakEvent.
|
||||
*
|
||||
* @param entityBreaker The entity that caused the sprinkler to break, if applicable (can be null).
|
||||
* @param blockBreaker The block that caused the sprinkler to break, if applicable (can be null).
|
||||
* @param location The location of the sprinkler being broken.
|
||||
* @param blockState The state of the sprinkler block before it was broken.
|
||||
* @param config The configuration of the sprinkler being broken.
|
||||
* @param reason The reason why the sprinkler was broken.
|
||||
*/
|
||||
public SprinklerBreakEvent(
|
||||
@Nullable Entity entityBreaker,
|
||||
@Nullable Block blockBreaker,
|
||||
@@ -59,21 +69,41 @@ public class SprinklerBreakEvent extends Event implements Cancellable {
|
||||
this.blockState = blockState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the event is cancelled.
|
||||
*
|
||||
* @return true if the event is cancelled, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancelled state of the event.
|
||||
*
|
||||
* @param cancel true to cancel the event, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event.
|
||||
*
|
||||
* @return the static handler list.
|
||||
*/
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event instance.
|
||||
*
|
||||
* @return the handler list.
|
||||
*/
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
@@ -81,35 +111,60 @@ public class SprinklerBreakEvent extends Event implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the sprinkler location
|
||||
* Gets the location of the sprinkler being broken.
|
||||
*
|
||||
* @return location
|
||||
* @return the location of the sprinkler.
|
||||
*/
|
||||
@NotNull
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entity responsible for breaking the sprinkler, if applicable.
|
||||
*
|
||||
* @return the entity that caused the break, or null if not applicable.
|
||||
*/
|
||||
@Nullable
|
||||
public Entity getEntityBreaker() {
|
||||
return entityBreaker;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the state of the sprinkler block before it was broken.
|
||||
*
|
||||
* @return the block state of the sprinkler.
|
||||
*/
|
||||
@NotNull
|
||||
public CustomCropsBlockState getBlockState() {
|
||||
return blockState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the configuration of the sprinkler being broken.
|
||||
*
|
||||
* @return the sprinkler configuration.
|
||||
*/
|
||||
@NotNull
|
||||
public SprinklerConfig getSprinklerConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the block responsible for breaking the sprinkler, if applicable.
|
||||
*
|
||||
* @return the block that caused the break, or null if not applicable.
|
||||
*/
|
||||
@Nullable
|
||||
public Block getBlockBreaker() {
|
||||
return blockBreaker;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the reason for the sprinkler breakage.
|
||||
*
|
||||
* @return the reason for the break.
|
||||
*/
|
||||
@NotNull
|
||||
public BreakReason getReason() {
|
||||
return reason;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
package net.momirealms.customcrops.api.event;
|
||||
|
||||
import net.momirealms.customcrops.api.core.block.SprinklerConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.sprinkler.SprinklerConfig;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import net.momirealms.customcrops.api.misc.water.WateringMethod;
|
||||
import org.bukkit.Location;
|
||||
@@ -30,7 +30,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* An event that triggered when a pot is watered by the fill-methods set in each sprinkler's config
|
||||
* An event that is triggered when a sprinkler is filled with water using the fill methods defined in its configuration.
|
||||
*/
|
||||
public class SprinklerFillEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
@@ -43,6 +43,17 @@ public class SprinklerFillEvent extends PlayerEvent implements Cancellable {
|
||||
private final CustomCropsBlockState blockState;
|
||||
private final EquipmentSlot hand;
|
||||
|
||||
/**
|
||||
* Constructor for the SprinklerFillEvent.
|
||||
*
|
||||
* @param player The player who is filling the sprinkler.
|
||||
* @param itemInHand The ItemStack representing the item in the player's hand.
|
||||
* @param hand The hand (main or offhand) used by the player for filling.
|
||||
* @param location The location of the sprinkler being filled.
|
||||
* @param wateringMethod The method used to fill the sprinkler.
|
||||
* @param blockState The state of the sprinkler block before it is filled.
|
||||
* @param config The configuration of the sprinkler being filled.
|
||||
*/
|
||||
public SprinklerFillEvent(
|
||||
@NotNull Player player,
|
||||
@NotNull ItemStack itemInHand,
|
||||
@@ -61,21 +72,41 @@ public class SprinklerFillEvent extends PlayerEvent implements Cancellable {
|
||||
this.hand = hand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the event is cancelled.
|
||||
*
|
||||
* @return true if the event is cancelled, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancelled state of the event.
|
||||
*
|
||||
* @param cancel true to cancel the event, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
cancelled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event.
|
||||
*
|
||||
* @return the static handler list.
|
||||
*/
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event instance.
|
||||
*
|
||||
* @return the handler list.
|
||||
*/
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
@@ -83,9 +114,9 @@ public class SprinklerFillEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the pot location
|
||||
* Gets the location of the sprinkler being filled.
|
||||
*
|
||||
* @return location
|
||||
* @return the location of the sprinkler.
|
||||
*/
|
||||
@NotNull
|
||||
public Location getLocation() {
|
||||
@@ -93,30 +124,50 @@ public class SprinklerFillEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the item in hand
|
||||
* Gets the ItemStack representing the item in the player's hand.
|
||||
*
|
||||
* @return item in hand
|
||||
* @return the item in hand.
|
||||
*/
|
||||
@NotNull
|
||||
public ItemStack getItemInHand() {
|
||||
return itemInHand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the configuration of the sprinkler being filled.
|
||||
*
|
||||
* @return the sprinkler configuration.
|
||||
*/
|
||||
@NotNull
|
||||
public SprinklerConfig getSprinklerConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the method used to fill the sprinkler.
|
||||
*
|
||||
* @return the watering method.
|
||||
*/
|
||||
@NotNull
|
||||
public WateringMethod getWateringMethod() {
|
||||
return wateringMethod;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the state of the sprinkler block before it is filled.
|
||||
*
|
||||
* @return the block state of the sprinkler.
|
||||
*/
|
||||
@NotNull
|
||||
public CustomCropsBlockState getBlockState() {
|
||||
return blockState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hand (main or offhand) used by the player to fill the sprinkler.
|
||||
*
|
||||
* @return the equipment slot representing the hand used.
|
||||
*/
|
||||
@NotNull
|
||||
public EquipmentSlot getHand() {
|
||||
return hand;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
package net.momirealms.customcrops.api.event;
|
||||
|
||||
import net.momirealms.customcrops.api.core.block.SprinklerConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.sprinkler.SprinklerConfig;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -29,7 +29,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* An event that triggered when interacting a sprinkler
|
||||
* An event that is triggered when a player interacts with a sprinkler in the CustomCrops plugin.
|
||||
*/
|
||||
public class SprinklerInteractEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
@@ -41,6 +41,16 @@ public class SprinklerInteractEvent extends PlayerEvent implements Cancellable {
|
||||
private final ItemStack itemInHand;
|
||||
private final EquipmentSlot hand;
|
||||
|
||||
/**
|
||||
* Constructor for the SprinklerInteractEvent.
|
||||
*
|
||||
* @param who The player who is interacting with the sprinkler.
|
||||
* @param itemInHand The ItemStack representing the item in the player's hand.
|
||||
* @param location The location of the sprinkler being interacted with.
|
||||
* @param config The configuration of the sprinkler being interacted with.
|
||||
* @param blockState The state of the sprinkler block at the time of interaction.
|
||||
* @param hand The hand (main or offhand) used by the player for the interaction.
|
||||
*/
|
||||
public SprinklerInteractEvent(
|
||||
@NotNull Player who,
|
||||
@NotNull ItemStack itemInHand,
|
||||
@@ -57,21 +67,41 @@ public class SprinklerInteractEvent extends PlayerEvent implements Cancellable {
|
||||
this.blockState = blockState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the event is cancelled.
|
||||
*
|
||||
* @return true if the event is cancelled, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancelled state of the event.
|
||||
*
|
||||
* @param cancel true to cancel the event, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event.
|
||||
*
|
||||
* @return the static handler list.
|
||||
*/
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event instance.
|
||||
*
|
||||
* @return the handler list.
|
||||
*/
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
@@ -79,34 +109,49 @@ public class SprinklerInteractEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the sprinkler location
|
||||
* Gets the location of the sprinkler being interacted with.
|
||||
*
|
||||
* @return location
|
||||
* @return the location of the sprinkler.
|
||||
*/
|
||||
@NotNull
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the state of the sprinkler block at the time of interaction.
|
||||
*
|
||||
* @return the block state of the sprinkler.
|
||||
*/
|
||||
@NotNull
|
||||
public CustomCropsBlockState getBlockState() {
|
||||
return blockState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the configuration of the sprinkler being interacted with.
|
||||
*
|
||||
* @return the sprinkler configuration.
|
||||
*/
|
||||
@NotNull
|
||||
public SprinklerConfig getSprinklerConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hand (main or offhand) used by the player to interact with the sprinkler.
|
||||
*
|
||||
* @return the equipment slot representing the hand used.
|
||||
*/
|
||||
@NotNull
|
||||
public EquipmentSlot getHand() {
|
||||
return hand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the item in player's hand
|
||||
* Gets the ItemStack representing the item in the player's hand.
|
||||
*
|
||||
* @return item in hand
|
||||
* @return the item in hand.
|
||||
*/
|
||||
@NotNull
|
||||
public ItemStack getItemInHand() {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
package net.momirealms.customcrops.api.event;
|
||||
|
||||
import net.momirealms.customcrops.api.core.block.SprinklerConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.sprinkler.SprinklerConfig;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -28,8 +28,9 @@ import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
||||
/**
|
||||
* An event that triggered when placing a sprinkler
|
||||
* An event that is triggered when a player places a sprinkler in the CustomCrops plugin.
|
||||
*/
|
||||
public class SprinklerPlaceEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
@@ -41,6 +42,16 @@ public class SprinklerPlaceEvent extends PlayerEvent implements Cancellable {
|
||||
private final CustomCropsBlockState blockState;
|
||||
private final EquipmentSlot hand;
|
||||
|
||||
/**
|
||||
* Constructor for the SprinklerPlaceEvent.
|
||||
*
|
||||
* @param who The player who is placing the sprinkler.
|
||||
* @param itemInHand The ItemStack representing the item in the player's hand.
|
||||
* @param hand The hand (main or offhand) used by the player to place the sprinkler.
|
||||
* @param location The location where the sprinkler is being placed.
|
||||
* @param config The configuration of the sprinkler being placed.
|
||||
* @param blockState The state of the block where the sprinkler is placed.
|
||||
*/
|
||||
public SprinklerPlaceEvent(
|
||||
@NotNull Player who,
|
||||
@NotNull ItemStack itemInHand,
|
||||
@@ -57,21 +68,41 @@ public class SprinklerPlaceEvent extends PlayerEvent implements Cancellable {
|
||||
this.blockState = blockState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the event is cancelled.
|
||||
*
|
||||
* @return true if the event is cancelled, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancelled state of the event.
|
||||
*
|
||||
* @param cancel true to cancel the event, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event.
|
||||
*
|
||||
* @return the static handler list.
|
||||
*/
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event instance.
|
||||
*
|
||||
* @return the handler list.
|
||||
*/
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
@@ -79,35 +110,50 @@ public class SprinklerPlaceEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the item in player's hand
|
||||
* Gets the ItemStack representing the item in the player's hand.
|
||||
*
|
||||
* @return item in hand
|
||||
* @return the item in hand.
|
||||
*/
|
||||
@NotNull
|
||||
public ItemStack getItemInHand() {
|
||||
return itemInHand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the state of the block where the sprinkler is placed.
|
||||
*
|
||||
* @return the block state of the sprinkler.
|
||||
*/
|
||||
@NotNull
|
||||
public CustomCropsBlockState getBlockState() {
|
||||
return blockState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the sprinkler location
|
||||
* Gets the location where the sprinkler is being placed.
|
||||
*
|
||||
* @return location
|
||||
* @return the location of the sprinkler.
|
||||
*/
|
||||
@NotNull
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the configuration of the sprinkler being placed.
|
||||
*
|
||||
* @return the sprinkler configuration.
|
||||
*/
|
||||
@NotNull
|
||||
public SprinklerConfig getSprinklerConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hand (main or offhand) used by the player to place the sprinkler.
|
||||
*
|
||||
* @return the equipment slot representing the hand used.
|
||||
*/
|
||||
@NotNull
|
||||
public EquipmentSlot getHand() {
|
||||
return hand;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
package net.momirealms.customcrops.api.event;
|
||||
|
||||
import net.momirealms.customcrops.api.core.item.WateringCanConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.wateringcan.WateringCanConfig;
|
||||
import net.momirealms.customcrops.api.misc.water.FillMethod;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -29,7 +29,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* An event that triggered when player tries to add water to the watering-can
|
||||
* An event that is triggered when a player attempts to add water to a watering can in the CustomCrops plugin.
|
||||
*/
|
||||
public class WateringCanFillEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
@@ -41,6 +41,16 @@ public class WateringCanFillEvent extends PlayerEvent implements Cancellable {
|
||||
private final Location location;
|
||||
private final EquipmentSlot hand;
|
||||
|
||||
/**
|
||||
* Constructor for the WateringCanFillEvent.
|
||||
*
|
||||
* @param player The player who is filling the watering can.
|
||||
* @param hand The hand (main or offhand) used by the player to hold the watering can.
|
||||
* @param itemInHand The ItemStack representing the watering can in the player's hand.
|
||||
* @param location The location where the filling action is taking place.
|
||||
* @param config The configuration of the watering can being filled.
|
||||
* @param fillMethod The method used to fill the watering can.
|
||||
*/
|
||||
public WateringCanFillEvent(
|
||||
@NotNull Player player,
|
||||
@NotNull EquipmentSlot hand,
|
||||
@@ -58,60 +68,90 @@ public class WateringCanFillEvent extends PlayerEvent implements Cancellable {
|
||||
this.hand = hand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the event is cancelled.
|
||||
*
|
||||
* @return true if the event is cancelled, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancelled state of the event.
|
||||
*
|
||||
* @param cancel true to cancel the event, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
cancelled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event.
|
||||
*
|
||||
* @return the static handler list.
|
||||
*/
|
||||
@Override
|
||||
public @NotNull HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event.
|
||||
*
|
||||
* @return the static handler list.
|
||||
*/
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the watering can item
|
||||
* Gets the ItemStack representing the watering can in the player's hand.
|
||||
*
|
||||
* @return the watering can item
|
||||
* @return the watering can item.
|
||||
*/
|
||||
@NotNull
|
||||
public ItemStack getItemInHand() {
|
||||
return itemInHand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the configuration of the watering can being filled.
|
||||
*
|
||||
* @return the watering can configuration.
|
||||
*/
|
||||
@NotNull
|
||||
public WateringCanConfig getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the positive fill method
|
||||
* Gets the method used to fill the watering can.
|
||||
*
|
||||
* @return positive fill method
|
||||
* @return the fill method.
|
||||
*/
|
||||
@NotNull
|
||||
public FillMethod getFillMethod() {
|
||||
return fillMethod;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hand (main or offhand) used by the player to hold the watering can.
|
||||
*
|
||||
* @return the equipment slot representing the hand used.
|
||||
*/
|
||||
@NotNull
|
||||
public EquipmentSlot getHand() {
|
||||
return hand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the location
|
||||
* Gets the location where the filling action is taking place.
|
||||
*
|
||||
* @return location
|
||||
* @return the location of the action.
|
||||
*/
|
||||
@NotNull
|
||||
public Location getLocation() {
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
package net.momirealms.customcrops.api.event;
|
||||
|
||||
import net.momirealms.customcrops.api.core.block.PotConfig;
|
||||
import net.momirealms.customcrops.api.core.item.WateringCanConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.pot.PotConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.wateringcan.WateringCanConfig;
|
||||
import net.momirealms.customcrops.api.core.world.Pos3;
|
||||
import net.momirealms.customcrops.common.util.Pair;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* An event that triggered when player tries to use watering-can to add water to pots/sprinklers
|
||||
* An event that is triggered when a player attempts to use a watering can to add water to pots or sprinklers.
|
||||
*/
|
||||
public class WateringCanWaterPotEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
@@ -44,6 +44,16 @@ public class WateringCanWaterPotEvent extends PlayerEvent implements Cancellable
|
||||
private final PotConfig potConfig;
|
||||
private final List<Pair<Pos3, String>> potWithIDs;
|
||||
|
||||
/**
|
||||
* Constructor for the WateringCanWaterPotEvent.
|
||||
*
|
||||
* @param player The player who is using the watering can.
|
||||
* @param itemInHand The ItemStack representing the watering can in the player's hand.
|
||||
* @param hand The hand (main or offhand) used by the player to hold the watering can.
|
||||
* @param wateringCanConfig The configuration of the watering can being used.
|
||||
* @param potConfig The configuration of the pot being watered.
|
||||
* @param potWithIDs The list of pots with their positions and IDs.
|
||||
*/
|
||||
public WateringCanWaterPotEvent(
|
||||
@NotNull Player player,
|
||||
@NotNull ItemStack itemInHand,
|
||||
@@ -61,51 +71,91 @@ public class WateringCanWaterPotEvent extends PlayerEvent implements Cancellable
|
||||
this.potWithIDs = potWithIDs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the event is cancelled.
|
||||
*
|
||||
* @return true if the event is cancelled, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancelled state of the event.
|
||||
*
|
||||
* @param cancel true to cancel the event, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
cancelled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event instance.
|
||||
*
|
||||
* @return the handler list.
|
||||
*/
|
||||
@Override
|
||||
public @NotNull HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event.
|
||||
*
|
||||
* @return the static handler list.
|
||||
*/
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the watering can item
|
||||
* Gets the ItemStack representing the watering can in the player's hand.
|
||||
*
|
||||
* @return watering can item
|
||||
* @return the watering can item.
|
||||
*/
|
||||
@NotNull
|
||||
public ItemStack getItemInHand() {
|
||||
return itemInHand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hand (main or offhand) used by the player to hold the watering can.
|
||||
*
|
||||
* @return the equipment slot representing the hand used.
|
||||
*/
|
||||
@NotNull
|
||||
public EquipmentSlot getHand() {
|
||||
return hand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the configuration of the watering can being used.
|
||||
*
|
||||
* @return the watering can configuration.
|
||||
*/
|
||||
@NotNull
|
||||
public WateringCanConfig getWateringCanConfig() {
|
||||
return wateringCanConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the configuration of the pot being watered.
|
||||
*
|
||||
* @return the pot configuration.
|
||||
*/
|
||||
@NotNull
|
||||
public PotConfig getPotConfig() {
|
||||
return potConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of pots with their positions and IDs.
|
||||
*
|
||||
* @return the list of pots with positions and IDs.
|
||||
*/
|
||||
@NotNull
|
||||
public List<Pair<Pos3, String>> getPotWithIDs() {
|
||||
return potWithIDs;
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
package net.momirealms.customcrops.api.event;
|
||||
|
||||
import net.momirealms.customcrops.api.core.block.SprinklerConfig;
|
||||
import net.momirealms.customcrops.api.core.item.WateringCanConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.sprinkler.SprinklerConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.wateringcan.WateringCanConfig;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -30,7 +30,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* An event that triggered when player tries to use watering-can to add water to pots/sprinklers
|
||||
* An event that is triggered when a player attempts to use a watering can to add water to a sprinkler in the CustomCrops plugin.
|
||||
*/
|
||||
public class WateringCanWaterSprinklerEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
@@ -43,6 +43,17 @@ public class WateringCanWaterSprinklerEvent extends PlayerEvent implements Cance
|
||||
private final CustomCropsBlockState blockState;
|
||||
private final Location location;
|
||||
|
||||
/**
|
||||
* Constructor for the WateringCanWaterSprinklerEvent.
|
||||
*
|
||||
* @param player The player who is using the watering can.
|
||||
* @param itemInHand The ItemStack representing the watering can in the player's hand.
|
||||
* @param hand The hand (main or offhand) used by the player to hold the watering can.
|
||||
* @param wateringCanConfig The configuration of the watering can being used.
|
||||
* @param sprinklerConfig The configuration of the sprinkler being watered.
|
||||
* @param blockState The state of the block where the sprinkler is located.
|
||||
* @param location The location of the sprinkler being watered.
|
||||
*/
|
||||
public WateringCanWaterSprinklerEvent(
|
||||
@NotNull Player player,
|
||||
@NotNull ItemStack itemInHand,
|
||||
@@ -62,56 +73,101 @@ public class WateringCanWaterSprinklerEvent extends PlayerEvent implements Cance
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the event is cancelled.
|
||||
*
|
||||
* @return true if the event is cancelled, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancelled state of the event.
|
||||
*
|
||||
* @param cancel true to cancel the event, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
cancelled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event instance.
|
||||
*
|
||||
* @return the handler list.
|
||||
*/
|
||||
@Override
|
||||
public @NotNull HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of handlers for this event.
|
||||
*
|
||||
* @return the static handler list.
|
||||
*/
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the watering can item
|
||||
* Gets the ItemStack representing the watering can in the player's hand.
|
||||
*
|
||||
* @return watering can item
|
||||
* @return the watering can item.
|
||||
*/
|
||||
@NotNull
|
||||
public ItemStack getItemInHand() {
|
||||
return itemInHand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hand (main or offhand) used by the player to hold the watering can.
|
||||
*
|
||||
* @return the equipment slot representing the hand used.
|
||||
*/
|
||||
@NotNull
|
||||
public EquipmentSlot getHand() {
|
||||
return hand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the configuration of the watering can being used.
|
||||
*
|
||||
* @return the watering can configuration.
|
||||
*/
|
||||
@NotNull
|
||||
public WateringCanConfig getWateringCanConfig() {
|
||||
return wateringCanConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the configuration of the sprinkler being watered.
|
||||
*
|
||||
* @return the sprinkler configuration.
|
||||
*/
|
||||
@NotNull
|
||||
public SprinklerConfig getSprinklerConfig() {
|
||||
return sprinklerConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the state of the block where the sprinkler is located.
|
||||
*
|
||||
* @return the block state of the sprinkler.
|
||||
*/
|
||||
@NotNull
|
||||
public CustomCropsBlockState getBlockState() {
|
||||
return blockState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the location of the sprinkler being watered.
|
||||
*
|
||||
* @return the location of the sprinkler.
|
||||
*/
|
||||
@NotNull
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
|
||||
@@ -23,12 +23,12 @@ import net.momirealms.customcrops.api.action.Action;
|
||||
import net.momirealms.customcrops.api.action.ActionManager;
|
||||
import net.momirealms.customcrops.api.context.ContextKeys;
|
||||
import net.momirealms.customcrops.api.core.ConfigManager;
|
||||
import net.momirealms.customcrops.api.core.block.CrowAttack;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.CrowAttack;
|
||||
import net.momirealms.customcrops.api.core.block.GreenhouseBlock;
|
||||
import net.momirealms.customcrops.api.core.block.PotBlock;
|
||||
import net.momirealms.customcrops.api.core.block.ScarecrowBlock;
|
||||
import net.momirealms.customcrops.api.core.item.Fertilizer;
|
||||
import net.momirealms.customcrops.api.core.item.FertilizerConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.fertilizer.Fertilizer;
|
||||
import net.momirealms.customcrops.api.core.mechanic.fertilizer.FertilizerConfig;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsWorld;
|
||||
import net.momirealms.customcrops.api.core.world.Pos3;
|
||||
|
||||
@@ -22,6 +22,7 @@ import net.momirealms.customcrops.api.core.ConfigManager;
|
||||
import net.momirealms.customcrops.api.core.SimpleRegistryAccess;
|
||||
import net.momirealms.customcrops.api.core.block.*;
|
||||
import net.momirealms.customcrops.api.core.item.*;
|
||||
import net.momirealms.customcrops.api.core.mechanic.fertilizer.FertilizerType;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import net.momirealms.customcrops.api.event.CustomCropsReloadEvent;
|
||||
import net.momirealms.customcrops.api.misc.HologramManager;
|
||||
|
||||
@@ -27,9 +27,9 @@ import net.momirealms.customcrops.api.core.ExistenceForm;
|
||||
import net.momirealms.customcrops.api.core.FurnitureRotation;
|
||||
import net.momirealms.customcrops.api.core.block.CropBlock;
|
||||
import net.momirealms.customcrops.api.core.block.PotBlock;
|
||||
import net.momirealms.customcrops.api.core.block.VariationData;
|
||||
import net.momirealms.customcrops.api.core.item.Fertilizer;
|
||||
import net.momirealms.customcrops.api.core.item.FertilizerConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.VariationData;
|
||||
import net.momirealms.customcrops.api.core.mechanic.fertilizer.Fertilizer;
|
||||
import net.momirealms.customcrops.api.core.mechanic.fertilizer.FertilizerConfig;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsChunk;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsWorld;
|
||||
|
||||
@@ -28,7 +28,7 @@ import net.momirealms.customcrops.api.action.Action;
|
||||
import net.momirealms.customcrops.api.context.ContextKeys;
|
||||
import net.momirealms.customcrops.api.core.block.CustomCropsBlock;
|
||||
import net.momirealms.customcrops.api.core.block.SprinklerBlock;
|
||||
import net.momirealms.customcrops.api.core.block.SprinklerConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.sprinkler.SprinklerConfig;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsWorld;
|
||||
import net.momirealms.customcrops.api.core.world.Pos3;
|
||||
import net.momirealms.customcrops.api.misc.placeholder.BukkitPlaceholderManager;
|
||||
|
||||
@@ -30,9 +30,13 @@ import dev.dejvokep.boostedyaml.settings.updater.UpdaterSettings;
|
||||
import dev.dejvokep.boostedyaml.utils.format.NodeRole;
|
||||
import net.momirealms.customcrops.api.BukkitCustomCropsPlugin;
|
||||
import net.momirealms.customcrops.api.core.*;
|
||||
import net.momirealms.customcrops.api.core.block.*;
|
||||
import net.momirealms.customcrops.api.core.item.FertilizerConfig;
|
||||
import net.momirealms.customcrops.api.core.item.WateringCanConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.fertilizer.FertilizerConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.wateringcan.WateringCanConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.DeathCondition;
|
||||
import net.momirealms.customcrops.api.core.mechanic.pot.PotConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.CropConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.CropStageConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.sprinkler.SprinklerConfig;
|
||||
import net.momirealms.customcrops.common.helper.AdventureHelper;
|
||||
import net.momirealms.customcrops.common.locale.TranslationManager;
|
||||
import net.momirealms.customcrops.common.plugin.CustomCropsProperties;
|
||||
|
||||
@@ -25,13 +25,13 @@ import net.momirealms.customcrops.api.core.ConfigManager;
|
||||
import net.momirealms.customcrops.api.core.CustomForm;
|
||||
import net.momirealms.customcrops.api.core.ExistenceForm;
|
||||
import net.momirealms.customcrops.api.core.Registries;
|
||||
import net.momirealms.customcrops.api.core.block.CropConfig;
|
||||
import net.momirealms.customcrops.api.core.block.CropStageConfig;
|
||||
import net.momirealms.customcrops.api.core.block.PotConfig;
|
||||
import net.momirealms.customcrops.api.core.block.SprinklerConfig;
|
||||
import net.momirealms.customcrops.api.core.item.FertilizerConfig;
|
||||
import net.momirealms.customcrops.api.core.item.FertilizerType;
|
||||
import net.momirealms.customcrops.api.core.item.WateringCanConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.CropConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.crop.CropStageConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.pot.PotConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.sprinkler.SprinklerConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.fertilizer.FertilizerConfig;
|
||||
import net.momirealms.customcrops.api.core.mechanic.fertilizer.FertilizerType;
|
||||
import net.momirealms.customcrops.api.core.mechanic.wateringcan.WateringCanConfig;
|
||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
||||
import net.momirealms.customcrops.api.misc.value.TextValue;
|
||||
import net.momirealms.customcrops.api.misc.water.WaterBar;
|
||||
|
||||
Reference in New Issue
Block a user