package fr.xephi.authme.data.limbo; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.initialization.Reloadable; import fr.xephi.authme.output.ConsoleLoggerFactory; import fr.xephi.authme.permission.PermissionsManager; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.PluginSettings; import org.bukkit.entity.Player; import javax.annotation.PostConstruct; import javax.inject.Inject; import java.util.Collection; import java.util.Collections; /** * Changes the permission group according to the auth status of the player and the configuration. *
* If this feature is enabled, the primary permissions group of a player is replaced until he has * logged in. Some permission plugins have a notion of a primary group; for other permission plugins the * first group is simply taken. *
* The groups that are used as replacement until the player logs in is configurable and depends on if
* the player is registered or not. Note that some (all?) permission systems require the group to actually
* exist for the replacement to take place. Furthermore, since some permission groups require that players
* be in at least one group, this will mean that the player is not removed from his primary group.
*/
class AuthGroupHandler implements Reloadable {
private final ConsoleLogger logger = ConsoleLoggerFactory.get(AuthGroupHandler.class);
@Inject
private PermissionsManager permissionsManager;
@Inject
private Settings settings;
private UserGroup unregisteredGroup;
private UserGroup registeredGroup;
AuthGroupHandler() {
}
/**
* Sets the group of a player by its authentication status.
*
* @param player the player
* @param limbo the associated limbo player (nullable)
* @param groupType the group type
*/
void setGroup(Player player, LimboPlayer limbo, AuthGroupType groupType) {
if (!useAuthGroups()) {
return;
}
Collection