Removes the DirectionHelper's getBlockAt method as it only increased complexity
This commit is contained in:
parent
0506cf1b61
commit
82ed28bba0
@ -3,7 +3,6 @@ package net.knarcraft.stargate.portal;
|
|||||||
import net.knarcraft.stargate.Stargate;
|
import net.knarcraft.stargate.Stargate;
|
||||||
import net.knarcraft.stargate.container.BlockLocation;
|
import net.knarcraft.stargate.container.BlockLocation;
|
||||||
import net.knarcraft.stargate.container.RelativeBlockVector;
|
import net.knarcraft.stargate.container.RelativeBlockVector;
|
||||||
import net.knarcraft.stargate.utility.DirectionHelper;
|
|
||||||
import net.knarcraft.stargate.utility.EconomyHandler;
|
import net.knarcraft.stargate.utility.EconomyHandler;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
@ -195,7 +194,8 @@ public class Gate {
|
|||||||
Character key = layout.getLayout()[lineIndex][rowIndex];
|
Character key = layout.getLayout()[lineIndex][rowIndex];
|
||||||
|
|
||||||
Material materialInLayout = characterMaterialMap.get(key);
|
Material materialInLayout = characterMaterialMap.get(key);
|
||||||
Material materialAtLocation = DirectionHelper.getBlockAt(topLeft, borderVector, yaw).getType();
|
Material materialAtLocation = topLeft.getRelativeLocation(borderVector, yaw).getType();
|
||||||
|
|
||||||
if (materialInLayout == null) {
|
if (materialInLayout == null) {
|
||||||
/* This generally should not happen with proper checking, but just in case a material character is not
|
/* This generally should not happen with proper checking, but just in case a material character is not
|
||||||
* recognized, but still allowed in previous checks, verify the gate as long as all such instances of
|
* recognized, but still allowed in previous checks, verify the gate as long as all such instances of
|
||||||
@ -225,7 +225,7 @@ public class Gate {
|
|||||||
Stargate.debug("verifyGateEntrancesMatch", String.valueOf(topLeft));
|
Stargate.debug("verifyGateEntrancesMatch", String.valueOf(topLeft));
|
||||||
for (RelativeBlockVector entranceVector : layout.getEntrances()) {
|
for (RelativeBlockVector entranceVector : layout.getEntrances()) {
|
||||||
Stargate.debug("verifyGateEntrancesMatch", String.valueOf(entranceVector));
|
Stargate.debug("verifyGateEntrancesMatch", String.valueOf(entranceVector));
|
||||||
Material type = DirectionHelper.getBlockAt(topLeft, entranceVector, yaw).getType();
|
Material type = topLeft.getRelativeLocation(entranceVector, yaw).getType();
|
||||||
|
|
||||||
//Ignore entrance if it's air or water, and we're creating a new gate
|
//Ignore entrance if it's air or water, and we're creating a new gate
|
||||||
if (onCreate && (type == Material.AIR || type == Material.WATER)) {
|
if (onCreate && (type == Material.AIR || type == Material.WATER)) {
|
||||||
|
@ -8,7 +8,6 @@ import net.knarcraft.stargate.event.StargateActivateEvent;
|
|||||||
import net.knarcraft.stargate.event.StargateCloseEvent;
|
import net.knarcraft.stargate.event.StargateCloseEvent;
|
||||||
import net.knarcraft.stargate.event.StargateDeactivateEvent;
|
import net.knarcraft.stargate.event.StargateDeactivateEvent;
|
||||||
import net.knarcraft.stargate.event.StargateOpenEvent;
|
import net.knarcraft.stargate.event.StargateOpenEvent;
|
||||||
import net.knarcraft.stargate.utility.DirectionHelper;
|
|
||||||
import net.knarcraft.stargate.utility.SignHelper;
|
import net.knarcraft.stargate.utility.SignHelper;
|
||||||
import org.bukkit.Axis;
|
import org.bukkit.Axis;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -670,7 +669,7 @@ public class Portal {
|
|||||||
* @return <p>The block at the given relative position</p>
|
* @return <p>The block at the given relative position</p>
|
||||||
*/
|
*/
|
||||||
public BlockLocation getBlockAt(RelativeBlockVector vector) {
|
public BlockLocation getBlockAt(RelativeBlockVector vector) {
|
||||||
return DirectionHelper.getBlockAt(getTopLeft(), vector, getYaw());
|
return getTopLeft().getRelativeLocation(vector, getYaw());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package net.knarcraft.stargate.utility;
|
package net.knarcraft.stargate.utility;
|
||||||
|
|
||||||
import net.knarcraft.stargate.container.BlockLocation;
|
|
||||||
import net.knarcraft.stargate.container.RelativeBlockVector;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
@ -85,18 +83,6 @@ public final class DirectionHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a block location relative to another
|
|
||||||
*
|
|
||||||
* @param topLeft <p>The block location to start at (Usually the top-left block of a portal)</p>
|
|
||||||
* @param vector <p>The relative vector describing the relative location</p>
|
|
||||||
* @param yaw <p>The yaw pointing outwards from the portal</p>
|
|
||||||
* @return <p>A block location relative to the given location</p>
|
|
||||||
*/
|
|
||||||
public static BlockLocation getBlockAt(BlockLocation topLeft, RelativeBlockVector vector, double yaw) {
|
|
||||||
return topLeft.getRelativeLocation(vector, yaw);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Moves a location relatively
|
* Moves a location relatively
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user