mirror of
https://github.com/SimplexDevelopment/Traverse.git
synced 2025-07-03 16:16:41 +00:00
Fishnets and Baubles
This commit is contained in:
@ -1,8 +1,5 @@
|
||||
package mc.unraveled.reforged.plugin;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.SneakyThrows;
|
||||
import mc.unraveled.reforged.api.Locker;
|
||||
import mc.unraveled.reforged.banning.BanManager;
|
||||
import mc.unraveled.reforged.command.*;
|
||||
import mc.unraveled.reforged.command.base.CommandLoader;
|
||||
@ -10,52 +7,104 @@ import mc.unraveled.reforged.config.Yaml;
|
||||
import mc.unraveled.reforged.config.YamlManager;
|
||||
import mc.unraveled.reforged.data.DataManager;
|
||||
import mc.unraveled.reforged.data.LoginManager;
|
||||
import mc.unraveled.reforged.data.StaffChat;
|
||||
import mc.unraveled.reforged.economy.EconomyManager;
|
||||
import mc.unraveled.reforged.listening.InfractionListener;
|
||||
import mc.unraveled.reforged.listening.PlayerDataListener;
|
||||
import mc.unraveled.reforged.listening.StaffChatListener;
|
||||
import mc.unraveled.reforged.permission.RankManager;
|
||||
import mc.unraveled.reforged.service.base.Scheduling;
|
||||
import mc.unraveled.reforged.service.base.ServicePool;
|
||||
import mc.unraveled.reforged.storage.DBConnectionHandler;
|
||||
import mc.unraveled.reforged.storage.DBProperties;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public final class Traverse extends JavaPlugin implements Locker {
|
||||
public final class Traverse extends JavaPlugin {
|
||||
|
||||
// Secondary variable declaration.
|
||||
private final String CONFIG_FILE = "config.yml";
|
||||
private final File CONFIG = new File(getDataFolder(), CONFIG_FILE);
|
||||
// Primary variable declaration.
|
||||
@Getter
|
||||
|
||||
private DBConnectionHandler SQLManager;
|
||||
@Getter
|
||||
|
||||
private DataManager dataManager;
|
||||
@Getter
|
||||
|
||||
private CommandLoader commandLoader;
|
||||
@Getter
|
||||
|
||||
private BanManager banManager;
|
||||
@Getter
|
||||
|
||||
private RankManager rankManager;
|
||||
@Getter
|
||||
|
||||
private Scheduling scheduler;
|
||||
@Getter
|
||||
|
||||
private ServicePool PIPELINE;
|
||||
@Getter
|
||||
|
||||
private EconomyManager economyManager;
|
||||
@Getter
|
||||
|
||||
private LoginManager loginManager;
|
||||
@Getter
|
||||
|
||||
private YamlManager yamlManager;
|
||||
@Getter
|
||||
private Yaml yamlConfig;
|
||||
private StaffChat staffChat;
|
||||
|
||||
public DBConnectionHandler getSQLManager() {
|
||||
return SQLManager;
|
||||
}
|
||||
|
||||
public DataManager getDataManager() {
|
||||
return dataManager;
|
||||
}
|
||||
|
||||
public CommandLoader getCommandLoader() {
|
||||
return commandLoader;
|
||||
}
|
||||
|
||||
public BanManager getBanManager() {
|
||||
return banManager;
|
||||
}
|
||||
|
||||
public RankManager getRankManager() {
|
||||
return rankManager;
|
||||
}
|
||||
|
||||
public Scheduling getScheduler() {
|
||||
return scheduler;
|
||||
}
|
||||
|
||||
public ServicePool getPIPELINE() {
|
||||
return PIPELINE;
|
||||
}
|
||||
|
||||
public EconomyManager getEconomyManager() {
|
||||
return economyManager;
|
||||
}
|
||||
|
||||
public LoginManager getLoginManager() {
|
||||
return loginManager;
|
||||
}
|
||||
|
||||
public YamlManager getYamlManager() {
|
||||
return yamlManager;
|
||||
}
|
||||
|
||||
public Yaml getYamlConfig() {
|
||||
return yamlConfig;
|
||||
}
|
||||
|
||||
public StaffChat getStaffChat() {
|
||||
return staffChat;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SneakyThrows
|
||||
public void onEnable() {
|
||||
this.SQLManager = new DBConnectionHandler(new DBProperties("db.properties"));
|
||||
this.dataManager = new DataManager(this);
|
||||
this.commandLoader = new CommandLoader(this, "TRAVERSE");
|
||||
this.dataManager = new DataManager(this);
|
||||
this.banManager = new BanManager(this);
|
||||
this.rankManager = new RankManager(this);
|
||||
this.scheduler = new Scheduling(this);
|
||||
@ -63,6 +112,7 @@ public final class Traverse extends JavaPlugin implements Locker {
|
||||
this.economyManager = new EconomyManager(this);
|
||||
this.loginManager = new LoginManager(this);
|
||||
this.yamlManager = new YamlManager(this);
|
||||
this.staffChat = new StaffChat(this);
|
||||
|
||||
registerCommands();
|
||||
registerListeners();
|
||||
@ -78,48 +128,55 @@ public final class Traverse extends JavaPlugin implements Locker {
|
||||
// Plugin shutdown logic
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public void registerCommands() {
|
||||
synchronized (lock()) {
|
||||
getCommandLoader().register(
|
||||
new BanCMD(this),
|
||||
new BankCMD(this),
|
||||
new EntityPurgeCMD(this),
|
||||
new GroupCMD(this),
|
||||
new MuteCMD(this),
|
||||
new PardonCMD(this),
|
||||
new TraverseCMD(this),
|
||||
new UnmuteCMD(this)
|
||||
);
|
||||
lock().wait(1000);
|
||||
}
|
||||
getCommandLoader().register(
|
||||
new BanCMD(this),
|
||||
new BanInfoCMD(this),
|
||||
new BankCMD(this),
|
||||
new EntityPurgeCMD(this),
|
||||
new GroupCMD(this),
|
||||
new KickCMD(this),
|
||||
new LockCMD(this),
|
||||
new MuteCMD(this),
|
||||
new PardonCMD(this),
|
||||
new PlayerDataCMD(this),
|
||||
new StaffChatCMD(this),
|
||||
new TraverseCMD(this),
|
||||
new UnmuteCMD(this)
|
||||
);
|
||||
|
||||
lock().notify();
|
||||
getCommandLoader().load();
|
||||
}
|
||||
|
||||
public void registerListeners() {
|
||||
new InfractionListener(this);
|
||||
getServer().getPluginManager().registerEvents(new InfractionListener(this), this);
|
||||
getServer().getPluginManager().registerEvents(new StaffChatListener(this), this);
|
||||
getServer().getPluginManager().registerEvents(new PlayerDataListener(this), this);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public void registerConfig() {
|
||||
Yaml yaml;
|
||||
if (CONFIG.createNewFile()) {
|
||||
yaml = getYamlManager().bldr()
|
||||
.fileName(CONFIG_FILE)
|
||||
.dataFolder(getDataFolder())
|
||||
.copyDefaults(true)
|
||||
.build();
|
||||
} else {
|
||||
yaml = getYamlManager().bldr()
|
||||
.fileName(CONFIG_FILE)
|
||||
.dataFolder(getDataFolder())
|
||||
.copyDefaults(false)
|
||||
.build();
|
||||
try {
|
||||
if (CONFIG.createNewFile()) {
|
||||
yaml = getYamlManager().bldr()
|
||||
.fileName(CONFIG_FILE)
|
||||
.dataFolder(getDataFolder())
|
||||
.copyDefaults(true)
|
||||
.build();
|
||||
} else {
|
||||
yaml = getYamlManager().bldr()
|
||||
.fileName(CONFIG_FILE)
|
||||
.dataFolder(getDataFolder())
|
||||
.copyDefaults(false)
|
||||
.build();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Bukkit.getLogger().severe("Could not create config.yml!");
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
this.yamlConfig = yaml;
|
||||
|
||||
this.yamlConfig = yaml;
|
||||
getYamlConfig().loadFromFile();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user