Files
src
build.gradle
Code
21 1,238
src/main/java/com/example/ezfishing/EzFishing.java
package com.example.ezfishing;
import com.example.ezfishing.command.FishingCommand;
import com.example.ezfishing.event.EventScheduler;
import com.example.ezfishing.listener.FishingListener;
import com.example.ezfishing.listener.PlayerMoveListener;
import com.example.ezfishing.listener.SelectionListener;
import com.example.ezfishing.loot.LootManager;
import com.example.ezfishing.region.RegionData;
import com.example.ezfishing.region.RegionManager;
import com.example.ezfishing.selection.SelectionManager;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
@Getter
public class EzFishing extends JavaPlugin {
private ConfigManager configManager;
private MessageManager messageManager;
private RegionManager regionManager;
private RegionData regionData;
private LootManager lootManager;
private EventScheduler eventScheduler;
private SelectionManager selectionManager;
@Override
public void onEnable() {
this.configManager = new ConfigManager(this);
this.messageManager = new MessageManager(this);
this.regionData = new RegionData(this);
this.regionManager = new RegionManager(this);
this.lootManager = new LootManager(this);
this.selectionManager = new SelectionManager();
this.eventScheduler = new EventScheduler(this);
this.regionData.loadRegions();
Bukkit.getPluginManager().registerEvents(new FishingListener(this), this);
Bukkit.getPluginManager().registerEvents(new SelectionListener(this), this);
Bukkit.getPluginManager().registerEvents(new PlayerMoveListener(this), this);
this.getCommand("fishing").setExecutor(new FishingCommand(this));
this.eventScheduler.start();
this.getLogger().info("EzFishing has been enabled!");
}
@Override
public void onDisable() {
if (this.eventScheduler != null) {
this.eventScheduler.stop();
}
if (this.regionData != null) {
this.regionData.saveRegions();
}
this.getLogger().info("EzFishing has been disabled!");
}
public void reload() {
this.configManager.reload();
this.lootManager.reload();
this.regionData.loadRegions();
}
}