diff --git a/src/dev/_2lstudios/viarewindpotions/Main.java b/src/dev/_2lstudios/viarewindpotions/Main.java index 4072689..173c9ea 100644 --- a/src/dev/_2lstudios/viarewindpotions/Main.java +++ b/src/dev/_2lstudios/viarewindpotions/Main.java @@ -3,6 +3,7 @@ import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.ProtocolManager; +import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; @@ -19,8 +20,19 @@ public void onEnable() { final PluginManager pluginManager = getServer().getPluginManager(); final ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager(); - if (pluginManager.getPlugin("ViaRewind-Legacy-Support") == null || !configurationUtil.getConfiguration("%datafolder%/ViaRewind-Legacy-Support/config.yml").getBoolean("area-effect-cloud-particles")) + if (pluginManager.isPluginEnabled("ProtocolSupport") || pluginManager.isPluginEnabled("ViaRewind")) { + getLogger().info("ViaRewind/ProtocolSupport detected, enabling integration."); + } else if (pluginManager.isPluginEnabled("ViaBackwards")) { + getLogger().warning("ViaBackwards detected. In order to make ViaPotions work correctly, it is required that you have ViaRewind installed."); + } else { + getLogger().severe("No compatible plugins have been detected, disabling the plugin."); + getLogger().severe("In order to make ViaPotions functional, ViaRewind or ProtocolSupport must be installed."); + pluginManager.disablePlugin(this); + } + + if (pluginManager.getPlugin("ViaRewind-Legacy-Support") == null || !configurationUtil.getConfiguration("%datafolder%/ViaRewind-Legacy-Support/config.yml").getBoolean("area-effect-cloud-particles")) { pluginManager.registerEvents(new AreaEffectCloudListener(this, versionUtil), this); + } protocolManager.addPacketListener(new SpawnEntityListener(this, versionUtil)); protocolManager.addPacketListener(new WorldEventAdapter(this, versionUtil));