Merge pull request #184 from kezz/viewable-defaults

Simplify Viewable packet sending
This commit is contained in:
TheMode 2021-03-26 09:23:42 +01:00 committed by GitHub
commit 1b162c1139
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -80,9 +80,6 @@ public interface Viewable {
* @param packet the packet to send
*/
default void sendPacketToViewersAndSelf(@NotNull ServerPacket packet) {
if (this instanceof Player) {
((Player) this).getPlayerConnection().sendPacket(packet);
}
sendPacketToViewers(packet);
}
}

View File

@ -618,6 +618,12 @@ public class Player extends LivingEntity implements CommandSender {
return true;
}
@Override
public void sendPacketToViewersAndSelf(@NotNull ServerPacket packet) {
this.playerConnection.sendPacket(packet);
super.sendPacketToViewersAndSelf(packet);
}
/**
* Changes the player instance and load surrounding chunks if needed.
* <p>