use of com.velocitypowered.api.permission.PermissionProvider in project LimboAPI by Elytrium.
the class LoginTasksQueue method finish.
private void finish() {
this.plugin.removeLoginQueue(this.player);
MinecraftConnection connection = this.player.getConnection();
this.server.getEventManager().fire(new GameProfileRequestEvent(this.inbound, this.player.getGameProfile(), this.player.isOnlineMode())).thenAcceptAsync(gameProfile -> this.server.getEventManager().fire(new SafeGameProfileRequestEvent(gameProfile.getGameProfile(), gameProfile.isOnlineMode())).thenAcceptAsync(safeGameProfile -> {
try {
profile.set(this.player, safeGameProfile.getGameProfile());
// From Velocity.
this.server.getEventManager().fire(new PermissionsSetupEvent(this.player, (PermissionProvider) defaultPermissions.get(null))).thenAcceptAsync(event -> {
if (!connection.isClosed()) {
// Wait for permissions to load, then set the players' permission function.
final PermissionFunction function = event.createFunction(this.player);
if (function == null) {
this.plugin.getLogger().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.", event.getProvider().getClass().getName(), this.player.getUsername());
} else {
try {
setPermissionFunction.invoke(this.player, function);
} catch (IllegalAccessException | InvocationTargetException ex) {
this.plugin.getLogger().error("Exception while completing injection to {}", this.player, ex);
}
}
try {
this.initialize(connection);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
});
} catch (IllegalAccessException ex) {
this.plugin.getLogger().error("Exception while completing injection to {}", this.player, ex);
}
}, connection.eventLoop()), connection.eventLoop());
}
Aggregations