64 lines
1.6 KiB
Java
64 lines
1.6 KiB
Java
package com.alttd.playershops;
|
|
|
|
import com.alttd.playershops.config.Config;
|
|
import net.milkbowl.vault.economy.Economy;
|
|
import org.bukkit.Bukkit;
|
|
import org.bukkit.plugin.RegisteredServiceProvider;
|
|
import org.bukkit.plugin.java.JavaPlugin;
|
|
|
|
public class PlayerShops extends JavaPlugin {
|
|
|
|
private static PlayerShops instance;
|
|
private Economy econ;
|
|
|
|
public void onEnable() {
|
|
instance = this;
|
|
if(!setupEconomy()) {
|
|
Bukkit.getLogger().warning("Error loading Vault and economy.\n Disabling plugin");
|
|
this.setEnabled(false);
|
|
return;
|
|
}
|
|
Bukkit.getLogger().info("Hooked into Vault economy provided by " + econ.getName());
|
|
reloadConfigs();
|
|
|
|
registerListeners();
|
|
registerCommands();
|
|
}
|
|
|
|
private boolean setupEconomy() {
|
|
if (getServer().getPluginManager().getPlugin("Vault") == null) {
|
|
return false;
|
|
}
|
|
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
|
|
if (rsp == null) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public Economy getEconomy() {
|
|
if(econ == null)
|
|
setupEconomy();
|
|
return econ;
|
|
}
|
|
|
|
private void registerListeners() {
|
|
|
|
}
|
|
|
|
private void registerCommands() {
|
|
// for(String command : this.getDescription().getCommands().keySet()) {
|
|
// getCommand(command).setExecutor();
|
|
// }
|
|
}
|
|
|
|
public void reloadConfigs() {
|
|
Config.reload();
|
|
}
|
|
|
|
public static PlayerShops getInstance() {
|
|
return instance;
|
|
}
|
|
|
|
}
|