Prevents loading of gate files using non-blocks as part of the border
This commit is contained in:
		@@ -395,6 +395,7 @@ portalInfoServer=Server: %server%
 | 
			
		||||
  players accidentally losing the creatures during teleportation
 | 
			
		||||
- Fixes a potential exception when a gate's open-block or closed-block is set to a material which isn't a block
 | 
			
		||||
- Fixes a potential exception when a portal without a sign has an invalid gate type
 | 
			
		||||
- Prevents loading of gate files using non-blocks as part of the border
 | 
			
		||||
 | 
			
		||||
#### \[Version 0.9.2.1] EpicKnarvik97 fork
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -69,6 +69,15 @@ public class Gate {
 | 
			
		||||
        return layout;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets a copy of the character to material mapping for this gate
 | 
			
		||||
     *
 | 
			
		||||
     * @return <p>The character to material map</p>
 | 
			
		||||
     */
 | 
			
		||||
    public Map<Character, Material> getCharacterMaterialMap() {
 | 
			
		||||
        return new HashMap<>(characterMaterialMap);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the material type used for this gate's control blocks
 | 
			
		||||
     *
 | 
			
		||||
 
 | 
			
		||||
@@ -189,7 +189,7 @@ public class GateHandler {
 | 
			
		||||
     */
 | 
			
		||||
    private static boolean validateGate(Gate gate, String fileName) {
 | 
			
		||||
        String failString = String.format("Could not load Gate %s", fileName) + " - %s";
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        if (gate.getLayout().getControls().length != 2) {
 | 
			
		||||
            Stargate.logSevere(String.format(failString, "Gates must have exactly 2 control points."));
 | 
			
		||||
            return false;
 | 
			
		||||
@@ -199,16 +199,24 @@ public class GateHandler {
 | 
			
		||||
            Stargate.logSevere(String.format(failString, "Gate button must be a type of button."));
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        if (!gate.getPortalOpenBlock().isBlock()) {
 | 
			
		||||
            Stargate.logSevere(String.format(failString, "Gate open block must be a type of block."));
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        if (!gate.getPortalClosedBlock().isBlock()) {
 | 
			
		||||
            Stargate.logSevere(String.format(failString, "Gate closed block must be a type of block."));
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        for (Material material : gate.getCharacterMaterialMap().values()) {
 | 
			
		||||
            if (!material.isBlock()) {
 | 
			
		||||
                Stargate.logSevere(String.format(failString, "Every gate border block must be a type of block."));
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user