Only load lines for signs configured, fixes #61
Don't try to load line 4 when it isn't configured in the configuration, fixes the onload IndexOutOfBoundsException.
This commit is contained in:
		@@ -18,7 +18,8 @@ Beta 5 Changes
 | 
				
			|||||||
* Changed the jail api, see [#72's comment](https://github.com/graywolf336/Jail/issues/72#issuecomment-104757472) for some details
 | 
					* Changed the jail api, see [#72's comment](https://github.com/graywolf336/Jail/issues/72#issuecomment-104757472) for some details
 | 
				
			||||||
* Changed the format of the jail check command, thanks to stevoh6. [#65](https://github.com/graywolf336/Jail/pull/65)
 | 
					* Changed the format of the jail check command, thanks to stevoh6. [#65](https://github.com/graywolf336/Jail/pull/65)
 | 
				
			||||||
* Changed the explanation of why the gamemode setting was problematic and give the available options. [#73](https://github.com/graywolf336/Jail/issues/73)
 | 
					* Changed the explanation of why the gamemode setting was problematic and give the available options. [#73](https://github.com/graywolf336/Jail/issues/73)
 | 
				
			||||||
* Fixed an issue where cell data was being duplicated (or more) in the database [#74](https://github.com/graywolf336/Jail/issues/74)
 | 
					* Fixed an issue where cell data was being duplicated (or more) in the database. [#74](https://github.com/graywolf336/Jail/issues/74)
 | 
				
			||||||
 | 
					* Fixed an on load issue when the config didn't have four lines for the signs. [#61](https://github.com/graywolf336/Jail/issues/61)
 | 
				
			||||||
* Fixed jail sticks not putting players into cells. [#68](https://github.com/graywolf336/Jail/issues/68)
 | 
					* Fixed jail sticks not putting players into cells. [#68](https://github.com/graywolf336/Jail/issues/68)
 | 
				
			||||||
* Fixed respawning after dying not placing players back into their cells when another plugin sets their respawn point. [#55](https://github.com/graywolf336/Jail/issues/55)
 | 
					* Fixed respawning after dying not placing players back into their cells when another plugin sets their respawn point. [#55](https://github.com/graywolf336/Jail/issues/55)
 | 
				
			||||||
* Fixed time being added/subtracted from a player's time when they were jailed forever, resulting in them being able to get out. [#69](https://github.com/graywolf336/Jail/issues/69)
 | 
					* Fixed time being added/subtracted from a player's time when they were jailed forever, resulting in them being able to get out. [#69](https://github.com/graywolf336/Jail/issues/69)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,16 +19,17 @@ import com.graywolf336.jail.events.PrisonerTimeChangeEvent;
 | 
				
			|||||||
import com.graywolf336.jail.events.PrisonerTransferredEvent;
 | 
					import com.graywolf336.jail.events.PrisonerTransferredEvent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CellSignListener implements Listener {
 | 
					public class CellSignListener implements Listener {
 | 
				
			||||||
    private String lineOne, lineTwo, lineThree, lineFour;
 | 
					    private String lineOne = "", lineTwo = "", lineThree = "", lineFour = "";
 | 
				
			||||||
    private JailMain pl;
 | 
					    private JailMain pl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public CellSignListener(JailMain plugin) {
 | 
					    public CellSignListener(JailMain plugin) {
 | 
				
			||||||
        pl = plugin;
 | 
					        pl = plugin;
 | 
				
			||||||
        List<String> lines = pl.getConfig().getStringList(Settings.CELLSIGNLINES.getPath());
 | 
					        List<String> lines = pl.getConfig().getStringList(Settings.CELLSIGNLINES.getPath());
 | 
				
			||||||
        lineOne = lines.get(0);
 | 
					        
 | 
				
			||||||
        lineTwo = lines.get(1);
 | 
					        if(lines.size() >= 1) lineOne = lines.get(0);
 | 
				
			||||||
        lineThree = lines.get(2);
 | 
					        if(lines.size() >= 2) lineTwo = lines.get(1);
 | 
				
			||||||
        lineFour = lines.get(3);
 | 
					        if(lines.size() >= 3) lineThree = lines.get(2);
 | 
				
			||||||
 | 
					        if(lines.size() >= 4) lineFour = lines.get(3);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @EventHandler(ignoreCancelled=true, priority = EventPriority.MONITOR)
 | 
					    @EventHandler(ignoreCancelled=true, priority = EventPriority.MONITOR)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user