mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-22 08:29:35 +00:00
bug fix 1.5.4
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user