Removed pointless assignments before packet send.

This commit is contained in:
MobiusDevelopment
2020-01-30 23:02:45 +00:00
parent 5cd563c611
commit 845dea2551
505 changed files with 842 additions and 1792 deletions

View File

@@ -667,8 +667,7 @@ public abstract class AbstractAI implements Ctrl
protected void clientNotifyDead()
{
// Send a Server->Client packet Die to the actor and all PlayerInstance in its _knownPlayers
final Die msg = new Die(_actor);
_actor.broadcastPacket(msg);
_actor.broadcastPacket(new Die(_actor));
// Init AI
_intention = AI_INTENTION_IDLE;

View File

@@ -41,8 +41,7 @@ public class PcCafePointsManager
if (player.getPcCafePoints() >= Config.PC_CAFE_MAX_POINTS)
{
final SystemMessage message = new SystemMessage(SystemMessageId.YOU_HAVE_EARNED_THE_MAXIMUM_NUMBER_OF_PA_POINTS);
player.sendPacket(message);
player.sendPacket(new SystemMessage(SystemMessageId.YOU_HAVE_EARNED_THE_MAXIMUM_NUMBER_OF_PA_POINTS));
return;
}

View File

@@ -260,9 +260,9 @@ public class CursedWeapon implements INamable
_item.setDropTime(0); // Prevent item from being removed by ItemsAutoDestroy
// RedSky and Earthquake
final ExRedSky packet = new ExRedSky(10);
final ExRedSky rs = new ExRedSky(10);
final Earthquake eq = new Earthquake(player.getX(), player.getY(), player.getZ(), 14, 3);
Broadcast.toAllOnlinePlayers(packet);
Broadcast.toAllOnlinePlayers(rs);
Broadcast.toAllOnlinePlayers(eq);
}
else

View File

