mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-25 09:59:20 +00:00
3.1.1-hotfix
This commit is contained in:
@@ -193,11 +193,11 @@ public final class CustomCrops extends JavaPlugin {
|
||||
|
||||
private boolean loadPlatform() {
|
||||
PluginManager pluginManager = Bukkit.getPluginManager();
|
||||
if (pluginManager.isPluginEnabled("ItemsAdder")) {
|
||||
if (pluginManager.getPlugin("ItemsAdder") != null) {
|
||||
this.platform = Platform.ItemsAdder;
|
||||
this.platformInterface = new ItemsAdderPluginImpl();
|
||||
}
|
||||
else if (pluginManager.isPluginEnabled("Oraxen")) {
|
||||
else if (pluginManager.getPlugin("Oraxen") != null) {
|
||||
this.platform = Platform.Oraxen;
|
||||
this.platformInterface = new OraxenPluginImpl();
|
||||
}
|
||||
|
||||
@@ -157,16 +157,18 @@ public class SprinklerManager extends Function implements Listener {
|
||||
public void onItemSpawn(ItemSpawnEvent event) {
|
||||
if (event.isCancelled()) return;
|
||||
Item item = event.getEntity();
|
||||
String id = plugin.getPlatformInterface().getItemStackID(item.getItemStack());
|
||||
ItemStack origin = item.getItemStack();
|
||||
String id = plugin.getPlatformInterface().getItemStackID(origin);
|
||||
String key = itemToKey.get(id);
|
||||
if (key == null) return;
|
||||
String twoD = sprinklerConfigMap.get(key).getTwoD();
|
||||
if (twoD == null) return;
|
||||
if (twoD == null || id.equals(twoD)) return;
|
||||
ItemStack itemStack = plugin.getPlatformInterface().getItemStack(twoD);
|
||||
if (itemStack == null) {
|
||||
AdventureUtils.consoleMessage("<red>[CustomCrops] 2D sprinkler " + twoD + " doesn't exist");
|
||||
return;
|
||||
}
|
||||
itemStack.setAmount(origin.getAmount());
|
||||
item.setItemStack(itemStack);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user