Try to fix a weird null case
Dieser Commit ist enthalten in:
Ursprung
679035c3bf
Commit
1bdd200794
@ -47,6 +47,7 @@ public class MinecraftFields {
|
|||||||
* @return The player connection.
|
* @return The player connection.
|
||||||
*/
|
*/
|
||||||
public static Object getPlayerConnection(Player player) {
|
public static Object getPlayerConnection(Player player) {
|
||||||
|
Preconditions.checkNotNull(player, "player cannot be null!");
|
||||||
return getPlayerConnection(BukkitUnwrapper.getInstance().unwrapItem(player));
|
return getPlayerConnection(BukkitUnwrapper.getInstance().unwrapItem(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -671,7 +671,7 @@ public class ChannelInjector extends ByteToMessageDecoder implements Injector {
|
|||||||
MinecraftMethods.getSendPacketMethod().invoke(getPlayerConnection(), packet);
|
MinecraftMethods.getSendPacketMethod().invoke(getPlayerConnection(), packet);
|
||||||
}
|
}
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
ProtocolLibrary.getErrorReporter().reportWarning(factory.getPlugin(),
|
ProtocolLibrary.getErrorReporter().reportWarning(this,
|
||||||
Report.newBuilder(REPORT_CANNOT_SEND_PACKET).messageParam(packet, playerName).error(ex).build());
|
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() {
|
private Object getPlayerConnection() {
|
||||||
if (playerConnection == null) {
|
if (playerConnection == null) {
|
||||||
playerConnection = MinecraftFields.getPlayerConnection(player);
|
playerConnection = MinecraftFields.getPlayerConnection(getPlayer());
|
||||||
}
|
}
|
||||||
return playerConnection;
|
return playerConnection;
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren