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);
}
JobsPlayer JPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
CMIGui gui = new CMIGui(player);
gui.setTitle(Jobs.getLanguage().getMessage("command.info.gui.pickjob"));
gui.setFiller(CMIMaterial.get(Jobs.getGCManager().guiFiller));
@ -55,6 +53,8 @@ public class GuiManager {
gui.setInvSize(GuiSize);
JobsPlayer JPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
int i = 0;
int pos = Jobs.getGCManager().getJobsGUIStartPosition() - 1;
@ -192,8 +192,11 @@ public class GuiManager {
int i = 0;
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())
continue;

View File

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

View File

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

View File

@ -185,25 +185,6 @@ public class GeneralConfigManager {
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) {
this.useTnTFinder = state;
}

View File

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