Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-16 21:10:30 +01:00
Warn about null permission functions.
Dieser Commit ist enthalten in:
Ursprung
0016f4ce19
Commit
3111816545
@ -17,6 +17,7 @@ import com.velocitypowered.api.event.connection.PreLoginEvent.PreLoginComponentR
|
||||
import com.velocitypowered.api.event.permission.PermissionsSetupEvent;
|
||||
import com.velocitypowered.api.event.player.GameProfileRequestEvent;
|
||||
import com.velocitypowered.api.event.player.PlayerChooseInitialServerEvent;
|
||||
import com.velocitypowered.api.permission.PermissionFunction;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import com.velocitypowered.api.util.GameProfile;
|
||||
import com.velocitypowered.api.util.UuidUtils;
|
||||
@ -231,7 +232,16 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
|
||||
.thenAcceptAsync(event -> {
|
||||
if (!mcConnection.isClosed()) {
|
||||
// wait for permissions to load, then set the players permission function
|
||||
player.setPermissionFunction(event.createFunction(player));
|
||||
final PermissionFunction function = event.createFunction(player);
|
||||
if (function == null) {
|
||||
logger.error(
|
||||
"A plugin permission provider {} provided an invalid permission function"
|
||||
+ " for player {}. This is a bug in the plugin, not in Velocity. Falling"
|
||||
+ " back to the default permission function.", player.getUsername(),
|
||||
event.getProvider());
|
||||
} else {
|
||||
player.setPermissionFunction(function);
|
||||
}
|
||||
completeLoginProtocolPhaseAndInitialize(player);
|
||||
}
|
||||
}, mcConnection.eventLoop());
|
||||
|
@ -65,6 +65,13 @@ public final class VelocityConsole extends SimpleTerminalConsole implements Cons
|
||||
PermissionsSetupEvent event = new PermissionsSetupEvent(this, s -> ALWAYS_TRUE);
|
||||
// we can safely block here, this is before any listeners fire
|
||||
this.permissionFunction = this.server.getEventManager().fire(event).join().createFunction(this);
|
||||
if (this.permissionFunction == null) {
|
||||
logger.error(
|
||||
"A plugin permission provider {} provided an invalid permission function"
|
||||
+ " for the console. This is a bug in the plugin, not in Velocity. Falling"
|
||||
+ " back to the default permission function.", event.getProvider());
|
||||
this.permissionFunction = ALWAYS_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren