Files
src
build.gradle
settings.gradle
Code
41 2,597
src/main/java/com/h4xry/smp/H4xrySmp.java
package com.h4xry.smp;
import com.h4xry.smp.auction.AuctionListener;
import com.h4xry.smp.auction.AuctionManager;
import com.h4xry.smp.commands.AddMoneyCommand;
import com.h4xry.smp.commands.AuctionCommand;
import com.h4xry.smp.commands.BalanceCommand;
import com.h4xry.smp.commands.H4xryCommand;
import com.h4xry.smp.commands.OrdersCommand;
import com.h4xry.smp.commands.PayCommand;
import com.h4xry.smp.commands.SellCommand;
import com.h4xry.smp.commands.SellListener;
import com.h4xry.smp.commands.ShopCommand;
import com.h4xry.smp.commands.StaffModeCommand;
import com.h4xry.smp.commands.SettingsCommand;
import com.h4xry.smp.commands.NightVisionCommand;
import com.h4xry.smp.economy.EconomyManager;
import com.h4xry.smp.orders.OrderManager;
import com.h4xry.smp.roles.RoleManager;
import com.h4xry.smp.scoreboard.ScoreboardService;
import com.h4xry.smp.shop.ShopListener;
import com.h4xry.smp.settings.SettingsListener;
import com.h4xry.smp.settings.SettingsManager;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public final class H4xrySmp extends JavaPlugin {
private EconomyManager economyManager;
private RoleManager roleManager;
private OrderManager orderManager;
private AuctionManager auctionManager;
private ScoreboardService scoreboardService;
private StaffModeCommand staffModeCommand;
private SettingsManager settingsManager;
@Override
public void onEnable() {
saveDefaultConfig();
economyManager = new EconomyManager(this);
roleManager = new RoleManager(this);
orderManager = new OrderManager(this, economyManager);
auctionManager = new AuctionManager(this, economyManager);
settingsManager = new SettingsManager(this);
scoreboardService = new ScoreboardService(this, economyManager, roleManager, settingsManager);
scoreboardService.start();
Bukkit.getPluginManager().registerEvents(scoreboardService, this);
Bukkit.getPluginManager().registerEvents(new ShopListener(this, economyManager), this);
Bukkit.getPluginManager().registerEvents(new AuctionListener(this, auctionManager), this);
Bukkit.getPluginManager().registerEvents(new SettingsListener(this), this);
Bukkit.getPluginManager().registerEvents(new SellListener(this, economyManager, orderManager), this);
getCommand("h4xrysmp").setExecutor(new H4xryCommand(this));
getCommand("balance").setExecutor(new BalanceCommand(this, economyManager));
getCommand("shop").setExecutor(new ShopCommand(this));
getCommand("orders").setExecutor(new OrdersCommand(this, orderManager));
getCommand("auction").setExecutor(new AuctionCommand(this, auctionManager));
getCommand("sell").setExecutor(new SellCommand(this, economyManager, orderManager));
getCommand("addmoney").setExecutor(new AddMoneyCommand(this));
getCommand("pay").setExecutor(new PayCommand(this));
staffModeCommand = new StaffModeCommand(this);
getCommand("sfmode").setExecutor(staffModeCommand);
getCommand("settings").setExecutor(new SettingsCommand(this));
getCommand("nv").setExecutor(new NightVisionCommand());
}
@Override
public void onDisable() {
if (staffModeCommand != null) {
staffModeCommand.restoreAll();
}
if (scoreboardService != null) {
scoreboardService.stop();
}
if (economyManager != null) {
economyManager.save();
}
if (orderManager != null) {
orderManager.save();
}
if (auctionManager != null) {
auctionManager.save();
}
if (settingsManager != null) {
settingsManager.save();
}
}
public EconomyManager getEconomyManager() {
return economyManager;
}
public RoleManager getRoleManager() {
return roleManager;
}
public OrderManager getOrderManager() {
return orderManager;
}
public AuctionManager getAuctionManager() {
return auctionManager;
}
public ScoreboardService getScoreboardService() {
return scoreboardService;
}
public SettingsManager getSettingsManager() {
return settingsManager;
}
}