Skip to content

Join server when it's full with permission to do so when use-custom-server-full-message is true issue still persisting #6432

@benediktjohannes

Description

@benediktjohannes

Type of bug

Other unexpected behaviour

/ess dump all output

I've not tested this, I'm sorry, it's just a code review

Error log (if applicable)

No response

Bug description

This is quite similar to #6424, just in another place:

private final class LoginListener1_21 implements Listener {
    @EventHandler(priority = EventPriority.HIGH)
    public void onPlayerListFull(final PlayerServerFullCheckEvent event) {
        if (ess.getPermissionsHandler().isOfflinePermissionSet(event.getPlayerProfile().getId(), "essentials.joinfullserver")) {
            event.allow(true);
            return;
        }

        if (!event.isAllowed() && ess.getSettings().isCustomServerFullMessage()) {
            PaperAdventureSmuggler.smugglePlayerServerFullCheckEvent(event, AdventureUtil.miniToLegacy(tlLiteral("serverFull")));
        }
    }

was fixed via adding !event.isAllowed(), but it still persists in another case here:

    @EventHandler(priority = EventPriority.HIGH)
    public void onPlayerLogin(final PlayerLoginEvent event) {
        if (event.getResult() == PlayerLoginEvent.Result.KICK_FULL) {
            final User kfuser = ess.getUser(event.getPlayer());
            kfuser.update(event.getPlayer());
            if (kfuser.isAuthorized("essentials.joinfullserver")) {
                event.allow();
                return;
            }
            if (ess.getSettings().isCustomServerFullMessage()) {
                event.disallow(PlayerLoginEvent.Result.KICK_FULL, tlLiteral("serverFull"));
            }
        }
    }
}

where it should IMO (but I'm not quite sure because it's jsut a code review and not tested) not be if (ess.getSettings().isCustomServerFullMessage()), but be if ((event.getResult() != PlayerLoginEvent.Result.ALLOWED) && ess.getSettings().isCustomServerFullMessage()) because it could be allowed via if (kfuser.isAuthorized("essentials.joinfullserver"))

Steps to reproduce

  1. Log in onto the server with the result KICK_FULL
  2. Be authorized with essentials.joinfullserver

Expected behaviour

The player should not be kicked in dependence of the custom message set or not, but they should be able to log in onto the server if they're permitted to do so

Actual behaviour

The player isn't able to login (not quite sure because it's just a code review and not tested and I may be mistaken if this is done by another pice of code that fixes this or something like this, but I don't think so)

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug: unconfirmedPotential bugs that need replicating to verify.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions