mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2025-03-12 14:49:20 +01:00
Try to fix a weird null case
This commit is contained in:
parent
679035c3bf
commit
1bdd200794
@ -47,6 +47,7 @@ public class MinecraftFields {
|
||||
* @return The player connection.
|
||||
*/
|
||||
public static Object getPlayerConnection(Player player) {
|
||||
Preconditions.checkNotNull(player, "player cannot be null!");
|
||||
return getPlayerConnection(BukkitUnwrapper.getInstance().unwrapItem(player));
|
||||
}
|
||||
|
||||
|
@ -671,7 +671,7 @@ public class ChannelInjector extends ByteToMessageDecoder implements Injector {
|
||||
MinecraftMethods.getSendPacketMethod().invoke(getPlayerConnection(), packet);
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
ProtocolLibrary.getErrorReporter().reportWarning(factory.getPlugin(),
|
||||
ProtocolLibrary.getErrorReporter().reportWarning(this,
|
||||
Report.newBuilder(REPORT_CANNOT_SEND_PACKET).messageParam(packet, playerName).error(ex).build());
|
||||
}
|
||||
}
|
||||
@ -716,7 +716,7 @@ public class ChannelInjector extends ByteToMessageDecoder implements Injector {
|
||||
*/
|
||||
private Object getPlayerConnection() {
|
||||
if (playerConnection == null) {
|
||||
playerConnection = MinecraftFields.getPlayerConnection(player);
|
||||
playerConnection = MinecraftFields.getPlayerConnection(getPlayer());
|
||||
}
|
||||
return playerConnection;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user