9
0
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:
Xiao-MoMi
2023-05-07 09:51:10 +08:00
parent 57253a6fbb
commit 01ffc9d48d
3 changed files with 7 additions and 5 deletions

View File

@@ -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();
}

View File

@@ -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);
}
}