1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 14:05:25 +01:00

Lets fix special signs has not updated heads

- Last commit stability fix for registering class
This commit is contained in:
montlikadani 2019-03-01 17:03:45 +01:00
parent ef7eafee08
commit 2c0451aa55
3 changed files with 33 additions and 24 deletions

View File

@ -181,11 +181,15 @@ public class Jobs extends JavaPlugin {
@Deprecated @Deprecated
public static McMMOManager getMcMMOlistener() { public static McMMOManager getMcMMOlistener() {
return McMMOManager == null ? new McMMOManager() : McMMOManager; if (McMMOManager == null)
McMMOManager = new McMMOManager();
return McMMOManager;
} }
public static McMMOManager getMcMMOManager() { public static McMMOManager getMcMMOManager() {
return McMMOManager == null ? new McMMOManager() : McMMOManager; if (McMMOManager == null)
McMMOManager = new McMMOManager();
return McMMOManager;
} }
public void setPistonProtectionListener() { public void setPistonProtectionListener() {
@ -208,7 +212,9 @@ public class Jobs extends JavaPlugin {
private boolean PlaceholderAPIEnabled = false; private boolean PlaceholderAPIEnabled = false;
public Placeholder getPlaceholderAPIManager() { public Placeholder getPlaceholderAPIManager() {
return Placeholder == null ? new Placeholder(this) : Placeholder; if (Placeholder == null)
Placeholder = new Placeholder(this);
return Placeholder;
} }
private boolean setupPlaceHolderAPI() { private boolean setupPlaceHolderAPI() {
@ -269,11 +275,15 @@ public class Jobs extends JavaPlugin {
} }
public static Reflections getReflections() { public static Reflections getReflections() {
return reflections == null ? new Reflections() : reflections; if (reflections == null)
reflections = new Reflections();
return reflections;
} }
public static JobsManager getDBManager() { public static JobsManager getDBManager() {
return DBManager == null ? new JobsManager(instance) : DBManager; if (DBManager == null)
DBManager = new JobsManager(instance);
return DBManager;
} }
public static void setShopManager() { public static void setShopManager() {
@ -305,7 +315,9 @@ public class Jobs extends JavaPlugin {
} }
public static ActionBarTitleMessages getActionBar() { public static ActionBarTitleMessages getActionBar() {
return actionbar == null ? new ActionBarTitleMessages() : actionbar; if (actionbar == null)
actionbar = new ActionBarTitleMessages();
return actionbar;
} }
public static void setNms(NMS nms) { public static void setNms(NMS nms) {
@ -326,10 +338,6 @@ public class Jobs extends JavaPlugin {
return pManager; return pManager;
} }
public void setPlayerManager() {
}
public static void setRestrictedBlockManager() { public static void setRestrictedBlockManager() {
RBManager = new RestrictedBlockManager(); RBManager = new RestrictedBlockManager();
} }
@ -419,7 +427,9 @@ public class Jobs extends JavaPlugin {
* @return the scoreboard manager * @return the scoreboard manager
*/ */
public CMIScoreboardManager getCMIScoreboardManager() { public CMIScoreboardManager getCMIScoreboardManager() {
return CMIScoreboardManager == null ? new CMIScoreboardManager(this) : CMIScoreboardManager; if (CMIScoreboardManager == null)
CMIScoreboardManager = new CMIScoreboardManager(this);
return CMIScoreboardManager;
} }
protected static Jobs instance; protected static Jobs instance;
@ -969,7 +979,7 @@ public class Jobs extends JavaPlugin {
if (income == 0D && pointAmount == 0D) if (income == 0D && pointAmount == 0D)
return; return;
Boost boost = pManager.getFinalBonus(jPlayer, noneJob); Boost boost = getPlayerManager().getFinalBonus(jPlayer, noneJob);
// Calculate income // Calculate income
@ -1071,7 +1081,7 @@ public class Jobs extends JavaPlugin {
player.giveExp(expInt); player.giveExp(expInt);
} }
} }
Boost boost = pManager.getFinalBonus(jPlayer, prog.getJob(), ent, victim); Boost boost = getPlayerManager().getFinalBonus(jPlayer, prog.getJob(), ent, victim);
// Calculate income // Calculate income
if (income != 0D) { if (income != 0D) {
@ -1164,7 +1174,7 @@ public class Jobs extends JavaPlugin {
} }
if (prog.addExperience(expAmount)) if (prog.addExperience(expAmount))
pManager.performLevelUp(jPlayer, prog.getJob(), oldLevel); getPlayerManager().performLevelUp(jPlayer, prog.getJob(), oldLevel);
} }
//need to update bp //need to update bp
@ -1316,7 +1326,7 @@ public class Jobs extends JavaPlugin {
} }
if (prog.addExperience(payment.getExp())) if (prog.addExperience(payment.getExp()))
pManager.performLevelUp(jPlayer, prog.getJob(), oldLevel); getPlayerManager().performLevelUp(jPlayer, prog.getJob(), oldLevel);
} }
public static void consoleMsg(String msg) { public static void consoleMsg(String msg) {

View File

@ -214,7 +214,7 @@ public class SignUtil {
sign.setLine(3, line1); sign.setLine(3, line1);
sign.update(); sign.update();
if (!UpdateHead(sign, PlayerName, timelapse)) if (!UpdateHead(sign, pl.getPlayerName(), timelapse))
timelapse--; timelapse--;
} }

View File

@ -24,7 +24,7 @@ public class browse implements Cmd {
if (Jobs.getGCManager().BrowseUseNewLook) { if (Jobs.getGCManager().BrowseUseNewLook) {
List<Job> jobList = new ArrayList<>(Jobs.getJobs()); List<Job> jobList = new ArrayList<>(Jobs.getJobs());
if (jobList.size() == 0) { if (jobList.isEmpty()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.error.nojobs")); sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.error.nojobs"));
return true; return true;
} }
@ -33,7 +33,7 @@ public class browse implements Cmd {
Inventory inv = null; Inventory inv = null;
try { try {
inv = Jobs.getGUIManager().CreateJobsGUI((Player) sender); inv = Jobs.getGUIManager().CreateJobsGUI((Player) sender);
} catch (Exception e) { } catch (Throwable e) {
((Player) sender).closeInventory(); ((Player) sender).closeInventory();
Jobs.getGUIManager().GuiList.remove(((Player) sender).getUniqueId()); Jobs.getGUIManager().GuiList.remove(((Player) sender).getUniqueId());
return true; return true;
@ -53,7 +53,7 @@ public class browse implements Cmd {
try { try {
page = Integer.parseInt(one.substring("-p:".length())); page = Integer.parseInt(one.substring("-p:".length()));
continue; continue;
} catch (Exception e) { } catch (Throwable e) {
} }
} }
} }
@ -63,7 +63,7 @@ public class browse implements Cmd {
try { try {
j = Jobs.getJob(one.substring("-j:".length())); j = Jobs.getJob(one.substring("-j:".length()));
continue; continue;
} catch (Exception e) { } catch (Throwable e) {
} }
} }
} }
@ -231,12 +231,11 @@ public class browse implements Cmd {
builder.append(Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", (int) (job.getBonus() * 100))); builder.append(Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", (int) (job.getBonus() * 100)));
lines.add(builder.toString()); lines.add(builder.toString());
if (!job.getDescription().isEmpty()) { if (!job.getDescription().isEmpty())
lines.add(" - " + job.getDescription().replace("/n", "")); lines.add(" - " + job.getDescription().replace("/n", ""));
}
} }
if (lines.size() == 0) { if (lines.isEmpty()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.error.nojobs")); sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.error.nojobs"));
return true; return true;
} }
@ -246,7 +245,7 @@ public class browse implements Cmd {
Inventory inv = null; Inventory inv = null;
try { try {
inv = Jobs.getGUIManager().CreateJobsGUI((Player) sender); inv = Jobs.getGUIManager().CreateJobsGUI((Player) sender);
} catch (Exception e) { } catch (Throwable e) {
((Player) sender).closeInventory(); ((Player) sender).closeInventory();
Jobs.getGUIManager().GuiList.remove(((Player) sender).getName()); Jobs.getGUIManager().GuiList.remove(((Player) sender).getName());
return true; return true;