9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-28 03:19:15 +00:00

3.0.6-hotfix2

This commit is contained in:
Xiao-MoMi
2023-05-03 01:02:43 +08:00
parent 957da5e47a
commit 8ea72844ee
4 changed files with 8 additions and 6 deletions

View File

@@ -4,7 +4,7 @@ plugins {
} }
group = 'net.momirealms' group = 'net.momirealms'
version = '3.0.6-hotfix' version = '3.0.6-hotfix2'
repositories { repositories {
mavenCentral() mavenCentral()

View File

@@ -37,7 +37,7 @@ public class SprinklerConfig {
private final WaterAmountHologram waterAmountHologram; private final WaterAmountHologram waterAmountHologram;
private final SprinklerAnimation sprinklerAnimation; private final SprinklerAnimation sprinklerAnimation;
public SprinklerConfig(String key, int storage, int range, @Nullable Sound sound, @NotNull ItemMode itemMode, @NotNull String threeD, @NotNull String twoD, public SprinklerConfig(String key, int storage, int range, @Nullable Sound sound, @NotNull ItemMode itemMode, @NotNull String threeD, @Nullable String twoD,
@NotNull PassiveFillMethod[] passiveFillMethods, @Nullable WaterAmountHologram waterAmountHologram, SprinklerAnimation sprinklerAnimation) { @NotNull PassiveFillMethod[] passiveFillMethods, @Nullable WaterAmountHologram waterAmountHologram, SprinklerAnimation sprinklerAnimation) {
this.key = key; this.key = key;
this.storage = storage; this.storage = storage;
@@ -78,7 +78,7 @@ public class SprinklerConfig {
return threeD; return threeD;
} }
@NotNull @Nullable
public String getTwoD() { public String getTwoD() {
return twoD; return twoD;
} }

View File

@@ -83,8 +83,8 @@ public class SprinklerManager extends Function implements Listener {
if (sprinklerSec == null) continue; if (sprinklerSec == null) continue;
String twoD = sprinklerSec.getString("2D-item"); String twoD = sprinklerSec.getString("2D-item");
String threeD = sprinklerSec.getString("3D-item"); String threeD = sprinklerSec.getString("3D-item");
if (twoD == null || threeD == null) { if (threeD == null) {
AdventureUtils.consoleMessage("<red>[CustomCrops] 2/3D-item is not set for sprinkler: " + key); AdventureUtils.consoleMessage("<red>[CustomCrops] 3D-item is not set for sprinkler: " + key);
continue; continue;
} }
PassiveFillMethod[] methods = ConfigUtils.getPassiveFillMethods(sprinklerSec.getConfigurationSection("fill-method")); PassiveFillMethod[] methods = ConfigUtils.getPassiveFillMethods(sprinklerSec.getConfigurationSection("fill-method"));
@@ -129,7 +129,7 @@ public class SprinklerManager extends Function implements Listener {
) : null ) : null
); );
this.itemToKey.put(threeD, key); this.itemToKey.put(threeD, key);
this.itemToKey.put(twoD, key); if (twoD != null) this.itemToKey.put(twoD, key);
this.sprinklerConfigMap.put(key, sprinklerConfig); this.sprinklerConfigMap.put(key, sprinklerConfig);
} }
} }
@@ -161,6 +161,7 @@ public class SprinklerManager extends Function implements Listener {
String key = itemToKey.get(id); String key = itemToKey.get(id);
if (key == null) return; if (key == null) return;
String twoD = sprinklerConfigMap.get(key).getTwoD(); String twoD = sprinklerConfigMap.get(key).getTwoD();
if (twoD == null) return;
ItemStack itemStack = plugin.getPlatformInterface().getItemStack(twoD); ItemStack itemStack = plugin.getPlatformInterface().getItemStack(twoD);
if (itemStack == null) { if (itemStack == null) {
AdventureUtils.consoleMessage("<red>[CustomCrops] 2D sprinkler " + twoD + " doesn't exist"); AdventureUtils.consoleMessage("<red>[CustomCrops] 2D sprinkler " + twoD + " doesn't exist");

View File

@@ -9,6 +9,7 @@ sprinkler_1:
storage: 4 storage: 4
# 2/3D物品 # 2/3D物品
3D-item: customcrops:sprinkler_1 3D-item: customcrops:sprinkler_1
# Optional, remove this section if you don't need 2d items
2D-item: customcrops:sprinkler_1_item 2D-item: customcrops:sprinkler_1_item
# ITEM_FRAME / TRIPWIRE / ITEM_DISPLAY (1.19.4+) # ITEM_FRAME / TRIPWIRE / ITEM_DISPLAY (1.19.4+)
# Sprinkler item type # Sprinkler item type