Fix a few things, getting back into the flow
This commit is contained in:
		@@ -199,6 +199,22 @@ public class JailManager {
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets whether the location is inside of a Jail.
 | 
			
		||||
     * 
 | 
			
		||||
     * @param l to determine if is in a jail
 | 
			
		||||
     * @return whether it is inside a jail or not
 | 
			
		||||
     */
 | 
			
		||||
    public boolean isLocationAJail(Location l) {
 | 
			
		||||
        for(Jail j : jails.values()) {
 | 
			
		||||
            if(Util.isInsideAB(l.toVector(), j.getMinPoint().toVector(), j.getMaxPoint().toVector())) {
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Checks to see if the given name for a {@link Jail} is valid, returns true if it is a valid jail.
 | 
			
		||||
     * 
 | 
			
		||||
 
 | 
			
		||||
@@ -25,7 +25,7 @@ public class EntityListener implements Listener {
 | 
			
		||||
            for(Block b : event.blockList()) {
 | 
			
		||||
                //Check the current block and if it is inside a jail,
 | 
			
		||||
                //then let's do something else
 | 
			
		||||
                if(pl.getJailManager().getJailFromLocation(b.getLocation()) != null) {
 | 
			
		||||
                if(pl.getJailManager().isLocationAJail(b.getLocation())) {
 | 
			
		||||
                    //Clear the blocklist, this way the explosion effect still happens
 | 
			
		||||
                    event.blockList().clear();
 | 
			
		||||
                    return;
 | 
			
		||||
@@ -39,7 +39,7 @@ public class EntityListener implements Listener {
 | 
			
		||||
        //If we are protecting the jails from endermen protection
 | 
			
		||||
        if(pl.getConfig().getBoolean(Settings.ENDERMENPROTECTION.getPath())) {
 | 
			
		||||
            //Check if there are any jails where the block's location is
 | 
			
		||||
            if(pl.getJailManager().getJailFromLocation(event.getBlock().getLocation()) != null) {
 | 
			
		||||
            if(pl.getJailManager().isLocationAJail(event.getBlock().getLocation())) {
 | 
			
		||||
                //Let's cancel the event so it doesn't happen
 | 
			
		||||
                event.setCancelled(true);
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -107,8 +107,8 @@ public class TestJailDefaultConfig {
 | 
			
		||||
 | 
			
		||||
        // interaction blocks protection section
 | 
			
		||||
        List<String> interactionBlocks = main.getConfig().getStringList(Settings.PREVENTINTERACTIONBLOCKS.getPath());
 | 
			
		||||
        assertTrue("Default interaction blocks whitelist doesn't contain wooden_door.", interactionBlocks.contains("wooden_door"));
 | 
			
		||||
        assertTrue("Default interaction blocks whitelist doesn't contain iron_door_block.", interactionBlocks.contains("iron_door_block"));
 | 
			
		||||
        assertTrue("Default interaction blocks whitelist doesn't contain wooden_door.", interactionBlocks.contains("oak_door"));
 | 
			
		||||
        assertTrue("Default interaction blocks whitelist doesn't contain iron_door_block.", interactionBlocks.contains("iron_door"));
 | 
			
		||||
        assertEquals("Default setting for preventing interaction blocks penalty is not 5m.", "5m", main.getConfig().getString(Settings.PREVENTINTERACTIONBLOCKSPENALTY.getPath()));
 | 
			
		||||
 | 
			
		||||
        // interaction items protection section
 | 
			
		||||
@@ -116,7 +116,7 @@ public class TestJailDefaultConfig {
 | 
			
		||||
        assertEquals("Default setting for preventing interaction blocks penalty is not 5m.", "5m", main.getConfig().getString(Settings.PREVENTINTERACTIONBLOCKSPENALTY.getPath()));
 | 
			
		||||
 | 
			
		||||
        assertTrue("Default setting for recieving messages is false.", main.getConfig().getBoolean(Settings.RECIEVEMESSAGES.getPath()));
 | 
			
		||||
        assertFalse("Default setting for scoreboard being enabled is true.", main.getConfig().getBoolean(Settings.SCOREBOARDENABLED.getPath()));
 | 
			
		||||
        assertTrue("Default setting for scoreboard being enabled is false.", main.getConfig().getBoolean(Settings.SCOREBOARDENABLED.getPath()));
 | 
			
		||||
        assertEquals("Default setting for the scoreboard title is not Jail Info.", "Jail Info", main.getConfig().getString(Settings.SCOREBOARDTITLE.getPath()));
 | 
			
		||||
        assertEquals("Default setting for the scoreboard time language is not &aTime:", "&aTime:", main.getConfig().getString(Settings.SCOREBOARDTIME.getPath()));
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user