Prevents loading of gate files using non-blocks as part of the border

This commit is contained in:
Kristian Knarvik 2021-11-25 03:39:15 +01:00
parent 2ed0fe7817
commit f92fd2de5d
3 changed files with 21 additions and 3 deletions

View File

@ -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

View File

@ -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
*

View File

@ -209,6 +209,14 @@ public class GateHandler {
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;
}