Fix duplicate "... entered battle" messages

This commit is contained in:
Stephen Seo 2018-10-18 13:43:26 +09:00
parent 0a26eee53a
commit 967fed3164

View file

@ -191,6 +191,8 @@ public class Battle
} }
} }
if(isServer)
{
for(Combatant c : this.sideA.values()) for(Combatant c : this.sideA.values())
{ {
if(c.entityInfo != null) if(c.entityInfo != null)
@ -221,6 +223,7 @@ public class Battle
sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, c.entity.getEntityId(), 0, id); sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, c.entity.getEntityId(), 0, id);
} }
} }
}
lastInstant = System.nanoTime(); lastInstant = System.nanoTime();
state = State.DECISION; state = State.DECISION;
@ -299,6 +302,8 @@ public class Battle
newCombatant.yaw = e.rotationYaw; newCombatant.yaw = e.rotationYaw;
newCombatant.pitch = e.rotationPitch; newCombatant.pitch = e.rotationPitch;
} }
if(isServer)
{
if(newCombatant.entityInfo != null) if(newCombatant.entityInfo != null)
{ {
sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, newCombatant.entity.getEntityId(), 0, id, newCombatant.entityInfo.category); sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, newCombatant.entity.getEntityId(), 0, id, newCombatant.entityInfo.category);
@ -311,6 +316,7 @@ public class Battle
{ {
sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, newCombatant.entity.getEntityId(), 0, id); sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, newCombatant.entity.getEntityId(), 0, id);
} }
}
notifyPlayersBattleInfo(); notifyPlayersBattleInfo();
} }
@ -352,6 +358,8 @@ public class Battle
newCombatant.yaw = e.rotationYaw; newCombatant.yaw = e.rotationYaw;
newCombatant.pitch = e.rotationPitch; newCombatant.pitch = e.rotationPitch;
} }
if(isServer)
{
if(newCombatant.entityInfo != null) if(newCombatant.entityInfo != null)
{ {
sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, newCombatant.entity.getEntityId(), 0, id, newCombatant.entityInfo.category); sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, newCombatant.entity.getEntityId(), 0, id, newCombatant.entityInfo.category);
@ -364,6 +372,7 @@ public class Battle
{ {
sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, newCombatant.entity.getEntityId(), 0, id); sendMessageToAllPlayers(PacketBattleMessage.MessageType.ENTERED, newCombatant.entity.getEntityId(), 0, id);
} }
}
notifyPlayersBattleInfo(); notifyPlayersBattleInfo();
} }