Files
src
build.gradle
settings.gradle
Code
11 636
src/main/java/com/kodari/bountyhonor/BountyHonorPlugin.java
package com.kodari.bountyhonor;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;
public final class BountyHonorPlugin extends JavaPlugin {
private BountyManager bountyManager;
@Override
public void onEnable() {
saveDefaultConfig();
bountyManager = new BountyManager(this);
bountyManager.load();
BountyCommand bountyCommand = new BountyCommand(this, bountyManager);
PluginCommand command = getCommand("bounty");
if (command == null) {
getLogger().severe("The bounty command is missing from plugin.yml.");
getServer().getPluginManager().disablePlugin(this);
return;
}
command.setExecutor(bountyCommand);
command.setTabCompleter(bountyCommand);
getServer().getPluginManager().registerEvents(
new BountyListener(this, bountyManager),
this
);
getServer().getScheduler().runTaskTimer(
this,
new HonorPerkTask(this, bountyManager),
20L,
20L
);
}
@Override
public void onDisable() {
if (bountyManager != null) {
bountyManager.save();
}
}
public BountyManager getBountyManager() {
return bountyManager;
}
}