mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-22 16:39:36 +00:00
1.5.17
This commit is contained in:
@@ -87,6 +87,7 @@ public class ConfigReader {
|
|||||||
public static boolean quality;
|
public static boolean quality;
|
||||||
public static boolean canAddWater;
|
public static boolean canAddWater;
|
||||||
public static boolean allWorld;
|
public static boolean allWorld;
|
||||||
|
public static boolean needEmptyHand;
|
||||||
public static double quality_1;
|
public static double quality_1;
|
||||||
public static double quality_2;
|
public static double quality_2;
|
||||||
|
|
||||||
@@ -116,6 +117,7 @@ public class ConfigReader {
|
|||||||
allWorld = config.getBoolean("config.all-world-grow",false);
|
allWorld = config.getBoolean("config.all-world-grow",false);
|
||||||
hasParticle = config.getBoolean("config.water-particles", true);
|
hasParticle = config.getBoolean("config.water-particles", true);
|
||||||
rightClickHarvest = config.getBoolean("config.right-click-harvest", true);
|
rightClickHarvest = config.getBoolean("config.right-click-harvest", true);
|
||||||
|
needEmptyHand = config.getBoolean("config.harvest-with-empty-hand", true);
|
||||||
|
|
||||||
//数量与高度限制
|
//数量与高度限制
|
||||||
enableLimit = config.getBoolean("config.limit.enable",true);
|
enableLimit = config.getBoolean("config.limit.enable",true);
|
||||||
@@ -378,6 +380,7 @@ public class ConfigReader {
|
|||||||
public static double sprinklerOffset;
|
public static double sprinklerOffset;
|
||||||
|
|
||||||
public static void loadMessage(){
|
public static void loadMessage(){
|
||||||
|
|
||||||
YamlConfiguration config = getConfig("messages/messages_" + Config.lang +".yml");
|
YamlConfiguration config = getConfig("messages/messages_" + Config.lang +".yml");
|
||||||
prefix = config.getString("messages.prefix");
|
prefix = config.getString("messages.prefix");
|
||||||
reload = config.getString("messages.reload");
|
reload = config.getString("messages.reload");
|
||||||
@@ -452,6 +455,9 @@ public class ConfigReader {
|
|||||||
if (config.contains("crops." + key + ".return")){
|
if (config.contains("crops." + key + ".return")){
|
||||||
cropInstance.setReturnStage(config.getString("crops." + key + ".return"));
|
cropInstance.setReturnStage(config.getString("crops." + key + ".return"));
|
||||||
}
|
}
|
||||||
|
if (config.contains("crops." + key + ".commands")){
|
||||||
|
cropInstance.setCommands(config.getStringList("crops." + key + ".commands"));
|
||||||
|
}
|
||||||
if (config.contains("crops." + key + ".requirements")){
|
if (config.contains("crops." + key + ".requirements")){
|
||||||
List<Requirement> requirements = new ArrayList<>();
|
List<Requirement> requirements = new ArrayList<>();
|
||||||
config.getConfigurationSection("crops." + key + ".requirements").getValues(false).forEach((requirement, value) -> {
|
config.getConfigurationSection("crops." + key + ".requirements").getValues(false).forEach((requirement, value) -> {
|
||||||
|
|||||||
@@ -21,13 +21,11 @@ import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
|||||||
import net.momirealms.customcrops.commands.Executor;
|
import net.momirealms.customcrops.commands.Executor;
|
||||||
import net.momirealms.customcrops.commands.Completer;
|
import net.momirealms.customcrops.commands.Completer;
|
||||||
import net.momirealms.customcrops.datamanager.*;
|
import net.momirealms.customcrops.datamanager.*;
|
||||||
import net.momirealms.customcrops.helper.LibraryLoader;
|
|
||||||
import net.momirealms.customcrops.listener.BreakBlock;
|
import net.momirealms.customcrops.listener.BreakBlock;
|
||||||
import net.momirealms.customcrops.listener.InteractEntity;
|
import net.momirealms.customcrops.listener.InteractEntity;
|
||||||
import net.momirealms.customcrops.listener.ItemSpawn;
|
import net.momirealms.customcrops.listener.ItemSpawn;
|
||||||
import net.momirealms.customcrops.listener.RightClick;
|
import net.momirealms.customcrops.listener.RightClick;
|
||||||
import net.momirealms.customcrops.timer.CropTimer;
|
import net.momirealms.customcrops.timer.CropTimer;
|
||||||
import net.momirealms.customcrops.timer.CropTimerAsync;
|
|
||||||
import net.momirealms.customcrops.utils.AdventureManager;
|
import net.momirealms.customcrops.utils.AdventureManager;
|
||||||
import net.momirealms.customcrops.utils.BackUp;
|
import net.momirealms.customcrops.utils.BackUp;
|
||||||
import net.momirealms.customcrops.utils.HoloUtil;
|
import net.momirealms.customcrops.utils.HoloUtil;
|
||||||
@@ -45,7 +43,6 @@ public final class CustomCrops extends JavaPlugin {
|
|||||||
public static JavaPlugin instance;
|
public static JavaPlugin instance;
|
||||||
public static BukkitAudiences adventure;
|
public static BukkitAudiences adventure;
|
||||||
private CropTimer cropTimer;
|
private CropTimer cropTimer;
|
||||||
private CropTimerAsync cropTimerAsync;
|
|
||||||
private CropManager cropManager;
|
private CropManager cropManager;
|
||||||
private SprinklerManager sprinklerManager;
|
private SprinklerManager sprinklerManager;
|
||||||
private SeasonManager seasonManager;
|
private SeasonManager seasonManager;
|
||||||
@@ -54,18 +51,6 @@ public final class CustomCrops extends JavaPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void onLoad(){
|
public void onLoad(){
|
||||||
|
|
||||||
// instance = this;
|
|
||||||
// LibraryLoader.load("net.kyori","adventure-api","4.11.0","https://oss.sonatype.org/content/groups/public");
|
|
||||||
// LibraryLoader.load("net.kyori","adventure-platform-api","4.1.1","https://oss.sonatype.org/content/groups/public");
|
|
||||||
// LibraryLoader.load("net.kyori","adventure-platform-bukkit","4.1.1","https://oss.sonatype.org/content/groups/public");
|
|
||||||
// LibraryLoader.load("net.kyori","adventure-platform-facet","4.1.1","https://oss.sonatype.org/content/groups/public");
|
|
||||||
// LibraryLoader.load("net.kyori","adventure-text-serializer-gson","4.11.0","https://oss.sonatype.org/content/groups/public");
|
|
||||||
// LibraryLoader.load("net.kyori","adventure-text-serializer-plain","4.11.0","https://oss.sonatype.org/content/groups/public");
|
|
||||||
// LibraryLoader.load("net.kyori","adventure-text-serializer-gson-legacy-impl","4.11.0","https://oss.sonatype.org/content/groups/public");
|
|
||||||
// LibraryLoader.load("net.kyori","adventure-nbt","4.11.0","https://oss.sonatype.org/content/groups/public");
|
|
||||||
// LibraryLoader.load("net.kyori","adventure-key","4.11.0","https://oss.sonatype.org/content/groups/public");
|
|
||||||
// LibraryLoader.load("net.kyori","adventure-text-minimessage","4.11.0","https://oss.sonatype.org/content/groups/public");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -96,11 +81,7 @@ public final class CustomCrops extends JavaPlugin {
|
|||||||
Bukkit.getPluginManager().registerEvents(new InteractEntity(this), this);
|
Bukkit.getPluginManager().registerEvents(new InteractEntity(this), this);
|
||||||
|
|
||||||
//开始计时器
|
//开始计时器
|
||||||
if(ConfigReader.Config.asyncCheck){
|
this.cropTimer = new CropTimer(this);
|
||||||
this.cropTimerAsync = new CropTimerAsync(this);
|
|
||||||
}else {
|
|
||||||
this.cropTimer = new CropTimer(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
//载入数据
|
//载入数据
|
||||||
if (ConfigReader.Season.enable){
|
if (ConfigReader.Season.enable){
|
||||||
@@ -156,15 +137,10 @@ public final class CustomCrops extends JavaPlugin {
|
|||||||
if (cropTimer != null) {
|
if (cropTimer != null) {
|
||||||
this.cropTimer.stopTimer(cropTimer.getTaskID());
|
this.cropTimer.stopTimer(cropTimer.getTaskID());
|
||||||
}
|
}
|
||||||
if (cropTimerAsync != null){
|
|
||||||
this.cropTimerAsync.stopTimer(cropTimerAsync.getTaskID());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (adventure != null) {
|
if (adventure != null) {
|
||||||
adventure.close();
|
adventure.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
instance = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CropManager getCropManager() { return this.cropManager; }
|
public CropManager getCropManager() { return this.cropManager; }
|
||||||
|
|||||||
@@ -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.integrations;
|
package net.momirealms.customcrops.integrations;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
public class BreakBlock implements Listener {
|
public class BreakBlock implements Listener {
|
||||||
@@ -66,7 +67,6 @@ public class BreakBlock implements Listener {
|
|||||||
String[] cropNameList = StringUtils.split(StringUtils.split(namespacedId, ":")[1], "_");
|
String[] cropNameList = StringUtils.split(StringUtils.split(namespacedId, ":")[1], "_");
|
||||||
int nextStage = Integer.parseInt(cropNameList[2]) + 1;
|
int nextStage = Integer.parseInt(cropNameList[2]) + 1;
|
||||||
if (CustomBlock.getInstance(StringUtils.chop(namespacedId) + nextStage) == null) {
|
if (CustomBlock.getInstance(StringUtils.chop(namespacedId) + nextStage) == null) {
|
||||||
|
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(CustomCrops.instance, ()-> {
|
Bukkit.getScheduler().runTaskAsynchronously(CustomCrops.instance, ()-> {
|
||||||
if (location.getBlock().getType() != Material.AIR) return;
|
if (location.getBlock().getType() != Material.AIR) return;
|
||||||
CropInstance cropInstance = ConfigReader.CROPS.get(cropNameList[0]);
|
CropInstance cropInstance = ConfigReader.CROPS.get(cropNameList[0]);
|
||||||
@@ -75,6 +75,15 @@ public class BreakBlock implements Listener {
|
|||||||
Location itemLoc = location.clone().add(0.5,0.2,0.5);
|
Location itemLoc = location.clone().add(0.5,0.2,0.5);
|
||||||
World world = location.getWorld();
|
World world = location.getWorld();
|
||||||
Fertilizer fertilizer = PotManager.Cache.get(SimpleLocation.fromLocation(location.clone().subtract(0,1,0)));
|
Fertilizer fertilizer = PotManager.Cache.get(SimpleLocation.fromLocation(location.clone().subtract(0,1,0)));
|
||||||
|
List<String> commands = cropInstance.getCommands();
|
||||||
|
if (commands != null){
|
||||||
|
Bukkit.getScheduler().callSyncMethod(CustomCrops.instance, ()-> {
|
||||||
|
for (String command : commands){
|
||||||
|
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), command.replace("{player}", player.getName()));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
}
|
||||||
if (fertilizer != null){
|
if (fertilizer != null){
|
||||||
if (fertilizer instanceof QualityCrop qualityCrop){
|
if (fertilizer instanceof QualityCrop qualityCrop){
|
||||||
int[] weights = qualityCrop.getChance();
|
int[] weights = qualityCrop.getChance();
|
||||||
|
|||||||
@@ -317,61 +317,74 @@ public class RightClick implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(ConfigReader.Config.rightClickHarvest && !ConfigReader.Config.needEmptyHand){
|
||||||
|
rightClickHarvest(event, player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (ConfigReader.Config.rightClickHarvest && action == Action.RIGHT_CLICK_BLOCK) {
|
else if (ConfigReader.Config.rightClickHarvest && action == Action.RIGHT_CLICK_BLOCK) {
|
||||||
Block block = event.getClickedBlock();
|
rightClickHarvest(event, player);
|
||||||
Location location = block.getLocation();
|
}
|
||||||
CustomBlock customBlock = CustomBlock.byAlreadyPlaced(block);
|
}
|
||||||
if (customBlock == null) return;
|
}
|
||||||
for (Integration integration : ConfigReader.Config.integration){
|
|
||||||
if (!integration.canBreak(location, player)) return;
|
private void rightClickHarvest(PlayerInteractEvent event, Player player) {
|
||||||
}
|
Block block = event.getClickedBlock();
|
||||||
String namespacedID = customBlock.getNamespacedID();
|
Location location = block.getLocation();
|
||||||
if (namespacedID.contains("_stage_")){
|
CustomBlock customBlock = CustomBlock.byAlreadyPlaced(block);
|
||||||
if(namespacedID.equals(ConfigReader.Basic.dead)) return;
|
if (customBlock == null) return;
|
||||||
String[] cropNameList = StringUtils.split(customBlock.getId(), "_");
|
for (Integration integration : ConfigReader.Config.integration){
|
||||||
int nextStage = Integer.parseInt(cropNameList[2]) + 1;
|
if (!integration.canBreak(location, player)) return;
|
||||||
if (CustomBlock.getInstance(StringUtils.chop(namespacedID) + nextStage) == null) {
|
}
|
||||||
if (ConfigReader.Config.quality){
|
String namespacedID = customBlock.getNamespacedID();
|
||||||
CropInstance cropInstance = ConfigReader.CROPS.get(cropNameList[0]);
|
if (namespacedID.contains("_stage_")){
|
||||||
ThreadLocalRandom current = ThreadLocalRandom.current();
|
if(namespacedID.equals(ConfigReader.Basic.dead)) return;
|
||||||
int random = current.nextInt(cropInstance.getMin(), cropInstance.getMax() + 1);
|
String[] cropNameList = StringUtils.split(customBlock.getId(), "_");
|
||||||
World world = location.getWorld();
|
int nextStage = Integer.parseInt(cropNameList[2]) + 1;
|
||||||
Location itemLoc = location.clone().add(0.5,0.2,0.5);
|
if (CustomBlock.getInstance(StringUtils.chop(namespacedID) + nextStage) == null) {
|
||||||
Fertilizer fertilizer = PotManager.Cache.get(location.clone().subtract(0,1,0));
|
if (ConfigReader.Config.quality){
|
||||||
if (fertilizer != null){
|
CropInstance cropInstance = ConfigReader.CROPS.get(cropNameList[0]);
|
||||||
if (fertilizer instanceof QualityCrop qualityCrop){
|
ThreadLocalRandom current = ThreadLocalRandom.current();
|
||||||
int[] weights = qualityCrop.getChance();
|
int random = current.nextInt(cropInstance.getMin(), cropInstance.getMax() + 1);
|
||||||
double weightTotal = weights[0] + weights[1] + weights[2];
|
World world = location.getWorld();
|
||||||
double rank_1 = weights[0]/(weightTotal);
|
Location itemLoc = location.clone().add(0.5,0.2,0.5);
|
||||||
double rank_2 = 1 - weights[1]/(weightTotal);
|
Fertilizer fertilizer = PotManager.Cache.get(location.clone().subtract(0,1,0));
|
||||||
for (int i = 0; i < random; i++){
|
List<String> commands = cropInstance.getCommands();
|
||||||
double ran = Math.random();
|
if (commands != null){
|
||||||
if (ran < rank_1){
|
for (String command : commands){
|
||||||
world.dropItem(itemLoc, CustomStack.getInstance(cropInstance.getQuality_1()).getItemStack());
|
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), command.replace("{player}", player.getName()));
|
||||||
}else if(ran > rank_2){
|
|
||||||
world.dropItem(itemLoc, CustomStack.getInstance(cropInstance.getQuality_2()).getItemStack());
|
|
||||||
}else {
|
|
||||||
world.dropItem(itemLoc, CustomStack.getInstance(cropInstance.getQuality_3()).getItemStack());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
BreakBlock.normalDrop(cropInstance, random, itemLoc, world);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
BreakBlock.normalDrop(cropInstance, random, itemLoc, world);
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
customBlock.getLoot().forEach(loot-> location.getWorld().dropItem(location.clone().add(0.5,0.2,0.5), loot));
|
|
||||||
}
|
|
||||||
CustomBlock.remove(location);
|
|
||||||
CropInstance crop = ConfigReader.CROPS.get(cropNameList[0]);
|
|
||||||
AdventureManager.playerSound(player, ConfigReader.Sounds.harvestSource, ConfigReader.Sounds.harvestKey);
|
|
||||||
if(crop.getReturnStage() != null){
|
|
||||||
CustomBlock.place(crop.getReturnStage(), location);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (fertilizer != null){
|
||||||
|
if (fertilizer instanceof QualityCrop qualityCrop){
|
||||||
|
int[] weights = qualityCrop.getChance();
|
||||||
|
double weightTotal = weights[0] + weights[1] + weights[2];
|
||||||
|
double rank_1 = weights[0]/(weightTotal);
|
||||||
|
double rank_2 = 1 - weights[1]/(weightTotal);
|
||||||
|
for (int i = 0; i < random; i++){
|
||||||
|
double ran = Math.random();
|
||||||
|
if (ran < rank_1){
|
||||||
|
world.dropItem(itemLoc, CustomStack.getInstance(cropInstance.getQuality_1()).getItemStack());
|
||||||
|
}else if(ran > rank_2){
|
||||||
|
world.dropItem(itemLoc, CustomStack.getInstance(cropInstance.getQuality_2()).getItemStack());
|
||||||
|
}else {
|
||||||
|
world.dropItem(itemLoc, CustomStack.getInstance(cropInstance.getQuality_3()).getItemStack());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
BreakBlock.normalDrop(cropInstance, random, itemLoc, world);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
BreakBlock.normalDrop(cropInstance, random, itemLoc, world);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
customBlock.getLoot().forEach(loot-> location.getWorld().dropItem(location.clone().add(0.5,0.2,0.5), loot));
|
||||||
|
}
|
||||||
|
CustomBlock.remove(location);
|
||||||
|
CropInstance crop = ConfigReader.CROPS.get(cropNameList[0]);
|
||||||
|
AdventureManager.playerSound(player, ConfigReader.Sounds.harvestSource, ConfigReader.Sounds.harvestKey);
|
||||||
|
if(crop.getReturnStage() != null){
|
||||||
|
CustomBlock.place(crop.getReturnStage(), location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
package net.momirealms.customcrops.timer;
|
package net.momirealms.customcrops.timer;
|
||||||
|
|
||||||
|
import net.momirealms.customcrops.ConfigReader;
|
||||||
import net.momirealms.customcrops.CustomCrops;
|
import net.momirealms.customcrops.CustomCrops;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
@@ -27,7 +28,12 @@ public class CropTimer {
|
|||||||
|
|
||||||
public CropTimer(CustomCrops plugin) {
|
public CropTimer(CustomCrops plugin) {
|
||||||
TimeCheck tc = new TimeCheck(plugin);
|
TimeCheck tc = new TimeCheck(plugin);
|
||||||
BukkitTask task = tc.runTaskTimer(CustomCrops.instance, 1,1);
|
BukkitTask task;
|
||||||
|
if (ConfigReader.Config.asyncCheck){
|
||||||
|
task = tc.runTaskTimerAsynchronously(CustomCrops.instance, 1,1);
|
||||||
|
}else {
|
||||||
|
task = tc.runTaskTimer(CustomCrops.instance, 1,1);
|
||||||
|
}
|
||||||
this.taskID = task.getTaskId();
|
this.taskID = task.getTaskId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ public class CropInstance {
|
|||||||
private String quality_1;
|
private String quality_1;
|
||||||
private String quality_2;
|
private String quality_2;
|
||||||
private String quality_3;
|
private String quality_3;
|
||||||
|
private List<String> commands;
|
||||||
|
|
||||||
public CropInstance(int min, int max){
|
public CropInstance(int min, int max){
|
||||||
this.min = min;
|
this.min = min;
|
||||||
@@ -53,6 +54,7 @@ public class CropInstance {
|
|||||||
public String getQuality_3() { return quality_3; }
|
public String getQuality_3() { return quality_3; }
|
||||||
public int getMax() { return max; }
|
public int getMax() { return max; }
|
||||||
public int getMin() { return min; }
|
public int getMin() { return min; }
|
||||||
|
public List<String> getCommands() { return commands; }
|
||||||
|
|
||||||
public void setReturnStage(String stage){ this.returnStage = stage; }
|
public void setReturnStage(String stage){ this.returnStage = stage; }
|
||||||
public void setGiant(String giant) { this.giant = giant; }
|
public void setGiant(String giant) { this.giant = giant; }
|
||||||
@@ -62,4 +64,5 @@ public class CropInstance {
|
|||||||
public void setQuality_1(String quality_1) { this.quality_1 = quality_1; }
|
public void setQuality_1(String quality_1) { this.quality_1 = quality_1; }
|
||||||
public void setQuality_2(String quality_2) { this.quality_2 = quality_2; }
|
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 setQuality_3(String quality_3) { this.quality_3 = quality_3; }
|
||||||
|
public void setCommands(List<String> commands) { this.commands = commands; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,11 +60,23 @@ public class Placeholders extends PlaceholderExpansion{
|
|||||||
.replace("winter", ConfigReader.Message.winter);
|
.replace("winter", ConfigReader.Message.winter);
|
||||||
}
|
}
|
||||||
if (params.equalsIgnoreCase("nextseason")){
|
if (params.equalsIgnoreCase("nextseason")){
|
||||||
|
if (!ConfigReader.Config.worlds.contains(player.getPlayer().getWorld())){
|
||||||
|
return ConfigReader.Message.noSeason;
|
||||||
|
}
|
||||||
return String.valueOf(ConfigReader.Season.duration - ((int) ((player.getPlayer().getWorld().getFullTime() / 24000L) % (ConfigReader.Season.duration * 4)) % ConfigReader.Season.duration));
|
return String.valueOf(ConfigReader.Season.duration - ((int) ((player.getPlayer().getWorld().getFullTime() / 24000L) % (ConfigReader.Season.duration * 4)) % ConfigReader.Season.duration));
|
||||||
}
|
}
|
||||||
if (params.startsWith("nextseason_")){
|
if (params.startsWith("nextseason_")){
|
||||||
return String.valueOf(ConfigReader.Season.duration - ((int) ((Bukkit.getWorld(params.substring(11)).getFullTime() / 24000L) % (ConfigReader.Season.duration * 4)) % ConfigReader.Season.duration));
|
return String.valueOf(ConfigReader.Season.duration - ((int) ((Bukkit.getWorld(params.substring(11)).getFullTime() / 24000L) % (ConfigReader.Season.duration * 4)) % ConfigReader.Season.duration));
|
||||||
}
|
}
|
||||||
|
if (params.equalsIgnoreCase("current")){
|
||||||
|
if (!ConfigReader.Config.worlds.contains(player.getPlayer().getWorld())){
|
||||||
|
return ConfigReader.Message.noSeason;
|
||||||
|
}
|
||||||
|
return String.valueOf((int) ((player.getPlayer().getWorld().getFullTime() / 24000L) % (ConfigReader.Season.duration * 4)) % ConfigReader.Season.duration + 1);
|
||||||
|
}
|
||||||
|
if (params.startsWith("current_")){
|
||||||
|
return String.valueOf(((int) (Bukkit.getWorld(params.substring(8)).getFullTime() / 24000L) % (ConfigReader.Season.duration * 4)) % ConfigReader.Season.duration+ 1);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,12 +35,12 @@ lore:
|
|||||||
watering-can:
|
watering-can:
|
||||||
enable: true
|
enable: true
|
||||||
#Lore format
|
#Lore format
|
||||||
|
#Available variables: {water_info}
|
||||||
|
#{water}current water {max_water}max storage
|
||||||
lore:
|
lore:
|
||||||
- '<italic:false><white>{water_info}'
|
- '<italic:false><white>{water_info}'
|
||||||
- '<italic:false><gray>Right click water to add water to the can.'
|
- '<italic:false><gray>Right click water to add water to the can.'
|
||||||
|
#{water_info}
|
||||||
#Available variables: {water_info}
|
|
||||||
#{water}current water {max_water}max storage
|
|
||||||
left: '<font:customcrops:default>뀂'
|
left: '<font:customcrops:default>뀂'
|
||||||
full: '뀁뀃'
|
full: '뀁뀃'
|
||||||
empty: '뀁뀄'
|
empty: '뀁뀄'
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ config:
|
|||||||
Lands: false
|
Lands: false
|
||||||
GriefPrevention: false
|
GriefPrevention: false
|
||||||
|
|
||||||
|
AureliumSkills: false
|
||||||
|
mcMMO: false
|
||||||
|
|
||||||
#The time to start growing(ticks)
|
#The time to start growing(ticks)
|
||||||
#1000ticks is 7am in game. (0-23999)
|
#1000ticks is 7am in game. (0-23999)
|
||||||
#Sprinklers will work after all crops finish growing
|
#Sprinklers will work after all crops finish growing
|
||||||
@@ -76,4 +79,8 @@ config:
|
|||||||
|
|
||||||
#can player harvest crops with right click?
|
#can player harvest crops with right click?
|
||||||
#if set "false" crops can't be harvested repeatedly
|
#if set "false" crops can't be harvested repeatedly
|
||||||
right-click-harvest: true
|
right-click-harvest: true
|
||||||
|
|
||||||
|
#If "right-click-harvest" is true
|
||||||
|
#Should player be allowed to harvest with items in hand
|
||||||
|
harvest-with-empty-hand: true
|
||||||
@@ -16,6 +16,11 @@ crops:
|
|||||||
block: customcrops:gigantic_tomato
|
block: customcrops:gigantic_tomato
|
||||||
chance: 0.01
|
chance: 0.01
|
||||||
|
|
||||||
|
#optional
|
||||||
|
commands:
|
||||||
|
- 'say {player} harvested a tomato! lol'
|
||||||
|
|
||||||
|
#optional
|
||||||
season:
|
season:
|
||||||
- summer
|
- summer
|
||||||
- autumn
|
- autumn
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
config:
|
config:
|
||||||
lang: chinese
|
|
||||||
|
|
||||||
#插件兼容
|
#插件兼容
|
||||||
integration:
|
integration:
|
||||||
Residence: false
|
Residence: false
|
||||||
@@ -10,7 +8,6 @@ config:
|
|||||||
PlotSquared: false
|
PlotSquared: false
|
||||||
Towny: false
|
Towny: false
|
||||||
Lands: false
|
Lands: false
|
||||||
GriefPrevention: false
|
|
||||||
|
|
||||||
#生长时间点(tick)
|
#生长时间点(tick)
|
||||||
#1000代表上午7点,农作物陆续开始生长
|
#1000代表上午7点,农作物陆续开始生长
|
||||||
@@ -78,5 +75,8 @@ config:
|
|||||||
#作为所有世界农作物生长的时间、季节判断依据
|
#作为所有世界农作物生长的时间、季节判断依据
|
||||||
all-world-grow: false
|
all-world-grow: false
|
||||||
|
|
||||||
#玩家是否能空手右键收获
|
#玩家是否能右键收获
|
||||||
right-click-harvest: true
|
right-click-harvest: true
|
||||||
|
|
||||||
|
#玩家是否需要空手右键收获
|
||||||
|
harvest-with-empty-hand: true
|
||||||
@@ -18,6 +18,10 @@ crops:
|
|||||||
block: customcrops:gigantic_tomato
|
block: customcrops:gigantic_tomato
|
||||||
chance: 0.01
|
chance: 0.01
|
||||||
|
|
||||||
|
#收获时候执行指令
|
||||||
|
commands:
|
||||||
|
- 'say {player} harvested a tomato! lol'
|
||||||
|
|
||||||
#生长季节
|
#生长季节
|
||||||
season:
|
season:
|
||||||
- summer
|
- summer
|
||||||
|
|||||||
Reference in New Issue
Block a user