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

Temporary fix when the user have a lot of jobs and throws error

This temporary fix the ArrayIndexOutOfBoundsException when the user have a lot of jobs in the file and opens the GUI, will crash it. #666
This commit is contained in:
montlikadani 2020-02-11 19:19:05 +01:00
parent 7271bda0c5
commit a1c2274b1b
6 changed files with 10 additions and 33 deletions

View File

@ -36,8 +36,6 @@ public class GuiManager {
JobsList.add(job); JobsList.add(job);
} }
JobsPlayer JPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
CMIGui gui = new CMIGui(player); CMIGui gui = new CMIGui(player);
gui.setTitle(Jobs.getLanguage().getMessage("command.info.gui.pickjob")); gui.setTitle(Jobs.getLanguage().getMessage("command.info.gui.pickjob"));
gui.setFiller(CMIMaterial.get(Jobs.getGCManager().guiFiller)); gui.setFiller(CMIMaterial.get(Jobs.getGCManager().guiFiller));
@ -55,6 +53,8 @@ public class GuiManager {
gui.setInvSize(GuiSize); gui.setInvSize(GuiSize);
JobsPlayer JPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
int i = 0; int i = 0;
int pos = Jobs.getGCManager().getJobsGUIStartPosition() - 1; int pos = Jobs.getGCManager().getJobsGUIStartPosition() - 1;
@ -192,8 +192,11 @@ public class GuiManager {
int i = 0; int i = 0;
for (ActionType actionType : ActionType.values()) { for (ActionType actionType : ActionType.values()) {
List<JobInfo> info = job.getJobInfo(actionType); if (i > 54) {
break;
}
List<JobInfo> info = job.getJobInfo(actionType);
if (info == null || info.isEmpty()) if (info == null || info.isEmpty())
continue; continue;

View File

@ -21,8 +21,4 @@ public interface NMS {
public double getMaxHealth(LivingEntity entity); public double getMaxHealth(LivingEntity entity);
public short getDurability(ItemStack item); public short getDurability(ItemStack item);
// public Enchantment getEnchantment(String type);
//
// public String getEnchantName(Enchantment type);
} }

View File

@ -44,7 +44,7 @@ public class ChatFilterRule {
this.blockType = ChatFilterBlockType.None; this.blockType = ChatFilterBlockType.None;
} }
public ChatFilterRule() { public ChatFilterRule() {
} }
public List<Pattern> getPattern() { public List<Pattern> getPattern() {

View File

@ -81,7 +81,6 @@ public class SignUtil {
// Sign file // Sign file
public void LoadSigns() { public void LoadSigns() {
// Boolean false does not create a file
if (!Jobs.getGCManager().SignsEnabled) if (!Jobs.getGCManager().SignsEnabled)
return; return;
@ -141,7 +140,6 @@ public class SignUtil {
cancelSignTask(); cancelSignTask();
} }
// Signs save file
public void saveSigns() { public void saveSigns() {
File f = new File(Jobs.getFolder(), "Signs.yml"); File f = new File(Jobs.getFolder(), "Signs.yml");
YamlConfiguration conf = YamlConfiguration.loadConfiguration(f); YamlConfiguration conf = YamlConfiguration.loadConfiguration(f);

View File

@ -185,25 +185,6 @@ public class GeneralConfigManager {
return currencyLimitUse.get(type); return currencyLimitUse.get(type);
} }
/**
* @deprecated Use {@link #useBreederFinder}
* Sets the breeder finder boolean
* @param state boolean
*/
@Deprecated
public void setBreederFinder(boolean state) {
this.useBreederFinder = state;
}
/**
* @deprecated Use {@link #useBreederFinder}
* @return boolean
*/
@Deprecated
public boolean isUseBreederFinder() {
return useBreederFinder;
}
public void setTntFinder(boolean state) { public void setTntFinder(boolean state) {
this.useTnTFinder = state; this.useTnTFinder = state;
} }

View File

@ -1810,10 +1810,9 @@ public class JobsPaymentListener implements Listener {
} }
} }
if (whiteList.contains("=") && whiteList.split("=").length == 2) { if (whiteList.contains("=") && whiteList.split("=").length == 2 &&
if (!hand.getEnchantments().containsKey(CMIEnchantment.getEnchantment(whiteList.split("=")[1]))) { !hand.getEnchantments().containsKey(CMIEnchantment.getEnchantment(whiteList.split("=")[1]))) {
return false; return false;
}
} }
if (mat != null && hand.getType().equals(mat.getMaterial())) { if (mat != null && hand.getType().equals(mat.getMaterial())) {