Skip to content

Reduce 6 lines in one on ChannelPacketListener class #1

@Braayy

Description

@Braayy

On the ChannelPacketListener class all methods have this code:

boolean cancel;
if (uuid != null) {
  cancel = SimplePacketListener.callPacketListeners((Packet<?>) msg, Bukkit.getPlayer(uuid));
} else {
  cancel = SimplePacketListener.callPacketListeners((Packet<?>) msg, null);
}

But it can be reduce to only:

boolean cancel = SimplePacketListener.callPacketListeners((Packet<?>) msg, Bukkit.getPlayer(uuid));

Because Bukkit#getPlayer returns null if it dont find any player with the given UUID.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions