Skip to content

Commit

Permalink
Prevent installing on both Mod and Bukkit side
Browse files Browse the repository at this point in the history
  • Loading branch information
HaHaWTH committed Jan 11, 2025
1 parent 336102f commit 3d57ec7
Showing 1 changed file with 11 additions and 1 deletion.
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

0 comments on commit 3d57ec7

Please sign in to comment.