9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-19 15:09:25 +00:00

Refactor events

This commit is contained in:
XiaoMoMi
2024-09-04 22:26:27 +08:00
parent 14c3d0a338
commit 33cfd7deac
30 changed files with 143 additions and 157 deletions

View File

@@ -912,7 +912,7 @@ public abstract class AbstractActionManager<T> implements ActionManager<T> {
if (EventUtils.fireAndCheckCancel(plantEvent)) {
return;
}
cropBlock.point(state, plantEvent.getPoint());
cropBlock.point(state, plantEvent.point());
if (triggerAction) {
ActionManager.trigger((Context<Player>) context, cropConfig.plantActions());
}

View File

@@ -100,7 +100,7 @@ public class SeedItem extends AbstractCustomCropsItem {
if (EventUtils.fireAndCheckCancel(plantEvent)) {
return InteractionResult.COMPLETE;
}
int point = plantEvent.getPoint();
int point = plantEvent.point();
CropStageConfig stageConfig = cropConfig.stageWithModelByPoint(point);
if (stageConfig == null) {
return InteractionResult.COMPLETE;

View File

@@ -281,7 +281,7 @@ public class WateringCanItem extends AbstractCustomCropsItem {
context.arg(ContextKeys.CURRENT_WATER, waterInCan - 1);
PotBlock potBlock = (PotBlock) BuiltInBlockMechanics.POT.mechanic();
for (Pair<Pos3, String> pair : waterPotEvent.getPotWithIDs()) {
for (Pair<Pos3, String> pair : waterPotEvent.pots()) {
CustomCropsBlockState potState = potBlock.fixOrGetState(world,pair.left(), potConfig, pair.right());
Location temp = pair.left().toLocation(bukkitWorld);
if (potBlock.addWater(potState, potConfig, wateringCanConfig.wateringAmount())) {

View File

@@ -112,7 +112,7 @@ public class BoneMealDispenseEvent extends Event implements Cancellable {
* @return the location of the crop block.
*/
@NotNull
public Location getLocation() {
public Location location() {
return location;
}
@@ -122,7 +122,7 @@ public class BoneMealDispenseEvent extends Event implements Cancellable {
* @return the ItemStack of bone meal.
*/
@NotNull
public ItemStack getBoneMealItem() {
public ItemStack boneMealItem() {
return boneMealItem;
}
@@ -132,7 +132,7 @@ public class BoneMealDispenseEvent extends Event implements Cancellable {
* @return the block state of the crop.
*/
@NotNull
public CustomCropsBlockState getBlockState() {
public CustomCropsBlockState blockState() {
return blockState;
}
@@ -142,7 +142,7 @@ public class BoneMealDispenseEvent extends Event implements Cancellable {
* @return the BoneMeal configuration.
*/
@NotNull
public BoneMeal getBoneMeal() {
public BoneMeal boneMeal() {
return boneMeal;
}
@@ -152,7 +152,7 @@ public class BoneMealDispenseEvent extends Event implements Cancellable {
* @return the dispenser block.
*/
@NotNull
public Block getDispenser() {
public Block dispenser() {
return dispenser;
}
}

View File

@@ -120,7 +120,7 @@ public class BoneMealUseEvent extends PlayerEvent implements Cancellable {
* @return the location of the crop block.
*/
@NotNull
public Location getLocation() {
public Location location() {
return location;
}
@@ -130,7 +130,7 @@ public class BoneMealUseEvent extends PlayerEvent implements Cancellable {
* @return the crop configuration.
*/
@NotNull
public CropConfig getConfig() {
public CropConfig cropConfig() {
return config;
}
@@ -141,7 +141,7 @@ public class BoneMealUseEvent extends PlayerEvent implements Cancellable {
* @return the ItemStack in hand.
*/
@NotNull
public ItemStack getItemInHand() {
public ItemStack itemInHand() {
return itemInHand;
}
@@ -151,7 +151,7 @@ public class BoneMealUseEvent extends PlayerEvent implements Cancellable {
* @return the block state of the crop.
*/
@NotNull
public CustomCropsBlockState getBlockState() {
public CustomCropsBlockState blockState() {
return blockState;
}
@@ -161,7 +161,7 @@ public class BoneMealUseEvent extends PlayerEvent implements Cancellable {
* @return the equipment slot.
*/
@NotNull
public EquipmentSlot getEquipmentSlot() {
public EquipmentSlot hand() {
return equipmentSlot;
}
@@ -171,7 +171,7 @@ public class BoneMealUseEvent extends PlayerEvent implements Cancellable {
* @return the BoneMeal configuration.
*/
@NotNull
public BoneMeal getBoneMeal() {
public BoneMeal boneMeal() {
return boneMeal;
}
}

View File

@@ -122,7 +122,7 @@ public class CropBreakEvent extends Event implements Cancellable {
* @return the location of the broken crop block.
*/
@NotNull
public Location getLocation() {
public Location location() {
return location;
}
@@ -132,7 +132,7 @@ public class CropBreakEvent extends Event implements Cancellable {
* @return the block that caused the break, or null if not applicable.
*/
@Nullable
public Block getBlockBreaker() {
public Block blockBreaker() {
return blockBreaker;
}
@@ -142,7 +142,7 @@ public class CropBreakEvent extends Event implements Cancellable {
* @return the entity that caused the break, or null if not applicable.
*/
@Nullable
public Entity getEntityBreaker() {
public Entity entityBreaker() {
return entityBreaker;
}
@@ -152,7 +152,7 @@ public class CropBreakEvent extends Event implements Cancellable {
* @return the block state before breakage, or null if not applicable.
*/
@NotNull
public CustomCropsBlockState getBlockState() {
public CustomCropsBlockState blockState() {
return blockState;
}
@@ -162,7 +162,7 @@ public class CropBreakEvent extends Event implements Cancellable {
* @return the stage item ID.
*/
@NotNull
public String getStageItemID() {
public String cropStageItemID() {
return stageItemID;
}
@@ -172,7 +172,7 @@ public class CropBreakEvent extends Event implements Cancellable {
* @return the crop configuration.
*/
@NotNull
public CropConfig getCropConfig() {
public CropConfig cropConfig() {
return config;
}
@@ -182,7 +182,7 @@ public class CropBreakEvent extends Event implements Cancellable {
* @return the reason for the break.
*/
@NotNull
public BreakReason getReason() {
public BreakReason reason() {
return reason;
}
}

View File

@@ -118,7 +118,7 @@ public class CropInteractEvent extends PlayerEvent implements Cancellable {
* @return the location of the crop block.
*/
@NotNull
public Location getLocation() {
public Location location() {
return location;
}
@@ -129,7 +129,7 @@ public class CropInteractEvent extends PlayerEvent implements Cancellable {
* @return the ItemStack in hand.
*/
@NotNull
public ItemStack getItemInHand() {
public ItemStack itemInHand() {
return itemInHand;
}
@@ -139,7 +139,7 @@ public class CropInteractEvent extends PlayerEvent implements Cancellable {
* @return the crop configuration.
*/
@NotNull
public CropConfig getCropConfig() {
public CropConfig cropConfig() {
return config;
}
@@ -149,7 +149,7 @@ public class CropInteractEvent extends PlayerEvent implements Cancellable {
* @return the block state of the crop.
*/
@NotNull
public CustomCropsBlockState getBlockState() {
public CustomCropsBlockState blockState() {
return blockState;
}
@@ -159,7 +159,7 @@ public class CropInteractEvent extends PlayerEvent implements Cancellable {
* @return the equipment slot representing the hand used.
*/
@NotNull
public EquipmentSlot getHand() {
public EquipmentSlot hand() {
return hand;
}
@@ -169,7 +169,7 @@ public class CropInteractEvent extends PlayerEvent implements Cancellable {
* @return the stage item ID.
*/
@NotNull
public String getStageItemID() {
public String cropStageItemID() {
return stageItemID;
}
}

View File

@@ -97,7 +97,7 @@ public class CropPlantEvent extends PlayerEvent implements Cancellable {
* @return the seed item.
*/
@NotNull
public ItemStack getItemInHand() {
public ItemStack itemInHand() {
return itemInHand;
}
@@ -128,7 +128,7 @@ public class CropPlantEvent extends PlayerEvent implements Cancellable {
* @return the block state of the crop.
*/
@NotNull
public CustomCropsBlockState getBlockState() {
public CustomCropsBlockState blockState() {
return blockState;
}
@@ -138,7 +138,7 @@ public class CropPlantEvent extends PlayerEvent implements Cancellable {
* @return the equipment slot representing the hand used.
*/
@NotNull
public EquipmentSlot getHand() {
public EquipmentSlot hand() {
return hand;
}
@@ -148,7 +148,7 @@ public class CropPlantEvent extends PlayerEvent implements Cancellable {
* @return the crop configuration.
*/
@NotNull
public CropConfig getCropConfig() {
public CropConfig cropConfig() {
return config;
}
@@ -158,7 +158,7 @@ public class CropPlantEvent extends PlayerEvent implements Cancellable {
* @return the location of the crop.
*/
@NotNull
public Location getLocation() {
public Location location() {
return location;
}
@@ -168,7 +168,7 @@ public class CropPlantEvent extends PlayerEvent implements Cancellable {
*
* @return the initial point.
*/
public int getPoint() {
public int point() {
return point;
}
@@ -177,7 +177,7 @@ public class CropPlantEvent extends PlayerEvent implements Cancellable {
*
* @param point the new initial point value.
*/
public void setPoint(int point) {
public void point(int point) {
this.point = point;
}
}

View File

@@ -64,7 +64,7 @@ public class CustomCropsReloadEvent extends Event {
*
* @return the plugin instance.
*/
public BukkitCustomCropsPlugin getPluginInstance() {
public BukkitCustomCropsPlugin plugin() {
return plugin;
}
}

View File

@@ -119,7 +119,7 @@ public class FertilizerUseEvent extends PlayerEvent implements Cancellable {
* @return the item in hand.
*/
@NotNull
public ItemStack getItemInHand() {
public ItemStack itemInHand() {
return itemInHand;
}
@@ -129,7 +129,7 @@ public class FertilizerUseEvent extends PlayerEvent implements Cancellable {
* @return the location of the pot.
*/
@NotNull
public Location getLocation() {
public Location location() {
return location;
}
@@ -139,7 +139,7 @@ public class FertilizerUseEvent extends PlayerEvent implements Cancellable {
* @return the block state of the pot.
*/
@NotNull
public CustomCropsBlockState getBlockState() {
public CustomCropsBlockState blockState() {
return blockState;
}
@@ -149,7 +149,7 @@ public class FertilizerUseEvent extends PlayerEvent implements Cancellable {
* @return the equipment slot representing the hand used.
*/
@NotNull
public EquipmentSlot getHand() {
public EquipmentSlot hand() {
return hand;
}
@@ -159,7 +159,7 @@ public class FertilizerUseEvent extends PlayerEvent implements Cancellable {
* @return the pot configuration.
*/
@NotNull
public PotConfig getPotConfig() {
public PotConfig potConfig() {
return config;
}
@@ -169,7 +169,7 @@ public class FertilizerUseEvent extends PlayerEvent implements Cancellable {
* @return the fertilizer configuration.
*/
@NotNull
public Fertilizer getFertilizer() {
public Fertilizer fertilizer() {
return fertilizer;
}
}

View File

@@ -115,7 +115,7 @@ public class GreenhouseGlassBreakEvent extends Event implements Cancellable {
* @return the location of the glass block.
*/
@NotNull
public Location getLocation() {
public Location location() {
return location;
}
@@ -125,7 +125,7 @@ public class GreenhouseGlassBreakEvent extends Event implements Cancellable {
* @return the entity that caused the break, or null if not applicable.
*/
@Nullable
public Entity getEntityBreaker() {
public Entity entityBreaker() {
return entityBreaker;
}
@@ -135,7 +135,7 @@ public class GreenhouseGlassBreakEvent extends Event implements Cancellable {
* @return the block that caused the break, or null if not applicable.
*/
@Nullable
public Block getBlockBreaker() {
public Block blockBreaker() {
return blockBreaker;
}
@@ -145,7 +145,7 @@ public class GreenhouseGlassBreakEvent extends Event implements Cancellable {
* @return the reason for the break.
*/
@NotNull
public BreakReason getReason() {
public BreakReason reason() {
return reason;
}
@@ -155,7 +155,7 @@ public class GreenhouseGlassBreakEvent extends Event implements Cancellable {
* @return the block state of the glass.
*/
@NotNull
public CustomCropsBlockState getBlockState() {
public CustomCropsBlockState blockState() {
return blockState;
}
@@ -164,7 +164,7 @@ public class GreenhouseGlassBreakEvent extends Event implements Cancellable {
*
* @return the glass item ID.
*/
public String getGlassItemID() {
public String glassItemID() {
return glassItemID;
}
}

View File

@@ -113,7 +113,7 @@ public class GreenhouseGlassInteractEvent extends PlayerEvent implements Cancell
* @return the location of the glass block.
*/
@NotNull
public Location getLocation() {
public Location location() {
return location;
}
@@ -123,7 +123,7 @@ public class GreenhouseGlassInteractEvent extends PlayerEvent implements Cancell
* @return the block state of the glass.
*/
@NotNull
public CustomCropsBlockState getBlockState() {
public CustomCropsBlockState blockState() {
return blockState;
}
@@ -133,7 +133,7 @@ public class GreenhouseGlassInteractEvent extends PlayerEvent implements Cancell
* @return the equipment slot representing the hand used.
*/
@NotNull
public EquipmentSlot getHand() {
public EquipmentSlot hand() {
return hand;
}
@@ -143,7 +143,7 @@ public class GreenhouseGlassInteractEvent extends PlayerEvent implements Cancell
* @return the glass item ID.
*/
@NotNull
public String getGlassItemID() {
public String glassItemID() {
return glassItemID;
}
@@ -153,7 +153,7 @@ public class GreenhouseGlassInteractEvent extends PlayerEvent implements Cancell
* @return the item in hand.
*/
@NotNull
public ItemStack getItemInHand() {
public ItemStack itemInHand() {
return itemInHand;
}
}

View File

@@ -103,7 +103,7 @@ public class GreenhouseGlassPlaceEvent extends PlayerEvent implements Cancellabl
* @return the location of the glass block.
*/
@NotNull
public Location getLocation() {
public Location location() {
return location;
}
@@ -113,7 +113,7 @@ public class GreenhouseGlassPlaceEvent extends PlayerEvent implements Cancellabl
* @return the block state of the glass.
*/
@NotNull
public CustomCropsBlockState getBlockState() {
public CustomCropsBlockState blockState() {
return blockState;
}
@@ -123,7 +123,7 @@ public class GreenhouseGlassPlaceEvent extends PlayerEvent implements Cancellabl
* @return the glass item ID.
*/
@NotNull
public String getGlassItemID() {
public String glassItemID() {
return glassItemID;
}
}

View File

@@ -23,7 +23,6 @@ import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
@@ -117,7 +116,7 @@ public class PotBreakEvent extends Event implements Cancellable {
* @return the location of the pot block.
*/
@NotNull
public Location getLocation() {
public Location location() {
return location;
}
@@ -127,30 +126,17 @@ public class PotBreakEvent extends Event implements Cancellable {
* @return the entity that caused the break, or null if not applicable.
*/
@Nullable
public Entity getEntityBreaker() {
public Entity entityBreaker() {
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) {
return player;
}
return null;
}
/**
* Gets the reason for the pot breakage.
*
* @return the reason for the break.
*/
@NotNull
public BreakReason getReason() {
public BreakReason reason() {
return reason;
}
@@ -160,7 +146,7 @@ public class PotBreakEvent extends Event implements Cancellable {
* @return the pot configuration.
*/
@NotNull
public PotConfig getPotConfig() {
public PotConfig potConfig() {
return config;
}
@@ -170,7 +156,7 @@ public class PotBreakEvent extends Event implements Cancellable {
* @return the block state of the pot.
*/
@NotNull
public CustomCropsBlockState getBlockState() {
public CustomCropsBlockState blockState() {
return blockState;
}
@@ -180,7 +166,7 @@ public class PotBreakEvent extends Event implements Cancellable {
* @return the block that caused the break, or null if not applicable.
*/
@Nullable
public Block getBlockBreaker() {
public Block blockBreaker() {
return blockBreaker;
}
}

View File

@@ -119,7 +119,7 @@ public class PotFillEvent extends PlayerEvent implements Cancellable {
* @return the location of the pot.
*/
@NotNull
public Location getLocation() {
public Location location() {
return location;
}
@@ -129,7 +129,7 @@ public class PotFillEvent extends PlayerEvent implements Cancellable {
* @return the item in hand.
*/
@NotNull
public ItemStack getItemInHand() {
public ItemStack itemInHand() {
return itemInHand;
}
@@ -139,7 +139,7 @@ public class PotFillEvent extends PlayerEvent implements Cancellable {
* @return the pot configuration.
*/
@NotNull
public PotConfig getPotConfig() {
public PotConfig potConfig() {
return config;
}
@@ -149,7 +149,7 @@ public class PotFillEvent extends PlayerEvent implements Cancellable {
* @return the watering method.
*/
@NotNull
public WateringMethod getWateringMethod() {
public WateringMethod wateringMethod() {
return wateringMethod;
}
@@ -159,7 +159,7 @@ public class PotFillEvent extends PlayerEvent implements Cancellable {
* @return the block state of the pot.
*/
@NotNull
public CustomCropsBlockState getBlockState() {
public CustomCropsBlockState blockState() {
return blockState;
}
@@ -169,7 +169,7 @@ public class PotFillEvent extends PlayerEvent implements Cancellable {
* @return the equipment slot representing the hand used.
*/
@NotNull
public EquipmentSlot getHand() {
public EquipmentSlot hand() {
return hand;
}
}

View File

@@ -115,7 +115,7 @@ public class PotInteractEvent extends PlayerEvent implements Cancellable {
* @return the item in hand.
*/
@NotNull
public ItemStack getItemInHand() {
public ItemStack itemInHand() {
return itemInHand;
}
@@ -125,7 +125,7 @@ public class PotInteractEvent extends PlayerEvent implements Cancellable {
* @return the equipment slot representing the hand used.
*/
@NotNull
public EquipmentSlot getHand() {
public EquipmentSlot hand() {
return hand;
}
@@ -135,7 +135,7 @@ public class PotInteractEvent extends PlayerEvent implements Cancellable {
* @return the location of the pot.
*/
@NotNull
public Location getLocation() {
public Location location() {
return location;
}
@@ -145,7 +145,7 @@ public class PotInteractEvent extends PlayerEvent implements Cancellable {
* @return the block state of the pot.
*/
@NotNull
public CustomCropsBlockState getBlockState() {
public CustomCropsBlockState blockState() {
return blockState;
}
@@ -155,7 +155,7 @@ public class PotInteractEvent extends PlayerEvent implements Cancellable {
* @return the pot configuration.
*/
@NotNull
public PotConfig getPotConfig() {
public PotConfig potConfig() {
return config;
}
}

View File

@@ -37,7 +37,7 @@ public class PotPlaceEvent extends PlayerEvent implements Cancellable {
private boolean cancelled;
private final Location location;
private final PotConfig config;
private final CustomCropsBlockState state;
private final CustomCropsBlockState blockState;
private final ItemStack itemInHand;
private final EquipmentSlot hand;
@@ -47,7 +47,7 @@ public class PotPlaceEvent extends PlayerEvent implements Cancellable {
* @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 blockState 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.
*/
@@ -55,13 +55,13 @@ public class PotPlaceEvent extends PlayerEvent implements Cancellable {
@NotNull Player who,
@NotNull Location location,
@NotNull PotConfig config,
@NotNull CustomCropsBlockState state,
@NotNull CustomCropsBlockState blockState,
@NotNull ItemStack itemInHand,
@NotNull EquipmentSlot hand
) {
super(who);
this.location = location;
this.state = state;
this.blockState = blockState;
this.itemInHand = itemInHand;
this.hand = hand;
this.config = config;
@@ -114,7 +114,7 @@ public class PotPlaceEvent extends PlayerEvent implements Cancellable {
* @return the location of the pot.
*/
@NotNull
public Location getLocation() {
public Location location() {
return location;
}
@@ -124,8 +124,8 @@ public class PotPlaceEvent extends PlayerEvent implements Cancellable {
* @return the block state of the pot.
*/
@NotNull
public CustomCropsBlockState getState() {
return state;
public CustomCropsBlockState blockState() {
return blockState;
}
/**
@@ -134,7 +134,7 @@ public class PotPlaceEvent extends PlayerEvent implements Cancellable {
* @return the item in hand.
*/
@NotNull
public ItemStack getItemInHand() {
public ItemStack itemInHand() {
return itemInHand;
}
@@ -144,7 +144,7 @@ public class PotPlaceEvent extends PlayerEvent implements Cancellable {
* @return the equipment slot representing the hand used.
*/
@NotNull
public EquipmentSlot getHand() {
public EquipmentSlot hand() {
return hand;
}
@@ -154,7 +154,7 @@ public class PotPlaceEvent extends PlayerEvent implements Cancellable {
* @return the pot configuration.
*/
@NotNull
public PotConfig getPotConfig() {
public PotConfig potConfig() {
return config;
}
}

View File

@@ -115,7 +115,7 @@ public class ScarecrowBreakEvent extends Event implements Cancellable {
* @return the location of the scarecrow.
*/
@NotNull
public Location getLocation() {
public Location location() {
return location;
}
@@ -125,7 +125,7 @@ public class ScarecrowBreakEvent extends Event implements Cancellable {
* @return the entity that caused the break, or null if not applicable.
*/
@Nullable
public Entity getEntityBreaker() {
public Entity entityBreaker() {
return entityBreaker;
}
@@ -135,7 +135,7 @@ public class ScarecrowBreakEvent extends Event implements Cancellable {
* @return the block that caused the break, or null if not applicable.
*/
@Nullable
public Block getBlockBreaker() {
public Block blockBreaker() {
return blockBreaker;
}
@@ -145,7 +145,7 @@ public class ScarecrowBreakEvent extends Event implements Cancellable {
* @return the reason for the break.
*/
@NotNull
public BreakReason getReason() {
public BreakReason reason() {
return reason;
}
@@ -155,7 +155,7 @@ public class ScarecrowBreakEvent extends Event implements Cancellable {
* @return the block state of the scarecrow.
*/
@NotNull
public CustomCropsBlockState getBlockState() {
public CustomCropsBlockState blockState() {
return blockState;
}
@@ -164,7 +164,7 @@ public class ScarecrowBreakEvent extends Event implements Cancellable {
*
* @return the scarecrow item ID.
*/
public String getScarecrowItemID() {
public String scarecrowItemID() {
return scarecrowItemID;
}
}

View File

@@ -113,7 +113,7 @@ public class ScarecrowInteractEvent extends PlayerEvent implements Cancellable {
* @return the location of the scarecrow.
*/
@NotNull
public Location getLocation() {
public Location location() {
return location;
}
@@ -123,7 +123,7 @@ public class ScarecrowInteractEvent extends PlayerEvent implements Cancellable {
* @return the block state of the scarecrow.
*/
@NotNull
public CustomCropsBlockState getBlockState() {
public CustomCropsBlockState blockState() {
return blockState;
}
@@ -133,7 +133,7 @@ public class ScarecrowInteractEvent extends PlayerEvent implements Cancellable {
* @return the equipment slot representing the hand used.
*/
@NotNull
public EquipmentSlot getHand() {
public EquipmentSlot hand() {
return hand;
}
@@ -143,7 +143,7 @@ public class ScarecrowInteractEvent extends PlayerEvent implements Cancellable {
* @return the scarecrow item ID.
*/
@NotNull
public String getScarecrowItemID() {
public String scarecrowItemID() {
return scarecrowItemID;
}
@@ -153,7 +153,7 @@ public class ScarecrowInteractEvent extends PlayerEvent implements Cancellable {
* @return the item in hand.
*/
@NotNull
public ItemStack getItemInHand() {
public ItemStack itemInHand() {
return itemInHand;
}
}

View File

@@ -103,7 +103,7 @@ public class ScarecrowPlaceEvent extends PlayerEvent implements Cancellable {
* @return the scarecrow item ID.
*/
@NotNull
public String getScarecrowItemID() {
public String scarecrowItemID() {
return scarecrowItemID;
}
@@ -113,7 +113,7 @@ public class ScarecrowPlaceEvent extends PlayerEvent implements Cancellable {
* @return the location of the scarecrow.
*/
@NotNull
public Location getLocation() {
public Location location() {
return location;
}
@@ -123,7 +123,7 @@ public class ScarecrowPlaceEvent extends PlayerEvent implements Cancellable {
* @return the block state of the scarecrow.
*/
@NotNull
public CustomCropsBlockState getBlockState() {
public CustomCropsBlockState blockState() {
return blockState;
}
}

View File

@@ -116,7 +116,7 @@ public class SprinklerBreakEvent extends Event implements Cancellable {
* @return the location of the sprinkler.
*/
@NotNull
public Location getLocation() {
public Location location() {
return location;
}
@@ -126,7 +126,7 @@ public class SprinklerBreakEvent extends Event implements Cancellable {
* @return the entity that caused the break, or null if not applicable.
*/
@Nullable
public Entity getEntityBreaker() {
public Entity entityBreaker() {
return entityBreaker;
}
@@ -136,7 +136,7 @@ public class SprinklerBreakEvent extends Event implements Cancellable {
* @return the block state of the sprinkler.
*/
@NotNull
public CustomCropsBlockState getBlockState() {
public CustomCropsBlockState blockState() {
return blockState;
}
@@ -146,7 +146,7 @@ public class SprinklerBreakEvent extends Event implements Cancellable {
* @return the sprinkler configuration.
*/
@NotNull
public SprinklerConfig getSprinklerConfig() {
public SprinklerConfig sprinklerConfig() {
return config;
}
@@ -156,7 +156,7 @@ public class SprinklerBreakEvent extends Event implements Cancellable {
* @return the block that caused the break, or null if not applicable.
*/
@Nullable
public Block getBlockBreaker() {
public Block blockBreaker() {
return blockBreaker;
}
@@ -166,7 +166,7 @@ public class SprinklerBreakEvent extends Event implements Cancellable {
* @return the reason for the break.
*/
@NotNull
public BreakReason getReason() {
public BreakReason reason() {
return reason;
}
}

View File

@@ -119,7 +119,7 @@ public class SprinklerFillEvent extends PlayerEvent implements Cancellable {
* @return the location of the sprinkler.
*/
@NotNull
public Location getLocation() {
public Location location() {
return location;
}
@@ -129,7 +129,7 @@ public class SprinklerFillEvent extends PlayerEvent implements Cancellable {
* @return the item in hand.
*/
@NotNull
public ItemStack getItemInHand() {
public ItemStack itemInHand() {
return itemInHand;
}
@@ -139,7 +139,7 @@ public class SprinklerFillEvent extends PlayerEvent implements Cancellable {
* @return the sprinkler configuration.
*/
@NotNull
public SprinklerConfig getSprinklerConfig() {
public SprinklerConfig sprinklerConfig() {
return config;
}
@@ -149,7 +149,7 @@ public class SprinklerFillEvent extends PlayerEvent implements Cancellable {
* @return the watering method.
*/
@NotNull
public WateringMethod getWateringMethod() {
public WateringMethod wateringMethod() {
return wateringMethod;
}
@@ -159,7 +159,7 @@ public class SprinklerFillEvent extends PlayerEvent implements Cancellable {
* @return the block state of the sprinkler.
*/
@NotNull
public CustomCropsBlockState getBlockState() {
public CustomCropsBlockState blockState() {
return blockState;
}
@@ -169,7 +169,7 @@ public class SprinklerFillEvent extends PlayerEvent implements Cancellable {
* @return the equipment slot representing the hand used.
*/
@NotNull
public EquipmentSlot getHand() {
public EquipmentSlot hand() {
return hand;
}
}

View File

@@ -114,7 +114,7 @@ public class SprinklerInteractEvent extends PlayerEvent implements Cancellable {
* @return the location of the sprinkler.
*/
@NotNull
public Location getLocation() {
public Location location() {
return location;
}
@@ -124,7 +124,7 @@ public class SprinklerInteractEvent extends PlayerEvent implements Cancellable {
* @return the block state of the sprinkler.
*/
@NotNull
public CustomCropsBlockState getBlockState() {
public CustomCropsBlockState blockState() {
return blockState;
}
@@ -134,7 +134,7 @@ public class SprinklerInteractEvent extends PlayerEvent implements Cancellable {
* @return the sprinkler configuration.
*/
@NotNull
public SprinklerConfig getSprinklerConfig() {
public SprinklerConfig sprinklerConfig() {
return config;
}
@@ -144,7 +144,7 @@ public class SprinklerInteractEvent extends PlayerEvent implements Cancellable {
* @return the equipment slot representing the hand used.
*/
@NotNull
public EquipmentSlot getHand() {
public EquipmentSlot hand() {
return hand;
}
@@ -154,7 +154,7 @@ public class SprinklerInteractEvent extends PlayerEvent implements Cancellable {
* @return the item in hand.
*/
@NotNull
public ItemStack getItemInHand() {
public ItemStack itemInHand() {
return itemInHand;
}
}

View File

@@ -115,7 +115,7 @@ public class SprinklerPlaceEvent extends PlayerEvent implements Cancellable {
* @return the item in hand.
*/
@NotNull
public ItemStack getItemInHand() {
public ItemStack itemInHand() {
return itemInHand;
}
@@ -125,7 +125,7 @@ public class SprinklerPlaceEvent extends PlayerEvent implements Cancellable {
* @return the block state of the sprinkler.
*/
@NotNull
public CustomCropsBlockState getBlockState() {
public CustomCropsBlockState blockState() {
return blockState;
}
@@ -135,7 +135,7 @@ public class SprinklerPlaceEvent extends PlayerEvent implements Cancellable {
* @return the location of the sprinkler.
*/
@NotNull
public Location getLocation() {
public Location location() {
return location;
}
@@ -145,7 +145,7 @@ public class SprinklerPlaceEvent extends PlayerEvent implements Cancellable {
* @return the sprinkler configuration.
*/
@NotNull
public SprinklerConfig getSprinklerConfig() {
public SprinklerConfig sprinklerConfig() {
return config;
}
@@ -155,7 +155,7 @@ public class SprinklerPlaceEvent extends PlayerEvent implements Cancellable {
* @return the equipment slot representing the hand used.
*/
@NotNull
public EquipmentSlot getHand() {
public EquipmentSlot hand() {
return hand;
}
}

View File

@@ -114,7 +114,7 @@ public class WateringCanFillEvent extends PlayerEvent implements Cancellable {
* @return the watering can item.
*/
@NotNull
public ItemStack getItemInHand() {
public ItemStack itemInHand() {
return itemInHand;
}
@@ -124,7 +124,7 @@ public class WateringCanFillEvent extends PlayerEvent implements Cancellable {
* @return the watering can configuration.
*/
@NotNull
public WateringCanConfig getConfig() {
public WateringCanConfig wateringCanConfig() {
return config;
}
@@ -134,7 +134,7 @@ public class WateringCanFillEvent extends PlayerEvent implements Cancellable {
* @return the fill method.
*/
@NotNull
public FillMethod getFillMethod() {
public FillMethod fillMethod() {
return fillMethod;
}
@@ -144,7 +144,7 @@ public class WateringCanFillEvent extends PlayerEvent implements Cancellable {
* @return the equipment slot representing the hand used.
*/
@NotNull
public EquipmentSlot getHand() {
public EquipmentSlot hand() {
return hand;
}
@@ -154,7 +154,7 @@ public class WateringCanFillEvent extends PlayerEvent implements Cancellable {
* @return the location of the action.
*/
@NotNull
public Location getLocation() {
public Location location() {
return location;
}
}

View File

@@ -117,7 +117,7 @@ public class WateringCanWaterPotEvent extends PlayerEvent implements Cancellable
* @return the watering can item.
*/
@NotNull
public ItemStack getItemInHand() {
public ItemStack itemInHand() {
return itemInHand;
}
@@ -127,7 +127,7 @@ public class WateringCanWaterPotEvent extends PlayerEvent implements Cancellable
* @return the equipment slot representing the hand used.
*/
@NotNull
public EquipmentSlot getHand() {
public EquipmentSlot hand() {
return hand;
}
@@ -137,7 +137,7 @@ public class WateringCanWaterPotEvent extends PlayerEvent implements Cancellable
* @return the watering can configuration.
*/
@NotNull
public WateringCanConfig getWateringCanConfig() {
public WateringCanConfig wateringCanConfig() {
return wateringCanConfig;
}
@@ -147,7 +147,7 @@ public class WateringCanWaterPotEvent extends PlayerEvent implements Cancellable
* @return the pot configuration.
*/
@NotNull
public PotConfig getPotConfig() {
public PotConfig potConfig() {
return potConfig;
}
@@ -157,7 +157,7 @@ public class WateringCanWaterPotEvent extends PlayerEvent implements Cancellable
* @return the list of pots with positions and IDs.
*/
@NotNull
public List<Pair<Pos3, String>> getPotWithIDs() {
public List<Pair<Pos3, String>> pots() {
return potWithIDs;
}
}

View File

@@ -119,7 +119,7 @@ public class WateringCanWaterSprinklerEvent extends PlayerEvent implements Cance
* @return the watering can item.
*/
@NotNull
public ItemStack getItemInHand() {
public ItemStack itemInHand() {
return itemInHand;
}
@@ -129,7 +129,7 @@ public class WateringCanWaterSprinklerEvent extends PlayerEvent implements Cance
* @return the equipment slot representing the hand used.
*/
@NotNull
public EquipmentSlot getHand() {
public EquipmentSlot hand() {
return hand;
}
@@ -139,7 +139,7 @@ public class WateringCanWaterSprinklerEvent extends PlayerEvent implements Cance
* @return the watering can configuration.
*/
@NotNull
public WateringCanConfig getWateringCanConfig() {
public WateringCanConfig wateringCanConfig() {
return wateringCanConfig;
}
@@ -149,7 +149,7 @@ public class WateringCanWaterSprinklerEvent extends PlayerEvent implements Cance
* @return the sprinkler configuration.
*/
@NotNull
public SprinklerConfig getSprinklerConfig() {
public SprinklerConfig sprinklerConfig() {
return sprinklerConfig;
}
@@ -159,7 +159,7 @@ public class WateringCanWaterSprinklerEvent extends PlayerEvent implements Cance
* @return the block state of the sprinkler.
*/
@NotNull
public CustomCropsBlockState getBlockState() {
public CustomCropsBlockState blockState() {
return blockState;
}
@@ -169,7 +169,7 @@ public class WateringCanWaterSprinklerEvent extends PlayerEvent implements Cance
* @return the location of the sprinkler.
*/
@NotNull
public Location getLocation() {
public Location location() {
return location;
}
}

View File

@@ -55,9 +55,9 @@ public class BattlePassQuest implements Listener {
@EventHandler (ignoreCancelled = true)
public void onBreakCrop(CropBreakEvent event) {
Entity entity = event.getEntityBreaker();
Entity entity = event.entityBreaker();
if (!(entity instanceof Player player)) return;
String id = event.getStageItemID();
String id = event.cropStageItemID();
// remove namespace
if (id.contains(":")) {
id = id.split(":")[1];
@@ -76,7 +76,7 @@ public class BattlePassQuest implements Listener {
// Plant crops
this.executionBuilder("plant")
.player(player)
.root(event.getCropConfig().id())
.root(event.cropConfig().id())
.progress(1)
.buildAndExecute();
}

View File

@@ -73,10 +73,10 @@ public class BetonQuestQuest {
@EventHandler (ignoreCancelled = true)
public void onBreakCrop(CropBreakEvent event) {
if (!(event.getEntityBreaker() instanceof Player player)) {
if (!(event.entityBreaker() instanceof Player player)) {
return;
}
String id = event.getStageItemID();
String id = event.cropStageItemID();
OnlineProfile onlineProfile = PlayerConverter.getID(player);
if (!containsPlayer(onlineProfile)) {
@@ -155,7 +155,7 @@ public class BetonQuestQuest {
if (isInvalidLocation(event.getPlayer(), onlineProfile)) {
return;
}
if (this.crops.contains(event.getCropConfig().id()) && this.checkConditions(onlineProfile)) {
if (this.crops.contains(event.cropConfig().id()) && this.checkConditions(onlineProfile)) {
getCountingData(onlineProfile).progress(1);
completeIfDoneOrNotify(onlineProfile);
}

View File

@@ -42,11 +42,11 @@ public class ClueScrollsQuest implements Listener {
@EventHandler (ignoreCancelled = true)
public void onBreakCrop(CropBreakEvent event) {
if (!(event.getEntityBreaker() instanceof Player player)) return;
if (!(event.entityBreaker() instanceof Player player)) return;
harvestClue.handle(
player,
1,
new ClueDataPair("id", event.getStageItemID())
new ClueDataPair("id", event.cropStageItemID())
);
}
@@ -55,7 +55,7 @@ public class ClueScrollsQuest implements Listener {
plantClue.handle(
event.getPlayer(),
1,
new ClueDataPair("id", event.getCropConfig().id())
new ClueDataPair("id", event.cropConfig().id())
);
}
}