fun setGroup(playername: String, groupName: String){ //Check if player exist var offlinePlayer = BandiCore.instance!!.server.getOfflinePlayer(playername) if(offlinePlayer == null){ throw PlayerNotFoundException() } //Check if group exist var group = BandiCore.luckpermsAPI!!.groupManager.getGroup(groupName) if(group == null){ throw GroupNotFoundException() } BandiCore.luckpermsAPI!!.getUserManager().modifyUser(offlinePlayer.getUniqueId()) { user: User -> // Remove all other inherited groups the user had before. user.data().clear(NodeType.INHERITANCE::matches) // Create a node to add to the player. val node: Node = InheritanceNode.builder(group).build() // Add the node to the user. user.data().add(node) // Tell the sender. throw GroupChangedException() } }