Removed pointless FishingZoneManager class.

This commit is contained in:
MobiusDevelopment 2020-04-29 12:38:14 +00:00
parent 414cbb7773
commit 5cc2959111
3 changed files with 5 additions and 96 deletions

View File

@ -18,9 +18,9 @@ package org.l2jmobius.gameserver.handler.skillhandlers;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.datatables.xml.ZoneData;
import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.handler.ISkillHandler;
import org.l2jmobius.gameserver.instancemanager.FishingZoneManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.Skill;
import org.l2jmobius.gameserver.model.Skill.SkillType;
@ -128,8 +128,8 @@ public class Fishing implements ISkillHandler
final int y = player.getY() + y1;
int z = player.getZ() - 30;
// ...and if the spot is in a fishing zone. If it is, it will then position the hook on the water surface. If not, you have to be GM to proceed past here... in that case, the hook will be positioned using the old Z lookup method.
final FishingZone aimingTo = FishingZoneManager.getInstance().isInsideFishingZone(x, y, z);
final WaterZone water = FishingZoneManager.getInstance().isInsideWaterZone(x, y, z);
final FishingZone aimingTo = ZoneData.getInstance().getZone(x, y, z, FishingZone.class);
final WaterZone water = ZoneData.getInstance().getZone(x, y, z, WaterZone.class);
if ((water != null))
{
final Location waterLocation = new Location(x, y, water.getWaterZ() - 50);

View File

@ -1,91 +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.ArrayList;
import java.util.List;
import org.l2jmobius.gameserver.model.zone.type.FishingZone;
import org.l2jmobius.gameserver.model.zone.type.WaterZone;
public class FishingZoneManager
{
private List<FishingZone> _fishingZones;
private List<WaterZone> _waterZones;
private FishingZoneManager()
{
}
public void addFishingZone(FishingZone fishingZone)
{
if (_fishingZones == null)
{
_fishingZones = new ArrayList<>();
}
_fishingZones.add(fishingZone);
}
public void addWaterZone(WaterZone waterZone)
{
if (_waterZones == null)
{
_waterZones = new ArrayList<>();
}
_waterZones.add(waterZone);
}
/*
* isInsideFishingZone() - This function was modified to check the coordinates without caring for Z. This allows for the player to fish off bridges, into the water, or from other similar high places. One should be able to cast the line from up into the water, not only fishing whith one's feet
* wet. :) TODO: Consider in the future, limiting the maximum height one can be above water, if we start getting "orbital fishing" players... xD
*/
public FishingZone isInsideFishingZone(int x, int y, int z)
{
for (FishingZone temp : _fishingZones)
{
if (temp.isInsideZone(x, y, temp.getWaterZ() - 10))
{
return temp;
}
}
return null;
}
public WaterZone isInsideWaterZone(int x, int y, int z)
{
for (WaterZone temp : _waterZones)
{
if (temp.isInsideZone(x, y, temp.getWaterZ()))
{
return temp;
}
}
return null;
}
public static FishingZoneManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final FishingZoneManager INSTANCE = new FishingZoneManager();
}
}

View File

@ -80,7 +80,6 @@ import org.l2jmobius.gameserver.instancemanager.CoupleManager;
import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.DimensionalRiftManager;
import org.l2jmobius.gameserver.instancemanager.DuelManager;
import org.l2jmobius.gameserver.instancemanager.FishingZoneManager;
import org.l2jmobius.gameserver.instancemanager.FortSiegeManager;
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
import org.l2jmobius.gameserver.instancemanager.QuestManager;
@ -168,6 +167,7 @@ import org.l2jmobius.gameserver.model.variables.AccountVariables;
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.model.zone.type.TownZone;
import org.l2jmobius.gameserver.model.zone.type.WaterZone;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
@ -15228,7 +15228,7 @@ public class PlayerInstance extends Playable
*/
public boolean dismount()
{
if (FishingZoneManager.getInstance().isInsideWaterZone(getX(), getY(), getZ() - 300) == null)
if (ZoneData.getInstance().getZone(getX(), getY(), getZ() - 300, WaterZone.class) == null)
{
if (!isInWater() && (getZ() > 10000))
{