9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-22 08:29:35 +00:00
This commit is contained in:
Xiao-MoMi
2022-07-23 20:00:40 +08:00
parent 1955677b06
commit f9761f2fe6
12 changed files with 51 additions and 10 deletions

View File

0
libs/Lands(premium).txt Normal file
View File

View File

View File

View File

@@ -44,7 +44,7 @@ public class ConfigReader {
public static HashMap<String, WateringCan> CANS = new HashMap<>();
public static HashMap<String, Sprinkler> SPRINKLERS = new HashMap<>();
private static YamlConfiguration getConfig(String configName) {
public static YamlConfiguration getConfig(String configName) {
File file = new File(CustomCrops.instance.getDataFolder(), configName);
if (!file.exists()) {
CustomCrops.instance.saveResource(configName, false);
@@ -227,6 +227,14 @@ public class ConfigReader {
AdventureManager.consoleMessage("<gradient:#ff206c:#fdee55>[CustomCrops] </gradient><gold>Lands <color:#FFEBCD>Hooked!");
}
}
if(config.getBoolean("config.integration.GriefPrevention",false)){
if(Bukkit.getPluginManager().getPlugin("GriefPrevention") == null){
CustomCrops.instance.getLogger().warning("Failed to initialize GriefPrevention!");
}else {
integration.add(new GriefPrevention());
AdventureManager.consoleMessage("<gradient:#ff206c:#fdee55>[CustomCrops] </gradient><gold>GriefPrevention <color:#FFEBCD>Hooked!");
}
}
}
}

View File

@@ -33,8 +33,11 @@ import net.momirealms.customcrops.utils.BackUp;
import net.momirealms.customcrops.utils.HoloUtil;
import net.momirealms.customcrops.utils.Placeholders;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
import java.io.IOException;
import java.util.Objects;
public final class CustomCrops extends JavaPlugin {
@@ -111,8 +114,19 @@ public final class CustomCrops extends JavaPlugin {
this.potManager = new PotManager(this);
this.potManager.loadData();
//启动完成
AdventureManager.consoleMessage("<gradient:#ff206c:#fdee55>[CustomCrops] </gradient><color:#F5DEB3>Plugin Enabled!");
FileConfiguration fileConfiguration = Bukkit.getPluginManager().getPlugin("ItemsAdder").getConfig();
if (fileConfiguration.getBoolean("blocks.disable-REAL_WIRE")){
fileConfiguration.set("blocks.disable-REAL_WIRE", false);
try {
fileConfiguration.save(new File(Bukkit.getPluginManager().getPlugin("ItemsAdder").getDataFolder(), "config.yml"));
} catch (IOException e) {
e.printStackTrace();
}
AdventureManager.consoleMessage("<gradient:#ff206c:#fdee55>[CustomCrops] </gradient><red>Detected that you might have not set \"disable-REAL_WIRE\" false in ItemsAdder's config!");
AdventureManager.consoleMessage("<gradient:#ff206c:#fdee55>[CustomCrops] </gradient><red>You need a restart to apply that config :)");
}else {
AdventureManager.consoleMessage("<gradient:#ff206c:#fdee55>[CustomCrops] </gradient><color:#F5DEB3>Plugin Enabled!");
}
}
@Override

View File

@@ -0,0 +1,17 @@
package net.momirealms.customcrops.integrations;
import org.bukkit.Location;
import org.bukkit.entity.Player;
public class GriefPrevention implements Integration{
@Override
public boolean canBreak(Location location, Player player) {
return me.ryanhamshire.GriefPrevention.GriefPrevention.instance.allowBreak(player, location.getBlock(), location) == null;
}
@Override
public boolean canPlace(Location location, Player player) {
return me.ryanhamshire.GriefPrevention.GriefPrevention.instance.allowBuild(player, location) == null;
}
}

View File

@@ -33,7 +33,6 @@ public class CropTimer {
public void stopTimer(int ID) {
Bukkit.getScheduler().cancelTask(ID);
Bukkit.getServer().getScheduler().cancelTask(ID);
}
public int getTaskID() {

View File

@@ -33,7 +33,6 @@ public class CropTimerAsync {
public void stopTimer(int ID) {
Bukkit.getScheduler().cancelTask(ID);
Bukkit.getServer().getScheduler().cancelTask(ID);
}
public int getTaskID() {

View File

@@ -11,6 +11,7 @@ config:
PlotSquared: false
Towny: false
Lands: false
GriefPrevention: false
#The time to start growing(ticks)
#1000ticks is 7am in game. (0-23999)
@@ -27,8 +28,6 @@ config:
quality:
#If disabled, you need to configurate the loot in ItemsAdder config
#If enabled, make sure that your Grief Prevention Plugin is supported.
#Otherwise there might exists duplication.
enable: true
#Default ratio
default-ratio: 17/2/1

View File

@@ -15,6 +15,7 @@ softdepend:
- PlotSquared
- Towny
- Lands
- GriefPrevention
commands:
customcrops:
usage: /customcrops <args>

View File

@@ -1,4 +1,6 @@
config:
lang: chinese
#插件兼容
integration:
Residence: false
@@ -8,6 +10,7 @@ config:
PlotSquared: false
Towny: false
Lands: false
GriefPrevention: false
#生长时间点(tick)
#1000代表上午7点农作物陆续开始生长
@@ -27,8 +30,6 @@ config:
quality:
#若不启用则植物成熟阶段会掉落IA配置里的loot
#如果关闭产物品质需要在IA物品配置内自行添加最后一阶段掉落物
#如果你使用的领地插件不被兼容,请不要启用产物品质功能,
#请立即更换领地插件或寻找作者写领地兼容
enable: true
#默认品质权重比
default-ratio: 17/2/1
@@ -76,3 +77,6 @@ config:
#在此选项开启的状态下,白名单世界只能填写一个
#作为所有世界农作物生长的时间、季节判断依据
all-world-grow: false
#玩家是否能空手右键收获
right-click-harvest: true