mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-28 03:19:15 +00:00
fix build
This commit is contained in:
@@ -39,6 +39,7 @@ allprojects {
|
||||
maven("https://nexus.phoenixdevt.fr/repository/maven-public/")
|
||||
maven("https://r.irepo.space/maven/")
|
||||
maven("https://repo.auxilor.io/repository/maven-public/")
|
||||
maven("https://nexus.betonquest.org/repository/betonquest/")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#systemProp.socks.proxyHost=127.0.0.1
|
||||
#systemProp.socks.proxyPort=7890
|
||||
|
||||
#
|
||||
#systemProp.http.proxyHost=127.0.0.1
|
||||
#systemProp.http.proxyPort=7890
|
||||
|
||||
#
|
||||
#systemProp.https.proxyHost=127.0.0.1
|
||||
#systemProp.https.proxyPort=7890
|
||||
|
||||
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
|
||||
distributionUrl=https://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -20,16 +20,16 @@ dependencies {
|
||||
compileOnly("com.github.Zrips:Jobs:4.17.2")
|
||||
compileOnly("com.github.MilkBowl:VaultAPI:1.7")
|
||||
compileOnly("com.comphenix.protocol:ProtocolLib:5.0.0")
|
||||
compileOnly("pl.betoncraft:betonquest:1.12.10")
|
||||
compileOnly("net.Indyuce:MMOCore-API:1.12-SNAPSHOT")
|
||||
compileOnly("org.betonquest:betonquest:2.0.0")
|
||||
|
||||
implementation(project(":api"))
|
||||
implementation("net.kyori:adventure-api:4.14.0")
|
||||
implementation("net.kyori:adventure-api:4.15.0")
|
||||
implementation("net.kyori:adventure-platform-bukkit:4.3.3-SNAPSHOT")
|
||||
implementation("net.kyori:adventure-text-minimessage:4.14.0")
|
||||
implementation("net.kyori:adventure-text-serializer-legacy:4.14.0")
|
||||
implementation("net.kyori:adventure-text-minimessage:4.15.0")
|
||||
implementation("net.kyori:adventure-text-serializer-legacy:4.15.0")
|
||||
implementation("de.tr7zw:item-nbt-api:2.12.2")
|
||||
implementation("org.bstats:bstats-bukkit:3.0.1")
|
||||
implementation("org.bstats:bstats-bukkit:3.0.2")
|
||||
implementation(files("libs/BiomeAPI.jar", "libs/ProtectionLib.jar"))
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
@@ -30,7 +30,6 @@ import net.momirealms.customcrops.integration.papi.PlaceholderManager;
|
||||
import net.momirealms.customcrops.integration.quest.BattlePassCCQuest;
|
||||
import net.momirealms.customcrops.integration.quest.BetonQuestCCQuest;
|
||||
import net.momirealms.customcrops.integration.quest.ClueScrollCCQuest;
|
||||
import net.momirealms.customcrops.integration.quest.LegacyBetonQuestCCQuest;
|
||||
import net.momirealms.customcrops.integration.season.CustomCropsSeasonImpl;
|
||||
import net.momirealms.customcrops.integration.season.RealisticSeasonsImpl;
|
||||
import net.momirealms.customcrops.integration.skill.AureliumsImpl;
|
||||
@@ -181,8 +180,7 @@ public class IntegrationManager extends Function {
|
||||
hookMessage("ClueScrolls");
|
||||
}
|
||||
if (pluginManager.isPluginEnabled("BetonQuest")) {
|
||||
if (Bukkit.getPluginManager().getPlugin("BetonQuest").getDescription().getVersion().startsWith("2")) BetonQuestCCQuest.register();
|
||||
else LegacyBetonQuestCCQuest.register();
|
||||
BetonQuestCCQuest.register();
|
||||
hookMessage("BetonQuest");
|
||||
}
|
||||
if (pluginManager.isPluginEnabled("BattlePass")) {
|
||||
|
||||
@@ -1,157 +0,0 @@
|
||||
/*
|
||||
* 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.integration.quest;
|
||||
|
||||
import net.momirealms.customcrops.api.event.CropBreakEvent;
|
||||
import net.momirealms.customcrops.util.AdventureUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import pl.betoncraft.betonquest.BetonQuest;
|
||||
import pl.betoncraft.betonquest.Instruction;
|
||||
import pl.betoncraft.betonquest.api.Objective;
|
||||
import pl.betoncraft.betonquest.config.Config;
|
||||
import pl.betoncraft.betonquest.exceptions.InstructionParseException;
|
||||
import pl.betoncraft.betonquest.exceptions.QuestRuntimeException;
|
||||
import pl.betoncraft.betonquest.utils.LogUtils;
|
||||
import pl.betoncraft.betonquest.utils.PlayerConverter;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class LegacyBetonQuestCCQuest extends Objective implements Listener {
|
||||
|
||||
private final HashSet<String> crop_ids = new HashSet<>();
|
||||
private final int amount;
|
||||
private final boolean notify;
|
||||
private final int notifyInterval;
|
||||
|
||||
public LegacyBetonQuestCCQuest(Instruction instruction) throws InstructionParseException {
|
||||
super(instruction);
|
||||
this.template = CropData.class;
|
||||
this.notifyInterval = instruction.getInt(instruction.getOptional("notify"), 1);
|
||||
this.notify = instruction.hasArgument("notify") || this.notifyInterval > 1;
|
||||
this.amount = instruction.getInt(instruction.getOptional("amount"), 1);
|
||||
Collections.addAll(this.crop_ids, instruction.getArray());
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
BetonQuest.getInstance().registerObjectives("customfishing", LegacyBetonQuestCCQuest.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
Bukkit.getPluginManager().registerEvents(this, BetonQuest.getInstance());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
HandlerList.unregisterAll(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultDataInstruction() {
|
||||
return Integer.toString(this.amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProperty(String name, String playerID) {
|
||||
return switch (name.toLowerCase(Locale.ROOT)) {
|
||||
case "amount" ->
|
||||
Integer.toString(this.amount - ((LegacyBetonQuestCCQuest.CropData) this.dataMap.get(playerID)).getAmount());
|
||||
case "left" -> Integer.toString(((LegacyBetonQuestCCQuest.CropData) this.dataMap.get(playerID)).getAmount());
|
||||
case "total" -> Integer.toString(this.amount);
|
||||
default -> "";
|
||||
};
|
||||
}
|
||||
|
||||
private boolean isValidPlayer(Player player) {
|
||||
if (player == null) {
|
||||
return false;
|
||||
} else {
|
||||
return player.isOnline() && player.isValid();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onHarvest(CropBreakEvent event) {
|
||||
if (!(event.getEntity() instanceof Player player)) return;
|
||||
String playerID = PlayerConverter.getID(player);
|
||||
if (this.containsPlayer(playerID)) {
|
||||
if (this.crop_ids.contains(event.getCropItemID())) {
|
||||
if (this.checkConditions(playerID)) {
|
||||
if (!isValidPlayer(player)) {
|
||||
return;
|
||||
}
|
||||
CropData cropData = (CropData) this.dataMap.get(playerID);
|
||||
cropData.harvest(1);
|
||||
if (cropData.finished()) {
|
||||
this.completeObjective(playerID);
|
||||
}
|
||||
else if (this.notify && cropData.getAmount() % this.notifyInterval == 0) {
|
||||
try {
|
||||
Config.sendNotify(this.instruction.getPackage().getName(), playerID, "crop_to_harvest", new String[]{String.valueOf(cropData.getAmount())}, "crop_to_harvest,info");
|
||||
} catch (QuestRuntimeException e1) {
|
||||
try {
|
||||
LogUtils.getLogger().log(Level.WARNING, "The notify system was unable to play a sound for the 'crop_to_harvest' category in '" + this.instruction.getObjective().getFullID() + "'. Error was: '" + e1.getMessage() + "'");
|
||||
} catch (InstructionParseException e2) {
|
||||
LogUtils.logThrowableReport(e2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class CropData extends Objective.ObjectiveData {
|
||||
private int amount;
|
||||
|
||||
public CropData(String instruction, String playerID, String objID) {
|
||||
super(instruction, playerID, objID);
|
||||
try {
|
||||
this.amount = Integer.parseInt(instruction);
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
AdventureUtils.consoleMessage("[CustomCrops] NumberFormatException");
|
||||
this.amount = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public void harvest(int caughtAmount) {
|
||||
this.amount -= caughtAmount;
|
||||
this.update();
|
||||
}
|
||||
|
||||
public int getAmount() {
|
||||
return this.amount;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return String.valueOf(this.amount);
|
||||
}
|
||||
|
||||
public boolean finished() {
|
||||
return this.amount <= 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user