You didn't merge correctly!

This commit is contained in:
Max Qian 2016-08-15 15:17:55 -07:00
parent 7fdb84f36b
commit 50455376de
2 changed files with 0 additions and 103 deletions

View File

@ -54,11 +54,6 @@ public class PortalProtect implements Listener {
@EventHandler(priority = EventPriority.HIGH)
public void onExplosion(EntityExplodeEvent event) {
if (!Portal.portalsActive) {
return;
}
List<Block> blockList = event.blockList();
for (int i = 0; i < blockList.size(); i++) {
Block block = blockList.get(i);

View File

@ -525,104 +525,6 @@ public class Portal {
return false;
}
public static AdvancedPortal locationInPortal(Location loc){
return locationInPortal(loc, 0);
}
/**
* Only returns the first portal found. May have issues with additional area but overlapping should not occour at 0.
* @param loc
* @param additionalArea
* @return
*/
public static AdvancedPortal locationInPortal(Location loc, int additionalArea){
if (!Portal.portalsActive) {
return null;
}
for (AdvancedPortal portal : Portal.Portals) {
if (loc.getWorld() != null && portal.worldName.equals(loc.getWorld().getName())) {
if ((portal.pos1.getX() + 1D + additionalArea) >= loc.getX() && (portal.pos1.getY() + additionalArea) >= loc.getY() && (portal.pos1.getZ() + 1D + additionalArea) >= loc.getZ()) {
if (portal.pos2.getX() - additionalArea <= loc.getX() && portal.pos2.getY() - additionalArea <= loc.getY() && portal.pos2.getZ() - additionalArea <= loc.getZ()) {
return portal;
}
}
}
}
return null;
}
public static AdvancedPortal blockLocationInPortal(Location loc){
return locationInPortal(loc, 0);
}
public static AdvancedPortal blockLocationInPortal(Location loc, int additionalArea){
if (!Portal.portalsActive) {
return null;
}
for (AdvancedPortal portal : Portal.Portals) {
if (loc.getWorld() != null && portal.worldName.equals(loc.getWorld().getName())) {
if ((portal.pos1.getX() + additionalArea) >= loc.getX() && (portal.pos1.getY() + additionalArea) >= loc.getY() && (portal.pos1.getZ() + additionalArea) >= loc.getZ()) {
if (portal.pos2.getX() - additionalArea <= loc.getX() && portal.pos2.getY() - additionalArea <= loc.getY() && portal.pos2.getZ() - additionalArea <= loc.getZ()) {
return portal;
}
}
}
}
return null;
}
/**
* Only returns the first portal found. May have issues with additional area but overlapping should not occour at 0.
* @param player
* @param loc
* @param additionalArea
* @return
*/
public static AdvancedPortal playerInPortal(Player player, Location loc, int additionalArea){
if (!Portal.portalsActive) {
return null;
}
if(loc == null){
loc = player.getLocation();
}
Location eyeLoc = new Location(loc.getWorld(), loc.getX(), loc.getY() + player.getEyeHeight(), loc.getZ());
for (AdvancedPortal portal : Portal.Portals) {
if (loc.getWorld() != null && portal.worldName.equals(loc.getWorld().getName())) {
if (portal.trigger.equals(loc.getBlock().getType())
|| portal.trigger.equals(eyeLoc.getBlock().getType())) {
if ((portal.pos1.getX() + 1D + additionalArea) >= loc.getX() && (portal.pos1.getY() + additionalArea) >= loc.getY() && (portal.pos1.getZ() + 1D + additionalArea) >= loc.getZ()) {
if (portal.pos2.getX() - additionalArea <= loc.getX() && portal.pos2.getY() - additionalArea <= loc.getY() && portal.pos2.getZ() - additionalArea <= loc.getZ()) {
return portal;
}
}
}
}
}
return null;
}
public static AdvancedPortal playerInPortal(Player player){
return playerInPortal(player, null, 0);
}
public static AdvancedPortal playerInPortal(Player player, Location loc){
return playerInPortal(player, loc, 0);
}
public static AdvancedPortal playerInPortal(Player player, int additionalArea){
return playerInPortal(player, null, additionalArea);
}
public static void throwPlayerBack(Player player){
// Not ensured to remove them out of the portal but it makes it feel nicer for the player.
Vector velocity = player.getLocation().getDirection();