Dropped WarpedSpaceManager class.
This commit is contained in:
@ -33,7 +33,6 @@ import org.l2jmobius.gameserver.geoengine.geodata.Cell;
|
||||
import org.l2jmobius.gameserver.geoengine.geodata.IRegion;
|
||||
import org.l2jmobius.gameserver.geoengine.geodata.NullRegion;
|
||||
import org.l2jmobius.gameserver.geoengine.geodata.Region;
|
||||
import org.l2jmobius.gameserver.instancemanager.WarpedSpaceManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
@ -634,10 +633,6 @@ public class GeoEngine
|
||||
{
|
||||
return new Location(x, y, getHeight(x, y, z));
|
||||
}
|
||||
if (WarpedSpaceManager.getInstance().checkForWarpedSpace(x, y, z, tx, ty, tz, instance))
|
||||
{
|
||||
return new Location(x, y, getHeight(x, y, z));
|
||||
}
|
||||
|
||||
final LinePointIterator pointIter = new LinePointIterator(geoX, geoY, tGeoX, tGeoY);
|
||||
// First point is guaranteed to be available.
|
||||
@ -704,10 +699,6 @@ public class GeoEngine
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (WarpedSpaceManager.getInstance().checkForWarpedSpace(fromX, fromY, fromZ, toX, toY, toZ, instance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final LinePointIterator pointIter = new LinePointIterator(geoX, geoY, tGeoX, tGeoY);
|
||||
// First point is guaranteed to be available.
|
||||
|
@ -1,83 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.instancemanager;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.holders.WarpedSpaceHolder;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* @author Sdw
|
||||
*/
|
||||
public class WarpedSpaceManager
|
||||
{
|
||||
private Map<Creature, WarpedSpaceHolder> _warpedSpace = null;
|
||||
|
||||
public void addWarpedSpace(Creature creature, int radius)
|
||||
{
|
||||
if (_warpedSpace == null)
|
||||
{
|
||||
synchronized (this)
|
||||
{
|
||||
if (_warpedSpace == null)
|
||||
{
|
||||
_warpedSpace = new ConcurrentHashMap<>();
|
||||
}
|
||||
}
|
||||
}
|
||||
_warpedSpace.put(creature, new WarpedSpaceHolder(creature, radius));
|
||||
}
|
||||
|
||||
public void removeWarpedSpace(Creature creature)
|
||||
{
|
||||
_warpedSpace.remove(creature);
|
||||
}
|
||||
|
||||
public boolean checkForWarpedSpace(int originX, int originY, int originZ, int destinationX, int destinationY, int destinationZ, Instance instance)
|
||||
{
|
||||
if (_warpedSpace != null)
|
||||
{
|
||||
for (WarpedSpaceHolder holder : _warpedSpace.values())
|
||||
{
|
||||
final Creature creature = holder.getCreature();
|
||||
if (creature.getInstanceWorld() != instance)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
final int radius = creature.getTemplate().getCollisionRadius();
|
||||
final boolean originInRange = Util.calculateDistance(creature.getX(), creature.getY(), creature.getZ(), originX, originY, originZ, false, false) <= (holder.getRange() + radius);
|
||||
final boolean destinationInRange = Util.calculateDistance(creature.getX(), creature.getY(), creature.getZ(), destinationX, destinationY, destinationZ, false, false) <= (holder.getRange() + radius);
|
||||
return destinationInRange ? !originInRange : originInRange;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static WarpedSpaceManager getInstance()
|
||||
{
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final WarpedSpaceManager INSTANCE = new WarpedSpaceManager();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user