EssentialsX / Essentials

The modern Essentials suite for Spigot and Paper.
https://essentialsx.net
GNU General Public License v3.0
1.96k stars 980 forks source link

Vanish and SilentJoin bug [GroupManager] #1677

Closed PlugITNow closed 6 years ago

PlugITNow commented 6 years ago

EssentialsX version (/essentials): EssentialsX-2.0.1 (build #545)

Server software (/version): PaperSpigot-1.8.8-R0.1-SNAPSHOT

Bug description When an opped player connect on the server, he isn't vanished and the silent join doesnt work. It's very annying because players can see the staff

I precise that I have silent join and quit on true on my config

mdcfe commented 6 years ago

Make sure you've granted the relevant permissions to the group that should be vanished on join; to my knowledge, these are essentials.silentjoin (silent join), essentials.silentquit (silent disconnect) and essentials.silentjoin.vanish (vanish on join).

PlugITNow commented 6 years ago

The group already have thoses perms

mdcfe commented 6 years ago

If you run /vanish after connecting, what message appears?

FatmanC commented 6 years ago

I have the same bug. Only owner group has all the relevant vanish/silent join/quit permissions Yet admin and mod groups join silently/part silently and also when they login they are also in vanish So i added both to the individual users and groups: -essentials.vanish, -essentials.silentjoin, -essentials.silentquit, -essentials.silentjoin.vanish - still having same problem so i removed the g:vanish_mod from global groups - still happening in between each step ive tried, user log in vanished, so i get them to un vanish, (getting a message saying vanish is disabled making us visible to users) get them to log out and in to check the permissions went through, but they log back in, in vanish again. Ive gone into their individual user files removed anything even remotely associated with vanish (while they were visible) and same thing still occurs

mdcfe commented 6 years ago

@FatmanC This is a different problem. Please open a separate issue for this problem.

FatmanC commented 6 years ago

ok

PlugITNow commented 6 years ago

@md678685

it show "Invisibility for [Dev] PlugIT : activated" and another green message after "You are now invisible"

Debug mode show, no one of thoose perm are working (i tried to give it manually or by groups) :

[15:28:50] [Server thread/INFO]: [Essentials] checking if PlugIT has essentials.vanish.see - false [15:28:50] [Server thread/INFO]: [Essentials] checking if PlugIT has essentials.sleepingignored - false [15:28:50] [Server thread/INFO]: [Essentials] checking if PlugIT has essentials.silentjoin - false [15:28:50] [Server thread/INFO]: [Essentials] checking if PlugIT has essentials.silentjoin.vanish - false [15:28:50] [Server thread/INFO]: [+] [Dev] PlugIT [15:28:50] [Server thread/INFO]: [Essentials] looking up groupname of PlugIT - dev [15:28:50] [Server thread/INFO]: [Essentials] checking if PlugIT has essentials.motd - false [15:28:50] [Server thread/INFO]: [Essentials] checking if PlugIT has essentials.mail - false [15:28:50] [Server thread/INFO]: [Essentials] checking if PlugIT has essentials.fly.safelogin - false [15:28:50] [Server thread/INFO]: [Essentials] checking if PlugIT has essentials.speed - false

mdcfe commented 6 years ago

What permissions plugin are you using?

PlugITNow commented 6 years ago

EssentialsGroupManager

mdcfe commented 6 years ago

GroupManager is not supported - please switch to a supported permissions plugin such as PermissionsEx or LuckPerms.

PlugITNow commented 6 years ago

For people who want to keep on GroupManager, erasing the '*' perm of groups / player perms solve the issue, for others PEX is better ^^

ElgarL commented 2 years ago

I have tested this on GroupManager with Vault. The correct permissions are being reported by both. https://github.com/ElgarL/GroupManager/issues/93#issuecomment-1243610277 The join message is correctly muted but the quit is not. This is an Essentials issue which is here - https://github.com/EssentialsX/Essentials/blob/1eb5d8a4590d350baaa1c760019fb75de4e29b5b/Essentials/src/main/java/com/earth2me/essentials/User.java#L154 https://github.com/EssentialsX/Essentials/blob/1eb5d8a4590d350baaa1c760019fb75de4e29b5b/Essentials/src/main/java/com/earth2me/essentials/User.java#L172 https://github.com/EssentialsX/Essentials/blob/1eb5d8a4590d350baaa1c760019fb75de4e29b5b/Essentials/src/main/java/com/earth2me/essentials/User.java#L190

Those instanceof checks are always going to pass, as a Player is also an instanceof OfflinePlayer. It's never going to get beyond that and as such is going to treat all checks which go through there as OfflinePlayer/no permission. Reverse it if you want that test to work... if (!(base instanceof Player)) {

Here are the actual perms as reported by Vault and those Essentials thinks it has due to the OfflinePlayer instanceof always passing. [13:33:32] [Server thread/INFO]: Permission test (essentials.silentquit) true [13:33:32] [Server thread/INFO]: checking if ElgarL has essentials.silentquit - false

import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.RegisteredServiceProvider;

import net.milkbowl.vault.permission.Permission;

public class Permissions implements Listener {

    Plugin plugin;
    private Permission perms;

    public Permissions(Plugin plugin) {

        this.plugin = plugin;
        setupPermissions();
    }

    @EventHandler
    public void event(PlayerQuitEvent event) {

        Bukkit.broadcastMessage("Permission test (essentials.silentquit) " + perms.has(event.getPlayer(), "essentials.silentquit"));
    }

    private boolean setupPermissions() {

        RegisteredServiceProvider<Permission> rsp = plugin.getServer().getServicesManager().getRegistration(Permission.class);
        perms = rsp.getProvider();
        return perms != null;
    }
}
ElgarL commented 2 years ago

Yeah I've been looking into this more and this does not fix your issue.

I have after many hours of digging found the cause. It is GroupManager removing the permission attachment (clean-up) at the same priority (HIGHEST) as EssentialsX performs its PlayerQuit. I have delayed the clean-up by 1 tick in the pre-release of GroupManager https://github.com/ElgarL/GroupManager/releases/tag/v3.0-SNAPSHOT

This issue can now be closed properly on both ends.