9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-22 16:39:36 +00:00

bug fix 1.5.4

This commit is contained in:
Xiao-MoMi
2022-07-06 15:02:09 +08:00
parent f6dbe3c76c
commit d0d75ba809
3 changed files with 8 additions and 11 deletions

View File

@@ -81,10 +81,6 @@ public final class CustomCrops extends JavaPlugin {
//启动完成
AdventureManager.consoleMessage("<gradient:#ff206c:#fdee55>[CustomCrops] </gradient><color:#F5DEB3>插件已加载!作者:小默米 QQ:3266959688");
NBTItem nbtItem = new NBTItem(new ItemStack(Material.WHEAT));
nbtItem.getItem();
}
@Override

View File

@@ -42,7 +42,7 @@ public class BreakBlock implements Listener {
CustomBlock.remove(location);
return;
}
if(ConfigReader.Config.quality && namespacedId.equals(ConfigReader.Basic.dead)) return;
if(!ConfigReader.Config.quality || namespacedId.equals(ConfigReader.Basic.dead)) return;
String[] cropNameList = StringUtils.split(StringUtils.split(namespacedId, ":")[1], "_");
int nextStage = Integer.parseInt(cropNameList[2]) + 1;
if (CustomBlock.getInstance(StringUtils.chop(namespacedId) + nextStage) == null) {
@@ -83,21 +83,21 @@ public class BreakBlock implements Listener {
World world = location.getWorld();
Block blockUp = location.add(0,1,0).getBlock();
for (Integration integration : ConfigReader.Config.integration){
if(!integration.canPlace(location, event.getPlayer())) return;
if(!integration.canBreak(location, event.getPlayer())) return;
}
if(CustomBlock.byAlreadyPlaced(blockUp) != null){
String cropNamespacedId = CustomBlock.byAlreadyPlaced(blockUp).getNamespacedID();
CustomBlock customBlock = CustomBlock.byAlreadyPlaced(blockUp);
String cropNamespacedId = customBlock.getNamespacedID();
if(cropNamespacedId.contains("_stage_")){
CustomBlock.remove(location);
if (cropNamespacedId.equals(ConfigReader.Basic.dead)) return;
if(ConfigReader.Config.quality){
if (ConfigReader.Config.quality){
String[] cropNameList = StringUtils.split(StringUtils.split(cropNamespacedId, ":")[1], "_");
int nextStage = Integer.parseInt(cropNameList[2]) + 1;
if (CustomBlock.getInstance(StringUtils.chop(cropNamespacedId) + nextStage) == null) {
CropInstance cropInstance = ConfigReader.CROPS.get(cropNameList[0]);
ThreadLocalRandom current = ThreadLocalRandom.current();
int random = current.nextInt(cropInstance.getMin(), cropInstance.getMax() + 1);
location.add(0,1,0);
Location itemLoc = location.clone().add(0.5,0.2,0.5);
Fertilizer fertilizer = PotManager.Cache.get(location.clone().subtract(0,1,0));
if (fertilizer != null){
@@ -124,7 +124,7 @@ public class BreakBlock implements Listener {
return;
}
}
for (ItemStack itemStack : CustomBlock.byAlreadyPlaced(blockUp).getLoot()) {
for (ItemStack itemStack : customBlock.getLoot()) {
world.dropItem(location.clone().add(0.5, 0.2, 0.5), itemStack);
}
CustomBlock.remove(location);

View File

@@ -1,5 +1,5 @@
name: CustomCrops
version: '1.5.3'
version: '1.5.4'
main: net.momirealms.customcrops.CustomCrops
api-version: 1.16
depend:
@@ -12,6 +12,7 @@ softdepend:
- WorldGuard
- GriefDefender
- PlotSquared
- Towny
authors: [ XiaoMoMi ]
commands:
customcrops: