mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-26 04:25:15 +01:00
Lets make more stabily to catch exceptions
This commit is contained in:
parent
7d35127e6b
commit
a377ad08db
@ -97,7 +97,7 @@ public class ActionBarTitleMessages {
|
|||||||
Object player = getHandle.invoke(receivingPacket);
|
Object player = getHandle.invoke(receivingPacket);
|
||||||
Object connection = playerConnection.get(player);
|
Object connection = playerConnection.get(player);
|
||||||
sendPacket.invoke(connection, packet);
|
sendPacket.invoke(connection, packet);
|
||||||
} catch (Exception ex) {
|
} catch (Throwable t) {
|
||||||
// Bukkit.getLogger().log(Level.SEVERE, "Error {0}", ex);
|
// Bukkit.getLogger().log(Level.SEVERE, "Error {0}", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ public class ActionBarTitleMessages {
|
|||||||
Object player = getHandle.invoke(receivingPacket);
|
Object player = getHandle.invoke(receivingPacket);
|
||||||
Object connection = playerConnection.get(player);
|
Object connection = playerConnection.get(player);
|
||||||
sendPacket.invoke(connection, packet);
|
sendPacket.invoke(connection, packet);
|
||||||
} catch (Exception ex) {
|
} catch (Throwable t) {
|
||||||
// Bukkit.getLogger().log(Level.SEVERE, "Error {0}", ex);
|
// Bukkit.getLogger().log(Level.SEVERE, "Error {0}", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,15 +181,11 @@ public class Jobs extends JavaPlugin {
|
|||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static McMMOManager getMcMMOlistener() {
|
public static McMMOManager getMcMMOlistener() {
|
||||||
if (McMMOManager == null)
|
return McMMOManager == null ? new McMMOManager() : McMMOManager;
|
||||||
McMMOManager = new McMMOManager();
|
|
||||||
return McMMOManager;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static McMMOManager getMcMMOManager() {
|
public static McMMOManager getMcMMOManager() {
|
||||||
if (McMMOManager == null)
|
return McMMOManager == null ? new McMMOManager() : McMMOManager;
|
||||||
McMMOManager = new McMMOManager();
|
|
||||||
return McMMOManager;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPistonProtectionListener() {
|
public void setPistonProtectionListener() {
|
||||||
@ -212,9 +208,7 @@ public class Jobs extends JavaPlugin {
|
|||||||
private boolean PlaceholderAPIEnabled = false;
|
private boolean PlaceholderAPIEnabled = false;
|
||||||
|
|
||||||
public Placeholder getPlaceholderAPIManager() {
|
public Placeholder getPlaceholderAPIManager() {
|
||||||
if (Placeholder == null)
|
return Placeholder == null ? new Placeholder(this) : Placeholder;
|
||||||
Placeholder = new Placeholder(this);
|
|
||||||
return Placeholder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean setupPlaceHolderAPI() {
|
private boolean setupPlaceHolderAPI() {
|
||||||
@ -275,15 +269,11 @@ public class Jobs extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Reflections getReflections() {
|
public static Reflections getReflections() {
|
||||||
if (reflections == null)
|
return reflections == null ? new Reflections() : reflections;
|
||||||
reflections = new Reflections();
|
|
||||||
return reflections;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JobsManager getDBManager() {
|
public static JobsManager getDBManager() {
|
||||||
if (DBManager == null)
|
return DBManager == null ? new JobsManager(instance) : DBManager;
|
||||||
DBManager = new JobsManager(instance);
|
|
||||||
return DBManager;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setShopManager() {
|
public static void setShopManager() {
|
||||||
@ -315,7 +305,7 @@ public class Jobs extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ActionBarTitleMessages getActionBar() {
|
public static ActionBarTitleMessages getActionBar() {
|
||||||
return actionbar;
|
return actionbar == null ? new ActionBarTitleMessages() : actionbar;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setNms(NMS nms) {
|
public static void setNms(NMS nms) {
|
||||||
@ -427,9 +417,7 @@ public class Jobs extends JavaPlugin {
|
|||||||
* @return the scoreboard manager
|
* @return the scoreboard manager
|
||||||
*/
|
*/
|
||||||
public CMIScoreboardManager getCMIScoreboardManager() {
|
public CMIScoreboardManager getCMIScoreboardManager() {
|
||||||
if (CMIScoreboardManager == null)
|
return CMIScoreboardManager == null ? new CMIScoreboardManager(this) : CMIScoreboardManager;
|
||||||
CMIScoreboardManager = new CMIScoreboardManager(this);
|
|
||||||
return CMIScoreboardManager;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static Jobs instance;
|
protected static Jobs instance;
|
||||||
@ -777,6 +765,13 @@ public class Jobs extends JavaPlugin {
|
|||||||
instance = this;
|
instance = this;
|
||||||
setEnabled(true);
|
setEnabled(true);
|
||||||
|
|
||||||
|
if (instance == null) {
|
||||||
|
System.out.println("Plugin instance is null. Plugin will be disabled.");
|
||||||
|
System.out.println("Try restart your server completely. If this not work contact the developers.");
|
||||||
|
setEnabled(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
versionCheckManager = new VersionChecker(this);
|
versionCheckManager = new VersionChecker(this);
|
||||||
|
|
||||||
ItemManager.load();
|
ItemManager.load();
|
||||||
@ -812,7 +807,6 @@ public class Jobs extends JavaPlugin {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
setActionBar();
|
|
||||||
YmlMaker jobConfig = new YmlMaker(this, "jobConfig.yml");
|
YmlMaker jobConfig = new YmlMaker(this, "jobConfig.yml");
|
||||||
jobConfig.saveDefaultConfig();
|
jobConfig.saveDefaultConfig();
|
||||||
|
|
||||||
@ -838,6 +832,7 @@ public class Jobs extends JavaPlugin {
|
|||||||
setConfigManager();
|
setConfigManager();
|
||||||
setCommandManager();
|
setCommandManager();
|
||||||
setBpManager();
|
setBpManager();
|
||||||
|
setActionBar();
|
||||||
|
|
||||||
getCommand("jobs").setExecutor(cManager);
|
getCommand("jobs").setExecutor(cManager);
|
||||||
this.getCommand("jobs").setTabCompleter(new TabComplete());
|
this.getCommand("jobs").setTabCompleter(new TabComplete());
|
||||||
@ -889,6 +884,8 @@ public class Jobs extends JavaPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
|
if (instance == null) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
GUIManager.CloseInventories();
|
GUIManager.CloseInventories();
|
||||||
shopManager.CloseInventories();
|
shopManager.CloseInventories();
|
||||||
|
@ -113,9 +113,9 @@ public class SignUtil {
|
|||||||
if (JobName.contains("gtoplist"))
|
if (JobName.contains("gtoplist"))
|
||||||
PlayerList = Jobs.getJobsDAO().getGlobalTopList(0);
|
PlayerList = Jobs.getJobsDAO().getGlobalTopList(0);
|
||||||
|
|
||||||
HashMap<String, List<TopList>> temp = new HashMap<String, List<TopList>>();
|
HashMap<String, List<TopList>> temp = new HashMap<>();
|
||||||
|
|
||||||
for (com.gamingmesh.jobs.Signs.Sign one : new ArrayList<>(Signs.GetAllSigns())) {
|
for (com.gamingmesh.jobs.Signs.Sign one : new ArrayList<com.gamingmesh.jobs.Signs.Sign>(Signs.GetAllSigns())) {
|
||||||
String SignJobName = one.GetJobName();
|
String SignJobName = one.GetJobName();
|
||||||
|
|
||||||
if (!JobName.contains(SignJobName))
|
if (!JobName.contains(SignJobName))
|
||||||
|
Loading…
Reference in New Issue
Block a user