9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-22 08:29:35 +00:00

2.0-pre-release-1

This commit is contained in:
Xiao-MoMi
2022-10-06 20:03:25 +08:00
parent 1bc99a34a0
commit 4140155650
27 changed files with 310 additions and 29 deletions

1
libs/Oraxen(premium).txt Normal file
View File

@@ -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/

View File

@@ -27,6 +27,7 @@ import net.momirealms.customcrops.helper.LibraryLoader;
import net.momirealms.customcrops.integrations.papi.PlaceholderManager; import net.momirealms.customcrops.integrations.papi.PlaceholderManager;
import net.momirealms.customcrops.managers.CropManager; import net.momirealms.customcrops.managers.CropManager;
import net.momirealms.customcrops.utils.AdventureUtil; import net.momirealms.customcrops.utils.AdventureUtil;
import org.bstats.bukkit.Metrics;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@@ -88,6 +89,7 @@ public final class CustomCrops extends JavaPlugin {
} }
AdventureUtil.consoleMessage("[CustomCrops] Plugin Enabled!"); AdventureUtil.consoleMessage("[CustomCrops] Plugin Enabled!");
new Metrics(this, 16593);
} }
@Override @Override

View File

@@ -1,3 +1,21 @@
/*
* Copyright (C) <2022> <XiaoMoMi>
*
* 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 <https://www.gnu.org/licenses/>.
*/
package net.momirealms.customcrops.api.event; package net.momirealms.customcrops.api.event;
import net.momirealms.customcrops.objects.WorldState; import net.momirealms.customcrops.objects.WorldState;

View File

@@ -1,3 +1,21 @@
/*
* Copyright (C) <2022> <XiaoMoMi>
*
* 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 <https://www.gnu.org/licenses/>.
*/
package net.momirealms.customcrops.api.event; package net.momirealms.customcrops.api.event;
import net.momirealms.customcrops.api.crop.Crop; import net.momirealms.customcrops.api.crop.Crop;

View File

@@ -1,3 +1,21 @@
/*
* Copyright (C) <2022> <XiaoMoMi>
*
* 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 <https://www.gnu.org/licenses/>.
*/
package net.momirealms.customcrops.api.event; package net.momirealms.customcrops.api.event;
import org.bukkit.Location; import org.bukkit.Location;

View File

@@ -1,3 +1,21 @@
/*
* Copyright (C) <2022> <XiaoMoMi>
*
* 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 <https://www.gnu.org/licenses/>.
*/
package net.momirealms.customcrops.api.event; package net.momirealms.customcrops.api.event;
import net.momirealms.customcrops.objects.fertilizer.Fertilizer; import net.momirealms.customcrops.objects.fertilizer.Fertilizer;

View File

@@ -1,3 +1,21 @@
/*
* Copyright (C) <2022> <XiaoMoMi>
*
* 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 <https://www.gnu.org/licenses/>.
*/
package net.momirealms.customcrops.api.utils; package net.momirealms.customcrops.api.utils;
import net.momirealms.customcrops.CustomCrops; import net.momirealms.customcrops.CustomCrops;

View File

@@ -1,3 +1,20 @@
/*
* Copyright (C) <2022> <XiaoMoMi>
*
* 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 <https://www.gnu.org/licenses/>.
*/
package net.momirealms.customcrops.commands; package net.momirealms.customcrops.commands;
import net.momirealms.customcrops.config.MainConfig; import net.momirealms.customcrops.config.MainConfig;

View File

@@ -1,3 +1,20 @@
/*
* Copyright (C) <2022> <XiaoMoMi>
*
* 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 <https://www.gnu.org/licenses/>.
*/
package net.momirealms.customcrops.commands; package net.momirealms.customcrops.commands;
import net.momirealms.customcrops.commands.subcmd.ReloadCommand; import net.momirealms.customcrops.commands.subcmd.ReloadCommand;

View File

@@ -1,3 +1,20 @@
/*
* Copyright (C) <2022> <XiaoMoMi>
*
* 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 <https://www.gnu.org/licenses/>.
*/
package net.momirealms.customcrops.commands; package net.momirealms.customcrops.commands;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;

View File

@@ -1,3 +1,20 @@
/*
* Copyright (C) <2022> <XiaoMoMi>
*
* 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 <https://www.gnu.org/licenses/>.
*/
package net.momirealms.customcrops.commands.subcmd; package net.momirealms.customcrops.commands.subcmd;
import net.momirealms.customcrops.commands.AbstractSubCommand; import net.momirealms.customcrops.commands.AbstractSubCommand;

View File

