mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-21 16:09:21 +00:00
2.0.2
This commit is contained in:
@@ -4,7 +4,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = 'net.momirealms'
|
group = 'net.momirealms'
|
||||||
version = '2.0.1'
|
version = '2.0.2'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ public class WorldUtils {
|
|||||||
/**
|
/**
|
||||||
* unload a world's crop data
|
* unload a world's crop data
|
||||||
* @param world world
|
* @param world world
|
||||||
* @param disable whether the server is stopping
|
* @param sync whether unload is sync or async
|
||||||
*/
|
*/
|
||||||
public static void unloadCropWorld(World world, boolean disable) {
|
public static void unloadCropWorld(World world, boolean sync) {
|
||||||
CustomCrops.plugin.getCropManager().onWorldUnload(world, disable);
|
CustomCrops.plugin.getCropManager().onWorldUnload(world, sync);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,9 @@ import java.util.List;
|
|||||||
public class MainConfig {
|
public class MainConfig {
|
||||||
|
|
||||||
public static World[] worlds;
|
public static World[] worlds;
|
||||||
|
public static String[] worldNames;
|
||||||
public static List<World> worldList;
|
public static List<World> worldList;
|
||||||
|
public static List<String> worldNameList;
|
||||||
public static boolean whiteOrBlack;
|
public static boolean whiteOrBlack;
|
||||||
public static String customPlugin;
|
public static String customPlugin;
|
||||||
public static boolean OraxenHook;
|
public static boolean OraxenHook;
|
||||||
@@ -127,11 +129,11 @@ public class MainConfig {
|
|||||||
lang = config.getString("lang","english");
|
lang = config.getString("lang","english");
|
||||||
|
|
||||||
whiteOrBlack = config.getString("worlds.mode","whitelist").equals("whitelist");
|
whiteOrBlack = config.getString("worlds.mode","whitelist").equals("whitelist");
|
||||||
List<String> worldsName = config.getStringList("worlds.list");
|
worldNameList = config.getStringList("worlds.list");
|
||||||
worlds = new World[worldsName.size()];
|
worlds = new World[worldNameList.size()];
|
||||||
for (int i = 0; i < worldsName.size(); i++) {
|
for (int i = 0; i < worldNameList.size(); i++) {
|
||||||
if (Bukkit.getWorld(worldsName.get(i)) != null) {
|
if (Bukkit.getWorld(worldNameList.get(i)) != null) {
|
||||||
worlds[i] = Bukkit.getWorld(worldsName.get(i));
|
worlds[i] = Bukkit.getWorld(worldNameList.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,6 +144,7 @@ public class MainConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
worlds = worldList.toArray(new World[0]);
|
worlds = worldList.toArray(new World[0]);
|
||||||
|
worldNames = worldNameList.toArray(new String[0]);
|
||||||
worldFolder = StringUtils.replace(config.getString("worlds.worlds-folder",""), "\\", File.separator);
|
worldFolder = StringUtils.replace(config.getString("worlds.worlds-folder",""), "\\", File.separator);
|
||||||
|
|
||||||
cropMode = config.getString("mechanics.crops-mode", "tripwire").equals("tripwire");
|
cropMode = config.getString("mechanics.crops-mode", "tripwire").equals("tripwire");
|
||||||
@@ -361,6 +364,20 @@ public class MainConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<String> getWorldNameList() {
|
||||||
|
if (whiteOrBlack) {
|
||||||
|
return worldNameList;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
List<String> allWorldNames = new ArrayList<>();
|
||||||
|
for (World world : Bukkit.getWorlds()) {
|
||||||
|
allWorldNames.add(world.getName());
|
||||||
|
}
|
||||||
|
allWorldNames.removeAll(worldNameList);
|
||||||
|
return allWorldNames;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void hookMessage(String plugin){
|
private static void hookMessage(String plugin){
|
||||||
AdventureUtil.consoleMessage("[CustomCrops] <white>" + plugin + " Hooked!");
|
AdventureUtil.consoleMessage("[CustomCrops] <white>" + plugin + " Hooked!");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ public class CropManager extends Function {
|
|||||||
public void onWorldLoad(World world) {
|
public void onWorldLoad(World world) {
|
||||||
CustomWorld cw = customWorlds.get(world);
|
CustomWorld cw = customWorlds.get(world);
|
||||||
if (cw != null) return;
|
if (cw != null) return;
|
||||||
if (MainConfig.getWorldsList().contains(world)) {
|
if (MainConfig.getWorldNameList().contains(world.getName())) {
|
||||||
CustomWorld customWorld = new CustomWorld(world, this);
|
CustomWorld customWorld = new CustomWorld(world, this);
|
||||||
customWorlds.put(world, customWorld);
|
customWorlds.put(world, customWorld);
|
||||||
if (MainConfig.autoGrow && MainConfig.enableCompensation) {
|
if (MainConfig.autoGrow && MainConfig.enableCompensation) {
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
public class CustomWorld {
|
public class CustomWorld {
|
||||||
|
|
||||||
private final World world;
|
private final World world;
|
||||||
|
|
||||||
private final ConcurrentHashMap<SimpleLocation, Sprinkler> sprinklerCache;
|
private final ConcurrentHashMap<SimpleLocation, Sprinkler> sprinklerCache;
|
||||||
private final ConcurrentHashMap<SimpleLocation, Fertilizer> fertilizerCache;
|
private final ConcurrentHashMap<SimpleLocation, Fertilizer> fertilizerCache;
|
||||||
private final ConcurrentHashMap<String, HashSet<SimpleLocation>> scarecrowCache;
|
private final ConcurrentHashMap<String, HashSet<SimpleLocation>> scarecrowCache;
|
||||||
@@ -63,7 +62,6 @@ public class CustomWorld {
|
|||||||
|
|
||||||
public CustomWorld(World world, CropManager cropManager) {
|
public CustomWorld(World world, CropManager cropManager) {
|
||||||
this.world = world;
|
this.world = world;
|
||||||
|
|
||||||
this.fertilizerCache = new ConcurrentHashMap<>(2048);
|
this.fertilizerCache = new ConcurrentHashMap<>(2048);
|
||||||
this.sprinklerCache = new ConcurrentHashMap<>(1024);
|
this.sprinklerCache = new ConcurrentHashMap<>(1024);
|
||||||
this.scarecrowCache = new ConcurrentHashMap<>(256);
|
this.scarecrowCache = new ConcurrentHashMap<>(256);
|
||||||
@@ -83,8 +81,8 @@ public class CustomWorld {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unload(boolean disable) {
|
public void unload(boolean sync) {
|
||||||
if (disable) {
|
if (sync) {
|
||||||
unloadData();
|
unloadData();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#Don't change
|
# Don't change
|
||||||
|
# 请不要修改
|
||||||
config-version: '15'
|
config-version: '15'
|
||||||
|
|
||||||
# lang: english / spanish / chinese
|
# lang: english / spanish / chinese
|
||||||
@@ -6,6 +7,7 @@ lang: english
|
|||||||
|
|
||||||
integration:
|
integration:
|
||||||
# AntiGrief
|
# AntiGrief
|
||||||
|
# 防熊
|
||||||
Residence: false
|
Residence: false
|
||||||
WorldGuard: false
|
WorldGuard: false
|
||||||
Kingdoms: false
|
Kingdoms: false
|
||||||
@@ -17,19 +19,25 @@ integration:
|
|||||||
CrashClaim: false
|
CrashClaim: false
|
||||||
BentoBox: false
|
BentoBox: false
|
||||||
# Skill Xp
|
# Skill Xp
|
||||||
|
# 技能经验
|
||||||
AureliumSkills: false
|
AureliumSkills: false
|
||||||
mcMMO: false
|
mcMMO: false
|
||||||
MMOCore: false
|
MMOCore: false
|
||||||
EcoSkills: false
|
EcoSkills: false
|
||||||
JobsReborn: false
|
JobsReborn: false
|
||||||
# Season
|
# Season
|
||||||
|
# 季节
|
||||||
RealisticSeasons: false
|
RealisticSeasons: false
|
||||||
|
|
||||||
worlds:
|
worlds:
|
||||||
# This is designed for servers that using a separate folder for worlds
|
# This is designed for servers that using a separate folder for worlds
|
||||||
|
# 如果你的服务器使用独立文件夹存储世界,请在此填入根目录下的文件地址
|
||||||
worlds-folder: ''
|
worlds-folder: ''
|
||||||
# Mode: whitelist/blacklist
|
# Mode: whitelist/blacklist
|
||||||
# Requires a restart when changing this
|
# Requires a restart when changing mode or world list
|
||||||
|
# Because reloading world data might cause unexpected problems and lag
|
||||||
|
# 模式:白名单/黑名单
|
||||||
|
# 为了避免重载时候造成服务器卡顿,修改本栏需要重启服务器
|
||||||
mode: whitelist
|
mode: whitelist
|
||||||
list:
|
list:
|
||||||
- world
|
- world
|
||||||
@@ -37,51 +45,69 @@ worlds:
|
|||||||
optimization:
|
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
|
||||||
# When you are using both item_frame mode and ItemsAdder, you should set "max-furniture-vehicles-per-chunk" in ItemsAdder's config.yml to a higher value
|
# When you are using both item_frame mode and ItemsAdder, you should set "max-furniture-vehicles-per-chunk" in ItemsAdder's config.yml to a higher value
|
||||||
|
# 推荐启用区块限制来防止玩家种植大量农作物
|
||||||
|
# 如果你使用ItemsAdder的展示框模式,你需要在ItemsAdder的配置文件中设置"max-furniture-vehicles-per-chunk"到较高值,否则农作物种植后会消失
|
||||||
limitation:
|
limitation:
|
||||||
enable: true
|
enable: true
|
||||||
# max amount per chunk
|
# max amount per chunk
|
||||||
|
# 每个区块的限制数量
|
||||||
tripwire-amount: 64
|
tripwire-amount: 64
|
||||||
itemframe-amount: 64
|
itemframe-amount: 64
|
||||||
|
|
||||||
# Disable the water particles when using watering-cans
|
# Disable the water particles when using watering-cans
|
||||||
|
# 关闭水粒子效果
|
||||||
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 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:
|
||||||
# Mode: tripwire/item_frame
|
# Mode: tripwire/item_frame
|
||||||
|
# 模式:拌线/展示框
|
||||||
crops-mode: tripwire
|
crops-mode: tripwire
|
||||||
|
|
||||||
# If enabled, crops would start growing at about 7am(at most 5 seconds inaccuracy) and finish growing in the rest of the day
|
# If enabled, crops would start growing at about 7am(at most 5 seconds inaccuracy) and finish growing in the rest of the day
|
||||||
# Note: All the crops can only start growing when a world's time is about 7am, so when a world is loaded and its time is 8am,
|
# Note: All the crops can only start growing when a world's time is about 7am, so when a world is loaded and its time is 8am,
|
||||||
# crops would not grow in this day. You can enable time compensation make the crops grow when starting the server.
|
# crops would not grow in this day. You can enable time compensation make the crops grow when starting the server.
|
||||||
|
# 如果启用自动生长,农作物将在上午7点左右完成当日生长任务安排并且在接下来的时间里完成生长
|
||||||
|
# 请注意:农作物只有在生长点前种植才能在当日生长,否则需要等待下一个生长点,你可以开启下方的生长补偿功能
|
||||||
auto-grow:
|
auto-grow:
|
||||||
enable: true
|
enable: true
|
||||||
# For example, the time to start growing is 1000ticks(7am),
|
# For example, the time to start growing is 1000ticks(7am),
|
||||||
# sprinklers would finish their work in a random time between 1000~1300ticks,
|
# sprinklers would finish their work in a random time between 1000~1300ticks,
|
||||||
# Pot would start drying in a random time between 1300~1500ticks
|
# Pot would start drying in a random time between 1300~1500ticks
|
||||||
# and crops would grow in a random time between 1500~21500ticks
|
# and crops would grow in a random time between 1500~21500ticks
|
||||||
|
# 洒水器工作时间/种植盆干湿判断时间/农作物生长时间 不建议修改
|
||||||
sprinkler-work-time: 300
|
sprinkler-work-time: 300
|
||||||
pot-dry-time: 200
|
pot-dry-time: 200
|
||||||
crops-grow-time: 20000
|
crops-grow-time: 20000
|
||||||
# Crops would start growing instantly when the world is loaded instead of waiting for the second day's 7am
|
# Crops would start growing instantly when the world is loaded instead of waiting for the second day's 7am
|
||||||
|
# 生长补偿:当你种下农作物或刚加载世界且恰好错过生长点时候,进行补偿计算分配生长任务
|
||||||
time-compensation: true
|
time-compensation: true
|
||||||
# If the pot is wet, crop would 100% grow a stage per day
|
# If the pot is wet, crop would 100% grow a stage per day
|
||||||
# Otherwise they would have a lower chance to grow.
|
# Otherwise they would have a lower chance to grow.
|
||||||
# Recommend setting it to a value higher than 0 to make sure every crop can be ripe even if
|
# Recommend setting it to a value higher than 0 to make sure every crop can be ripe even if
|
||||||
# players don't take care of them, this is good for server performance because crop data would
|
# players don't take care of them, this is good for server performance because crop data would
|
||||||
# be removed from data file when the crop is ripe to avoid affecting server performance in the long term
|
# be removed from data file when the crop is ripe to avoid affecting server performance in the long term
|
||||||
|
# 如果种植盆是干燥的,每天生长一个阶段的概率是多少
|
||||||
|
# 建议设置高于0的数值,这样每个农作物都能得到生长,最后从数据中移除
|
||||||
|
# 长远来看,这样不会造成数据堆积,对服务器性能友好
|
||||||
dry-pot-grow-chance: 0.5
|
dry-pot-grow-chance: 0.5
|
||||||
# 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:
|
right-click-harvest:
|
||||||
enable: true
|
enable: true
|
||||||
|
# 是否需要空手
|
||||||
require-empty-hand: true
|
require-empty-hand: true
|
||||||
# Should player be prevented from planting if wrong season
|
# Should player be prevented from planting if wrong season
|
||||||
|
# 是否阻止玩家在错误季节种植
|
||||||
prevent-plant-if-wrong-season: true
|
prevent-plant-if-wrong-season: true
|
||||||
# Should player be notified of the wrong season?
|
# Should player be notified of the wrong season?
|
||||||
|
# 是否提示玩家错误的季节
|
||||||
should-notify-if-wrong-season: true
|
should-notify-if-wrong-season: true
|
||||||
|
|
||||||
fill:
|
fill:
|
||||||
@@ -90,6 +116,7 @@ mechanics:
|
|||||||
waterblock-to-watering-can: 1
|
waterblock-to-watering-can: 1
|
||||||
|
|
||||||
# Will bone meal accelerate the growth of crop
|
# Will bone meal accelerate the growth of crop
|
||||||
|
# 骨粉是否能加快农作物生长
|
||||||
bone-meal:
|
bone-meal:
|
||||||
enable: true
|
enable: true
|
||||||
chance: 0.5
|
chance: 0.5
|
||||||
@@ -97,24 +124,29 @@ mechanics:
|
|||||||
# Season mechanic
|
# Season mechanic
|
||||||
# Crops would go to death stage if growing in wrong seasons
|
# Crops would go to death stage if growing in wrong seasons
|
||||||
# Season would not affect ripe crops(for better performance and friendly player's experience)
|
# Season would not affect ripe crops(for better performance and friendly player's experience)
|
||||||
|
# 生长中的农作物会在错误的季节死去,但是不会影响已成熟的农作物
|
||||||
season:
|
season:
|
||||||
enable: true
|
enable: true
|
||||||
# If you want all the worlds to share the same season
|
# If you want all the worlds to share the same season
|
||||||
|
# 是否全世界同步季节
|
||||||
sync-seasons:
|
sync-seasons:
|
||||||
enable: false
|
enable: false
|
||||||
world: world
|
world: world
|
||||||
|
|
||||||
auto-season-change:
|
auto-season-change:
|
||||||
# If enabled, setseason command would only work for only one day
|
# If enabled, setseason command would only work for only one day
|
||||||
|
# 自动切换季节,如果启用则setseason指令仅对当天有效
|
||||||
enable: true
|
enable: true
|
||||||
#duration of each season
|
# duration of each season
|
||||||
|
# 每个季节的时长
|
||||||
duration: 28
|
duration: 28
|
||||||
greenhouse:
|
greenhouse:
|
||||||
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
|
# 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
|
# Place a scarecrow would protect the crops in this chunk
|
||||||
|
# 在生长过程中,农作物有小概率被乌鸦袭击,在当前区块放置稻草人可以驱赶乌鸦
|
||||||
crow:
|
crow:
|
||||||
enable: true
|
enable: true
|
||||||
chance: 0.005
|
chance: 0.005
|
||||||
@@ -124,14 +156,17 @@ mechanics:
|
|||||||
default-quality-ratio: 17/2/1
|
default-quality-ratio: 17/2/1
|
||||||
|
|
||||||
# A crop would go to dead stage if the sky-light level is lower than a value.
|
# A crop would go to dead stage if the sky-light level is lower than a value.
|
||||||
|
# 在自然光照不足时,农作物是否会死亡
|
||||||
dead-if-no-sky-light:
|
dead-if-no-sky-light:
|
||||||
enable: true
|
enable: true
|
||||||
level: 10
|
level: 10
|
||||||
|
|
||||||
vanilla-crops:
|
vanilla-crops:
|
||||||
# Can vanilla crops be harvest with right clicks
|
# Can vanilla crops be harvested with right clicks
|
||||||
|
# 是否可以右键重复收获原版农作物
|
||||||
right-click-harvest: false
|
right-click-harvest: false
|
||||||
# Totally prevent player from planting these vanilla crops in farmland
|
# Totally prevent player from planting these vanilla crops in farmland
|
||||||
|
# 阻止玩家种植原版农作物
|
||||||
prevent-plant:
|
prevent-plant:
|
||||||
enable: false
|
enable: false
|
||||||
list:
|
list:
|
||||||
@@ -142,6 +177,8 @@ mechanics:
|
|||||||
# Convert vanilla items into CustomCrops crops
|
# Convert vanilla items into CustomCrops crops
|
||||||
# You need to make extra CustomCrops/IA/Oraxen configs/models for these crops
|
# You need to make extra CustomCrops/IA/Oraxen configs/models for these crops
|
||||||
# This makes it possible to make vanilla crops have a better mechanic
|
# This makes it possible to make vanilla crops have a better mechanic
|
||||||
|
# 将原版物品转换为customcrops插件农作物
|
||||||
|
# 你需要为此制作额外的模型和配置
|
||||||
convert-to-customcrops:
|
convert-to-customcrops:
|
||||||
enable: false
|
enable: false
|
||||||
list:
|
list:
|
||||||
@@ -152,6 +189,7 @@ mechanics:
|
|||||||
|
|
||||||
# This option requires a skill-plugin hook
|
# This option requires a skill-plugin hook
|
||||||
# Which would increase the amount of crops player get
|
# Which would increase the amount of crops player get
|
||||||
|
# 这需要一个技能插件才能生效,可以根据玩家种植技能等级提供增益
|
||||||
skill-bonus:
|
skill-bonus:
|
||||||
enable: false
|
enable: false
|
||||||
bonus-per-level: 0.001
|
bonus-per-level: 0.001
|
||||||
@@ -246,13 +284,18 @@ season-change-command:
|
|||||||
|
|
||||||
watering-can-lore:
|
watering-can-lore:
|
||||||
# Should watering-can has dynamic lore according to the water amount
|
# Should watering-can has dynamic lore according to the water amount
|
||||||
|
# 水壶是否有根据水量变化的动态lore
|
||||||
enable: true
|
enable: true
|
||||||
# Only packets can remain the former lore, otherwise the lore would be replaced
|
# Only packets can remain the former lore, otherwise the lore would be replaced
|
||||||
|
# 只有发包描述才能保持原有的物品描述,否则会被强制替换
|
||||||
packets:
|
packets:
|
||||||
# Should watering-can's lore be sent by packets
|
# Should watering-can's lore be sent by packets
|
||||||
# Wouldn't work in creative mode for safety
|
# Wouldn't work in creative mode for safety
|
||||||
|
# 是否启用发包模式
|
||||||
|
# 安全起见,创造模式下这不会生效
|
||||||
enable: true
|
enable: true
|
||||||
# true: top / false: bottom
|
# true: top / false: bottom
|
||||||
|
# 发包描述位于描述的顶部还是底部
|
||||||
top-or-bottom: true
|
top-or-bottom: true
|
||||||
# Lore format
|
# Lore format
|
||||||
# Available variables: {water_bar}
|
# Available variables: {water_bar}
|
||||||
|
|||||||
Reference in New Issue
Block a user