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:
@@ -81,10 +81,6 @@ public final class CustomCrops extends JavaPlugin {
|
|||||||
|
|
||||||
//启动完成
|
//启动完成
|
||||||
AdventureManager.consoleMessage("<gradient:#ff206c:#fdee55>[CustomCrops] </gradient><color:#F5DEB3>插件已加载!作者:小默米 QQ:3266959688");
|
AdventureManager.consoleMessage("<gradient:#ff206c:#fdee55>[CustomCrops] </gradient><color:#F5DEB3>插件已加载!作者:小默米 QQ:3266959688");
|
||||||
|
|
||||||
NBTItem nbtItem = new NBTItem(new ItemStack(Material.WHEAT));
|
|
||||||
nbtItem.getItem();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class BreakBlock implements Listener {
|
|||||||
CustomBlock.remove(location);
|
CustomBlock.remove(location);
|
||||||
return;
|
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], "_");
|
String[] cropNameList = StringUtils.split(StringUtils.split(namespacedId, ":")[1], "_");
|
||||||
int nextStage = Integer.parseInt(cropNameList[2]) + 1;
|
int nextStage = Integer.parseInt(cropNameList[2]) + 1;
|
||||||
if (CustomBlock.getInstance(StringUtils.chop(namespacedId) + nextStage) == null) {
|
if (CustomBlock.getInstance(StringUtils.chop(namespacedId) + nextStage) == null) {
|
||||||
@@ -83,21 +83,21 @@ public class BreakBlock implements Listener {
|
|||||||
World world = location.getWorld();
|
World world = location.getWorld();
|
||||||
Block blockUp = location.add(0,1,0).getBlock();
|
Block blockUp = location.add(0,1,0).getBlock();
|
||||||
for (Integration integration : ConfigReader.Config.integration){
|
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){
|
if(CustomBlock.byAlreadyPlaced(blockUp) != null){
|
||||||
String cropNamespacedId = CustomBlock.byAlreadyPlaced(blockUp).getNamespacedID();
|
CustomBlock customBlock = CustomBlock.byAlreadyPlaced(blockUp);
|
||||||
|
String cropNamespacedId = customBlock.getNamespacedID();
|
||||||
if(cropNamespacedId.contains("_stage_")){
|
if(cropNamespacedId.contains("_stage_")){
|
||||||
CustomBlock.remove(location);
|
CustomBlock.remove(location);
|
||||||
if (cropNamespacedId.equals(ConfigReader.Basic.dead)) return;
|
if (cropNamespacedId.equals(ConfigReader.Basic.dead)) return;
|
||||||
if(ConfigReader.Config.quality){
|
if (ConfigReader.Config.quality){
|
||||||
String[] cropNameList = StringUtils.split(StringUtils.split(cropNamespacedId, ":")[1], "_");
|
String[] cropNameList = StringUtils.split(StringUtils.split(cropNamespacedId, ":")[1], "_");
|
||||||
int nextStage = Integer.parseInt(cropNameList[2]) + 1;
|
int nextStage = Integer.parseInt(cropNameList[2]) + 1;
|
||||||
if (CustomBlock.getInstance(StringUtils.chop(cropNamespacedId) + nextStage) == null) {
|
if (CustomBlock.getInstance(StringUtils.chop(cropNamespacedId) + nextStage) == null) {
|
||||||
CropInstance cropInstance = ConfigReader.CROPS.get(cropNameList[0]);
|
CropInstance cropInstance = ConfigReader.CROPS.get(cropNameList[0]);
|
||||||
ThreadLocalRandom current = ThreadLocalRandom.current();
|
ThreadLocalRandom current = ThreadLocalRandom.current();
|
||||||
int random = current.nextInt(cropInstance.getMin(), cropInstance.getMax() + 1);
|
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);
|
Location itemLoc = location.clone().add(0.5,0.2,0.5);
|
||||||
Fertilizer fertilizer = PotManager.Cache.get(location.clone().subtract(0,1,0));
|
Fertilizer fertilizer = PotManager.Cache.get(location.clone().subtract(0,1,0));
|
||||||
if (fertilizer != null){
|
if (fertilizer != null){
|
||||||
@@ -124,7 +124,7 @@ public class BreakBlock implements Listener {
|
|||||||
return;
|
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);
|
world.dropItem(location.clone().add(0.5, 0.2, 0.5), itemStack);
|
||||||
}
|
}
|
||||||
CustomBlock.remove(location);
|
CustomBlock.remove(location);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
name: CustomCrops
|
name: CustomCrops
|
||||||
version: '1.5.3'
|
version: '1.5.4'
|
||||||
main: net.momirealms.customcrops.CustomCrops
|
main: net.momirealms.customcrops.CustomCrops
|
||||||
api-version: 1.16
|
api-version: 1.16
|
||||||
depend:
|
depend:
|
||||||
@@ -12,6 +12,7 @@ softdepend:
|
|||||||
- WorldGuard
|
- WorldGuard
|
||||||
- GriefDefender
|
- GriefDefender
|
||||||
- PlotSquared
|
- PlotSquared
|
||||||
|
- Towny
|
||||||
authors: [ XiaoMoMi ]
|
authors: [ XiaoMoMi ]
|
||||||
commands:
|
commands:
|
||||||
customcrops:
|
customcrops:
|
||||||
|
|||||||
Reference in New Issue
Block a user