1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-25 20:16:13 +01:00
This commit is contained in:
Zrips 2019-02-28 20:17:32 +02:00
commit ef7eafee08
3 changed files with 21 additions and 24 deletions

View File

@ -97,7 +97,7 @@ public class ActionBarTitleMessages {
Object player = getHandle.invoke(receivingPacket);
Object connection = playerConnection.get(player);
sendPacket.invoke(connection, packet);
} catch (Exception ex) {
} catch (Throwable t) {
// Bukkit.getLogger().log(Level.SEVERE, "Error {0}", ex);
}
@ -105,7 +105,7 @@ public class ActionBarTitleMessages {
Object player = getHandle.invoke(receivingPacket);
Object connection = playerConnection.get(player);
sendPacket.invoke(connection, packet);
} catch (Exception ex) {
} catch (Throwable t) {
// Bukkit.getLogger().log(Level.SEVERE, "Error {0}", ex);
}
}

View File

@ -181,15 +181,11 @@ public class Jobs extends JavaPlugin {
@Deprecated
public static McMMOManager getMcMMOlistener() {
if (McMMOManager == null)
McMMOManager = new McMMOManager();
return McMMOManager;
return McMMOManager == null ? new McMMOManager() : McMMOManager;
}
public static McMMOManager getMcMMOManager() {
if (McMMOManager == null)
McMMOManager = new McMMOManager();
return McMMOManager;
return McMMOManager == null ? new McMMOManager() : McMMOManager;
}
public void setPistonProtectionListener() {
@ -212,9 +208,7 @@ public class Jobs extends JavaPlugin {
private boolean PlaceholderAPIEnabled = false;
public Placeholder getPlaceholderAPIManager() {
if (Placeholder == null)
Placeholder = new Placeholder(this);
return Placeholder;
return Placeholder == null ? new Placeholder(this) : Placeholder;
}
private boolean setupPlaceHolderAPI() {
@ -275,15 +269,11 @@ public class Jobs extends JavaPlugin {
}
public static Reflections getReflections() {
if (reflections == null)
reflections = new Reflections();
return reflections;
return reflections == null ? new Reflections() : reflections;
}
public static JobsManager getDBManager() {
if (DBManager == null)
DBManager = new JobsManager(instance);
return DBManager;
return DBManager == null ? new JobsManager(instance) : DBManager;
}
public static void setShopManager() {
@ -315,7 +305,7 @@ public class Jobs extends JavaPlugin {
}
public static ActionBarTitleMessages getActionBar() {
return actionbar;
return actionbar == null ? new ActionBarTitleMessages() : actionbar;
}
public static void setNms(NMS nms) {
@ -429,9 +419,7 @@ public class Jobs extends JavaPlugin {
* @return the scoreboard manager
*/
public CMIScoreboardManager getCMIScoreboardManager() {
if (CMIScoreboardManager == null)
CMIScoreboardManager = new CMIScoreboardManager(this);
return CMIScoreboardManager;
return CMIScoreboardManager == null ? new CMIScoreboardManager(this) : CMIScoreboardManager;
}
protected static Jobs instance;
@ -779,6 +767,13 @@ public class Jobs extends JavaPlugin {
instance = this;
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);
ItemManager.load();
@ -814,7 +809,6 @@ public class Jobs extends JavaPlugin {
try {
setActionBar();
YmlMaker jobConfig = new YmlMaker(this, "jobConfig.yml");
jobConfig.saveDefaultConfig();
@ -839,6 +833,7 @@ public class Jobs extends JavaPlugin {
setConfigManager();
setCommandManager();
setBpManager();
setActionBar();
getCommand("jobs").setExecutor(cManager);
this.getCommand("jobs").setTabCompleter(new TabComplete());
@ -889,6 +884,8 @@ public class Jobs extends JavaPlugin {
@Override
public void onDisable() {
if (instance == null) return;
try {
GUIManager.CloseInventories();
shopManager.CloseInventories();

View File

@ -113,9 +113,9 @@ public class SignUtil {
if (JobName.contains("gtoplist"))
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();
if (!JobName.contains(SignJobName))