Simplifies some function calls
Some checks failed
EpicKnarvik97/Stargate/pipeline/head There was a failure building this commit

This commit is contained in:
Kristian Knarvik 2021-11-15 17:18:00 +01:00
parent 10c3914a60
commit 70495220eb
2 changed files with 5 additions and 6 deletions

View File

@ -191,9 +191,9 @@ public abstract class Teleporter {
*/ */
private Location adjustExitLocation(Location traveller, Location exitLocation) { private Location adjustExitLocation(Location traveller, Location exitLocation) {
if (exitLocation != null) { if (exitLocation != null) {
BlockData blockData = portal.getWorld().getBlockAt(exitLocation).getBlockData(); BlockData blockData = exitLocation.getBlock().getBlockData();
if ((blockData instanceof Bisected && ((Bisected) blockData).getHalf() == Bisected.Half.BOTTOM) || if ((blockData instanceof Bisected bisected && bisected.getHalf() == Bisected.Half.BOTTOM) ||
(blockData instanceof Slab) && ((Slab) blockData).getType() == Slab.Type.BOTTOM) { (blockData instanceof Slab slab && slab.getType() == Slab.Type.BOTTOM)) {
//Prevent traveller from spawning inside a slab //Prevent traveller from spawning inside a slab
Stargate.debug("adjustExitLocation", "Added a block to get above a slab"); Stargate.debug("adjustExitLocation", "Added a block to get above a slab");
exitLocation.add(0, 1, 0); exitLocation.add(0, 1, 0);

View File

@ -292,16 +292,15 @@ public final class PortalFileHelper {
*/ */
private static void updatePortalButton(Portal portal) { private static void updatePortalButton(Portal portal) {
BlockLocation buttonLocation = getButtonLocation(portal); BlockLocation buttonLocation = getButtonLocation(portal);
BlockData buttonData = buttonLocation.getBlock().getBlockData();
if (portal.getOptions().isAlwaysOn()) { if (portal.getOptions().isAlwaysOn()) {
//Clear button if not already air or water //Clear button if not already air or water
if (MaterialHelper.isButtonCompatible(buttonData.getMaterial())) { if (MaterialHelper.isButtonCompatible(buttonLocation.getType())) {
Material newMaterial = decideRemovalMaterial(buttonLocation, portal); Material newMaterial = decideRemovalMaterial(buttonLocation, portal);
Stargate.addBlockChangeRequest(new BlockChangeRequest(buttonLocation, newMaterial, null)); Stargate.addBlockChangeRequest(new BlockChangeRequest(buttonLocation, newMaterial, null));
} }
} else { } else {
//Replace button if the material does not match //Replace button if the material does not match
if (buttonData.getMaterial() != portal.getGate().getPortalButton()) { if (buttonLocation.getType() != portal.getGate().getPortalButton()) {
generatePortalButton(portal, DirectionHelper.getBlockFaceFromYaw(portal.getYaw())); generatePortalButton(portal, DirectionHelper.getBlockFaceFromYaw(portal.getYaw()));
} }
} }