diff --git a/libs/Oraxen(premium).txt b/libs/Oraxen(premium).txt new file mode 100644 index 0000000..399f3be --- /dev/null +++ b/libs/Oraxen(premium).txt @@ -0,0 +1 @@ +https://www.spigotmc.org/resources/%E2%9C%85-10-%E2%98%84%EF%B8%8F-oraxen-add-items-blocks-armors-hats-food-furnitures-plants-and-gui.72448/ \ No newline at end of file diff --git a/src/main/java/net/momirealms/customcrops/CustomCrops.java b/src/main/java/net/momirealms/customcrops/CustomCrops.java index 5cbf3f4..1768be6 100644 --- a/src/main/java/net/momirealms/customcrops/CustomCrops.java +++ b/src/main/java/net/momirealms/customcrops/CustomCrops.java @@ -27,6 +27,7 @@ import net.momirealms.customcrops.helper.LibraryLoader; import net.momirealms.customcrops.integrations.papi.PlaceholderManager; import net.momirealms.customcrops.managers.CropManager; import net.momirealms.customcrops.utils.AdventureUtil; +import org.bstats.bukkit.Metrics; import org.bukkit.Bukkit; import org.bukkit.plugin.java.JavaPlugin; @@ -88,6 +89,7 @@ public final class CustomCrops extends JavaPlugin { } AdventureUtil.consoleMessage("[CustomCrops] Plugin Enabled!"); + new Metrics(this, 16593); } @Override diff --git a/src/main/java/net/momirealms/customcrops/api/event/CustomWorldEvent.java b/src/main/java/net/momirealms/customcrops/api/event/CustomWorldEvent.java index cbc89d6..470f8b4 100644 --- a/src/main/java/net/momirealms/customcrops/api/event/CustomWorldEvent.java +++ b/src/main/java/net/momirealms/customcrops/api/event/CustomWorldEvent.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + package net.momirealms.customcrops.api.event; import net.momirealms.customcrops.objects.WorldState; diff --git a/src/main/java/net/momirealms/customcrops/api/event/SeedPlantEvent.java b/src/main/java/net/momirealms/customcrops/api/event/SeedPlantEvent.java index 7f6f644..d8ccc73 100644 --- a/src/main/java/net/momirealms/customcrops/api/event/SeedPlantEvent.java +++ b/src/main/java/net/momirealms/customcrops/api/event/SeedPlantEvent.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + package net.momirealms.customcrops.api.event; import net.momirealms.customcrops.api.crop.Crop; diff --git a/src/main/java/net/momirealms/customcrops/api/event/SprinklerPlaceEvent.java b/src/main/java/net/momirealms/customcrops/api/event/SprinklerPlaceEvent.java index b5c5408..af42692 100644 --- a/src/main/java/net/momirealms/customcrops/api/event/SprinklerPlaceEvent.java +++ b/src/main/java/net/momirealms/customcrops/api/event/SprinklerPlaceEvent.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + package net.momirealms.customcrops.api.event; import org.bukkit.Location; diff --git a/src/main/java/net/momirealms/customcrops/api/event/SurveyorUseEvent.java b/src/main/java/net/momirealms/customcrops/api/event/SurveyorUseEvent.java index 822e3a0..89da1c9 100644 --- a/src/main/java/net/momirealms/customcrops/api/event/SurveyorUseEvent.java +++ b/src/main/java/net/momirealms/customcrops/api/event/SurveyorUseEvent.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + package net.momirealms.customcrops.api.event; import net.momirealms.customcrops.objects.fertilizer.Fertilizer; diff --git a/src/main/java/net/momirealms/customcrops/api/utils/WorldUtils.java b/src/main/java/net/momirealms/customcrops/api/utils/WorldUtils.java index 617c8bc..95ed28c 100644 --- a/src/main/java/net/momirealms/customcrops/api/utils/WorldUtils.java +++ b/src/main/java/net/momirealms/customcrops/api/utils/WorldUtils.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + package net.momirealms.customcrops.api.utils; import net.momirealms.customcrops.CustomCrops; diff --git a/src/main/java/net/momirealms/customcrops/commands/AbstractSubCommand.java b/src/main/java/net/momirealms/customcrops/commands/AbstractSubCommand.java index 4e0e2ca..d716394 100644 --- a/src/main/java/net/momirealms/customcrops/commands/AbstractSubCommand.java +++ b/src/main/java/net/momirealms/customcrops/commands/AbstractSubCommand.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package net.momirealms.customcrops.commands; import net.momirealms.customcrops.config.MainConfig; diff --git a/src/main/java/net/momirealms/customcrops/commands/PluginCommand.java b/src/main/java/net/momirealms/customcrops/commands/PluginCommand.java index 41df62b..832e345 100644 --- a/src/main/java/net/momirealms/customcrops/commands/PluginCommand.java +++ b/src/main/java/net/momirealms/customcrops/commands/PluginCommand.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package net.momirealms.customcrops.commands; import net.momirealms.customcrops.commands.subcmd.ReloadCommand; diff --git a/src/main/java/net/momirealms/customcrops/commands/SubCommand.java b/src/main/java/net/momirealms/customcrops/commands/SubCommand.java index fd492c9..174fb73 100644 --- a/src/main/java/net/momirealms/customcrops/commands/SubCommand.java +++ b/src/main/java/net/momirealms/customcrops/commands/SubCommand.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package net.momirealms.customcrops.commands; import org.bukkit.command.CommandSender; diff --git a/src/main/java/net/momirealms/customcrops/commands/subcmd/ReloadCommand.java b/src/main/java/net/momirealms/customcrops/commands/subcmd/ReloadCommand.java index db96e38..1a09ac4 100644 --- a/src/main/java/net/momirealms/customcrops/commands/subcmd/ReloadCommand.java +++ b/src/main/java/net/momirealms/customcrops/commands/subcmd/ReloadCommand.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package net.momirealms.customcrops.commands.subcmd; import net.momirealms.customcrops.commands.AbstractSubCommand; diff --git a/src/main/java/net/momirealms/customcrops/commands/subcmd/SetSeasonCommand.java b/src/main/java/net/momirealms/customcrops/commands/subcmd/SetSeasonCommand.java index 09b7c22..6e9668b 100644 --- a/src/main/java/net/momirealms/customcrops/commands/subcmd/SetSeasonCommand.java +++ b/src/main/java/net/momirealms/customcrops/commands/subcmd/SetSeasonCommand.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package net.momirealms.customcrops.commands.subcmd; import net.momirealms.customcrops.api.utils.SeasonUtils; diff --git a/src/main/java/net/momirealms/customcrops/commands/subcmd/SimulateCommand.java b/src/main/java/net/momirealms/customcrops/commands/subcmd/SimulateCommand.java index ca4a3f1..0ec9712 100644 --- a/src/main/java/net/momirealms/customcrops/commands/subcmd/SimulateCommand.java +++ b/src/main/java/net/momirealms/customcrops/commands/subcmd/SimulateCommand.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package net.momirealms.customcrops.commands.subcmd; import net.momirealms.customcrops.CustomCrops; diff --git a/src/main/java/net/momirealms/customcrops/config/SoundConfig.java b/src/main/java/net/momirealms/customcrops/config/SoundConfig.java index 562b363..72af3e3 100644 --- a/src/main/java/net/momirealms/customcrops/config/SoundConfig.java +++ b/src/main/java/net/momirealms/customcrops/config/SoundConfig.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package net.momirealms.customcrops.config; import net.kyori.adventure.key.Key; diff --git a/src/main/java/net/momirealms/customcrops/integrations/customplugin/HandlerP.java b/src/main/java/net/momirealms/customcrops/integrations/customplugin/HandlerP.java index f1f79a5..3612f40 100644 --- a/src/main/java/net/momirealms/customcrops/integrations/customplugin/HandlerP.java +++ b/src/main/java/net/momirealms/customcrops/integrations/customplugin/HandlerP.java @@ -240,6 +240,12 @@ public abstract class HandlerP extends Function { } } + public void removeScarecrow(Location location) { + CustomWorld customWorld = cropManager.getCustomWorld(location.getWorld()); + if (customWorld == null) return; + customWorld.removeScarecrow(location); + } + public boolean placeSprinkler(String id, Location location, Player player, ItemStack item) { Sprinkler config = SprinklerConfig.SPRINKLERS_2D.get(id); @@ -292,12 +298,6 @@ public abstract class HandlerP extends Function { return StringUtils.chop(id) + nextStage; } - public void placeScareCrow(Location location) { - CustomWorld customWorld = cropManager.getCustomWorld(location.getWorld()); - if (customWorld == null) return; - - } - public boolean fillWaterCan(String id, NBTItem nbtItem, ItemStack itemStack, Player player) { WaterCan config = WaterCanConfig.CANS.get(id); if (config != null) { diff --git a/src/main/java/net/momirealms/customcrops/integrations/customplugin/itemsadder/ItemsAdderFrameHandler.java b/src/main/java/net/momirealms/customcrops/integrations/customplugin/itemsadder/ItemsAdderFrameHandler.java index 48fd6f9..b6154c1 100644 --- a/src/main/java/net/momirealms/customcrops/integrations/customplugin/itemsadder/ItemsAdderFrameHandler.java +++ b/src/main/java/net/momirealms/customcrops/integrations/customplugin/itemsadder/ItemsAdderFrameHandler.java @@ -91,6 +91,14 @@ public class ItemsAdderFrameHandler extends ItemsAdderHandler { if (player.getGameMode() != GameMode.CREATIVE) itemInHand.setAmount(itemInHand.getAmount() - 1); if (Math.random() < MainConfig.boneMealChance) { entity.getWorld().spawnParticle(MainConfig.boneMealSuccess, location.clone().add(0,0.5, 0),3,0.2,0.2,0.2); + if (SoundConfig.boneMeal.isEnable()) { + AdventureUtil.playerSound( + player, + SoundConfig.boneMeal.getSource(), + SoundConfig.boneMeal.getKey(), + 1,1 + ); + } CustomFurniture.remove(entity, false); CustomFurniture.spawn(getNextStage(namespacedID), location.getBlock()); } @@ -119,6 +127,11 @@ public class ItemsAdderFrameHandler extends ItemsAdderHandler { return; } + if (MainConfig.enableCrow && namespacedId.equals(BasicItemConfig.scarecrow)) { + super.removeScarecrow(event.getBukkitEntity().getLocation()); + return; + } + if (namespacedId.contains("_stage_")) { if (namespacedId.equals(BasicItemConfig.deadCrop)) return; if (hasNextStage(namespacedId)) { diff --git a/src/main/java/net/momirealms/customcrops/integrations/customplugin/itemsadder/ItemsAdderHandler.java b/src/main/java/net/momirealms/customcrops/integrations/customplugin/itemsadder/ItemsAdderHandler.java index 18e2a99..593e5b1 100644 --- a/src/main/java/net/momirealms/customcrops/integrations/customplugin/itemsadder/ItemsAdderHandler.java +++ b/src/main/java/net/momirealms/customcrops/integrations/customplugin/itemsadder/ItemsAdderHandler.java @@ -21,23 +21,18 @@ import de.tr7zw.changeme.nbtapi.NBTCompound; import de.tr7zw.changeme.nbtapi.NBTItem; import dev.lone.itemsadder.api.CustomBlock; import dev.lone.itemsadder.api.CustomStack; -import dev.lone.itemsadder.api.Events.CustomBlockBreakEvent; -import dev.lone.itemsadder.api.Events.CustomBlockInteractEvent; -import dev.lone.itemsadder.api.Events.FurnitureBreakEvent; -import dev.lone.itemsadder.api.Events.FurnitureInteractEvent; +import dev.lone.itemsadder.api.Events.*; import net.kyori.adventure.key.Key; import net.momirealms.customcrops.CustomCrops; import net.momirealms.customcrops.api.crop.Crop; import net.momirealms.customcrops.api.event.WaterEvent; -import net.momirealms.customcrops.config.CropConfig; -import net.momirealms.customcrops.config.MainConfig; -import net.momirealms.customcrops.config.SoundConfig; -import net.momirealms.customcrops.config.WaterCanConfig; +import net.momirealms.customcrops.config.*; import net.momirealms.customcrops.integrations.AntiGrief; import net.momirealms.customcrops.integrations.customplugin.HandlerP; import net.momirealms.customcrops.integrations.customplugin.itemsadder.listeners.ItemsAdderBlockListener; import net.momirealms.customcrops.integrations.customplugin.itemsadder.listeners.ItemsAdderFurnitureListener; import net.momirealms.customcrops.managers.CropManager; +import net.momirealms.customcrops.managers.CustomWorld; import net.momirealms.customcrops.objects.WaterCan; import net.momirealms.customcrops.utils.AdventureUtil; import org.apache.commons.lang.StringUtils; @@ -78,6 +73,16 @@ public abstract class ItemsAdderHandler extends HandlerP { HandlerList.unregisterAll(this.itemsAdderFurnitureListener); } + public void placeScarecrow(FurniturePlaceSuccessEvent event) { + if (!MainConfig.enableCrow) return; + String id = event.getNamespacedID(); + if (id == null || !id.equals(BasicItemConfig.scarecrow)) return; + Location location = event.getBukkitEntity().getLocation(); + CustomWorld customWorld = cropManager.getCustomWorld(location.getWorld()); + if (customWorld == null) return; + customWorld.addScarecrow(location); + } + @Override public void onPlayerInteract(PlayerInteractEvent event) { @@ -191,7 +196,7 @@ public abstract class ItemsAdderHandler extends HandlerP { } itemStack.setItemMeta(nbtItem.getItem().getItemMeta()); - super.waterPot(waterCan.width(), waterCan.getLength(), potLoc, player.getLocation().getYaw()); + super.waterPot(waterCan.getWidth(), waterCan.getLength(), potLoc, player.getLocation().getYaw()); } return true; diff --git a/src/main/java/net/momirealms/customcrops/integrations/customplugin/itemsadder/ItemsAdderWireHandler.java b/src/main/java/net/momirealms/customcrops/integrations/customplugin/itemsadder/ItemsAdderWireHandler.java index bfe9d3a..a9a19c3 100644 --- a/src/main/java/net/momirealms/customcrops/integrations/customplugin/itemsadder/ItemsAdderWireHandler.java +++ b/src/main/java/net/momirealms/customcrops/integrations/customplugin/itemsadder/ItemsAdderWireHandler.java @@ -87,6 +87,11 @@ public class ItemsAdderWireHandler extends ItemsAdderHandler { Sprinkler sprinkler = SprinklerConfig.SPRINKLERS_3D.get(namespacedID); if (sprinkler != null) { super.onBreakSprinkler(event.getBukkitEntity().getLocation()); + return; + } + + if (MainConfig.enableCrow && namespacedID.equals(BasicItemConfig.scarecrow)) { + super.removeScarecrow(event.getBukkitEntity().getLocation()); } } @@ -128,6 +133,14 @@ public class ItemsAdderWireHandler extends ItemsAdderHandler { if (player.getGameMode() != GameMode.CREATIVE) itemInHand.setAmount(itemInHand.getAmount() - 1); if (Math.random() < MainConfig.boneMealChance) { location.getWorld().spawnParticle(MainConfig.boneMealSuccess, location.clone().add(0.5,0.5, 0.5),3,0.2,0.2,0.2); + if (SoundConfig.boneMeal.isEnable()) { + AdventureUtil.playerSound( + player, + SoundConfig.boneMeal.getSource(), + SoundConfig.boneMeal.getKey(), + 1,1 + ); + } CustomBlock.remove(location); CustomBlock.place(getNextStage(blockID), location); } diff --git a/src/main/java/net/momirealms/customcrops/integrations/customplugin/itemsadder/listeners/ItemsAdderFurnitureListener.java b/src/main/java/net/momirealms/customcrops/integrations/customplugin/itemsadder/listeners/ItemsAdderFurnitureListener.java index d89d57c..dbfdc13 100644 --- a/src/main/java/net/momirealms/customcrops/integrations/customplugin/itemsadder/listeners/ItemsAdderFurnitureListener.java +++ b/src/main/java/net/momirealms/customcrops/integrations/customplugin/itemsadder/listeners/ItemsAdderFurnitureListener.java @@ -19,7 +19,7 @@ package net.momirealms.customcrops.integrations.customplugin.itemsadder.listener import dev.lone.itemsadder.api.Events.FurnitureBreakEvent; import dev.lone.itemsadder.api.Events.FurnitureInteractEvent; -import dev.lone.itemsadder.api.Events.FurniturePlaceEvent; +import dev.lone.itemsadder.api.Events.FurniturePlaceSuccessEvent; import net.momirealms.customcrops.integrations.customplugin.itemsadder.ItemsAdderHandler; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -43,7 +43,7 @@ public class ItemsAdderFurnitureListener implements Listener { } @EventHandler - public void onPlaceFurniture(FurniturePlaceEvent event) { - //TODO scarecrow + public void onPlaceFurniture(FurniturePlaceSuccessEvent event) { + handler.placeScarecrow(event); } } diff --git a/src/main/java/net/momirealms/customcrops/integrations/customplugin/oraxen/OraxenFrameHandler.java b/src/main/java/net/momirealms/customcrops/integrations/customplugin/oraxen/OraxenFrameHandler.java index 3aa3bfa..0d0a0aa 100644 --- a/src/main/java/net/momirealms/customcrops/integrations/customplugin/oraxen/OraxenFrameHandler.java +++ b/src/main/java/net/momirealms/customcrops/integrations/customplugin/oraxen/OraxenFrameHandler.java @@ -237,6 +237,14 @@ public class OraxenFrameHandler extends OraxenHandler { if (player.getGameMode() != GameMode.CREATIVE) itemInHand.setAmount(itemInHand.getAmount() - 1); if (Math.random() < MainConfig.boneMealChance) { itemFrame.getWorld().spawnParticle(MainConfig.boneMealSuccess, location.clone().add(0,0.5, 0),3,0.2,0.2,0.2); + if (SoundConfig.boneMeal.isEnable()) { + AdventureUtil.playerSound( + player, + SoundConfig.boneMeal.getSource(), + SoundConfig.boneMeal.getKey(), + 1,1 + ); + } String nextStage = getNextStage(id); itemFrame.setItem(customInterface.getItemStack(nextStage)); itemFrame.getPersistentDataContainer().set(OraxenHook.FURNITURE, PersistentDataType.STRING, nextStage); diff --git a/src/main/java/net/momirealms/customcrops/integrations/customplugin/oraxen/OraxenHandler.java b/src/main/java/net/momirealms/customcrops/integrations/customplugin/oraxen/OraxenHandler.java index 2d4f4d6..5c07644 100644 --- a/src/main/java/net/momirealms/customcrops/integrations/customplugin/oraxen/OraxenHandler.java +++ b/src/main/java/net/momirealms/customcrops/integrations/customplugin/oraxen/OraxenHandler.java @@ -84,12 +84,6 @@ public abstract class OraxenHandler extends HandlerP { customWorld.addScarecrow(location); } - public void removeScarecrow(Location location) { - CustomWorld customWorld = cropManager.getCustomWorld(location.getWorld()); - if (customWorld == null) return; - customWorld.removeScarecrow(location); - } - public boolean tryMisc(Player player, ItemStack itemInHand, Location potLoc) { if (itemInHand == null || itemInHand.getType() == Material.AIR) return true; String id = OraxenItems.getIdByItem(itemInHand); @@ -182,7 +176,7 @@ public abstract class OraxenHandler extends HandlerP { } can.setItemMeta(nbtItem.getItem().getItemMeta()); - super.waterPot(waterCan.width(), waterCan.getLength(), potLoc, player.getLocation().getYaw()); + super.waterPot(waterCan.getWidth(), waterCan.getLength(), potLoc, player.getLocation().getYaw()); } return true; } diff --git a/src/main/java/net/momirealms/customcrops/integrations/customplugin/oraxen/OraxenWireHandler.java b/src/main/java/net/momirealms/customcrops/integrations/customplugin/oraxen/OraxenWireHandler.java index 4b5ab95..2432de7 100644 --- a/src/main/java/net/momirealms/customcrops/integrations/customplugin/oraxen/OraxenWireHandler.java +++ b/src/main/java/net/momirealms/customcrops/integrations/customplugin/oraxen/OraxenWireHandler.java @@ -274,6 +274,14 @@ public class OraxenWireHandler extends OraxenHandler{ if (player.getGameMode() != GameMode.CREATIVE) itemInHand.setAmount(itemInHand.getAmount() - 1); if (Math.random() < MainConfig.boneMealChance) { seedLoc.getWorld().spawnParticle(MainConfig.boneMealSuccess, seedLoc.clone().add(0.5,0.5, 0.5),3,0.2,0.2,0.2); + if (SoundConfig.boneMeal.isEnable()) { + AdventureUtil.playerSound( + player, + SoundConfig.boneMeal.getSource(), + SoundConfig.boneMeal.getKey(), + 1,1 + ); + } StringBlockMechanicFactory.setBlockModel(block, getNextStage(id)); } return; diff --git a/src/main/java/net/momirealms/customcrops/integrations/season/RealisticSeasonsHook.java b/src/main/java/net/momirealms/customcrops/integrations/season/RealisticSeasonsHook.java index 1ffbc92..772d920 100644 --- a/src/main/java/net/momirealms/customcrops/integrations/season/RealisticSeasonsHook.java +++ b/src/main/java/net/momirealms/customcrops/integrations/season/RealisticSeasonsHook.java @@ -23,7 +23,6 @@ import net.momirealms.customcrops.config.MainConfig; import org.bukkit.World; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.mozilla.javascript.tools.jsc.Main; public class RealisticSeasonsHook extends Function implements SeasonInterface { diff --git a/src/main/java/net/momirealms/customcrops/managers/CropManager.java b/src/main/java/net/momirealms/customcrops/managers/CropManager.java index 59e2f28..39a1daa 100644 --- a/src/main/java/net/momirealms/customcrops/managers/CropManager.java +++ b/src/main/java/net/momirealms/customcrops/managers/CropManager.java @@ -24,6 +24,7 @@ import net.momirealms.customcrops.api.event.CropHarvestEvent; import net.momirealms.customcrops.config.BasicItemConfig; import net.momirealms.customcrops.config.MainConfig; import net.momirealms.customcrops.config.SeasonConfig; +import net.momirealms.customcrops.config.SoundConfig; import net.momirealms.customcrops.integrations.customplugin.CustomInterface; import net.momirealms.customcrops.integrations.customplugin.HandlerP; import net.momirealms.customcrops.integrations.customplugin.itemsadder.ItemsAdderFrameHandler; @@ -48,6 +49,7 @@ import net.momirealms.customcrops.objects.fertilizer.Fertilizer; import net.momirealms.customcrops.objects.fertilizer.QualityCrop; import net.momirealms.customcrops.objects.fertilizer.RetainingSoil; import net.momirealms.customcrops.objects.fertilizer.YieldIncreasing; +import net.momirealms.customcrops.utils.AdventureUtil; import net.momirealms.customcrops.utils.ArmorStandUtil; import org.bukkit.Bukkit; import org.bukkit.GameMode; @@ -269,6 +271,15 @@ public class CropManager extends Function { ActionInterface[] actions = crop.getActions(); if (actions != null) performActions(actions, player); + if (SoundConfig.harvestCrop.isEnable()) { + AdventureUtil.playerSound( + player, + SoundConfig.harvestCrop.getSource(), + SoundConfig.harvestCrop.getKey(), + 1,1 + ); + } + if (player.getGameMode() == GameMode.CREATIVE) return; QualityLoot qualityLoot = crop.getQualityLoot(); diff --git a/src/main/java/net/momirealms/customcrops/managers/OraxenFrameCropImpl.java b/src/main/java/net/momirealms/customcrops/managers/OraxenFrameCropImpl.java index 7434b1d..fa0e7b1 100644 --- a/src/main/java/net/momirealms/customcrops/managers/OraxenFrameCropImpl.java +++ b/src/main/java/net/momirealms/customcrops/managers/OraxenFrameCropImpl.java @@ -24,7 +24,6 @@ import net.momirealms.customcrops.config.CropConfig; import net.momirealms.customcrops.config.MainConfig; import net.momirealms.customcrops.integrations.customplugin.CustomInterface; import net.momirealms.customcrops.integrations.customplugin.oraxen.OraxenHook; -import net.momirealms.customcrops.managers.timer.CrowTask; import net.momirealms.customcrops.objects.GiganticCrop; import net.momirealms.customcrops.objects.fertilizer.Fertilizer; import net.momirealms.customcrops.objects.fertilizer.Gigantic; @@ -35,7 +34,6 @@ import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.Location; import org.bukkit.entity.ItemFrame; -import org.bukkit.entity.Player; import org.bukkit.persistence.PersistentDataType; public class OraxenFrameCropImpl implements CropModeInterface { diff --git a/src/main/java/net/momirealms/customcrops/managers/timer/CrowTask.java b/src/main/java/net/momirealms/customcrops/managers/timer/CrowTask.java index 9b15ab4..66afbb2 100644 --- a/src/main/java/net/momirealms/customcrops/managers/timer/CrowTask.java +++ b/src/main/java/net/momirealms/customcrops/managers/timer/CrowTask.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package net.momirealms.customcrops.managers.timer; import net.momirealms.customcrops.CustomCrops; diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 51710e6..d213513 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -35,6 +35,7 @@ optimization: # Recommend enabling this to prevent large quantities of crops/itemframes lagging the server limitation: enable: true + # max amount per chunk tripwire-amount: 64 itemframe-amount: 64 @@ -42,7 +43,7 @@ optimization: disable-water-particles: false # Disable the animation when sprinkler works disable-sprinkler-animation: false - # Auto back up the data for when a world is unloaded + # Auto back up the data when a world is unloaded auto-back-up: true mechanics: @@ -108,6 +109,8 @@ mechanics: enable: true #effective range range: 5 + # During the crop grow progress, crops have little chance to be eaten by a crow + # Place a scarecrow would protect the crops in this chunk crow: enable: true chance: 0.005