Archiviert
13
0

Try to fix a weird null case

Dieser Commit ist enthalten in:
Dan Mulloy 2016-07-16 16:03:01 -04:00
Ursprung 679035c3bf
Commit 1bdd200794
2 geänderte Dateien mit 3 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -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));
}

Datei anzeigen

@ -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;
}