use of br.net.fabiozumbi12.UltimateChat.Bukkit.config.UCConfig in project UltimateChat by FabioZumbi12.
the class UChat method onServerStart.
@Listener
public void onServerStart(GamePostInitializationEvent event) {
try {
uchat = this;
this.serv = Sponge.getServer();
// init logger
this.logger = new UCLogger(this.serv);
// init config
this.config = new UCConfig(this.factory);
// init lang
this.lang = new UCLang();
// set compat perms
this.setCompatperms();
logger.info("Init commands module...");
this.cmds = new UCCommands(this);
game.getEventManager().registerListeners(plugin, new UCListener());
// init other features
// Jedis
registerJedis();
// JDA
registerJDA();
logger.info("Init API module...");
this.ucapi = new uChatAPI();
// register placeholdersapi
if (Sponge.getPluginManager().getPlugin("placeholderapi").isPresent()) {
new UCPlaceHoldersRelational(this);
}
getLogger().logClear("\n" + "&b _ _ _ _ _ _ _____ _ _ \n" + " | | | | | | (_) | | / ____| | | | \n" + " | | | | | |_ _ _ __ ___ __ _| |_ ___| | | |__ __ _| |_ \n" + " | | | | | __| | '_ ` _ \\ / _` | __/ _ \\ | | '_ \\ / _` | __|\n" + " | |__| | | |_| | | | | | | (_| | || __/ |____| | | | (_| | |_ \n" + " \\____/|_|\\__|_|_| |_| |_|\\__,_|\\__\\___|\\_____|_| |_|\\__,_|\\__|\n" + " \n" + "&a" + plugin.getName() + " " + plugin.getVersion().get() + " enabled!\n");
if (this.UCJDA != null) {
this.UCJDA.sendRawToDiscord(lang.get("discord.start"));
}
} catch (Exception e) {
e.printStackTrace();
}
}
use of br.net.fabiozumbi12.UltimateChat.Bukkit.config.UCConfig in project UltimateChat by FabioZumbi12.
the class UChat method reload.
public void reload() {
this.getServer().getScheduler().cancelTasks(this);
try {
this.config = new UCConfig(this);
} catch (IOException e) {
e.printStackTrace();
}
this.lang = new UCLang();
this.registerAliases();
this.registerJDA();
this.registerJedis();
this.initAutomessage();
// ping other plugins when uchat reload
UChatReloadEvent reloadEvent = new UChatReloadEvent();
Bukkit.getPluginManager().callEvent(reloadEvent);
}
use of br.net.fabiozumbi12.UltimateChat.Bukkit.config.UCConfig in project UltimateChat by FabioZumbi12.
the class UChat method onEnable.
public void onEnable() {
try {
uchat = this;
logger = new UCLogger(this);
config = new UCConfig(this);
lang = new UCLang();
amConfig = new YamlConfiguration();
// check hooks
Vault = checkVault();
SClans = checkSC();
MarryReloded = checkMR();
MarryMaster = checkMM();
ProtocolLib = checkPL();
PlaceHolderAPI = checkPHAPI();
Factions = checkFac();
listener = new UCListener();
getServer().getPluginCommand("uchat").setExecutor(listener);
getServer().getPluginManager().registerEvents(listener, this);
getServer().getPluginManager().registerEvents(new UCChatProtection(), this);
getServer().getMessenger().registerOutgoingPluginChannel(this, "uChat");
getServer().getMessenger().registerIncomingPluginChannel(this, "uChat", new UChatBungee());
// register aliases
registerAliases();
if (ProtocolLib) {
logger.info("ProtocolLib found. Hooked.");
}
if (PlaceHolderAPI) {
try {
Class.forName("me.clip.placeholderapi.expansion.Relational");
if (new UCPlaceHoldersRelational(this).register()) {
isRelation = true;
logger.info("PlaceHolderAPI found. Hooked and registered some chat placeholders with relational tag feature.");
}
} catch (ClassNotFoundException ex) {
if (new UCPlaceHolders(this).register()) {
isRelation = false;
logger.info("PlaceHolderAPI found. Hooked and registered some chat placeholders.");
}
}
}
if (MarryReloded) {
mapi = MarriageAPI.getInstance();
logger.info("Marriage Reloaded found. Hooked.");
}
if (MarryMaster) {
mm = (MarriageMaster) Bukkit.getPluginManager().getPlugin("MarriageMaster");
logger.info("MarryMaster found. Hooked.");
}
if (SClans) {
sc = SimpleClans.getInstance();
logger.info("SimpleClans found. Hooked.");
}
if (Vault) {
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
RegisteredServiceProvider<Chat> rschat = getServer().getServicesManager().getRegistration(Chat.class);
RegisteredServiceProvider<Permission> rsperm = getServer().getServicesManager().getRegistration(Permission.class);
// Economy
if (rsp == null) {
logger.warning("Vault found Economy, but for some reason cant be used.");
} else {
econ = rsp.getProvider();
logger.info("Vault economy found. Hooked.");
}
// Chat
if (rschat == null) {
logger.warning("Vault found chat, but for some reason cant be used.");
} else {
chat = rschat.getProvider();
logger.info("Vault chat found. Hooked.");
}
// Perms
if (rsperm == null) {
logger.warning("Vault found permissions, but for some reason cant be used.");
} else {
perms = rsperm.getProvider();
logger.info("Vault perms found. Hooked.");
}
}
logger.info("Init API module...");
this.ucapi = new uChatAPI();
// init other features
// Jedis
registerJedis();
// JDA
registerJDA();
initAutomessage();
getUCLogger().info("Server Version: " + getServer().getBukkitVersion());
getUCLogger().logClear(ChatColor.translateAlternateColorCodes('&', "\n" + "&b _ _ _ _ _ _ _____ _ _ \n" + " | | | | | | (_) | | / ____| | | | \n" + " | | | | | |_ _ _ __ ___ __ _| |_ ___| | | |__ __ _| |_ \n" + " | | | | | __| | '_ ` _ \\ / _` | __/ _ \\ | | '_ \\ / _` | __|\n" + " | |__| | | |_| | | | | | | (_| | || __/ |____| | | | (_| | |_ \n" + " \\____/|_|\\__|_|_| |_| |_|\\__,_|\\__\\___|\\_____|_| |_|\\__,_|\\__|\n" + " \n" + "&a" + getDescription().getFullName() + " enabled!\n"));
if (this.UCJDA != null) {
this.UCJDA.sendRawToDiscord(lang.get("discord.start"));
}
} catch (Exception e) {
e.printStackTrace();
super.setEnabled(false);
}
}
use of br.net.fabiozumbi12.UltimateChat.Bukkit.config.UCConfig in project UltimateChat by FabioZumbi12.
the class UChat method reload.
public void reload() throws IOException {
this.cmds.removeCmds();
this.channels = null;
this.config = new UCConfig(factory);
this.lang = new UCLang();
try {
setCompatperms();
} catch (Exception ex) {
ex.printStackTrace();
}
this.cmds = new UCCommands(this);
registerJedis();
registerJDA();
// fire event
UChatReloadEvent event = new UChatReloadEvent();
Sponge.getEventManager().post(event);
}
Aggregations