Files
src
.gitignore
build.gradle
settings.gradle
Code
13 739
src/main/java/com/velrion/pointshop/PointShopPlugin.java
package com.velrion.pointshop;
import com.velrion.pointshop.command.PointShopCommand;
import com.velrion.pointshop.config.MessageManager;
import com.velrion.pointshop.gui.PointShopGUI;
import com.velrion.pointshop.listener.ShopListener;
import com.velrion.pointshop.shop.ShopManager;
import org.black_ixx.playerpoints.PlayerPoints;
import org.black_ixx.playerpoints.PlayerPointsAPI;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.IOException;
public class PointShopPlugin extends JavaPlugin {
private MessageManager messageManager;
private ShopManager shopManager;
private PointShopGUI pointShopGUI;
private PlayerPointsAPI pointsApi;
@Override
public void onEnable() {
if (!Bukkit.getPluginManager().isPluginEnabled("PlayerPoints")) {
getLogger().severe("PlayerPoints is required for PointShop.");
getServer().getPluginManager().disablePlugin(this);
return;
}
this.pointsApi = PlayerPoints.getInstance().getAPI();
this.messageManager = new MessageManager(this);
this.shopManager = new ShopManager(this);
this.pointShopGUI = new PointShopGUI(shopManager, messageManager);
Bukkit.getPluginManager().registerEvents(
new ShopListener(shopManager, messageManager, pointsApi), this
);
PointShopCommand command = new PointShopCommand(shopManager, messageManager, pointShopGUI);
getCommand("pointshop").setExecutor(command);
getCommand("pointshop").setTabCompleter(command);
}
@Override
public void onDisable() {
if (shopManager == null) {
return;
}
try {
shopManager.save();
} catch (IOException exception) {
getLogger().severe("Could not save shop.yml: " + exception.getMessage());
}
}
}