9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-27 10:59:20 +00:00
This commit is contained in:
Xiao-MoMi
2023-04-23 19:21:58 +08:00
parent ec915b6628
commit 5195534528
5 changed files with 18 additions and 8 deletions

View File

@@ -17,6 +17,7 @@
package net.momirealms.customcrops.api.customplugin;
import dev.lone.itemsadder.api.Events.CustomBlockBreakEvent;
import net.momirealms.customcrops.CustomCrops;
import net.momirealms.customcrops.api.customplugin.itemsadder.ItemsAdderHandler;
import net.momirealms.customcrops.api.customplugin.oraxen.OraxenHandler;
@@ -52,6 +53,7 @@ import org.bukkit.block.BlockFace;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerInteractEvent;
@@ -105,6 +107,11 @@ public class PlatformManager extends Function {
onBreakSomething(player, block.getLocation(), id, event);
}
public void onBreakChorus(Player player, Block block, String id, CustomBlockBreakEvent event) {
if (event.isCancelled()) return;
onBreakSomething(player, block.getLocation(), id, event);
}
public void onBreakNoteBlock(Player player, Block block, String id, Cancellable event) {
if (event.isCancelled()) return;
onBreakSomething(player, block.getLocation(), id, event);
@@ -132,6 +139,7 @@ public class PlatformManager extends Function {
public void onInteractBlock(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) return;
if (event.useItemInHand() == Event.Result.DENY) return;
if (event.getAction() == org.bukkit.event.block.Action.RIGHT_CLICK_AIR) {
onInteractAir(event.getPlayer());
} else if (event.getAction() == org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK) {
@@ -410,7 +418,7 @@ public class PlatformManager extends Function {
AdventureUtils.playerSound(player, passiveFillMethod.getSound());
}
if (passiveFillMethod.getParticle() != null) {
location.getWorld().spawnParticle(passiveFillMethod.getParticle(), location.clone().add(0.5,0.4, 0.5),5,0.3,0.1,0.3);
location.getWorld().spawnParticle(passiveFillMethod.getParticle(), location.clone().add(0.5,0.3, 0.5),5,0.3,0.1,0.3);
}
}
@@ -483,7 +491,7 @@ public class PlatformManager extends Function {
}
event.setCancelled(true);
doPassiveFillAction(player, item_in_hand, passiveFillMethod, pot_loc);
doPassiveFillAction(player, item_in_hand, passiveFillMethod, location);
potData.addWater(potWaterEvent.getWater());
return true;
}
@@ -648,7 +656,7 @@ public class PlatformManager extends Function {
}
event.setCancelled(true);
doPassiveFillAction(player, item_in_hand, passiveFillMethod, location);
doPassiveFillAction(player, item_in_hand, passiveFillMethod, location.clone().add(0,1,0));
plugin.getWorldDataManager().addWaterToPot(SimpleLocation.getByBukkitLocation(location), potWaterEvent.getWater(), pot_id);
break outer;
}

View File

@@ -36,6 +36,7 @@ public class ItemsAdderHandler extends Handler {
switch (block.getType()) {
case NOTE_BLOCK -> platformManager.onBreakNoteBlock(event.getPlayer(), event.getBlock(), event.getNamespacedID(), event);
case TRIPWIRE -> platformManager.onBreakTripWire(event.getPlayer(), event.getBlock(), event.getNamespacedID(), event);
case CHORUS_PLANT -> platformManager.onBreakChorus(event.getPlayer(), event.getBlock(), event.getNamespacedID(), event);
}
}

View File

@@ -37,7 +37,7 @@ public class AboutCommand extends AbstractSubCommand {
AdventureUtils.sendMessage(sender, "<#FFA500>⛈ CustomCrops <gray>- <#F4A460>" + CustomCrops.getInstance().getVersionHelper().getPluginVersion());
AdventureUtils.sendMessage(sender, "<#FFFFE0>Custom crop system based on thread pool");
AdventureUtils.sendMessage(sender, "<#DA70D6>\uD83E\uDDEA Author: <#FFC0CB>XiaoMoMi");
AdventureUtils.sendMessage(sender, "<#FF7F50>\uD83D\uDD25 Contributors: <#FFA07A>Cha_Shao<white>, <#FFA07A>TopOrigin<white>, <#FFA07A>AmazingCat<white>, <#FFA07A>Iqtester");
AdventureUtils.sendMessage(sender, "<#FF7F50>\uD83D\uDD25 Contributors: <#FFA07A>Cha_Shao<white>, <#FFA07A>TopOrigin<white>, <#FFA07A>AmazingCat");
AdventureUtils.sendMessage(sender, "<#FFD700>⭐ <click:open_url:https://mo-mi.gitbook.io/xiaomomi-plugins/plugin-wiki/customcrops>Document</click> <#A9A9A9>| <#FAFAD2>⛏ <click:open_url:https://github.com/Xiao-MoMi/Custom-Crops>Github</click> <#A9A9A9>| <#48D1CC>\uD83D\uDD14 <click:open_url:https://polymart.org/resource/customcrops.2625>Polymart</click>");
return true;
}

View File

@@ -19,6 +19,7 @@ package net.momirealms.customcrops.integration.job;
import com.willfp.ecojobs.api.EcoJobsAPI;
import com.willfp.ecojobs.jobs.Job;
import com.willfp.ecojobs.jobs.Jobs;
import net.momirealms.customcrops.integration.JobInterface;
import org.bukkit.entity.Player;