@@ -1817,8 +1817,7 @@ public class PlayerInstance extends Playable
return;
}
_lastCompassZone = ExSetCompassZoneCode.ALTEREDZONE;
final ExSetCompassZoneCode cz = new ExSetCompassZoneCode(ExSetCompassZoneCode.ALTEREDZONE);
sendPacket(cz);
sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.ALTEREDZONE));
}
else if (isInsideZone(ZoneId.SIEGE))
{
@@ -1827,8 +1826,7 @@ public class PlayerInstance extends Playable
return;
}
_lastCompassZone = ExSetCompassZoneCode.SIEGEWARZONE2;
final ExSetCompassZoneCode cz = new ExSetCompassZoneCode(ExSetCompassZoneCode.SIEGEWARZONE2);
sendPacket(cz);
sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.SIEGEWARZONE2));
}
else if (isInsideZone(ZoneId.PVP))
{
@@ -1837,8 +1835,7 @@ public class PlayerInstance extends Playable
return;
}
_lastCompassZone = ExSetCompassZoneCode.PVPZONE;
final ExSetCompassZoneCode cz = new ExSetCompassZoneCode(ExSetCompassZoneCode.PVPZONE);
sendPacket(cz);
sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.PVPZONE));
}
else if (isInsideZone(ZoneId.PEACE))
{
@@ -1847,8 +1844,7 @@ public class PlayerInstance extends Playable
return;
}
_lastCompassZone = ExSetCompassZoneCode.PEACEZONE;
final ExSetCompassZoneCode cz = new ExSetCompassZoneCode(ExSetCompassZoneCode.PEACEZONE);
sendPacket(cz);
sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.PEACEZONE));
}
else
{
@@ -1861,8 +1857,7 @@ public class PlayerInstance extends Playable
updatePvPStatus();
}
_lastCompassZone = ExSetCompassZoneCode.GENERALZONE;
final ExSetCompassZoneCode cz = new ExSetCompassZoneCode(ExSetCompassZoneCode.GENERALZONE);
sendPacket(cz);
sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.GENERALZONE));
}
}
@@ -4378,8 +4373,7 @@ public class PlayerInstance extends Playable
sendPacket(ActionFailed.STATIC_PACKET);
// Send a Server->Client packet StopMove to this PlayerInstance
final StopMove sm = new StopMove(this);
sendPacket(sm);
sendPacket(new StopMove(this));
SystemMessage smsg = null;
synchronized (target)
@@ -10452,7 +10446,6 @@ public class PlayerInstance extends Playable
if (!_snoopListener.isEmpty())
{
final Snoop sn = new Snoop(getObjectId(), getName(), type, name, text);
for (PlayerInstance pci : _snoopListener)
{
if (pci != null)
@@ -11753,8 +11746,7 @@ public class PlayerInstance extends Playable
else if (_canFeed)
{
setCurrentFeed(getMaxFeed());
final SetupGauge sg = new SetupGauge(3, (_curFeed * 10000) / getFeedConsume(), (getMaxFeed() * 10000) / getFeedConsume());
sendPacket(sg);
sendPacket(new SetupGauge(3, (_curFeed * 10000) / getFeedConsume(), (getMaxFeed() * 10000) / getFeedConsume()));
if (!isDead())
{
_mountFeedTask = ThreadPool.scheduleAtFixedRate(new PetFeedTask(this), 10000, 10000);
@@ -11813,8 +11805,7 @@ public class PlayerInstance extends Playable
{
final boolean lastHungryState = isHungry();
_curFeed = num > getMaxFeed() ? getMaxFeed() : num;
final SetupGauge sg = new SetupGauge(3, (_curFeed * 10000) / getFeedConsume(), (getMaxFeed() * 10000) / getFeedConsume());
sendPacket(sg);
sendPacket(new SetupGauge(3, (_curFeed * 10000) / getFeedConsume(), (getMaxFeed() * 10000) / getFeedConsume()));
// broadcast move speed change when strider becomes hungry / full
if (lastHungryState != isHungry())
{

View File

@@ -246,10 +246,8 @@ public class RaceManagerInstance extends Npc
if (_state == STARTING_RACE)
{
// state++;
final PlaySound sRace = new PlaySound(1, "S_Race", 0, 0, 0, 0, 0);
broadcast(sRace);
final PlaySound sRace2 = new PlaySound(0, "ItemSound2.race_start", 1, 121209259, 12125, 182487, -3559);
broadcast(sRace2);
broadcast(new PlaySound(1, "S_Race", 0, 0, 0, 0, 0));
broadcast(new PlaySound(0, "ItemSound2.race_start", 1, 121209259, 12125, 182487, -3559));
_packet = new MonRaceInfo(_codes[1][0], _codes[1][1], race.getMonsters(), race.getSpeeds());
sendMonsterInfo();

View File

@@ -78,8 +78,7 @@ public class CommandChannelMatchingRoom extends MatchingRoom
p.sendPacket(new ExMPCCRoomMember(player, this));
});
final SystemMessage sm = new SystemMessage(kicked ? SystemMessageId.YOU_WERE_EXPELLED_FROM_THE_COMMAND_CHANNEL_MATCHING_ROOM : SystemMessageId.YOU_EXITED_FROM_THE_COMMAND_CHANNEL_MATCHING_ROOM);
player.sendPacket(sm);
player.sendPacket(new SystemMessage(kicked ? SystemMessageId.YOU_WERE_EXPELLED_FROM_THE_COMMAND_CHANNEL_MATCHING_ROOM : SystemMessageId.YOU_EXITED_FROM_THE_COMMAND_CHANNEL_MATCHING_ROOM));
}
@Override

View File

@@ -84,8 +84,7 @@ public class PartyMatchingRoom extends MatchingRoom
p.sendPacket(SystemMessageId.THE_LEADER_OF_THE_PARTY_ROOM_HAS_CHANGED);
});
final SystemMessage sm2 = new SystemMessage(kicked ? SystemMessageId.YOU_HAVE_BEEN_OUSTED_FROM_THE_PARTY_ROOM : SystemMessageId.YOU_HAVE_EXITED_THE_PARTY_ROOM);
player.sendPacket(sm2);
player.sendPacket(new SystemMessage(kicked ? SystemMessageId.YOU_HAVE_BEEN_OUSTED_FROM_THE_PARTY_ROOM : SystemMessageId.YOU_HAVE_EXITED_THE_PARTY_ROOM));
player.sendPacket(ExClosePartyRoom.STATIC_PACKET);
}

View File

@@ -194,8 +194,7 @@ public abstract class VoteSystem implements Runnable
private void announce(String msg)
{
final CreatureSay cs = new CreatureSay(null, ChatType.CRITICAL_ANNOUNCE, "", msg);
Broadcast.toAllOnlinePlayers(cs);
Broadcast.toAllOnlinePlayers(new CreatureSay(null, ChatType.CRITICAL_ANNOUNCE, "", msg));
}
public abstract int getVotes();

View File

@@ -56,8 +56,7 @@ public class CannotMoveAnymoreInVehicle implements IClientIncomingPacket
{
player.setInVehiclePosition(new Location(_x, _y, _z));
player.setHeading(_heading);
final StopMoveInVehicle msg = new StopMoveInVehicle(player, _boatId);
player.broadcastPacket(msg);
player.broadcastPacket(new StopMoveInVehicle(player, _boatId));
}
}
}

View File

@@ -67,7 +67,6 @@ public class RequestRecipeBookDestroy implements IClientIncomingPacket
player.unregisterRecipeList(_recipeID);
// Send the new recipe book.
final RecipeBookItemList response = new RecipeBookItemList(player, rp.isDwarvenRecipe());
player.sendPacket(response);
player.sendPacket(new RecipeBookItemList(player, rp.isDwarvenRecipe()));
}
}

View File

@@ -61,7 +61,6 @@ public class RequestRecipeBookOpen implements IClientIncomingPacket
return;
}
final RecipeBookItemList response = new RecipeBookItemList(player, _isDwarvenCraft);
player.sendPacket(response);
player.sendPacket(new RecipeBookItemList(player, _isDwarvenCraft));
}
}

View File

@@ -107,8 +107,7 @@ public class RequestAnswerFriendInvite implements IClientIncomingPacket
}
else
{
final SystemMessage msg = new SystemMessage(SystemMessageId.YOU_HAVE_FAILED_TO_ADD_A_FRIEND_TO_YOUR_FRIENDS_LIST);
requestor.sendPacket(msg);
requestor.sendPacket(new SystemMessage(SystemMessageId.YOU_HAVE_FAILED_TO_ADD_A_FRIEND_TO_YOUR_FRIENDS_LIST));
}
player.setActiveRequester(null);