@@ -1,3 +1,20 @@
/*
* Copyright (C) <2022> <XiaoMoMi>
*
* 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 <https://www.gnu.org/licenses/>.
*/
package net.momirealms.customcrops.commands.subcmd; package net.momirealms.customcrops.commands.subcmd;
import net.momirealms.customcrops.api.utils.SeasonUtils; import net.momirealms.customcrops.api.utils.SeasonUtils;

View File

@@ -1,3 +1,20 @@
/*
* Copyright (C) <2022> <XiaoMoMi>
*
* 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 <https://www.gnu.org/licenses/>.
*/
package net.momirealms.customcrops.commands.subcmd; package net.momirealms.customcrops.commands.subcmd;
import net.momirealms.customcrops.CustomCrops; import net.momirealms.customcrops.CustomCrops;

View File

@@ -1,3 +1,20 @@
/*
* Copyright (C) <2022> <XiaoMoMi>
*
* 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 <https://www.gnu.org/licenses/>.
*/
package net.momirealms.customcrops.config; package net.momirealms.customcrops.config;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;

View File

@@ -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) { public boolean placeSprinkler(String id, Location location, Player player, ItemStack item) {
Sprinkler config = SprinklerConfig.SPRINKLERS_2D.get(id); Sprinkler config = SprinklerConfig.SPRINKLERS_2D.get(id);
@@ -292,12 +298,6 @@ public abstract class HandlerP extends Function {
return StringUtils.chop(id) + nextStage; 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) { public boolean fillWaterCan(String id, NBTItem nbtItem, ItemStack itemStack, Player player) {
WaterCan config = WaterCanConfig.CANS.get(id); WaterCan config = WaterCanConfig.CANS.get(id);
if (config != null) { if (config != null) {

View File

@@ -91,6 +91,14 @@ public class ItemsAdderFrameHandler extends ItemsAdderHandler {
if (player.getGameMode() != GameMode.CREATIVE) itemInHand.setAmount(itemInHand.getAmount() - 1); if (player.getGameMode() != GameMode.CREATIVE) itemInHand.setAmount(itemInHand.getAmount() - 1);
if (Math.random() < MainConfig.boneMealChance) { if (Math.random() < MainConfig.boneMealChance) {
entity.getWorld().spawnParticle(MainConfig.boneMealSuccess, location.clone().add(0,0.5, 0),3,0.2,0.2,0.2); 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.remove(entity, false);
CustomFurniture.spawn(getNextStage(namespacedID), location.getBlock()); CustomFurniture.spawn(getNextStage(namespacedID), location.getBlock());
} }
@@ -119,6 +127,11 @@ public class ItemsAdderFrameHandler extends ItemsAdderHandler {
return; return;
} }
if (MainConfig.enableCrow && namespacedId.equals(BasicItemConfig.scarecrow)) {
super.removeScarecrow(event.getBukkitEntity().getLocation());
return;
}
if (namespacedId.contains("_stage_")) { if (namespacedId.contains("_stage_")) {
if (namespacedId.equals(BasicItemConfig.deadCrop)) return; if (namespacedId.equals(BasicItemConfig.deadCrop)) return;
if (hasNextStage(namespacedId)) { if (hasNextStage(namespacedId)) {

View File

@@ -21,23 +21,18 @@ import de.tr7zw.changeme.nbtapi.NBTCompound;
import de.tr7zw.changeme.nbtapi.NBTItem; import de.tr7zw.changeme.nbtapi.NBTItem;
import dev.lone.itemsadder.api.CustomBlock; import dev.lone.itemsadder.api.CustomBlock;
import dev.lone.itemsadder.api.CustomStack; import dev.lone.itemsadder.api.CustomStack;
import dev.lone.itemsadder.api.Events.CustomBlockBreakEvent; import dev.lone.itemsadder.api.Events.*;
import dev.lone.itemsadder.api.Events.CustomBlockInteractEvent;
import dev.lone.itemsadder.api.Events.FurnitureBreakEvent;
import dev.lone.itemsadder.api.Events.FurnitureInteractEvent;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import net.momirealms.customcrops.CustomCrops; import net.momirealms.customcrops.CustomCrops;
import net.momirealms.customcrops.api.crop.Crop; import net.momirealms.customcrops.api.crop.Crop;
import net.momirealms.customcrops.api.event.WaterEvent; import net.momirealms.customcrops.api.event.WaterEvent;
import net.momirealms.customcrops.config.CropConfig; import net.momirealms.customcrops.config.*;
import net.momirealms.customcrops.config.MainConfig;
import net.momirealms.customcrops.config.SoundConfig;
import net.momirealms.customcrops.config.WaterCanConfig;
import net.momirealms.customcrops.integrations.AntiGrief; import net.momirealms.customcrops.integrations.AntiGrief;
import net.momirealms.customcrops.integrations.customplugin.HandlerP; import net.momirealms.customcrops.integrations.customplugin.HandlerP;
import net.momirealms.customcrops.integrations.customplugin.itemsadder.listeners.ItemsAdderBlockListener; import net.momirealms.customcrops.integrations.customplugin.itemsadder.listeners.ItemsAdderBlockListener;
import net.momirealms.customcrops.integrations.customplugin.itemsadder.listeners.ItemsAdderFurnitureListener; import net.momirealms.customcrops.integrations.customplugin.itemsadder.listeners.ItemsAdderFurnitureListener;
import net.momirealms.customcrops.managers.CropManager; import net.momirealms.customcrops.managers.CropManager;
import net.momirealms.customcrops.managers.CustomWorld;
import net.momirealms.customcrops.objects.WaterCan; import net.momirealms.customcrops.objects.WaterCan;
import net.momirealms.customcrops.utils.AdventureUtil; import net.momirealms.customcrops.utils.AdventureUtil;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
@@ -78,6 +73,16 @@ public abstract class ItemsAdderHandler extends HandlerP {
HandlerList.unregisterAll(this.itemsAdderFurnitureListener); 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 @Override
public void onPlayerInteract(PlayerInteractEvent event) { public void onPlayerInteract(PlayerInteractEvent event) {
@@ -191,7 +196,7 @@ public abstract class ItemsAdderHandler extends HandlerP {
} }
itemStack.setItemMeta(nbtItem.getItem().getItemMeta()); 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; return true;

View File

@@ -87,6 +87,11 @@ public class ItemsAdderWireHandler extends ItemsAdderHandler {
Sprinkler sprinkler = SprinklerConfig.SPRINKLERS_3D.get(namespacedID); Sprinkler sprinkler = SprinklerConfig.SPRINKLERS_3D.get(namespacedID);
if (sprinkler != null) { if (sprinkler != null) {
super.onBreakSprinkler(event.getBukkitEntity().getLocation()); 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 (player.getGameMode() != GameMode.CREATIVE) itemInHand.setAmount(itemInHand.getAmount() - 1);
if (Math.random() < MainConfig.boneMealChance) { 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); 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.remove(location);
CustomBlock.place(getNextStage(blockID), location); CustomBlock.place(getNextStage(blockID), location);
} }

View File

@@ -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.FurnitureBreakEvent;
import dev.lone.itemsadder.api.Events.FurnitureInteractEvent; 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 net.momirealms.customcrops.integrations.customplugin.itemsadder.ItemsAdderHandler;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
@@ -43,7 +43,7 @@ public class ItemsAdderFurnitureListener implements Listener {
} }
@EventHandler @EventHandler
public void onPlaceFurniture(FurniturePlaceEvent event) { public void onPlaceFurniture(FurniturePlaceSuccessEvent event) {
//TODO scarecrow handler.placeScarecrow(event);
} }
} }

View File

@@ -237,6 +237,14 @@ public class OraxenFrameHandler extends OraxenHandler {
if (player.getGameMode() != GameMode.CREATIVE) itemInHand.setAmount(itemInHand.getAmount() - 1); if (player.getGameMode() != GameMode.CREATIVE) itemInHand.setAmount(itemInHand.getAmount() - 1);
if (Math.random() < MainConfig.boneMealChance) { if (Math.random() < MainConfig.boneMealChance) {
itemFrame.getWorld().spawnParticle(MainConfig.boneMealSuccess, location.clone().add(0,0.5, 0),3,0.2,0.2,0.2); 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); String nextStage = getNextStage(id);
itemFrame.setItem(customInterface.getItemStack(nextStage)); itemFrame.setItem(customInterface.getItemStack(nextStage));
itemFrame.getPersistentDataContainer().set(OraxenHook.FURNITURE, PersistentDataType.STRING, nextStage); itemFrame.getPersistentDataContainer().set(OraxenHook.FURNITURE, PersistentDataType.STRING, nextStage);

View File

@@ -84,12 +84,6 @@ public abstract class OraxenHandler extends HandlerP {
customWorld.addScarecrow(location); 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) { public boolean tryMisc(Player player, ItemStack itemInHand, Location potLoc) {
if (itemInHand == null || itemInHand.getType() == Material.AIR) return true; if (itemInHand == null || itemInHand.getType() == Material.AIR) return true;
String id = OraxenItems.getIdByItem(itemInHand); String id = OraxenItems.getIdByItem(itemInHand);
@@ -182,7 +176,7 @@ public abstract class OraxenHandler extends HandlerP {
} }
can.setItemMeta(nbtItem.getItem().getItemMeta()); 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; return true;
} }

View File

@@ -274,6 +274,14 @@ public class OraxenWireHandler extends OraxenHandler{
if (player.getGameMode() != GameMode.CREATIVE) itemInHand.setAmount(itemInHand.getAmount() - 1); if (player.getGameMode() != GameMode.CREATIVE) itemInHand.setAmount(itemInHand.getAmount() - 1);
if (Math.random() < MainConfig.boneMealChance) { 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); 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)); StringBlockMechanicFactory.setBlockModel(block, getNextStage(id));
} }
return; return;

View File

@@ -23,7 +23,6 @@ import net.momirealms.customcrops.config.MainConfig;
import org.bukkit.World; import org.bukkit.World;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.mozilla.javascript.tools.jsc.Main;
public class RealisticSeasonsHook extends Function implements SeasonInterface { public class RealisticSeasonsHook extends Function implements SeasonInterface {

View File

@@ -24,6 +24,7 @@ import net.momirealms.customcrops.api.event.CropHarvestEvent;
import net.momirealms.customcrops.config.BasicItemConfig; import net.momirealms.customcrops.config.BasicItemConfig;
import net.momirealms.customcrops.config.MainConfig; import net.momirealms.customcrops.config.MainConfig;
import net.momirealms.customcrops.config.SeasonConfig; 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.CustomInterface;
import net.momirealms.customcrops.integrations.customplugin.HandlerP; import net.momirealms.customcrops.integrations.customplugin.HandlerP;
import net.momirealms.customcrops.integrations.customplugin.itemsadder.ItemsAdderFrameHandler; 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.QualityCrop;
import net.momirealms.customcrops.objects.fertilizer.RetainingSoil; import net.momirealms.customcrops.objects.fertilizer.RetainingSoil;
import net.momirealms.customcrops.objects.fertilizer.YieldIncreasing; import net.momirealms.customcrops.objects.fertilizer.YieldIncreasing;
import net.momirealms.customcrops.utils.AdventureUtil;
import net.momirealms.customcrops.utils.ArmorStandUtil; import net.momirealms.customcrops.utils.ArmorStandUtil;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.GameMode; import org.bukkit.GameMode;
@@ -269,6 +271,15 @@ public class CropManager extends Function {
ActionInterface[] actions = crop.getActions(); ActionInterface[] actions = crop.getActions();
if (actions != null) performActions(actions, player); 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; if (player.getGameMode() == GameMode.CREATIVE) return;
QualityLoot qualityLoot = crop.getQualityLoot(); QualityLoot qualityLoot = crop.getQualityLoot();

View File

@@ -24,7 +24,6 @@ import net.momirealms.customcrops.config.CropConfig;
import net.momirealms.customcrops.config.MainConfig; import net.momirealms.customcrops.config.MainConfig;
import net.momirealms.customcrops.integrations.customplugin.CustomInterface; import net.momirealms.customcrops.integrations.customplugin.CustomInterface;
import net.momirealms.customcrops.integrations.customplugin.oraxen.OraxenHook; 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.GiganticCrop;
import net.momirealms.customcrops.objects.fertilizer.Fertilizer; import net.momirealms.customcrops.objects.fertilizer.Fertilizer;
import net.momirealms.customcrops.objects.fertilizer.Gigantic; import net.momirealms.customcrops.objects.fertilizer.Gigantic;
@@ -35,7 +34,6 @@ import org.bukkit.Bukkit;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.ItemFrame; import org.bukkit.entity.ItemFrame;
import org.bukkit.entity.Player;
import org.bukkit.persistence.PersistentDataType; import org.bukkit.persistence.PersistentDataType;
public class OraxenFrameCropImpl implements CropModeInterface { public class OraxenFrameCropImpl implements CropModeInterface {

View File

@@ -1,3 +1,20 @@
/*
* Copyright (C) <2022> <XiaoMoMi>
*
* 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 <https://www.gnu.org/licenses/>.
*/
package net.momirealms.customcrops.managers.timer; package net.momirealms.customcrops.managers.timer;
import net.momirealms.customcrops.CustomCrops; import net.momirealms.customcrops.CustomCrops;

View File

@@ -35,6 +35,7 @@ optimization:
# Recommend enabling this to prevent large quantities of crops/itemframes lagging the server # Recommend enabling this to prevent large quantities of crops/itemframes lagging the server
limitation: limitation:
enable: true enable: true
# max amount per chunk
tripwire-amount: 64 tripwire-amount: 64
itemframe-amount: 64 itemframe-amount: 64
@@ -42,7 +43,7 @@ optimization:
disable-water-particles: false disable-water-particles: false
# Disable the animation when sprinkler works # Disable the animation when sprinkler works
disable-sprinkler-animation: false 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 auto-back-up: true
mechanics: mechanics:
@@ -108,6 +109,8 @@ mechanics:
enable: true enable: true
#effective range #effective range
range: 5 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: crow:
enable: true enable: true
chance: 0.005 chance: 0.005