Files
src
build.gradle
Code
27 1,845
src/main/java/com/example/bountyascension/BountyAscension.java
package com.example.bountyascension;
import com.example.bountyascension.command.BountyCommand;
import com.example.bountyascension.command.QuestCommand;
import com.example.bountyascension.command.TeamCommand;
import com.example.bountyascension.command.WithdrawCommand;
import com.example.bountyascension.inventory.gui.GUIListener;
import com.example.bountyascension.inventory.gui.GUIManager;
import com.example.bountyascension.listener.PlayerDeathListener;
import com.example.bountyascension.listener.PlayerJoinListener;
import com.example.bountyascension.listener.PerkListener;
import com.example.bountyascension.listener.QuestProgressListener;
import com.example.bountyascension.manager.BountyManager;
import com.example.bountyascension.manager.PerkManager;
import com.example.bountyascension.manager.QuestManager;
import com.example.bountyascension.manager.TeamManager;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
@Getter
public class BountyAscension extends JavaPlugin {
private BountyManager bountyManager;
private QuestManager questManager;
private TeamManager teamManager;
private PerkManager perkManager;
private GUIManager guiManager;
@Override
public void onEnable() {
saveDefaultConfig();
this.teamManager = new TeamManager(this);
this.bountyManager = new BountyManager(this);
this.perkManager = new PerkManager(this);
this.questManager = new QuestManager(this);
this.guiManager = new GUIManager();
this.bountyManager.loadData();
registerListeners();
registerCommands();
startAutoSave();
getLogger().info("BountyAscension has been enabled!");
}
@Override
public void onDisable() {
this.bountyManager.saveData();
getLogger().info("BountyAscension has been disabled!");
}
private void registerListeners() {
Bukkit.getPluginManager().registerEvents(new PlayerJoinListener(this), this);
Bukkit.getPluginManager().registerEvents(new PlayerDeathListener(this), this);
Bukkit.getPluginManager().registerEvents(new PerkListener(this), this);
Bukkit.getPluginManager().registerEvents(new QuestProgressListener(this), this);
Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);
}
private void registerCommands() {
getCommand("bounty").setExecutor(new BountyCommand(this));
getCommand("quest").setExecutor(new QuestCommand(this));
getCommand("withdraw").setExecutor(new WithdrawCommand(this));
getCommand("team").setExecutor(new TeamCommand(this));
}
private void startAutoSave() {
Bukkit.getScheduler().runTaskTimerAsynchronously(this, () -> {
bountyManager.saveData();
}, 6000L, 6000L);
}
}