geforkt von Mirrors/Velocity
Add missing null check
Dieser Commit ist enthalten in:
Ursprung
8b94fe6ed2
Commit
2a842bffbe
@ -2,6 +2,7 @@ package com.velocitypowered.proxy.connection.backend;
|
|||||||
|
|
||||||
import com.velocitypowered.api.event.connection.PluginMessageEvent;
|
import com.velocitypowered.api.event.connection.PluginMessageEvent;
|
||||||
import com.velocitypowered.api.event.player.ServerConnectedEvent;
|
import com.velocitypowered.api.event.player.ServerConnectedEvent;
|
||||||
|
import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
|
||||||
import com.velocitypowered.proxy.VelocityServer;
|
import com.velocitypowered.proxy.VelocityServer;
|
||||||
import com.velocitypowered.proxy.connection.VelocityConstants;
|
import com.velocitypowered.proxy.connection.VelocityConstants;
|
||||||
import com.velocitypowered.proxy.connection.client.ClientPlaySessionHandler;
|
import com.velocitypowered.proxy.connection.client.ClientPlaySessionHandler;
|
||||||
@ -84,14 +85,18 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginMessageEvent event = new PluginMessageEvent(connection, connection.getPlayer(), server.getChannelRegistrar().getFromId(pm.getChannel()),
|
ChannelIdentifier id = server.getChannelRegistrar().getFromId(pm.getChannel());
|
||||||
pm.getData());
|
if (id == null) {
|
||||||
server.getEventManager().fire(event)
|
connection.getPlayer().getConnection().write(pm);
|
||||||
.thenAcceptAsync(pme -> {
|
} else {
|
||||||
if (pme.getResult().isAllowed()) {
|
PluginMessageEvent event = new PluginMessageEvent(connection, connection.getPlayer(), id, pm.getData());
|
||||||
connection.getPlayer().getConnection().write(pm);
|
server.getEventManager().fire(event)
|
||||||
}
|
.thenAcceptAsync(pme -> {
|
||||||
}, connection.getMinecraftConnection().getChannel().eventLoop());
|
if (pme.getResult().isAllowed()) {
|
||||||
|
connection.getPlayer().getConnection().write(pm);
|
||||||
|
}
|
||||||
|
}, connection.getMinecraftConnection().getChannel().eventLoop());
|
||||||
|
}
|
||||||
} else if (connection.hasCompletedJoin()) {
|
} else if (connection.hasCompletedJoin()) {
|
||||||
// Just forward the packet on. We don't have anything to handle at this time.
|
// Just forward the packet on. We don't have anything to handle at this time.
|
||||||
connection.getPlayer().getConnection().write(packet);
|
connection.getPlayer().getConnection().write(packet);
|
||||||
|
@ -2,6 +2,7 @@ package com.velocitypowered.proxy.connection.client;
|
|||||||
|
|
||||||
import com.velocitypowered.api.event.connection.DisconnectEvent;
|
import com.velocitypowered.api.event.connection.DisconnectEvent;
|
||||||
import com.velocitypowered.api.event.connection.PluginMessageEvent;
|
import com.velocitypowered.api.event.connection.PluginMessageEvent;
|
||||||
|
import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
|
||||||
import com.velocitypowered.proxy.VelocityServer;
|
import com.velocitypowered.proxy.VelocityServer;
|
||||||
import com.velocitypowered.proxy.connection.VelocityConstants;
|
import com.velocitypowered.proxy.connection.VelocityConstants;
|
||||||
import com.velocitypowered.proxy.connection.backend.VelocityServerConnection;
|
import com.velocitypowered.proxy.connection.backend.VelocityServerConnection;
|
||||||
@ -298,14 +299,18 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
|
|||||||
loginPluginMessages.add(packet);
|
loginPluginMessages.add(packet);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PluginMessageEvent event = new PluginMessageEvent(player, player.getConnectedServer(),
|
ChannelIdentifier id = server.getChannelRegistrar().getFromId(packet.getChannel());
|
||||||
server.getChannelRegistrar().getFromId(packet.getChannel()), packet.getData());
|
if (id == null) {
|
||||||
server.getEventManager().fire(event)
|
player.getConnectedServer().getMinecraftConnection().write(packet);
|
||||||
.thenAcceptAsync(pme -> {
|
} else {
|
||||||
if (pme.getResult().isAllowed()) {
|
PluginMessageEvent event = new PluginMessageEvent(player, player.getConnectedServer(), id, packet.getData());
|
||||||
player.getConnectedServer().getMinecraftConnection().write(packet);
|
server.getEventManager().fire(event)
|
||||||
}
|
.thenAcceptAsync(pme -> {
|
||||||
}, player.getConnectedServer().getMinecraftConnection().getChannel().eventLoop());
|
if (pme.getResult().isAllowed()) {
|
||||||
|
player.getConnectedServer().getMinecraftConnection().write(packet);
|
||||||
|
}
|
||||||
|
}, player.getConnectedServer().getMinecraftConnection().getChannel().eventLoop());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren