mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-20 15:39:21 +00:00
1.4.7
This commit is contained in:
@@ -29,6 +29,7 @@ public class ConfigManager {
|
|||||||
public static boolean need_water;
|
public static boolean need_water;
|
||||||
public static boolean greenhouse;
|
public static boolean greenhouse;
|
||||||
public static boolean limit;
|
public static boolean limit;
|
||||||
|
public static boolean log_time;
|
||||||
|
|
||||||
public static List<String> worlds;
|
public static List<String> worlds;
|
||||||
public static List<Long> cropGrowTimeList;
|
public static List<Long> cropGrowTimeList;
|
||||||
@@ -82,10 +83,10 @@ public class ConfigManager {
|
|||||||
FileConfiguration configuration = CustomCrops.instance.getConfig();
|
FileConfiguration configuration = CustomCrops.instance.getConfig();
|
||||||
cropLoad();
|
cropLoad();
|
||||||
//处理配置
|
//处理配置
|
||||||
Config.res = configuration.getBoolean("config.integration.residence");
|
Config.res = configuration.getBoolean("config.integration.residence",false);
|
||||||
Config.king = configuration.getBoolean("config.integration.kingdomsX");
|
Config.king = configuration.getBoolean("config.integration.kingdomsX",false);
|
||||||
Config.wg = configuration.getBoolean("config.integration.worldguard");
|
Config.wg = configuration.getBoolean("config.integration.worldguard",false);
|
||||||
Config.gd = configuration.getBoolean("config.integration.griefdefender");
|
Config.gd = configuration.getBoolean("config.integration.griefdefender",false);
|
||||||
|
|
||||||
if(res){
|
if(res){
|
||||||
if(Bukkit.getPluginManager().getPlugin("Residence") == null){
|
if(Bukkit.getPluginManager().getPlugin("Residence") == null){
|
||||||
@@ -124,6 +125,7 @@ public class ConfigManager {
|
|||||||
Config.need_water = configuration.getBoolean("config.bone-meal-consume-water");
|
Config.need_water = configuration.getBoolean("config.bone-meal-consume-water");
|
||||||
Config.greenhouse = configuration.getBoolean("config.enable-greenhouse");
|
Config.greenhouse = configuration.getBoolean("config.enable-greenhouse");
|
||||||
Config.limit = configuration.getBoolean("config.enable-limit");
|
Config.limit = configuration.getBoolean("config.enable-limit");
|
||||||
|
Config.log_time = configuration.getBoolean("config.log-time-consume", false);
|
||||||
|
|
||||||
Config.bone_chance = configuration.getDouble("config.bone-meal-chance");
|
Config.bone_chance = configuration.getDouble("config.bone-meal-chance");
|
||||||
|
|
||||||
@@ -172,7 +174,6 @@ public class ConfigManager {
|
|||||||
Config.summer = configuration.getString("messages.summer");
|
Config.summer = configuration.getString("messages.summer");
|
||||||
Config.autumn = configuration.getString("messages.autumn");
|
Config.autumn = configuration.getString("messages.autumn");
|
||||||
Config.winter = configuration.getString("messages.winter");
|
Config.winter = configuration.getString("messages.winter");
|
||||||
Config.winter = configuration.getString("messages.noperm");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -81,7 +81,9 @@ public class CropManager {
|
|||||||
data.set(key.getWorld().getName() + "." + key.getBlockX() + "," + key.getBlockY()+ ","+ key.getBlockZ(), entry.getValue());
|
data.set(key.getWorld().getName() + "." + key.getBlockX() + "," + key.getBlockY()+ ","+ key.getBlockZ(), entry.getValue());
|
||||||
}
|
}
|
||||||
long finish1 = System.currentTimeMillis();
|
long finish1 = System.currentTimeMillis();
|
||||||
|
if (ConfigManager.Config.log_time){
|
||||||
MessageManager.consoleMessage("&#ccfbff-#ef96c5&[CustomCrops] &7农作物数据更新耗时&a" + (finish1 - start1) + "&fms",Bukkit.getConsoleSender());
|
MessageManager.consoleMessage("&#ccfbff-#ef96c5&[CustomCrops] &7农作物数据更新耗时&a" + (finish1 - start1) + "&fms",Bukkit.getConsoleSender());
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
阶段2:清理数据内无效的农作物并让有效农作物生长
|
阶段2:清理数据内无效的农作物并让有效农作物生长
|
||||||
*/
|
*/
|
||||||
@@ -225,7 +227,9 @@ public class CropManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
long finish2 = System.currentTimeMillis();
|
long finish2 = System.currentTimeMillis();
|
||||||
|
if (ConfigManager.Config.log_time){
|
||||||
MessageManager.consoleMessage("&#ccfbff-#ef96c5&[CustomCrops] &7农作物生长耗时&a" + (finish2 - start2) + "&fms",Bukkit.getConsoleSender());
|
MessageManager.consoleMessage("&#ccfbff-#ef96c5&[CustomCrops] &7农作物生长耗时&a" + (finish2 - start2) + "&fms",Bukkit.getConsoleSender());
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
阶段3:保存文件
|
阶段3:保存文件
|
||||||
@@ -238,6 +242,8 @@ public class CropManager {
|
|||||||
CustomCrops.instance.getLogger().warning("crop-data.yml保存出错!");
|
CustomCrops.instance.getLogger().warning("crop-data.yml保存出错!");
|
||||||
}
|
}
|
||||||
long finish3 = System.currentTimeMillis();
|
long finish3 = System.currentTimeMillis();
|
||||||
|
if (ConfigManager.Config.log_time){
|
||||||
MessageManager.consoleMessage("&#ccfbff-#ef96c5&[CustomCrops] &7农作物数据保存耗时&a" + (finish3 - start3) + "&fms",Bukkit.getConsoleSender());
|
MessageManager.consoleMessage("&#ccfbff-#ef96c5&[CustomCrops] &7农作物数据保存耗时&a" + (finish3 - start3) + "&fms",Bukkit.getConsoleSender());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,7 +78,9 @@ public class SprinklerManager {
|
|||||||
data.set(entry.getKey().getWorld().getName() + "." + entry.getKey().getBlockX() + "," + entry.getKey().getBlockY()+ ","+entry.getKey().getBlockZ(), entry.getValue());
|
data.set(entry.getKey().getWorld().getName() + "." + entry.getKey().getBlockX() + "," + entry.getKey().getBlockY()+ ","+entry.getKey().getBlockZ(), entry.getValue());
|
||||||
}
|
}
|
||||||
long finish1 = System.currentTimeMillis();
|
long finish1 = System.currentTimeMillis();
|
||||||
|
if (ConfigManager.Config.log_time){
|
||||||
MessageManager.consoleMessage("&#ccfbff-#ef96c5&[CustomCrops] &7洒水器数据更新耗时&a" + (finish1-start1) + "&fms",Bukkit.getConsoleSender());
|
MessageManager.consoleMessage("&#ccfbff-#ef96c5&[CustomCrops] &7洒水器数据更新耗时&a" + (finish1-start1) + "&fms",Bukkit.getConsoleSender());
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
阶段2:清理数据内无效的洒水器并工作
|
阶段2:清理数据内无效的洒水器并工作
|
||||||
*/
|
*/
|
||||||
@@ -118,8 +120,9 @@ public class SprinklerManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
long finish2 = System.currentTimeMillis();
|
long finish2 = System.currentTimeMillis();
|
||||||
|
if (ConfigManager.Config.log_time){
|
||||||
MessageManager.consoleMessage("&#ccfbff-#ef96c5&[CustomCrops] &7洒水器工作耗时&a" + (finish2-start2) + "&fms",Bukkit.getConsoleSender());
|
MessageManager.consoleMessage("&#ccfbff-#ef96c5&[CustomCrops] &7洒水器工作耗时&a" + (finish2-start2) + "&fms",Bukkit.getConsoleSender());
|
||||||
|
}
|
||||||
bukkitScheduler.runTaskAsynchronously(CustomCrops.instance,()->{
|
bukkitScheduler.runTaskAsynchronously(CustomCrops.instance,()->{
|
||||||
/*
|
/*
|
||||||
阶段3:保存数据
|
阶段3:保存数据
|
||||||
@@ -132,7 +135,9 @@ public class SprinklerManager {
|
|||||||
CustomCrops.instance.getLogger().warning("sprinkler-data.yml保存出错!");
|
CustomCrops.instance.getLogger().warning("sprinkler-data.yml保存出错!");
|
||||||
}
|
}
|
||||||
long finish3 = System.currentTimeMillis();
|
long finish3 = System.currentTimeMillis();
|
||||||
|
if (ConfigManager.Config.log_time){
|
||||||
MessageManager.consoleMessage("&#ccfbff-#ef96c5&[CustomCrops] &7洒水器数据保存耗时&a" + (finish3-start3) + "&fms",Bukkit.getConsoleSender());
|
MessageManager.consoleMessage("&#ccfbff-#ef96c5&[CustomCrops] &7洒水器数据保存耗时&a" + (finish3-start3) + "&fms",Bukkit.getConsoleSender());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,36 +8,27 @@ public class IntegrationCheck {
|
|||||||
|
|
||||||
//收获权限检测
|
//收获权限检测
|
||||||
public static boolean HarvestCheck(Location location, Player player){
|
public static boolean HarvestCheck(Location location, Player player){
|
||||||
boolean canH = false;
|
|
||||||
if(ConfigManager.Config.res){
|
if(ConfigManager.Config.res){
|
||||||
if(ResidenceIntegrations.checkResHarvest(location, player)){
|
if(!ResidenceIntegrations.checkResHarvest(location, player)){
|
||||||
canH = true;
|
|
||||||
}else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(ConfigManager.Config.king){
|
if(ConfigManager.Config.king){
|
||||||
if(KingdomsXIntegrations.checkKDBuild(location, player)){
|
if(!KingdomsXIntegrations.checkKDBuild(location, player)){
|
||||||
canH = true;
|
|
||||||
}else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(ConfigManager.Config.wg){
|
if(ConfigManager.Config.wg){
|
||||||
if(WorldGuardIntegrations.checkWGHarvest(location, player)){
|
if(!WorldGuardIntegrations.checkWGHarvest(location, player)){
|
||||||
canH = true;
|
|
||||||
}else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(ConfigManager.Config.gd){
|
if(ConfigManager.Config.gd){
|
||||||
if(GriefDefenderIntegrations.checkGDBreak(location, player)){
|
if(!GriefDefenderIntegrations.checkGDBreak(location, player)){
|
||||||
canH = true;
|
|
||||||
}else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return canH;
|
return true;
|
||||||
}
|
}
|
||||||
//种植等权限检测
|
//种植等权限检测
|
||||||
public static boolean PlaceCheck(Location location, Player player){
|
public static boolean PlaceCheck(Location location, Player player){
|
||||||
|
|||||||
@@ -14,16 +14,17 @@ public class TimeCheck extends BukkitRunnable {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
ConfigManager.Config.worlds.forEach(world ->{
|
ConfigManager.Config.worlds.forEach(world ->{
|
||||||
BukkitScheduler bukkitScheduler = Bukkit.getScheduler();
|
|
||||||
if(Bukkit.getWorld(world) != null){
|
if(Bukkit.getWorld(world) != null){
|
||||||
long time = Bukkit.getWorld(world).getTime();
|
long time = Bukkit.getWorld(world).getTime();
|
||||||
ConfigManager.Config.cropGrowTimeList.forEach(cropGrowTime -> {
|
ConfigManager.Config.cropGrowTimeList.forEach(cropGrowTime -> {
|
||||||
if(time == cropGrowTime){
|
if(time == cropGrowTime){
|
||||||
|
BukkitScheduler bukkitScheduler = Bukkit.getScheduler();
|
||||||
bukkitScheduler.runTaskAsynchronously(CustomCrops.instance, () -> CropManager.CropGrow(world));
|
bukkitScheduler.runTaskAsynchronously(CustomCrops.instance, () -> CropManager.CropGrow(world));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ConfigManager.Config.sprinklerWorkTimeList.forEach(sprinklerTime -> {
|
ConfigManager.Config.sprinklerWorkTimeList.forEach(sprinklerTime -> {
|
||||||
if(time == sprinklerTime){
|
if(time == sprinklerTime){
|
||||||
|
BukkitScheduler bukkitScheduler = Bukkit.getScheduler();
|
||||||
bukkitScheduler.runTaskAsynchronously(CustomCrops.instance, () -> SprinklerManager.SprinklerWork(world));
|
bukkitScheduler.runTaskAsynchronously(CustomCrops.instance, () -> SprinklerManager.SprinklerWork(world));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -37,13 +37,11 @@ config:
|
|||||||
#使用骨粉失败的粒子
|
#使用骨粉失败的粒子
|
||||||
failure: VILLAGER_ANGRY
|
failure: VILLAGER_ANGRY
|
||||||
|
|
||||||
|
|
||||||
#温室系统,在温室玻璃正下方的方块可以无视季节种植
|
#温室系统,在温室玻璃正下方的方块可以无视季节种植
|
||||||
enable-greenhouse: true
|
enable-greenhouse: true
|
||||||
#温室玻璃有效范围
|
#温室玻璃有效范围
|
||||||
greenhouse-range: 7
|
greenhouse-range: 7
|
||||||
|
|
||||||
|
|
||||||
#植物的种植盆方块
|
#植物的种植盆方块
|
||||||
pot: customcrops:pot
|
pot: customcrops:pot
|
||||||
#植物的浇过水的种植盆方块
|
#植物的浇过水的种植盆方块
|
||||||
@@ -67,17 +65,18 @@ config:
|
|||||||
#农作物枯萎后变成的方块,物品ID中请保留stage以保持其下方方块被破坏时,枯萎作物也被破坏的特性
|
#农作物枯萎后变成的方块,物品ID中请保留stage以保持其下方方块被破坏时,枯萎作物也被破坏的特性
|
||||||
dead-crop: customcrops:crop_stage_death
|
dead-crop: customcrops:crop_stage_death
|
||||||
|
|
||||||
|
|
||||||
#种植的最低和最高Y坐标
|
#种植的最低和最高Y坐标
|
||||||
height:
|
height:
|
||||||
min: 50
|
min: 50
|
||||||
max: 100
|
max: 150
|
||||||
#每个区块最大农作物数量和洒水器数量
|
#每个区块最大农作物数量和洒水器数量
|
||||||
#是否启用限制
|
#是否启用限制
|
||||||
enable-limit: true
|
enable-limit: true
|
||||||
max-crops: 64
|
max-crops: 64
|
||||||
max-sprinklers: 8
|
max-sprinklers: 8
|
||||||
|
|
||||||
|
#记录生长判断和洒水所需的时间
|
||||||
|
log-time-consume: false
|
||||||
|
|
||||||
#插件兼容
|
#插件兼容
|
||||||
integration:
|
integration:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
name: CustomCrops
|
name: CustomCrops
|
||||||
version: '1.4.5'
|
version: '1.4.7'
|
||||||
main: net.momirealms.customcrops.CustomCrops
|
main: net.momirealms.customcrops.CustomCrops
|
||||||
api-version: 1.16
|
api-version: 1.16
|
||||||
depend:
|
depend:
|
||||||
|
|||||||
Reference in New Issue
Block a user