Skip to content
This repository has been archived by the owner on May 22, 2023. It is now read-only.

Commit

Permalink
Updated PluginChecker
Browse files Browse the repository at this point in the history
Made more consistent with other listeners
  • Loading branch information
Sentropic committed Dec 20, 2020
1 parent c63fdb5 commit e9c5dd0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/main/java/com/sucy/skill/SkillAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ public void onEnable() {
listen(new DeathListener(), !VersionManager.isVersionAtLeast(11000));
listen(new LingeringPotionListener(), VersionManager.isVersionAtLeast(VersionManager.V1_9_0));
listen(new ExperienceListener(), settings.yieldsEnabled());
new PluginChecker(this);
listen(new PluginChecker(), true);


// Set up tasks
if (settings.isManaEnabled()) {
Expand Down
13 changes: 4 additions & 9 deletions src/main/java/com/sucy/skill/hook/PluginChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@
*/
package com.sucy.skill.hook;

import com.sucy.skill.SkillAPI;
import com.sucy.skill.listener.SkillAPIListener;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.plugin.PluginManager;
Expand All @@ -38,9 +37,7 @@
* Handler for checking whether or not hooked plugins are present
* and active before using related code.
*/
public class PluginChecker implements Listener {
private static PluginChecker singleton;

public class PluginChecker extends SkillAPIListener {
private static boolean vault;
private static boolean libsDisguises;
private static boolean noCheatPlus;
Expand All @@ -51,11 +48,9 @@ public class PluginChecker implements Listener {
private static boolean worldGuard;
private static boolean parties;

public PluginChecker(SkillAPI plugin) {
if (singleton != null) return;
singleton = this;
@Override
public void init() {
PluginManager pluginManager = Bukkit.getPluginManager();
pluginManager.registerEvents(this, plugin);

vault = pluginManager.isPluginEnabled("Vault") && VaultHook.isValid();
libsDisguises = pluginManager.isPluginEnabled("LibsDisguises");
Expand Down

0 comments on commit e9c5dd0

Please sign in to comment.