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:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user