Removed unnecessary methods from IClientOutgoingPacket.
This commit is contained in:
@@ -19,7 +19,6 @@ package org.l2jmobius.gameserver.network.serverpackets;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.network.IOutgoingPacket;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
|
||||
@@ -65,30 +64,7 @@ public interface IClientOutgoingPacket extends IOutgoingPacket
|
||||
return PAPERDOLL_ORDER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends this packet to the target player, useful for lambda operations like<br>
|
||||
* {@code World.getInstance().getPlayers().forEach(packet::sendTo)}
|
||||
* @param player
|
||||
*/
|
||||
default void sendTo(Player player)
|
||||
{
|
||||
player.sendPacket(this);
|
||||
}
|
||||
|
||||
default void runImpl(Player player)
|
||||
{
|
||||
}
|
||||
|
||||
default void writeOptionalD(PacketWriter packet, int value)
|
||||
{
|
||||
if (value >= Short.MAX_VALUE)
|
||||
{
|
||||
packet.writeH(Short.MAX_VALUE);
|
||||
packet.writeD(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
packet.writeH(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -111,10 +111,10 @@ public class Broadcast
|
||||
* In order to inform other players of state modification on the Creature, server just needs to go through _knownPlayers to send Server->Client Packet and check the distance between the targets.<br>
|
||||
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T SEND Server->Client packet to this Creature (to do this use method toSelfAndKnownPlayers)</b></font>
|
||||
* @param creature
|
||||
* @param mov
|
||||
* @param packet
|
||||
* @param radiusValue
|
||||
*/
|
||||
public static void toKnownPlayersInRadius(Creature creature, IClientOutgoingPacket mov, int radiusValue)
|
||||
public static void toKnownPlayersInRadius(Creature creature, IClientOutgoingPacket packet, int radiusValue)
|
||||
{
|
||||
int radius = radiusValue;
|
||||
if (radius < 0)
|
||||
@@ -122,7 +122,7 @@ public class Broadcast
|
||||
radius = 1500;
|
||||
}
|
||||
|
||||
World.getInstance().forEachVisibleObjectInRange(creature, Player.class, radius, mov::sendTo);
|
||||
World.getInstance().forEachVisibleObjectInRange(creature, Player.class, radius, player -> player.sendPacket(packet));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -146,7 +146,7 @@ public class Broadcast
|
||||
}
|
||||
|
||||
// To improve performance we are comparing values of radius^2 instead of calculating sqrt all the time
|
||||
public static void toSelfAndKnownPlayersInRadius(Creature creature, IClientOutgoingPacket mov, int radiusValue)
|
||||
public static void toSelfAndKnownPlayersInRadius(Creature creature, IClientOutgoingPacket packet, int radiusValue)
|
||||
{
|
||||
int radius = radiusValue;
|
||||
if (radius < 0)
|
||||
@@ -156,10 +156,10 @@ public class Broadcast
|
||||
|
||||
if (creature.isPlayer())
|
||||
{
|
||||
creature.sendPacket(mov);
|
||||
creature.sendPacket(packet);
|
||||
}
|
||||
|
||||
World.getInstance().forEachVisibleObjectInRange(creature, Player.class, radius, mov::sendTo);
|
||||
World.getInstance().forEachVisibleObjectInRange(creature, Player.class, radius, player -> player.sendPacket(packet));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user