Partial sync L2jUnity free release Feb 18th 2015.

This commit is contained in:
MobiusDev
2016-10-26 18:04:21 +00:00
parent 7b56568b81
commit 236412d1bf
10 changed files with 54 additions and 108 deletions

View File

@@ -20,7 +20,7 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -30,6 +30,7 @@ import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.gameserver.ThreadPoolManager;
@@ -643,14 +644,9 @@ public class AutoSpawnHandler
return _npcList;
}
public List<L2Spawn> getSpawns()
public Collection<L2Spawn> getSpawns()
{
final List<L2Spawn> npcSpawns = new ArrayList<>();
for (L2Npc npcInst : _npcList)
{
npcSpawns.add(npcInst.getSpawn());
}
return npcSpawns;
return _npcList.stream().map(L2Npc::getSpawn).collect(Collectors.toList());
}
public void setSpawnCount(int spawnCount)

View File

@@ -11064,11 +11064,6 @@ public final class L2PcInstance extends L2Playable
return _lastServerPosition;
}
public int getLastServerDistance(int x, int y, int z)
{
return (int) Util.calculateDistance(x, y, z, _lastServerPosition.getX(), _lastServerPosition.getY(), _lastServerPosition.getZ(), true, false);
}
@Override
public void addExpAndSp(long addToExp, long addToSp)
{

View File

@@ -131,7 +131,7 @@ public class CharKnownList extends ObjectKnownList
{
pIter.remove();
}
else if (!player.isVisible() || !Util.checkIfInShortRadius(getDistanceToForgetObject(player), getActiveObject(), player, true))
else if (!player.isVisible() || !Util.checkIfInShortRange(getDistanceToForgetObject(player), getActiveObject(), player, true))
{
pIter.remove();
removeKnownObject(player, true);
@@ -152,7 +152,7 @@ public class CharKnownList extends ObjectKnownList
{
continue;
}
else if (!summon.isVisible() || !Util.checkIfInShortRadius(getDistanceToForgetObject(summon), getActiveObject(), summon, true))
else if (!summon.isVisible() || !Util.checkIfInShortRange(getDistanceToForgetObject(summon), getActiveObject(), summon, true))
{
sIter.remove();
removeKnownObject(summon, true);
@@ -171,7 +171,7 @@ public class CharKnownList extends ObjectKnownList
{
oIter.remove();
}
else if (!object.isVisible() || !Util.checkIfInShortRadius(getDistanceToForgetObject(object), getActiveObject(), object, true))
else if (!object.isVisible() || !Util.checkIfInShortRange(getDistanceToForgetObject(object), getActiveObject(), object, true))
{
oIter.remove();
removeKnownObject(object, true);

View File

@@ -61,7 +61,7 @@ public class ObjectKnownList
}
// Check if object is not inside distance to watch object
if (!Util.checkIfInShortRadius(getDistanceToWatchObject(object), getActiveObject(), object, true))
if (!Util.checkIfInShortRange(getDistanceToWatchObject(object), getActiveObject(), object, true))
{
return false;
}
@@ -169,7 +169,7 @@ public class ObjectKnownList
}
// Remove all objects invisible or too far
if (!object.isVisible() || !Util.checkIfInShortRadius(getDistanceToForgetObject(object), getActiveObject(), object, true))
if (!object.isVisible() || !Util.checkIfInShortRange(getDistanceToForgetObject(object), getActiveObject(), object, true))
{
oIter.remove();
removeKnownObject(object, true);

View File

@@ -135,7 +135,7 @@ public class PcStat extends PlayableStat
// if this player has a pet and it is in his range he takes from the owner's Exp, give the pet Exp now
final L2Summon sPet = activeChar.getPet();
if ((sPet != null) && Util.checkIfInShortRadius(Config.ALT_PARTY_RANGE, activeChar, sPet, false))
if ((sPet != null) && Util.checkIfInShortRange(Config.ALT_PARTY_RANGE, activeChar, sPet, false))
{
final L2PetInstance pet = (L2PetInstance) sPet;
ratioTakenByPlayer = pet.getPetLevelData().getOwnerExpTaken() / 100f;

View File

@@ -17,6 +17,7 @@
package com.l2jmobius.gameserver.model.entity;
import java.util.Calendar;
import java.util.Collection;
import java.util.List;
import com.l2jmobius.gameserver.model.L2Clan;
@@ -37,7 +38,7 @@ public interface Siegable
L2SiegeClan getAttackerClan(L2Clan clan);
List<L2SiegeClan> getAttackerClans();
Collection<L2SiegeClan> getAttackerClans();
List<L2PcInstance> getAttackersInZone();

View File

@@ -21,6 +21,8 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -70,7 +72,7 @@ public abstract class ClanHallSiegeEngine extends Quest implements Siegable
protected final Logger _log;
private final Map<Integer, L2SiegeClan> _attackers = new ConcurrentHashMap<>();
private List<L2Spawn> _guards;
private Collection<L2Spawn> _guards;
public SiegableHall _hall;
public ScheduledFuture<?> _siegeTask;
@@ -212,7 +214,12 @@ public abstract class ClanHallSiegeEngine extends Quest implements Siegable
@Override
public boolean checkIsAttacker(L2Clan clan)
{
return (clan != null) && _attackers.containsKey(clan.getId());
if (clan == null)
{
return false;
}
return _attackers.containsKey(clan.getId());
}
@Override
@@ -234,9 +241,9 @@ public abstract class ClanHallSiegeEngine extends Quest implements Siegable
}
@Override
public List<L2SiegeClan> getAttackerClans()
public Collection<L2SiegeClan> getAttackerClans()
{
return new ArrayList<>(_attackers.values());
return Collections.unmodifiableCollection(_attackers.values());
}
@Override