mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-19 15:09:25 +00:00
1.5.18
This commit is contained in:
@@ -69,5 +69,8 @@ NEVER SET "only-grow-in-loaded-chunks" FALSE IF YOU DON'T DISABLE THE THREE FEAT
|
||||
### Placeholders
|
||||
%customcrops_season% show the season in the world\
|
||||
%customcrops_season_[world]%\
|
||||
==== these papi below will be accurate only in "Auto" mode ====\
|
||||
%customcrops_nextseason% show the days to the next season\
|
||||
%customcrops_nextseason_[world]%
|
||||
%customcrops_nextseason_[world]%\
|
||||
%customcrops_current% show the days the current season has gone\
|
||||
%customcrops_current_[world]%
|
||||
|
||||
@@ -5,7 +5,7 @@ plugins {
|
||||
|
||||
|
||||
group = 'net.momirealms'
|
||||
version = '1.5.17'
|
||||
version = '1.5.18'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -52,13 +52,13 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly "com.github.angeschossen:LandsAPI:6.5.1"
|
||||
compileOnly "com.github.TechFortress:GriefPrevention:16.18"
|
||||
compileOnly 'com.github.Archy-X:AureliumSkills:Beta1.3.6'
|
||||
compileOnly 'com.github.angeschossen:LandsAPI:6.5.1'
|
||||
compileOnly 'com.github.TechFortress:GriefPrevention:16.18'
|
||||
compileOnly 'com.destroystokyo.paper:paper-api:1.16.5-R0.1-SNAPSHOT'
|
||||
compileOnly 'com.comphenix.protocol:ProtocolLib:4.8.0'
|
||||
compileOnly 'me.clip:placeholderapi:2.11.2'
|
||||
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.7'
|
||||
compileOnly 'io.lumine:Mythic-Dist:5.0.3-SNAPSHOT'
|
||||
compileOnly 'com.github.LoneDev6:api-itemsadder:3.2.0c-beta6'
|
||||
compileOnly 'com.palmergames.bukkit.towny:towny:0.98.2.0'
|
||||
compileOnly fileTree(dir:'libs',includes:['*.jar'])
|
||||
|
||||
0
libs/MMOCore(premium).txt
Normal file
0
libs/MMOCore(premium).txt
Normal file
0
libs/mcMMO(premium).txt
Normal file
0
libs/mcMMO(premium).txt
Normal file
@@ -22,7 +22,11 @@ import net.momirealms.customcrops.fertilizer.Fertilizer;
|
||||
import net.momirealms.customcrops.fertilizer.QualityCrop;
|
||||
import net.momirealms.customcrops.fertilizer.RetainingSoil;
|
||||
import net.momirealms.customcrops.fertilizer.SpeedGrow;
|
||||
import net.momirealms.customcrops.integrations.*;
|
||||
import net.momirealms.customcrops.integrations.protection.*;
|
||||
import net.momirealms.customcrops.integrations.skill.Aurelium;
|
||||
import net.momirealms.customcrops.integrations.skill.MMOCore;
|
||||
import net.momirealms.customcrops.integrations.skill.SkillXP;
|
||||
import net.momirealms.customcrops.integrations.skill.mcMMO;
|
||||
import net.momirealms.customcrops.requirements.Biome;
|
||||
import net.momirealms.customcrops.requirements.Permission;
|
||||
import net.momirealms.customcrops.requirements.Requirement;
|
||||
@@ -90,6 +94,7 @@ public class ConfigReader {
|
||||
public static boolean needEmptyHand;
|
||||
public static double quality_1;
|
||||
public static double quality_2;
|
||||
public static SkillXP skillXP;
|
||||
|
||||
public static void loadConfig(){
|
||||
|
||||
@@ -237,6 +242,33 @@ public class ConfigReader {
|
||||
AdventureManager.consoleMessage("<gradient:#ff206c:#fdee55>[CustomCrops] </gradient><gold>GriefPrevention <color:#FFEBCD>Hooked!");
|
||||
}
|
||||
}
|
||||
|
||||
skillXP = null;
|
||||
|
||||
if(config.getBoolean("config.integration.mcMMO",false)){
|
||||
if(Bukkit.getPluginManager().getPlugin("mcMMO") == null){
|
||||
CustomCrops.instance.getLogger().warning("Failed to initialize mcMMO!");
|
||||
}else {
|
||||
skillXP = new mcMMO();
|
||||
AdventureManager.consoleMessage("<gradient:#ff206c:#fdee55>[CustomCrops] </gradient><gold>mcMMO <color:#FFEBCD>Hooked!");
|
||||
}
|
||||
}
|
||||
if(config.getBoolean("config.integration.AureliumSkills",false)){
|
||||
if(Bukkit.getPluginManager().getPlugin("AureliumSkills") == null){
|
||||
CustomCrops.instance.getLogger().warning("Failed to initialize AureliumSkills!");
|
||||
}else {
|
||||
skillXP = new Aurelium();
|
||||
AdventureManager.consoleMessage("<gradient:#ff206c:#fdee55>[CustomCrops] </gradient><gold>AureliumSkills <color:#FFEBCD>Hooked!");
|
||||
}
|
||||
}
|
||||
if(config.getBoolean("config.integration.MMOCore",false)){
|
||||
if(Bukkit.getPluginManager().getPlugin("MMOCore") == null){
|
||||
CustomCrops.instance.getLogger().warning("Failed to initialize MMOCore!");
|
||||
}else {
|
||||
skillXP = new MMOCore();
|
||||
AdventureManager.consoleMessage("<gradient:#ff206c:#fdee55>[CustomCrops] </gradient><gold>MMOCore <color:#FFEBCD>Hooked!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -458,6 +490,9 @@ public class ConfigReader {
|
||||
if (config.contains("crops." + key + ".commands")){
|
||||
cropInstance.setCommands(config.getStringList("crops." + key + ".commands"));
|
||||
}
|
||||
if (config.contains("crops." + key + ".skill-xp")){
|
||||
cropInstance.setSkillXP(config.getDouble("crops." + key + ".skill-xp"));
|
||||
}
|
||||
if (config.contains("crops." + key + ".requirements")){
|
||||
List<Requirement> requirements = new ArrayList<>();
|
||||
config.getConfigurationSection("crops." + key + ".requirements").getValues(false).forEach((requirement, value) -> {
|
||||
|
||||
@@ -48,11 +48,6 @@ public final class CustomCrops extends JavaPlugin {
|
||||
private SeasonManager seasonManager;
|
||||
private PotManager potManager;
|
||||
|
||||
@Override
|
||||
public void onLoad(){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package net.momirealms.customcrops.datamanager;
|
||||
|
||||
public class MushroomManager {
|
||||
|
||||
//A new feature coming
|
||||
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.integrations;
|
||||
package net.momirealms.customcrops.integrations.protection;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.integrations;
|
||||
package net.momirealms.customcrops.integrations.protection;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.integrations;
|
||||
package net.momirealms.customcrops.integrations.protection;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.integrations;
|
||||
package net.momirealms.customcrops.integrations.protection;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.integrations;
|
||||
package net.momirealms.customcrops.integrations.protection;
|
||||
|
||||
import me.angeschossen.lands.api.flags.Flags;
|
||||
import me.angeschossen.lands.api.integration.LandsIntegration;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.integrations;
|
||||
package net.momirealms.customcrops.integrations.protection;
|
||||
|
||||
import com.plotsquared.core.location.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.integrations;
|
||||
package net.momirealms.customcrops.integrations.protection;
|
||||
|
||||
import com.bekvon.bukkit.residence.containers.Flags;
|
||||
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.integrations;
|
||||
package net.momirealms.customcrops.integrations.protection;
|
||||
|
||||
import com.palmergames.bukkit.towny.object.TownyPermission;
|
||||
import com.palmergames.bukkit.towny.utils.PlayerCacheUtil;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.integrations;
|
||||
package net.momirealms.customcrops.integrations.protection;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
@@ -0,0 +1,17 @@
|
||||
package net.momirealms.customcrops.integrations.skill;
|
||||
|
||||
import com.archyx.aureliumskills.api.AureliumAPI;
|
||||
import com.archyx.aureliumskills.leveler.Leveler;
|
||||
import com.archyx.aureliumskills.skills.Skill;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Aurelium implements SkillXP {
|
||||
|
||||
private static final Leveler leveler = AureliumAPI.getPlugin().getLeveler();
|
||||
private static final Skill skill = AureliumAPI.getPlugin().getSkillRegistry().getSkill("farming");
|
||||
|
||||
@Override
|
||||
public void addXp(Player player, double amount) {
|
||||
leveler.addXp(player, skill, amount);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package net.momirealms.customcrops.integrations.skill;
|
||||
|
||||
import net.Indyuce.mmocore.experience.EXPSource;
|
||||
import net.Indyuce.mmocore.experience.Profession;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class MMOCore implements SkillXP{
|
||||
@Override
|
||||
public void addXp(Player player, double amount) {
|
||||
Profession profession = net.Indyuce.mmocore.MMOCore.plugin.professionManager.get("farming");
|
||||
profession.giveExperience(net.Indyuce.mmocore.MMOCore.plugin.dataProvider.getDataManager().get(player), amount, null ,EXPSource.OTHER);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package net.momirealms.customcrops.integrations.skill;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public interface SkillXP {
|
||||
void addXp(Player player, double amount);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package net.momirealms.customcrops.integrations.skill;
|
||||
|
||||
import com.gmail.nossr50.api.ExperienceAPI;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class mcMMO implements SkillXP {
|
||||
|
||||
@Override
|
||||
public void addXp(Player player, double amount) {
|
||||
ExperienceAPI.addXP(player, "Herbalism", (int) amount, "UNKNOWN");
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ import net.momirealms.customcrops.CustomCrops;
|
||||
import net.momirealms.customcrops.datamanager.PotManager;
|
||||
import net.momirealms.customcrops.fertilizer.Fertilizer;
|
||||
import net.momirealms.customcrops.fertilizer.QualityCrop;
|
||||
import net.momirealms.customcrops.integrations.Integration;
|
||||
import net.momirealms.customcrops.integrations.protection.Integration;
|
||||
import net.momirealms.customcrops.utils.CropInstance;
|
||||
import net.momirealms.customcrops.utils.SimpleLocation;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@@ -84,6 +84,12 @@ public class BreakBlock implements Listener {
|
||||
return null;
|
||||
});
|
||||
}
|
||||
if (ConfigReader.Config.skillXP != null && cropInstance.getSkillXP() != 0){
|
||||
Bukkit.getScheduler().callSyncMethod(CustomCrops.instance, ()-> {
|
||||
ConfigReader.Config.skillXP.addXp(player, cropInstance.getSkillXP());
|
||||
return null;
|
||||
});
|
||||
}
|
||||
if (fertilizer != null){
|
||||
if (fertilizer instanceof QualityCrop qualityCrop){
|
||||
int[] weights = qualityCrop.getChance();
|
||||
@@ -111,8 +117,7 @@ public class BreakBlock implements Listener {
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Bukkit.getScheduler().callSyncMethod(CustomCrops.instance, ()-> {
|
||||
normalDrop(cropInstance, random, itemLoc, world);
|
||||
return null;
|
||||
|
||||
@@ -32,7 +32,7 @@ import net.momirealms.customcrops.fertilizer.Fertilizer;
|
||||
import net.momirealms.customcrops.fertilizer.QualityCrop;
|
||||
import net.momirealms.customcrops.fertilizer.RetainingSoil;
|
||||
import net.momirealms.customcrops.fertilizer.SpeedGrow;
|
||||
import net.momirealms.customcrops.integrations.Integration;
|
||||
import net.momirealms.customcrops.integrations.protection.Integration;
|
||||
import net.momirealms.customcrops.limits.CropsPerChunk;
|
||||
import net.momirealms.customcrops.limits.SprinklersPerChunk;
|
||||
import net.momirealms.customcrops.requirements.PlantingCondition;
|
||||
@@ -180,7 +180,7 @@ public class RightClick implements Listener {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(water != 0 && action == Action.RIGHT_CLICK_BLOCK && event.getBlockFace() == BlockFace.UP){
|
||||
if(water != 0 && action == Action.RIGHT_CLICK_BLOCK){
|
||||
Block block = event.getClickedBlock();
|
||||
CustomBlock customBlock = CustomBlock.byAlreadyPlaced(block);
|
||||
if (customBlock == null) return;
|
||||
@@ -188,7 +188,7 @@ public class RightClick implements Listener {
|
||||
if(!integration.canPlace(block.getLocation(), player)) return;
|
||||
}
|
||||
String namespacedID = customBlock.getNamespacedID();
|
||||
if (namespacedID.equals(ConfigReader.Basic.pot) || namespacedID.equals(ConfigReader.Basic.watered_pot)){
|
||||
if ((namespacedID.equals(ConfigReader.Basic.pot) || namespacedID.equals(ConfigReader.Basic.watered_pot)) && event.getBlockFace() == BlockFace.UP){
|
||||
nbtItem.setInteger("WaterAmount", water - 1);
|
||||
AdventureManager.playerSound(player, ConfigReader.Sounds.waterPotSource, ConfigReader.Sounds.waterPotKey);
|
||||
waterPot(wateringCan.getWidth(), wateringCan.getLength(), block.getLocation(), player.getLocation().getYaw());
|
||||
@@ -354,6 +354,9 @@ public class RightClick implements Listener {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), command.replace("{player}", player.getName()));
|
||||
}
|
||||
}
|
||||
if (ConfigReader.Config.skillXP != null && cropInstance.getSkillXP() != 0){
|
||||
ConfigReader.Config.skillXP.addXp(player, cropInstance.getSkillXP());
|
||||
}
|
||||
if (fertilizer != null){
|
||||
if (fertilizer instanceof QualityCrop qualityCrop){
|
||||
int[] weights = qualityCrop.getChance();
|
||||
|
||||
@@ -1,41 +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.timer;
|
||||
|
||||
import net.momirealms.customcrops.CustomCrops;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
public class CropTimerAsync {
|
||||
|
||||
private final int taskID;
|
||||
|
||||
public CropTimerAsync(CustomCrops plugin) {
|
||||
TimeCheck tc = new TimeCheck(plugin);
|
||||
BukkitTask task = tc.runTaskTimerAsynchronously(CustomCrops.instance, 1,1);
|
||||
this.taskID = task.getTaskId();
|
||||
}
|
||||
|
||||
public void stopTimer(int ID) {
|
||||
Bukkit.getScheduler().cancelTask(ID);
|
||||
}
|
||||
|
||||
public int getTaskID() {
|
||||
return this.taskID;
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
package net.momirealms.customcrops.utils;
|
||||
|
||||
import net.momirealms.customcrops.integrations.skill.SkillXP;
|
||||
import net.momirealms.customcrops.requirements.Requirement;
|
||||
|
||||
import java.util.List;
|
||||
@@ -33,6 +34,7 @@ public class CropInstance {
|
||||
private String quality_1;
|
||||
private String quality_2;
|
||||
private String quality_3;
|
||||
private double skillXP;
|
||||
private List<String> commands;
|
||||
|
||||
public CropInstance(int min, int max){
|
||||
@@ -55,6 +57,7 @@ public class CropInstance {
|
||||
public int getMax() { return max; }
|
||||
public int getMin() { return min; }
|
||||
public List<String> getCommands() { return commands; }
|
||||
public double getSkillXP() {return skillXP;}
|
||||
|
||||
public void setReturnStage(String stage){ this.returnStage = stage; }
|
||||
public void setGiant(String giant) { this.giant = giant; }
|
||||
@@ -65,4 +68,5 @@ public class CropInstance {
|
||||
public void setQuality_2(String quality_2) { this.quality_2 = quality_2; }
|
||||
public void setQuality_3(String quality_3) { this.quality_3 = quality_3; }
|
||||
public void setCommands(List<String> commands) { this.commands = commands; }
|
||||
public void setSkillXP(double skillXP) {this.skillXP = skillXP;}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,9 @@ config:
|
||||
#english spanish chinese
|
||||
lang: english
|
||||
|
||||
#integration to prevent other players' grief
|
||||
|
||||
integration:
|
||||
#integration to prevent other players' grief
|
||||
Residence: false
|
||||
WorldGuard: false
|
||||
Kingdoms: false
|
||||
@@ -12,9 +13,10 @@ config:
|
||||
Towny: false
|
||||
Lands: false
|
||||
GriefPrevention: false
|
||||
|
||||
#integration to add players' farming skill xp
|
||||
AureliumSkills: false
|
||||
mcMMO: false
|
||||
MMOCore: false
|
||||
|
||||
#The time to start growing(ticks)
|
||||
#1000ticks is 7am in game. (0-23999)
|
||||
|
||||
@@ -20,6 +20,10 @@ crops:
|
||||
commands:
|
||||
- 'say {player} harvested a tomato! lol'
|
||||
|
||||
#optional
|
||||
#If you are using skill plugin, you can add farming skill xp to players
|
||||
#skill-xp: 100
|
||||
|
||||
#optional
|
||||
season:
|
||||
- summer
|
||||
|
||||
@@ -16,6 +16,9 @@ softdepend:
|
||||
- Towny
|
||||
- Lands
|
||||
- GriefPrevention
|
||||
- mcMMO
|
||||
- AureliumSkills
|
||||
- MMOCore
|
||||
commands:
|
||||
customcrops:
|
||||
usage: /customcrops <args>
|
||||
Reference in New Issue
Block a user