Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent duplicate installation on both Mod and Bukkit side #479

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ public class BukkitSparkPlugin extends JavaPlugin implements SparkPlugin {

@Override
public void onEnable() {
if (classExists("me.lucko.spark.forge.ForgeSparkMod")
|| classExists("me.lucko.spark.fabric.FabricSparkMod")
|| classExists("me.lucko.spark.neoforge.NeoForgeSparkMod")
) {
getLogger().warning("You have already installed spark as a mod. Installing spark both on Mod and Bukkit side will cause unexpected issues, disabling.");
getServer().getPluginManager().disablePlugin(this);
return;
}
this.audienceFactory = BukkitAudiences.create(this);
this.gameThreadDumper = new ThreadDumper.Specific(Thread.currentThread());

Expand Down Expand Up @@ -98,7 +106,9 @@ public boolean hasPermission(String permission) {

@Override
public void onDisable() {
this.platform.disable();
if (this.platform != null) {
this.platform.disable();
}
if (this.tpsCommand != null) {
CommandMapUtil.unregisterCommand(this.tpsCommand);
}
Expand Down