1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-02 14:29:07 +01:00

Some minor improvements for startup log

This commit is contained in:
Zrips 2021-10-26 17:32:42 +03:00
parent 89f51b091a
commit e76e9dfae0
13 changed files with 41 additions and 46 deletions

View File

@ -228,7 +228,7 @@ public final class ItemBoostManager {
} }
cfg.save(); cfg.save();
Jobs.consoleMsg("&e[Jobs] Loaded " + ITEMS.size() + " boosted items!"); Jobs.consoleMsg("&eLoaded &6" + ITEMS.size() + " &eboosted items");
} }
/** /**

View File

@ -117,6 +117,7 @@ import net.Zrips.CMILib.Colors.CMIChatColor;
import net.Zrips.CMILib.Container.PageInfo; import net.Zrips.CMILib.Container.PageInfo;
import net.Zrips.CMILib.Items.CMIMaterial; import net.Zrips.CMILib.Items.CMIMaterial;
import net.Zrips.CMILib.Logs.CMIDebug; import net.Zrips.CMILib.Logs.CMIDebug;
import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.RawMessages.RawMessage; import net.Zrips.CMILib.RawMessages.RawMessage;
import net.Zrips.CMILib.Version.Version; import net.Zrips.CMILib.Version.Version;
@ -265,7 +266,7 @@ public final class Jobs extends JavaPlugin {
try { try {
if (Integer.parseInt(papi if (Integer.parseInt(papi
.getDescription().getVersion().replaceAll("[^\\d]", "")) >= 2100 && new PlaceholderAPIHook(this).register()) { .getDescription().getVersion().replaceAll("[^\\d]", "")) >= 2100 && new PlaceholderAPIHook(this).register()) {
consoleMsg("&e[Jobs] PlaceholderAPI hooked."); consoleMsg("&6PlaceholderAPI &ehooked.");
} }
} catch (NumberFormatException ex) { } catch (NumberFormatException ex) {
return false; return false;
@ -574,7 +575,7 @@ public final class Jobs extends JavaPlugin {
getPlayerManager().addPlayerToCache(jPlayer); getPlayerManager().addPlayerToCache(jPlayer);
} }
if (!getPlayerManager().getPlayersCache().isEmpty()) if (!getPlayerManager().getPlayersCache().isEmpty())
consoleMsg("&e[Jobs] Preloaded &6" + getPlayerManager().getPlayersCache().size() + " &eplayers data in &6" + ((int) ((System.currentTimeMillis() - time) / 1000.0D * 100.0D) / 100.0D)); consoleMsg("&ePreloaded &6" + getPlayerManager().getPlayersCache().size() + " &eplayers data in &6" + ((int) ((System.currentTimeMillis() - time) / 1000.0D * 100.0D) / 100.0D));
} }
public static void convertDatabase() { public static void convertDatabase() {
@ -722,8 +723,12 @@ public final class Jobs extends JavaPlugin {
return versionCheckManager; return versionCheckManager;
} }
private final static String prefix = "&6------------- &2Jobs &6-------------";
private final static String suffix = "&6------------------------------------";
@Override @Override
public void onEnable() { public void onEnable() {
CMIMessages.consoleMessage(prefix);
instance = this; instance = this;
try { try {
@ -785,12 +790,14 @@ public final class Jobs extends JavaPlugin {
getCommandManager().fillCommands(); getCommandManager().fillCommands();
getDBManager().getDB().triggerTableIdUpdate(); getDBManager().getDB().triggerTableIdUpdate();
consoleMsg("&e[Jobs] Plugin has been enabled successfully."); consoleMsg("&ePlugin has been enabled successfully.");
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); e.printStackTrace();
System.out.println("There was some issues when starting plugin. Please contact dev about this. Plugin will be disabled."); System.out.println("There was some issues when starting plugin. Please contact dev about this. Plugin will be disabled.");
setEnabled(false); setEnabled(false);
} }
CMIMessages.consoleMessage(suffix);
} }
public static void reload() { public static void reload() {
@ -879,11 +886,12 @@ public final class Jobs extends JavaPlugin {
getScheduleManager().start(); getScheduleManager().start();
} else } else
getScheduleManager().cancel(); getScheduleManager().cancel();
} }
@Override @Override
public void onDisable() { public void onDisable() {
CMIMessages.consoleMessage(prefix);
HandlerList.unregisterAll(this); HandlerList.unregisterAll(this);
if (dao != null) { if (dao != null) {
@ -907,6 +915,8 @@ public final class Jobs extends JavaPlugin {
if (dao != null) { if (dao != null) {
dao.closeConnections(); dao.closeConnections();
} }
CMIMessages.consoleMessage(suffix);
} }
private static void checkDailyQuests(JobsPlayer jPlayer, Job job, ActionInfo info) { private static void checkDailyQuests(JobsPlayer jPlayer, Job job, ActionInfo info) {

View File

@ -953,7 +953,7 @@ public class ConfigManager {
Jobs.setJobs(jobs); Jobs.setJobs(jobs);
if (!jobs.isEmpty()) { if (!jobs.isEmpty()) {
Jobs.consoleMsg("&e[Jobs] Loaded " + jobs.size() + " jobs!"); Jobs.consoleMsg("&eLoaded &6" + jobs.size() + " &ejobs");
} }
ItemBoostManager.load(); ItemBoostManager.load();
@ -1461,13 +1461,13 @@ public class ConfigManager {
quests.add(quest); quests.add(quest);
} catch (Exception e) { } catch (Exception e) {
Jobs.consoleMsg("&c[Jobs] Can't load " + one + " quest for " + jobFullName); Jobs.consoleMsg("&cCan't load &6" + one + " &cquest for &6" + jobFullName);
e.printStackTrace(); e.printStackTrace();
} }
} }
job.setQuests(quests); job.setQuests(quests);
Jobs.consoleMsg("&e[Jobs] Loaded " + quests.size() + " quests for " + jobFullName); Jobs.consoleMsg("&eLoaded &6" + quests.size() + " &equests for &6" + jobFullName);
} }
job.setMaxDailyQuests(jobSection.getInt("maxDailyQuests", 1)); job.setMaxDailyQuests(jobSection.getInt("maxDailyQuests", 1));

View File

@ -46,11 +46,11 @@ public class ExploreManager {
if (!exploreEnabled) if (!exploreEnabled)
return; return;
Jobs.consoleMsg("&e[Jobs] Loading explorer data"); Jobs.consoleMsg("&eLoading explorer data");
Jobs.getJobsDAO().loadExplore(); Jobs.getJobsDAO().loadExplore();
int size = getSize(); int size = getSize();
Jobs.consoleMsg("&e[Jobs] Loaded explorer data" + (size != 0 ? " (" + size + ")" : ".")); Jobs.consoleMsg("&eLoaded explorer data" + (size != 0 ? " (&6" + size + "&e)" : "."));
} }
public Map<String, Map<String, ExploreRegion>> getWorlds() { public Map<String, Map<String, ExploreRegion>> getWorlds() {

View File

@ -199,9 +199,9 @@ public class NameTranslatorManager {
} }
if (listOfNames.size() > 0) if (listOfNames.size() > 0)
Jobs.consoleMsg("&e[Jobs] Loaded " + listOfNames.size() + " custom item names!"); Jobs.consoleMsg("&eLoaded &6" + listOfNames.size() + " &ecustom item names");
} else } else
Jobs.consoleMsg("&c[Jobs] The ItemList section not found in " + itemFile.fileName + " file."); Jobs.consoleMsg("&cThe ItemList section not found in &6" + itemFile.fileName + " &cfile.");
if ((section = itemFile.getConfig().getConfigurationSection("EntityList")) != null) { if ((section = itemFile.getConfig().getConfigurationSection("EntityList")) != null) {
listOfEntities.clear(); listOfEntities.clear();
@ -220,9 +220,9 @@ public class NameTranslatorManager {
} }
if (listOfEntities.size() > 0) if (listOfEntities.size() > 0)
Jobs.consoleMsg("&e[Jobs] Loaded " + listOfEntities.size() + " custom entity names!"); Jobs.consoleMsg("&eLoaded &6" + listOfEntities.size() + " &ecustom entity names");
} else } else
Jobs.consoleMsg("&c[Jobs] The EntityList section not found in " + itemFile.fileName + " file."); Jobs.consoleMsg("&cThe EntityList section not found in &6" + itemFile.fileName + " &cfile.");
if ((section = itemFile.getConfig().getConfigurationSection("MythicEntityList")) != null) { if ((section = itemFile.getConfig().getConfigurationSection("MythicEntityList")) != null) {
listOfMMEntities.clear(); listOfMMEntities.clear();
@ -233,9 +233,9 @@ public class NameTranslatorManager {
} }
if (listOfMMEntities.size() > 0) if (listOfMMEntities.size() > 0)
Jobs.consoleMsg("&e[Jobs] Loaded " + listOfMMEntities.size() + " custom MythicMobs names!"); Jobs.consoleMsg("&eLoaded &6" + listOfMMEntities.size() + " &ecustom MythicMobs names");
} else } else
Jobs.consoleMsg("&c[Jobs] The MythicEntityList section not found in " + itemFile.fileName + " file."); Jobs.consoleMsg("&cThe MythicEntityList section not found in &6" + itemFile.fileName + " &cfile.");
if ((section = itemFile.getConfig().getConfigurationSection("EnchantList")) != null) { if ((section = itemFile.getConfig().getConfigurationSection("EnchantList")) != null) {
listOfEnchants.clear(); listOfEnchants.clear();
@ -245,9 +245,9 @@ public class NameTranslatorManager {
} }
if (listOfEnchants.size() > 0) if (listOfEnchants.size() > 0)
Jobs.consoleMsg("&e[Jobs] Loaded " + listOfEnchants.size() + " custom enchant names!"); Jobs.consoleMsg("&eLoaded &6" + listOfEnchants.size() + " &ecustom enchant names");
} else } else
Jobs.consoleMsg("&c[Jobs] The EnchantList section not found in " + itemFile.fileName + " file."); Jobs.consoleMsg("&cThe EnchantList section not found in &6" + itemFile.fileName + " &cfile.");
if ((section = itemFile.getConfig().getConfigurationSection("ColorList")) != null) { if ((section = itemFile.getConfig().getConfigurationSection("ColorList")) != null) {
listOfColors.clear(); listOfColors.clear();
@ -260,9 +260,9 @@ public class NameTranslatorManager {
} }
if (listOfColors.size() > 0) if (listOfColors.size() > 0)
Jobs.consoleMsg("&e[Jobs] Loaded " + listOfColors.size() + " custom color names!"); Jobs.consoleMsg("&eLoaded &6" + listOfColors.size() + " &ecustom color names");
} else } else
Jobs.consoleMsg("&c[Jobs] The ColorList section not found in " + itemFile.fileName + " file."); Jobs.consoleMsg("&cThe ColorList section not found in &6" + itemFile.fileName + " &cfile.");
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")

View File

@ -45,7 +45,7 @@ public class RestrictedBlockManager {
CMIMaterial mat = cm == null ? null : cm.getCMIType(); CMIMaterial mat = cm == null ? null : cm.getCMIType();
if (mat == null || !mat.isBlock()) { if (mat == null || !mat.isBlock()) {
Jobs.consoleMsg("&e[Jobs] Your defined (" + one + ") protected block id/name is not correct!"); Jobs.consoleMsg("&eYour defined (&6" + one + "&e) protected block id/name is not correct!");
continue; continue;
} }
@ -78,7 +78,7 @@ public class RestrictedBlockManager {
int size = restrictedBlocksTimer.size(); int size = restrictedBlocksTimer.size();
if (size > 0) if (size > 0)
Jobs.consoleMsg("&e[Jobs] Loaded " + size + " protected blocks timers!"); Jobs.consoleMsg("&eLoaded &6" + size + " &eprotected blocks timers");
cfg.save(); cfg.save();
} }

View File

@ -470,6 +470,6 @@ public class ShopManager {
} }
if (!list.isEmpty()) if (!list.isEmpty())
Jobs.consoleMsg("&e[Jobs] Loaded " + list.size() + " shop items!"); Jobs.consoleMsg("&eLoaded &6" + list.size() + " &eshop items");
} }
} }

View File

@ -157,6 +157,6 @@ public class TitleManager {
int size = titles.size(); int size = titles.size();
if (size > 0) if (size > 0)
Jobs.consoleMsg("&e[Jobs] Loaded " + size + " titles!"); Jobs.consoleMsg("&eLoaded &6" + size + " &etitles");
} }
} }

View File

@ -324,7 +324,7 @@ public class BlockOwnerShip {
} }
if (total > 0) { if (total > 0) {
Jobs.consoleMsg("&e[Jobs] Loaded " + total + " " + path.toLowerCase() + " for reassigning."); Jobs.consoleMsg("&eLoaded &6" + total + " " + path.toLowerCase() + " &efor reassigning.");
} }
} }

View File

@ -485,7 +485,7 @@ public abstract class JobsDAO {
return; return;
} }
CMIMessages.consoleMessage("&2Connected to database (" + dbType + ")"); CMIMessages.consoleMessage("&eConnected to database (&6" + dbType + "&e)");
vacuum(); vacuum();

View File

@ -8,32 +8,17 @@ import java.sql.Statement;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.dao.JobsManager.DataBaseType; import com.gamingmesh.jobs.dao.JobsManager.DataBaseType;
import net.Zrips.CMILib.Messages.CMIMessages;
public class JobsMySQL extends JobsDAO { public class JobsMySQL extends JobsDAO {
private static String path = ""; private static String path = "";
static { static {
try { try {
Class.forName("com.mysql.cj.jdbc.Driver"); Class.forName("com.mysql.cj.jdbc.Driver");
path = "com.mysql.cj.jdbc.Driver"; path = "com.mysql.cj.jdbc.Driver";
} catch (Throwable e) { } catch (Throwable e) {
path = "com.mysql.jdbc.Driver"; path = "com.mysql.jdbc.Driver";
} }
String major = "";
String[] javaVersionElements = System.getProperty("java.runtime.version").split("\\.|_|-b");
try {
major = javaVersionElements[0];
} catch (Throwable e) {
String d = System.getProperty("java.version");
String[] s = d.split("_")[0].split(".");
major = s[1];
}
CMIMessages.consoleMessage("Detected Java" + major);
} }
JobsMySQL(Jobs plugin, String hostname, String database, String username, String password, String prefix, boolean certificate, boolean ssl, boolean autoReconnect, JobsMySQL(Jobs plugin, String hostname, String database, String username, String password, String prefix, boolean certificate, boolean ssl, boolean autoReconnect,

View File

@ -33,7 +33,7 @@ public class BufferedPaymentThread extends Thread {
@Override @Override
public void run() { public void run() {
Jobs.consoleMsg("&e[Jobs] Started buffered payment thread."); Jobs.consoleMsg("&eStarted buffered payment thread.");
while (running) { while (running) {
try { try {
@ -52,7 +52,7 @@ public class BufferedPaymentThread extends Thread {
running = false; running = false;
} }
} }
Jobs.consoleMsg("&e[Jobs] Buffered payment thread shutdown."); Jobs.consoleMsg("&eBuffered payment thread shutdown.");
} }
public void shutdown() { public void shutdown() {

View File

@ -33,7 +33,7 @@ public class DatabaseSaveThread extends Thread {
@Override @Override
public void run() { public void run() {
Jobs.consoleMsg("&e[Jobs] Started database save task."); Jobs.consoleMsg("&eStarted database save task.");
while (running) { while (running) {
try { try {
@ -51,7 +51,7 @@ public class DatabaseSaveThread extends Thread {
} }
} }
Jobs.consoleMsg("&e[Jobs] Database save task shutdown!"); Jobs.consoleMsg("&eDatabase save task shutdown!");
} }