9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-23 08:59:28 +00:00
This commit is contained in:
XiaoMoMi
2023-09-25 22:16:44 +08:00
parent 69cdadd704
commit 7854066a49
10 changed files with 63 additions and 21 deletions

View File

@@ -8,7 +8,7 @@ plugins {
allprojects { allprojects {
project.group = "net.momirealms" project.group = "net.momirealms"
project.version = "3.3.1.4" project.version = "3.3.1.5"
apply<JavaPlugin>() apply<JavaPlugin>()
apply(plugin = "java") apply(plugin = "java")
@@ -71,12 +71,5 @@ subprojects {
tasks.javadoc.configure { tasks.javadoc.configure {
options.quiet() options.quiet()
} }
if ("api" == project.name) {
java {
withSourcesJar()
withJavadocJar()
}
}
} }

View File

@@ -1,8 +1,8 @@
systemProp.socks.proxyHost=127.0.0.1 #systemProp.socks.proxyHost=127.0.0.1
systemProp.socks.proxyPort=7890 #systemProp.socks.proxyPort=7890
systemProp.http.proxyHost=127.0.0.1 #systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=7890 #systemProp.http.proxyPort=7890
systemProp.https.proxyHost=127.0.0.1 #systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=7890 #systemProp.https.proxyPort=7890

View File

@@ -28,7 +28,7 @@ dependencies {
implementation("net.kyori:adventure-platform-bukkit:4.3.0") implementation("net.kyori:adventure-platform-bukkit:4.3.0")
implementation("net.kyori:adventure-text-minimessage:4.14.0") implementation("net.kyori:adventure-text-minimessage:4.14.0")
implementation("net.kyori:adventure-text-serializer-legacy:4.14.0") implementation("net.kyori:adventure-text-serializer-legacy:4.14.0")
implementation("de.tr7zw:item-nbt-api:2.11.3") implementation("de.tr7zw:item-nbt-api:2.12.0")
implementation("org.bstats:bstats-bukkit:3.0.1") implementation("org.bstats:bstats-bukkit:3.0.1")
implementation(files("libs/BiomeAPI.jar", "libs/ProtectionLib.jar")) implementation(files("libs/BiomeAPI.jar", "libs/ProtectionLib.jar"))
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -22,9 +22,11 @@ import com.comphenix.protocol.ProtocolManager;
import net.kyori.adventure.platform.bukkit.BukkitAudiences; import net.kyori.adventure.platform.bukkit.BukkitAudiences;
import net.momirealms.customcrops.api.CustomCropsAPIImpl; import net.momirealms.customcrops.api.CustomCropsAPIImpl;
import net.momirealms.customcrops.api.CustomCropsPlugin; import net.momirealms.customcrops.api.CustomCropsPlugin;
import net.momirealms.customcrops.api.event.CropBreakEvent;
import net.momirealms.customcrops.api.object.basic.ConfigManager; import net.momirealms.customcrops.api.object.basic.ConfigManager;
import net.momirealms.customcrops.api.object.basic.MessageManager; import net.momirealms.customcrops.api.object.basic.MessageManager;
import net.momirealms.customcrops.api.object.crop.CropManager; import net.momirealms.customcrops.api.object.crop.CropManager;
import net.momirealms.customcrops.api.object.crop.GrowingCrop;
import net.momirealms.customcrops.api.object.fertilizer.FertilizerManager; import net.momirealms.customcrops.api.object.fertilizer.FertilizerManager;
import net.momirealms.customcrops.api.object.hologram.HologramManager; import net.momirealms.customcrops.api.object.hologram.HologramManager;
import net.momirealms.customcrops.api.object.pot.PotManager; import net.momirealms.customcrops.api.object.pot.PotManager;
@@ -32,6 +34,7 @@ import net.momirealms.customcrops.api.object.scheduler.Scheduler;
import net.momirealms.customcrops.api.object.season.SeasonManager; import net.momirealms.customcrops.api.object.season.SeasonManager;
import net.momirealms.customcrops.api.object.sprinkler.SprinklerManager; import net.momirealms.customcrops.api.object.sprinkler.SprinklerManager;
import net.momirealms.customcrops.api.object.wateringcan.WateringCanManager; import net.momirealms.customcrops.api.object.wateringcan.WateringCanManager;
import net.momirealms.customcrops.api.object.world.SimpleLocation;
import net.momirealms.customcrops.api.object.world.WorldDataManager; import net.momirealms.customcrops.api.object.world.WorldDataManager;
import net.momirealms.customcrops.command.CustomCropsCommand; import net.momirealms.customcrops.command.CustomCropsCommand;
import net.momirealms.customcrops.customplugin.Platform; import net.momirealms.customcrops.customplugin.Platform;

View File

@@ -0,0 +1,44 @@
/*
* 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.object.requirement;
import net.momirealms.biomeapi.BiomeAPI;
import net.momirealms.customcrops.api.object.action.Action;
import org.jetbrains.annotations.Nullable;
import java.util.HashSet;
public class BlackBiomeImpl extends AbstractRequirement implements Requirement {
private final HashSet<String> biomes;
public BlackBiomeImpl(@Nullable String[] msg, @Nullable Action[] actions, HashSet<String> biomes) {
super(msg, actions);
this.biomes = biomes;
}
@Override
public boolean isConditionMet(CurrentState currentState) {
String currentBiome = BiomeAPI.getBiome(currentState.getLocation());
if (!biomes.contains(currentBiome)) {
return true;
}
notMetActions(currentState);
return false;
}
}

View File

@@ -19,19 +19,20 @@ package net.momirealms.customcrops.integration.quest;
import io.github.battlepass.BattlePlugin; import io.github.battlepass.BattlePlugin;
import io.github.battlepass.api.events.server.PluginReloadEvent; import io.github.battlepass.api.events.server.PluginReloadEvent;
import io.github.battlepass.quests.service.base.ExternalQuestContainer; import net.advancedplugins.bp.impl.actions.ActionRegistry;
import io.github.battlepass.registry.quest.QuestRegistry; import net.advancedplugins.bp.impl.actions.external.executor.ActionQuestExecutor;
import net.momirealms.customcrops.api.event.CropBreakEvent; import net.momirealms.customcrops.api.event.CropBreakEvent;
import net.momirealms.customcrops.api.event.CropPlantEvent; import net.momirealms.customcrops.api.event.CropPlantEvent;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
public class BattlePassCCQuest implements Listener { public class BattlePassCCQuest implements Listener {
public static void register() { public static void register() {
QuestRegistry questRegistry = BattlePlugin.getApi().getQuestRegistry(); ActionRegistry actionRegistry = BattlePlugin.getPlugin().getActionRegistry();
questRegistry.hook("customcrops", CropQuest::new); actionRegistry.hook("customcrops", CropQuest::new);
} }
@EventHandler(ignoreCancelled = true) @EventHandler(ignoreCancelled = true)
@@ -39,9 +40,9 @@ public class BattlePassCCQuest implements Listener {
register(); register();
} }
private static class CropQuest extends ExternalQuestContainer { private static class CropQuest extends ActionQuestExecutor {
public CropQuest(BattlePlugin battlePlugin) { public CropQuest(JavaPlugin battlePlugin) {
super(battlePlugin, "customcrops"); super(battlePlugin, "customcrops");
} }

View File

@@ -208,6 +208,7 @@ public class ConfigUtils {
ConfigurationSection actionSec = innerSec.getConfigurationSection("actions"); ConfigurationSection actionSec = innerSec.getConfigurationSection("actions");
switch (type) { switch (type) {
case "biome" -> requirements.add(new BiomeImpl(msg, getActions(actionSec), new HashSet<>(innerSec.getStringList("value")))); case "biome" -> requirements.add(new BiomeImpl(msg, getActions(actionSec), new HashSet<>(innerSec.getStringList("value"))));
case "!biome" -> requirements.add(new BlackBiomeImpl(msg, getActions(actionSec), new HashSet<>(innerSec.getStringList("value"))));
case "weather" -> requirements.add(new WeatherImpl(msg, getActions(actionSec), innerSec.getStringList("value").toArray(new String[0]))); case "weather" -> requirements.add(new WeatherImpl(msg, getActions(actionSec), innerSec.getStringList("value").toArray(new String[0])));
case "ypos" -> requirements.add(new YPosImpl(msg, getActions(actionSec), innerSec.getStringList("value"))); case "ypos" -> requirements.add(new YPosImpl(msg, getActions(actionSec), innerSec.getStringList("value")));
case "season" -> { case "season" -> {