Files
src
Code
11 663
src/main/java/com/kodari/protectionaxe/ProtectionAxePlugin.java
package com.kodari.protectionaxe;
import com.kodari.protectionaxe.command.ProtectionAxeCommand;
import com.kodari.protectionaxe.listener.AxeInteractListener;
import com.kodari.protectionaxe.listener.ProtectionListener;
import com.kodari.protectionaxe.manager.CooldownManager;
import com.kodari.protectionaxe.manager.ItemManager;
import com.kodari.protectionaxe.manager.ProtectionManager;
import com.kodari.protectionaxe.task.CooldownActionBarTask;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;
public class ProtectionAxePlugin extends JavaPlugin {
private CooldownManager cooldownManager;
private ProtectionManager protectionManager;
private ItemManager itemManager;
@Override
public void onEnable() {
saveDefaultConfig();
cooldownManager = new CooldownManager();
protectionManager = new ProtectionManager();
itemManager = new ItemManager(this);
ProtectionAxeCommand command = new ProtectionAxeCommand(this);
PluginCommand protectionAxeCommand = getCommand("protectionaxe");
if (protectionAxeCommand != null) {
protectionAxeCommand.setExecutor(command);
protectionAxeCommand.setTabCompleter(command);
}
getServer().getPluginManager().registerEvents(
new AxeInteractListener(this, itemManager, cooldownManager, protectionManager),
this
);
getServer().getPluginManager().registerEvents(
new ProtectionListener(this, protectionManager),
this
);
getServer().getScheduler().runTaskTimer(
this,
new CooldownActionBarTask(this, itemManager, cooldownManager),
0L,
20L
);
}
public CooldownManager getCooldownManager() {
return cooldownManager;
}
public ProtectionManager getProtectionManager() {
return protectionManager;
}
public ItemManager getItemManager() {
return itemManager;
}
}