Moved ShopkeepersAPI reference to listener
parent
006a3a2c0d
commit
e036627fb1
|
@ -1,6 +1,5 @@
|
|||
package xyz.etztech.qol;
|
||||
|
||||
import com.nisovin.shopkeepers.api.ShopkeepersAPI;
|
||||
import com.nisovin.shopkeepers.api.ShopkeepersPlugin;
|
||||
import github.scarsz.discordsrv.DiscordSRV;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
|
@ -10,7 +9,6 @@ import org.bukkit.configuration.file.FileConfiguration;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.dynmap.DynmapAPI;
|
||||
import org.dynmap.markers.Marker;
|
||||
import org.dynmap.markers.MarkerAPI;
|
||||
|
@ -40,7 +38,6 @@ public class QoL extends JavaPlugin {
|
|||
private MarkerSet playerMarkerSet = null;
|
||||
private boolean qolMarkerLayerShow = false;
|
||||
private String qolMarkerSetLabel = null;
|
||||
private ShopkeepersPlugin shopkeepersAPI = null;
|
||||
|
||||
public static FileConfiguration config;
|
||||
private Logger log = Logger.getLogger( "Minecraft" );
|
||||
|
@ -101,10 +98,7 @@ public class QoL extends JavaPlugin {
|
|||
|
||||
// Shopkeepers Hook
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("Shopkeepers")) {
|
||||
shopkeepersAPI = ShopkeepersPlugin.getInstance();
|
||||
|
||||
new HeadShopListener(this);
|
||||
|
||||
log("Hooked in Shopkeepers for the head shop");
|
||||
}
|
||||
|
||||
|
@ -359,9 +353,5 @@ public class QoL extends JavaPlugin {
|
|||
public Spark getSpark() {
|
||||
return spark;
|
||||
}
|
||||
|
||||
public ShopkeepersPlugin getShopkeepersAPI() {
|
||||
return shopkeepersAPI;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,18 +18,20 @@ import java.util.List;
|
|||
|
||||
public class HeadShopListener implements Listener{
|
||||
|
||||
private QoL plugin;
|
||||
private final QoL plugin;
|
||||
private final ShopkeepersPlugin shopkeepersAPI;
|
||||
|
||||
public HeadShopListener(QoL plugin) {
|
||||
this.plugin = plugin;
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
|
||||
this.shopkeepersAPI = ShopkeepersPlugin.getInstance();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(PlayerJoinEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
|
||||
ShopkeepersPlugin shopkeepersAPI = plugin.getShopkeepersAPI();
|
||||
if (shopkeepersAPI != null && player.hasPermission("qol.head_shop")) {
|
||||
int shopKeeperID = plugin.getConfig().getInt("head_shop.id", -1);
|
||||
|
||||
|
|
Loading…
Reference in New Issue